From b950e2f71f727388c48c07e6e91b876d00c3db7b Mon Sep 17 00:00:00 2001 From: kvigor Date: Thu, 3 May 2001 22:24:50 +0000 Subject: [PATCH] fix desperate inefficiency of toBoolean when hand;ling a single byte in far space git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@768 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/ds390/gen.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/ds390/gen.c b/src/ds390/gen.c index 55d1fa29..184f8838 100644 --- a/src/ds390/gen.c +++ b/src/ds390/gen.c @@ -1471,8 +1471,9 @@ outBitC (operand * result) static void toBoolean (operand * oper) { - int size = AOP_SIZE (oper) - 1; - int offset = 1; + int size = AOP_SIZE (oper) - 1; + int offset = 1; + bool usedB = FALSE; /* The generic part of a generic pointer should * not participate in it's truth value. @@ -1487,8 +1488,9 @@ toBoolean (operand * oper) } _startLazyDPSEvaluation (); - if (AOP_NEEDSACC (oper)) + if (AOP_NEEDSACC (oper) && size) { + usedB = TRUE; emitcode ("push", "b"); emitcode ("mov", "b, %s", aopGet (AOP (oper), 0, FALSE, FALSE, FALSE)); } @@ -1498,7 +1500,7 @@ toBoolean (operand * oper) } while (size--) { - if (AOP_NEEDSACC (oper)) + if (usedB) { emitcode ("orl", "b,%s", aopGet (AOP (oper), offset++, FALSE, FALSE, FALSE)); } @@ -1509,7 +1511,7 @@ toBoolean (operand * oper) } _endLazyDPSEvaluation (); - if (AOP_NEEDSACC (oper)) + if (usedB) { emitcode ("mov", "a,b"); emitcode ("pop", "b"); @@ -8640,8 +8642,7 @@ genIfx (iCode * ic, iCode * popIc) operand *cond = IC_COND (ic); int isbit = 0; - D (emitcode (";", "genIfx "); - ); + D (emitcode (";", "genIfx ");); aopOp (cond, ic, FALSE, FALSE); -- 2.47.2