From 6a7d4b3c6bdfd99e0790cf64612b94e46c0084e3 Mon Sep 17 00:00:00 2001 From: kvigor Date: Tue, 30 Jan 2001 19:13:44 +0000 Subject: [PATCH] fix AOP_OP_3_NOFATAL git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@550 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/ds390/gen.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/ds390/gen.c b/src/ds390/gen.c index 13459ab0..e2db1f70 100644 --- a/src/ds390/gen.c +++ b/src/ds390/gen.c @@ -2969,17 +2969,24 @@ static void adjustArithmeticResult(iCode *ic) #define AOP_OP_3_NOFATAL(ic, rc) \ aopOp (IC_RIGHT(ic),ic,FALSE, FALSE); \ aopOp (IC_LEFT(ic),ic,FALSE, (AOP_TYPE(IC_RIGHT(ic)) == AOP_DPTR)); \ - aopOp (IC_RESULT(ic),ic,TRUE, (AOP_TYPE(IC_LEFT(ic)) == AOP_DPTR) || \ - (AOP_TYPE(IC_RIGHT(ic)) == AOP_DPTR)); \ if (AOP_TYPE(IC_LEFT(ic)) == AOP_DPTR2 && \ - AOP_TYPE(IC_RESULT(ic)) == AOP_DPTR2) \ + isOperandInFarSpace(IC_RESULT(ic))) \ { \ + /* No can do; DPTR & DPTR2 in use, and we need another. */ \ rc = TRUE; \ - freeAsmop(IC_RESULT(ic), NULL,ic,(RESULTONSTACK(ic) ? FALSE : TRUE)); \ } \ else \ { \ + aopOp (IC_RESULT(ic),ic,TRUE, (AOP_TYPE(IC_LEFT(ic)) == AOP_DPTR) || \ + (AOP_TYPE(IC_RIGHT(ic)) == AOP_DPTR)); \ rc = FALSE; \ + if (AOP_TYPE(IC_LEFT(ic)) == AOP_DPTR2 && \ + AOP_TYPE(IC_RESULT(ic)) == AOP_DPTR2) \ + { \ + /* werror(E_INTERNAL_ERROR,__FILE__,__LINE__, */ \ + fprintf(stderr, \ + "Ack: got unexpected DP2! (%s:%d %s:%d)\n", __FILE__, __LINE__, ic->filename, ic->lineno); \ + } \ } #define AOP_OP_2(ic) \ @@ -3024,6 +3031,10 @@ static void genPlus (iCode *ic) } #else AOP_OP_3_NOFATAL(ic, pushResult); + if (pushResult) + { + D(emitcode(";", "genPlus: must push result: 3 ops in far space");); + } #endif if (!pushResult) -- 2.47.2