From c1f031d23e612a4c2625ba1db2121bca4722a005 Mon Sep 17 00:00:00 2001 From: sandeep Date: Sat, 4 Mar 2000 18:30:09 +0000 Subject: [PATCH] 1) cse.c don't replace when not symop 2) icode.c fixed the &array[n] problem 3) lrange.c fixed name for used before def git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@148 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCcse.c | 6 ++++-- src/SDCCicode.c | 8 +++++--- src/SDCClrange.c | 32 +++++++++++++++----------------- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/SDCCcse.c b/src/SDCCcse.c index 00cda0b8..d84c007d 100644 --- a/src/SDCCcse.c +++ b/src/SDCCcse.c @@ -103,7 +103,8 @@ void replaceAllSymBySym (iCode *ic, operand *from , operand *to) IC_RESULT(lic)->isaddr = siaddr ; } - if (IC_RIGHT(lic) && IC_RIGHT(lic)->key == from->key ) { + if (IS_SYMOP(to) && + IC_RIGHT(lic) && IC_RIGHT(lic)->key == from->key ) { bitVectUnSetBit (OP_USES(from),lic->key); OP_USES(to) = bitVectSetBit(OP_USES(to),lic->key); siaddr = IC_RIGHT(lic)->isaddr ; @@ -111,7 +112,8 @@ void replaceAllSymBySym (iCode *ic, operand *from , operand *to) IC_RIGHT(lic)->isaddr = siaddr ; } - if (IC_LEFT(lic) && IC_LEFT(lic)->key == from->key ) { + if (IS_SYMOP(to) && + IC_LEFT(lic) && IC_LEFT(lic)->key == from->key ) { bitVectUnSetBit (OP_USES(from),lic->key); OP_USES(to) = bitVectSetBit(OP_USES(to),lic->key); siaddr = IC_LEFT(lic)->isaddr ; diff --git a/src/SDCCicode.c b/src/SDCCicode.c index 69de4a7b..9a0c4345 100644 --- a/src/SDCCicode.c +++ b/src/SDCCicode.c @@ -2078,7 +2078,7 @@ operand *geniCodeDerefPtr (operand *op) if (IS_PTR(optype)) setOClass(optype,retype); - #if 1 + #if 0 /* This block moved here from its original location * ten lines later by KV, 2/27/2000. * @@ -2101,7 +2101,7 @@ operand *geniCodeDerefPtr (operand *op) IS_CHAR(rtype) || IS_FLOAT(rtype) ); - #if 0 + #if 1 /* Moved upwards */ if (!lvaluereq) op = geniCodeRValue(op,TRUE); @@ -2797,6 +2797,7 @@ operand *ast2iCode (ast *tree) tree->opval.op != INLINEASM ) { if (IS_ASSIGN_OP(tree->opval.op) || IS_DEREF_OP(tree) || + (tree->opval.op == '&' && !tree->right) || tree->opval.op == PTR_OP) { lvaluereq++; left = operandFromAst(tree->left); @@ -2804,7 +2805,8 @@ operand *ast2iCode (ast *tree) } else { left = operandFromAst(tree->left); } - if (tree->opval.op == INC_OP || tree->opval.op == DEC_OP) { + if (tree->opval.op == INC_OP || + tree->opval.op == DEC_OP) { lvaluereq++; right= operandFromAst(tree->right); lvaluereq--; diff --git a/src/SDCClrange.c b/src/SDCClrange.c index 73b636b1..eea9a075 100644 --- a/src/SDCClrange.c +++ b/src/SDCClrange.c @@ -225,24 +225,22 @@ operand *operandLUse (operand *op, eBBlock **ebbs, ic->op != ADDRESS_OF && !IS_STATIC(etype) ) { -/* if (OP_SYMBOL(op)->isreqv && !OP_SYMBOL(op)->_isparm){ */ - -/* if (SPIL_LOC(op) && */ -/* bitVectIsZero(SPIL_LOC(op)->defs)) { */ -/* OP_SYMBOL(op)->isspilt = 1; */ -/* werror(W_LOCAL_NOINIT, */ -/* SPIL_LOC(op)->name, */ -/* ic->filename,ic->lineno); */ -/* } */ -/* } else { */ - - if (bitVectIsZero(op->usesDefs)) { + if (bitVectIsZero(op->usesDefs)) { OP_SYMBOL(op)->isspilt = 1; - werror(W_LOCAL_NOINIT, - OP_SYMBOL(op)->name, - ic->filename,ic->lineno); - } -/* } */ + + if (OP_SYMBOL(op)->isreqv && + !OP_SYMBOL(op)->_isparm && SPIL_LOC(op) ) { + + werror(W_LOCAL_NOINIT, + SPIL_LOC(op)->name, + ic->filename,ic->lineno); + } else { + + werror(W_LOCAL_NOINIT, + OP_SYMBOL(op)->name, + ic->filename,ic->lineno); + } + } } } return op; -- 2.30.2