diff --git a/include/ast.h b/include/ast.h index f728155..9f66e1d 100644 --- a/include/ast.h +++ b/include/ast.h @@ -55,7 +55,6 @@ public: static COND_EXPR *idOther(uint8_t seg, uint8_t regi, int16_t off); static COND_EXPR *idParam(int off, const STKFRAME *argSymtab); static COND_EXPR *unary(condNodeType t, COND_EXPR *sub_expr); - static COND_EXPR *idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, int off); static COND_EXPR *idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, iICODE atOffset); static COND_EXPR *idFunc(Function *pproc, STKFRAME *args); static COND_EXPR *idID(const ID *retVal, LOCAL_ID *locsym, iICODE ix_); diff --git a/src/ast.cpp b/src/ast.cpp index 3f0b4cd..3a062de 100644 --- a/src/ast.cpp +++ b/src/ast.cpp @@ -253,12 +253,6 @@ COND_EXPR *COND_EXPR::idLongIdx (int idx) /* Returns an identifier conditional expression node of type LONG_VAR */ -COND_EXPR *COND_EXPR::idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, int off) -{ - iICODE atOffset=pIcode; - advance(atOffset,off); - return idLong(localId,sd,pIcode,f,ix,du,atOffset); -} COND_EXPR *COND_EXPR::idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, iICODE atOffset) { int idx; diff --git a/src/dataflow.cpp b/src/dataflow.cpp index 4092c03..fa42c73 100644 --- a/src/dataflow.cpp +++ b/src/dataflow.cpp @@ -954,7 +954,7 @@ void Function::findExps() case HLI_ASSIGN: exp = COND_EXPR::idFunc ( picode->hl()->call.proc, picode->hl()->call.args); ticode->hl()->asgn.lhs = - COND_EXPR::idLong(&localId, DST, ticode,HIGH_FIRST, picode, eDEF, 1); + COND_EXPR::idLong(&localId, DST, ticode,HIGH_FIRST, picode, eDEF, ++iICODE(ticode)); ticode->hl()->asgn.rhs = exp; picode->invalidate(); numHlIcodes--; diff --git a/src/idioms/arith_idioms.cpp b/src/idioms/arith_idioms.cpp index f708314..9c63ef6 100644 --- a/src/idioms/arith_idioms.cpp +++ b/src/idioms/arith_idioms.cpp @@ -26,8 +26,8 @@ bool Idiom5::match(iICODE pIcode) int Idiom5::action() { COND_EXPR *rhs,*lhs,*expr; - lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0], LOW_FIRST, m_icodes[0], USE_DEF, 1); - rhs = COND_EXPR::idLong (&m_func->localId, SRC, m_icodes[0], LOW_FIRST, m_icodes[0], eUSE, 1); + lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0], LOW_FIRST, m_icodes[0], USE_DEF, m_icodes[1]); + rhs = COND_EXPR::idLong (&m_func->localId, SRC, m_icodes[0], LOW_FIRST, m_icodes[0], eUSE, m_icodes[1]); expr = COND_EXPR::boolOp (lhs, rhs, ADD); m_icodes[0]->setAsgn(lhs, expr); m_icodes[1]->invalidate(); @@ -59,8 +59,8 @@ bool Idiom6::match(iICODE pIcode) int Idiom6::action() { COND_EXPR *rhs,*lhs,*expr; - lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0], LOW_FIRST, m_icodes[0], USE_DEF, 1); - rhs = COND_EXPR::idLong (&m_func->localId, SRC, m_icodes[0], LOW_FIRST, m_icodes[0], eUSE, 1); + lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0], LOW_FIRST, m_icodes[0], USE_DEF, m_icodes[1]); + rhs = COND_EXPR::idLong (&m_func->localId, SRC, m_icodes[0], LOW_FIRST, m_icodes[0], eUSE, m_icodes[1]); expr = COND_EXPR::boolOp (lhs, rhs, SUB); m_icodes[0]->setAsgn(lhs, expr); m_icodes[1]->invalidate(); diff --git a/src/idioms/neg_idioms.cpp b/src/idioms/neg_idioms.cpp index 700ba1f..2f4255f 100644 --- a/src/idioms/neg_idioms.cpp +++ b/src/idioms/neg_idioms.cpp @@ -51,7 +51,7 @@ bool Idiom11::match (iICODE picode) int Idiom11::action() { COND_EXPR *lhs,*rhs; - lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0], HIGH_FIRST,m_icodes[0], USE_DEF, 1); + lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0], HIGH_FIRST,m_icodes[0], USE_DEF, m_icodes[1]); rhs = COND_EXPR::unary (NEGATION, lhs); m_icodes[0]->setAsgn(lhs, rhs); m_icodes[1]->invalidate(); diff --git a/src/idioms/xor_idioms.cpp b/src/idioms/xor_idioms.cpp index ee91ad7..4d5c5b1 100644 --- a/src/idioms/xor_idioms.cpp +++ b/src/idioms/xor_idioms.cpp @@ -40,7 +40,7 @@ bool Idiom21::match (iICODE picode) int Idiom21::action() { COND_EXPR *lhs,*rhs; - lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0],HIGH_FIRST, m_icodes[0], eDEF, 1); + lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0],HIGH_FIRST, m_icodes[0], eDEF, m_icodes[1]); rhs = COND_EXPR::idKte (m_icodes[1]->ll()->src.op() , 4); m_icodes[0]->setAsgn(lhs, rhs); m_icodes[0]->du.use = 0; /* clear register used in iXOR */ diff --git a/src/locident.cpp b/src/locident.cpp index c18e5d3..bd1848b 100644 --- a/src/locident.cpp +++ b/src/locident.cpp @@ -326,8 +326,6 @@ int LOCAL_ID::newLong(opLoc sd, iICODE pIcode, hlFirst f, iICODE ix,operDu du, i boolT checkLongEq (LONG_STKID_TYPE longId, iICODE pIcode, int i, Function * pProc, Assignment &asgn, iICODE atOffset) { LLOperand *pmHdst, *pmLdst, *pmHsrc, *pmLsrc; /* pointers to LOW_LEVEL icodes */ -// iICODE atOffset(pIcode); -// advance(atOffset,off); pmHdst = &pIcode->ll()->dst; pmLdst = &atOffset->ll()->dst; diff --git a/src/proplong.cpp b/src/proplong.cpp index 53b7504..895f1ed 100644 --- a/src/proplong.cpp +++ b/src/proplong.cpp @@ -366,7 +366,7 @@ int Function::findBackwarLongDefs(int loc_ident_idx, const ID &pLocId, iICODE be if ((pLocId.id.longId.h == pmH->regi) && (pLocId.id.longId.l == pmL->regi)) { asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx); - asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode, LOW_FIRST, pIcode/*idx*/, eUSE, 1); + asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode, LOW_FIRST, pIcode/*idx*/, eUSE, next1); icode.setRegDU( pmH->regi, USE_DEF); switch (icode.ll()->opcode) { @@ -414,7 +414,7 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be pIcode->setRegDU( next1->ll()->src.regi, eUSE); asgn.rhs = COND_EXPR::idLongIdx (loc_ident_idx); - asgn.lhs = COND_EXPR::idLong (&this->localId, DST, pIcode,HIGH_FIRST, pIcode, eDEF, 1); + asgn.lhs = COND_EXPR::idLong (&this->localId, DST, pIcode,HIGH_FIRST, pIcode, eDEF, next1); pIcode->setAsgn(asgn.lhs, asgn.rhs); next1->invalidate(); @@ -445,7 +445,7 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx); pIcode->setRegDU( pmH->regi, USE_DEF); asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode, - LOW_FIRST, pIcode/*idx*/, eUSE, 1); + LOW_FIRST, pIcode, eUSE, next1); switch (pIcode->ll()->opcode) { case iAND: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, AND); break;