Some more method splitting , replaced a few argument that were using

ICODE, with LLInst
This commit is contained in:
Artur K 2012-03-17 23:35:48 +01:00
parent d3a22fc03c
commit 7b63b45dd5
15 changed files with 69 additions and 65 deletions

View File

@ -157,6 +157,7 @@ public:
void displayStats(); void displayStats();
void processHliCall(COND_EXPR *exp, iICODE picode); void processHliCall(COND_EXPR *exp, iICODE picode);
void preprocessReturnDU(std::bitset<32> &_liveOut);
protected: protected:
bool removeInEdge_Flag_and_ProcessLatch(BB *pbb, BB *a, BB *b); bool removeInEdge_Flag_and_ProcessLatch(BB *pbb, BB *a, BB *b);
bool Case_X_and_Y(BB* pbb, BB* thenBB, BB* elseBB); bool Case_X_and_Y(BB* pbb, BB* thenBB, BB* elseBB);

View File

@ -80,7 +80,7 @@ public:
static COND_EXPR *idOther(eReg seg, eReg regi, int16_t off); static COND_EXPR *idOther(eReg seg, eReg regi, int16_t off);
static COND_EXPR *idParam(int off, const STKFRAME *argSymtab); static COND_EXPR *idParam(int off, const STKFRAME *argSymtab);
static COND_EXPR *unary(condNodeType t, COND_EXPR *sub_expr); 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, iICODE atOffset); static COND_EXPR *idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, LLInst &atOffset);
static COND_EXPR *idFunc(Function *pproc, STKFRAME *args); static COND_EXPR *idFunc(Function *pproc, STKFRAME *args);
static COND_EXPR *idID(const ID *retVal, LOCAL_ID *locsym, iICODE ix_); static COND_EXPR *idID(const ID *retVal, LOCAL_ID *locsym, iICODE ix_);
static COND_EXPR * id(const LLInst &ll_insn, opLoc sd, Function *pProc, iICODE ix_, ICODE &duIcode, operDu du); static COND_EXPR * id(const LLInst &ll_insn, opLoc sd, Function *pProc, iICODE ix_, ICODE &duIcode, operDu du);

View File

@ -143,8 +143,8 @@ char *writeJcondInv (HLTYPE, Function *, int *);
/* Exported funcions from locident.c */ /* Exported funcions from locident.c */
boolT checkLongEq (LONG_STKID_TYPE, iICODE, int, Function *, Assignment &asgn, iICODE atOffset); boolT checkLongEq (LONG_STKID_TYPE, iICODE, int, Function *, Assignment &asgn, LLInst &atOffset);
boolT checkLongRegEq (LONGID_TYPE, iICODE, int, Function *, Assignment &asgn, iICODE); boolT checkLongRegEq (LONGID_TYPE, iICODE, int, Function *, Assignment &asgn, LLInst &);
eReg otherLongRegi(eReg, int, LOCAL_ID *); eReg otherLongRegi(eReg, int, LOCAL_ID *);

View File

@ -124,7 +124,7 @@ public:
int newIntIdx(int16_t seg, int16_t off, eReg regi, int ix, hlType t); int newIntIdx(int16_t seg, int16_t off, eReg regi, int ix, hlType t);
int newLongReg(hlType t, eReg regH, eReg regL, iICODE ix_); int newLongReg(hlType t, eReg regH, eReg regL, iICODE ix_);
int newLong(opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, int off); int newLong(opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, int off);
int newLong(opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, iICODE atOffset); int newLong(opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, LLInst &atOffset);
void newIdent(hlType t, frameType f); void newIdent(hlType t, frameType f);
void flagByteWordId(int off); void flagByteWordId(int off);
void propLongId(uint8_t regL, uint8_t regH, const char *name); void propLongId(uint8_t regL, uint8_t regH, const char *name);

View File

@ -64,13 +64,13 @@ public:
static bool physicalReg(eReg r); static bool physicalReg(eReg r);
/* Writes the registers that are set in the bitvector */ /* Writes the registers that are set in the bitvector */
//TODO: move this into Machine_X86 ? //TODO: move this into Machine_X86 ?
static void writeBitVector (std::ostream &ostr,const std::bitset<32> &regi) static void writeRegVector (std::ostream &ostr,const std::bitset<32> &regi)
{ {
int j; int j;
for (j = rAX; j < INDEX_BX_SI; j++) for (j = rAX; j < INDEX_BX_SI; j++)
{ {
if (regi.test(j-1)) if (regi.test(j-1))
ostr << regName(eReg(j)); ostr << regName(eReg(j))<<" ";
} }
} }
static eReg subRegH(eReg reg); //TODO: move these into machine_x86 static eReg subRegH(eReg reg); //TODO: move these into machine_x86

View File

@ -246,7 +246,7 @@ COND_EXPR *COND_EXPR::idLongIdx (int idx)
/* Returns an identifier conditional expression node of type LONG_VAR */ /* 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, iICODE atOffset) COND_EXPR *COND_EXPR::idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, LLInst &atOffset)
{ {
int idx; int idx;
COND_EXPR *newExp = new COND_EXPR(IDENTIFIER); COND_EXPR *newExp = new COND_EXPR(IDENTIFIER);
@ -256,10 +256,10 @@ COND_EXPR *COND_EXPR::idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst
newExp->expr.ident.idType = CONSTANT; newExp->expr.ident.idType = CONSTANT;
if (f == HIGH_FIRST) if (f == HIGH_FIRST)
newExp->expr.ident.idNode.kte.kte = (pIcode->ll()->src().getImm2() << 16) + newExp->expr.ident.idNode.kte.kte = (pIcode->ll()->src().getImm2() << 16) +
atOffset->ll()->src().getImm2(); atOffset.src().getImm2();
else /* LOW_FIRST */ else /* LOW_FIRST */
newExp->expr.ident.idNode.kte.kte = newExp->expr.ident.idNode.kte.kte =
(atOffset->ll()->src().getImm2() << 16)+ pIcode->ll()->src().getImm2(); (atOffset.src().getImm2() << 16)+ pIcode->ll()->src().getImm2();
newExp->expr.ident.idNode.kte.size = 4; newExp->expr.ident.idNode.kte.size = 4;
} }
/* Save it as a long expression (reg, stack or glob) */ /* Save it as a long expression (reg, stack or glob) */

View File

@ -282,13 +282,13 @@ void Function::codeGen (std::ostream &fs)
cout << " Start = "<<pBB->begin()->loc_ip; cout << " Start = "<<pBB->begin()->loc_ip;
cout << ", end = "<<pBB->begin()->loc_ip+pBB->size()<<"\n"; cout << ", end = "<<pBB->begin()->loc_ip+pBB->size()<<"\n";
cout << " LiveUse = "; cout << " LiveUse = ";
Machine_X86::writeBitVector(cout,pBB->liveUse); Machine_X86::writeRegVector(cout,pBB->liveUse);
cout << "\n Def = "; cout << "\n Def = ";
Machine_X86::writeBitVector(cout,pBB->def); Machine_X86::writeRegVector(cout,pBB->def);
cout << "\n LiveOut = "; cout << "\n LiveOut = ";
Machine_X86::writeBitVector(cout,pBB->liveOut); Machine_X86::writeRegVector(cout,pBB->liveOut);
cout << "\n LiveIn = "; cout << "\n LiveIn = ";
Machine_X86::writeBitVector(cout,pBB->liveIn); Machine_X86::writeRegVector(cout,pBB->liveIn);
cout <<"\n\n"; cout <<"\n\n";
} }
} }

View File

@ -469,6 +469,7 @@ void BB::ProcessUseDefForFunc(eReg regi, int defRegIdx, iICODE picode)
picode->du.lastDefRegi |= duReg[regi]; picode->du.lastDefRegi |= duReg[regi];
} }
} }
/* If not used within this bb or in successors of this /* If not used within this bb or in successors of this
* bb (ie. not in liveOut), then register is useless, * bb (ie. not in liveOut), then register is useless,
* thus remove it. Also check that this is not a return * thus remove it. Also check that this is not a return
@ -621,7 +622,7 @@ bool COND_EXPR::xClear (rICODE range_to_check, iICODE lastBBinst, const LOCAL_ID
{ {
regi= locId.id_arr[expr.ident.idNode.regiIdx].id.regi; regi= locId.id_arr[expr.ident.idNode.regiIdx].id.regi;
range_to_check.advance_begin(1); range_to_check.advance_begin(1);
auto all_valid_and_high_level_after_start = range_to_check | filtered(ICODE::TypeAndValidFilter<HIGH_LEVEL>()); auto all_valid_and_high_level_after_start = range_to_check | filtered(ICODE::select_valid_high_level);
for (ICODE &i : all_valid_and_high_level_after_start) for (ICODE &i : all_valid_and_high_level_after_start)
if ((i.du.def & duReg[regi]).any()) if ((i.du.def & duReg[regi]).any())
return false; return false;
@ -701,9 +702,7 @@ static int processCArg (Function * pp, Function * pProc, ICODE * picode, int num
if (pp->args.numArgs > 0) if (pp->args.numArgs > 0)
{ {
if(_exp==NULL) if(_exp==NULL)
{
fprintf(stderr,"Would try to adjustForArgType with null _exp\n"); fprintf(stderr,"Would try to adjustForArgType with null _exp\n");
}
else else
pp->args.adjustForArgType (numArgs, _exp->expType (pProc)); pp->args.adjustForArgType (numArgs, _exp->expType (pProc));
} }
@ -1021,7 +1020,9 @@ int BB::findBBExps(LOCAL_ID &locals,Function *fnc)
case HLI_ASSIGN: case HLI_ASSIGN:
_exp = _icHl.call.toId(); _exp = _icHl.call.toId();
ticode->hl()->asgn.lhs = ticode->hl()->asgn.lhs =
COND_EXPR::idLong(&locals, DST, ticode,HIGH_FIRST, picode.base(), eDEF, ++iICODE(ticode)); COND_EXPR::idLong(&locals, DST,
ticode,HIGH_FIRST, picode.base(),
eDEF, *(++iICODE(ticode))->ll());
ticode->hl()->asgn.rhs = _exp; ticode->hl()->asgn.rhs = _exp;
picode->invalidate(); picode->invalidate();
numHlIcodes--; numHlIcodes--;
@ -1110,24 +1111,12 @@ void Function::findExps()
} }
} }
void Function::preprocessReturnDU(std::bitset<32> &_liveOut)
/** Invokes procedures related with data flow analysis. Works on a procedure
* at a time basis.
* Note: indirect recursion in liveRegAnalysis is possible. */
void Function::dataFlow(std::bitset<32> &_liveOut)
{ {
bool isAx, isBx, isCx, isDx;
int idx;
/* Remove references to register variables */
if (flg & SI_REGVAR)
_liveOut &= maskDuReg[rSI];
if (flg & DI_REGVAR)
_liveOut &= maskDuReg[rDI];
/* Function - return value register(s) */
if (_liveOut.any()) if (_liveOut.any())
{ {
int idx;
bool isAx, isBx, isCx, isDx;
flg |= PROC_IS_FUNC; flg |= PROC_IS_FUNC;
isAx = _liveOut.test(rAX - rAX); isAx = _liveOut.test(rAX - rAX);
isBx = _liveOut.test(rBX - rAX); isBx = _liveOut.test(rBX - rAX);
@ -1201,6 +1190,21 @@ void Function::dataFlow(std::bitset<32> &_liveOut)
} }
} }
}
/** Invokes procedures related with data flow analysis. Works on a procedure
* at a time basis.
* Note: indirect recursion in liveRegAnalysis is possible. */
void Function::dataFlow(std::bitset<32> &_liveOut)
{
/* Remove references to register variables */
if (flg & SI_REGVAR)
_liveOut &= maskDuReg[rSI];
if (flg & DI_REGVAR)
_liveOut &= maskDuReg[rDI];
/* Function - return value register(s) */
preprocessReturnDU(_liveOut);
/* Data flow analysis */ /* Data flow analysis */
liveAnal = true; liveAnal = true;

View File

@ -602,13 +602,13 @@ void ICODE::writeDU()
int my_idx = loc_ip; int my_idx = loc_ip;
{ {
ostringstream ostr; ostringstream ostr;
Machine_X86::writeBitVector(ostr,du.def); Machine_X86::writeRegVector(ostr,du.def);
if (!ostr.str().empty()) if (!ostr.str().empty())
printf ("Def (reg) = %s\n", ostr.str().c_str()); printf ("Def (reg) = %s\n", ostr.str().c_str());
} }
{ {
ostringstream ostr; ostringstream ostr;
Machine_X86::writeBitVector(ostr,du.use); Machine_X86::writeRegVector(ostr,du.use);
if (!ostr.str().empty()) if (!ostr.str().empty())
printf ("Use (reg) = %s\n", ostr.str().c_str()); printf ("Use (reg) = %s\n", ostr.str().c_str());
} }

View File

@ -26,8 +26,8 @@ bool Idiom5::match(iICODE pIcode)
int Idiom5::action() int Idiom5::action()
{ {
COND_EXPR *rhs,*lhs,*expr; COND_EXPR *rhs,*lhs,*expr;
lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0], LOW_FIRST, m_icodes[0], USE_DEF, m_icodes[1]); lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0], LOW_FIRST, m_icodes[0], USE_DEF, *m_icodes[1]->ll());
rhs = COND_EXPR::idLong (&m_func->localId, SRC, m_icodes[0], LOW_FIRST, m_icodes[0], eUSE, m_icodes[1]); rhs = COND_EXPR::idLong (&m_func->localId, SRC, m_icodes[0], LOW_FIRST, m_icodes[0], eUSE, *m_icodes[1]->ll());
expr = COND_EXPR::boolOp (lhs, rhs, ADD); expr = COND_EXPR::boolOp (lhs, rhs, ADD);
m_icodes[0]->setAsgn(lhs, expr); m_icodes[0]->setAsgn(lhs, expr);
m_icodes[1]->invalidate(); m_icodes[1]->invalidate();
@ -59,8 +59,8 @@ bool Idiom6::match(iICODE pIcode)
int Idiom6::action() int Idiom6::action()
{ {
COND_EXPR *rhs,*lhs,*expr; COND_EXPR *rhs,*lhs,*expr;
lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0], LOW_FIRST, m_icodes[0], USE_DEF, m_icodes[1]); lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0], LOW_FIRST, m_icodes[0], USE_DEF, *m_icodes[1]->ll());
rhs = COND_EXPR::idLong (&m_func->localId, SRC, m_icodes[0], LOW_FIRST, m_icodes[0], eUSE, m_icodes[1]); rhs = COND_EXPR::idLong (&m_func->localId, SRC, m_icodes[0], LOW_FIRST, m_icodes[0], eUSE, *m_icodes[1]->ll());
expr = COND_EXPR::boolOp (lhs, rhs, SUB); expr = COND_EXPR::boolOp (lhs, rhs, SUB);
m_icodes[0]->setAsgn(lhs, expr); m_icodes[0]->setAsgn(lhs, expr);
m_icodes[1]->invalidate(); m_icodes[1]->invalidate();

View File

@ -84,7 +84,7 @@ bool Idiom13::match(iICODE pIcode)
if (not m_icodes[0]->ll()->testFlags(I) && (regi >= rAL) && (regi <= rBH)) if (not m_icodes[0]->ll()->testFlags(I) && (regi >= rAL) && (regi <= rBH))
{ {
/* Check for MOV regH, 0 */ /* Check for MOV regH, 0 */
if (m_icodes[1]->ll()->match(iMOV) && m_icodes[1]->ll()->testFlags(I) && (m_icodes[1]->ll()->src().getImm2() == 0)) if (m_icodes[1]->ll()->match(iMOV,I) && (m_icodes[1]->ll()->src().getImm2() == 0))
{ {
if (m_icodes[1]->ll()->dst.regi == (regi + 4)) //WARNING: based on distance between AH-AL,BH-BL etc. if (m_icodes[1]->ll()->dst.regi == (regi + 4)) //WARNING: based on distance between AH-AL,BH-BL etc.
{ {

View File

@ -51,7 +51,7 @@ bool Idiom11::match (iICODE picode)
int Idiom11::action() int Idiom11::action()
{ {
COND_EXPR *lhs,*rhs; COND_EXPR *lhs,*rhs;
lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0], HIGH_FIRST,m_icodes[0], USE_DEF, m_icodes[1]); lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0], HIGH_FIRST,m_icodes[0], USE_DEF, *m_icodes[1]->ll());
rhs = COND_EXPR::unary (NEGATION, lhs); rhs = COND_EXPR::unary (NEGATION, lhs);
m_icodes[0]->setAsgn(lhs, rhs); m_icodes[0]->setAsgn(lhs, rhs);
m_icodes[1]->invalidate(); m_icodes[1]->invalidate();

View File

@ -40,7 +40,7 @@ bool Idiom21::match (iICODE picode)
int Idiom21::action() int Idiom21::action()
{ {
COND_EXPR *lhs,*rhs; COND_EXPR *lhs,*rhs;
lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0],HIGH_FIRST, m_icodes[0], eDEF, m_icodes[1]); lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0],HIGH_FIRST, m_icodes[0], eDEF, *m_icodes[1]->ll());
rhs = COND_EXPR::idKte (m_icodes[1]->ll()->src().getImm2() , 4); rhs = COND_EXPR::idKte (m_icodes[1]->ll()->src().getImm2() , 4);
m_icodes[0]->setAsgn(lhs, rhs); m_icodes[0]->setAsgn(lhs, rhs);
m_icodes[0]->du.use = 0; /* clear register used in iXOR */ m_icodes[0]->du.use = 0; /* clear register used in iXOR */
@ -59,7 +59,7 @@ bool Idiom7::match(iICODE picode)
{ {
if(picode==m_end) if(picode==m_end)
return false; return false;
LLOperand *dst, *src; const LLOperand *dst, *src;
m_icode=picode; m_icode=picode;
dst = &picode->ll()->dst; dst = &picode->ll()->dst;
src = &picode->ll()->src(); src = &picode->ll()->src();

View File

@ -275,20 +275,20 @@ int LOCAL_ID::newLongStk(hlType t, int offH, int offL)
/* Returns the index to an appropriate long identifier. /* Returns the index to an appropriate long identifier.
* Note: long constants should be checked first and stored as a long integer * Note: long constants should be checked first and stored as a long integer
* number in an expression record. */ * number in an expression record. */
int LOCAL_ID::newLong(opLoc sd, iICODE pIcode, hlFirst f, iICODE ix,operDu du, iICODE atOffset) int LOCAL_ID::newLong(opLoc sd, iICODE pIcode, hlFirst f, iICODE ix,operDu du, LLInst &atOffset)
{ {
size_t idx; size_t idx;
const LLOperand *pmH, *pmL; const LLOperand *pmH, *pmL;
LLInst &p_ll(*pIcode->ll()); LLInst &p_ll(*pIcode->ll());
if (f == LOW_FIRST) if (f == LOW_FIRST)
{ {
pmL = pIcode->ll()->get(sd); pmL = p_ll.get(sd);
pmH = atOffset->ll()->get(sd); pmH = atOffset.get(sd);
} }
else /* HIGH_FIRST */ else /* HIGH_FIRST */
{ {
pmL = atOffset->ll()->get(sd); pmL = atOffset.get(sd);
pmH = pIcode->ll()->get(sd); pmH = p_ll.get(sd);
} }
if (pmL->regi == 0) /* global variable */ if (pmL->regi == 0) /* global variable */
@ -332,15 +332,15 @@ int LOCAL_ID::newLong(opLoc sd, iICODE pIcode, hlFirst f, iICODE ix,operDu du, i
* idx : idx into icode array * idx : idx into icode array
* pProc : ptr to current procedure record * pProc : ptr to current procedure record
* rhs, lhs : return expressions if successful. */ * rhs, lhs : return expressions if successful. */
boolT checkLongEq (LONG_STKID_TYPE longId, iICODE pIcode, int i, Function * pProc, Assignment &asgn, iICODE atOffset) boolT checkLongEq (LONG_STKID_TYPE longId, iICODE pIcode, int i, Function * pProc, Assignment &asgn, LLInst &atOffset)
{ {
/* pointers to LOW_LEVEL icodes */ /* pointers to LOW_LEVEL icodes */
const LLOperand *pmHdst, *pmLdst, *pmHsrc, *pmLsrc; const LLOperand *pmHdst, *pmLdst, *pmHsrc, *pmLsrc;
pmHdst = &pIcode->ll()->dst; pmHdst = &pIcode->ll()->dst;
pmLdst = &atOffset->ll()->dst; pmLdst = &atOffset.dst;
pmHsrc = &pIcode->ll()->src(); pmHsrc = &pIcode->ll()->src();
pmLsrc = &atOffset->ll()->src(); pmLsrc = &atOffset.src();
if ((longId.offH == pmHdst->off) && (longId.offL == pmLdst->off)) if ((longId.offH == pmHdst->off) && (longId.offL == pmLdst->off))
{ {
@ -372,16 +372,15 @@ boolT checkLongEq (LONG_STKID_TYPE longId, iICODE pIcode, int i, Function * pPro
* pProc : ptr to current procedure record * pProc : ptr to current procedure record
* rhs, lhs : return expressions if successful. */ * rhs, lhs : return expressions if successful. */
boolT checkLongRegEq (LONGID_TYPE longId, iICODE pIcode, int i, boolT checkLongRegEq (LONGID_TYPE longId, iICODE pIcode, int i,
Function * pProc, Assignment &asgn, iICODE atOffset) Function * pProc, Assignment &asgn, LLInst &atOffset)
{ {
LLOperand *pmHdst, *pmLdst, *pmHsrc, *pmLsrc; /* pointers to LOW_LEVEL icodes */ /* pointers to LOW_LEVEL icodes */
// iICODE atOffset(pIcode); const LLOperand *pmHdst, *pmLdst, *pmHsrc, *pmLsrc;
// advance(atOffset,off);
pmHdst = &pIcode->ll()->dst; pmHdst = &pIcode->ll()->dst;
pmLdst = &atOffset->ll()->dst; pmLdst = &atOffset.dst;
pmHsrc = &pIcode->ll()->src(); pmHsrc = &pIcode->ll()->src();
pmLsrc = &atOffset->ll()->src(); pmLsrc = &atOffset.src();
if ((longId.h == pmHdst->regi) && (longId.l == pmLdst->regi)) if ((longId.h == pmHdst->regi) && (longId.l == pmLdst->regi))
{ {

View File

@ -248,7 +248,7 @@ void Function::propLongStk (int i, const ID &pLocId)
continue; continue;
if (pIcode->ll()->getOpcode() == next1->ll()->getOpcode()) if (pIcode->ll()->getOpcode() == next1->ll()->getOpcode())
{ {
if (checkLongEq (pLocId.id.longStkId, pIcode, i, this, asgn, next1) == true) if (checkLongEq (pLocId.id.longStkId, pIcode, i, this, asgn, *next1->ll()) == true)
{ {
switch (pIcode->ll()->getOpcode()) switch (pIcode->ll()->getOpcode())
{ {
@ -281,7 +281,7 @@ void Function::propLongStk (int i, const ID &pLocId)
/* Check long conditional (i.e. 2 CMPs and 3 branches */ /* Check long conditional (i.e. 2 CMPs and 3 branches */
else if ((pIcode->ll()->getOpcode() == iCMP) && (isLong23 (pIcode->getParent(), l23, &arc))) else if ((pIcode->ll()->getOpcode() == iCMP) && (isLong23 (pIcode->getParent(), l23, &arc)))
{ {
if ( checkLongEq (pLocId.id.longStkId, pIcode, i, this, asgn, l23) ) if ( checkLongEq (pLocId.id.longStkId, pIcode, i, this, asgn, *l23->ll()) )
{ {
advance(pIcode,longJCond23 (asgn.rhs, asgn.lhs, pIcode, arc, l23)); advance(pIcode,longJCond23 (asgn.rhs, asgn.lhs, pIcode, arc, l23));
} }
@ -291,7 +291,7 @@ void Function::propLongStk (int i, const ID &pLocId)
* 2 CMPs and 2 branches */ * 2 CMPs and 2 branches */
else if ((pIcode->ll()->getOpcode() == iCMP) && isLong22 (pIcode, pEnd, l23)) else if ((pIcode->ll()->getOpcode() == iCMP) && isLong22 (pIcode, pEnd, l23))
{ {
if ( checkLongEq (pLocId.id.longStkId, pIcode, i, this,asgn, l23) ) if ( checkLongEq (pLocId.id.longStkId, pIcode, i, this,asgn, *l23->ll()) )
{ {
advance(pIcode,longJCond22 (asgn.rhs, asgn.lhs, pIcode,pEnd)); advance(pIcode,longJCond22 (asgn.rhs, asgn.lhs, pIcode,pEnd));
} }
@ -327,7 +327,7 @@ int Function::findBackwarLongDefs(int loc_ident_idx, const ID &pLocId, iICODE be
localId.id_arr[loc_ident_idx].idx.push_back(pIcode);//idx-1//insert localId.id_arr[loc_ident_idx].idx.push_back(pIcode);//idx-1//insert
icode.setRegDU( pmL->regi, eDEF); icode.setRegDU( pmL->regi, eDEF);
asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx); asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode, HIGH_FIRST, pIcode, eUSE, next1); asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode, HIGH_FIRST, pIcode, eUSE, *next1->ll());
icode.setAsgn(asgn.lhs, asgn.rhs); icode.setAsgn(asgn.lhs, asgn.rhs);
next1->invalidate(); next1->invalidate();
forced_finish=true; /* to exit the loop */ forced_finish=true; /* to exit the loop */
@ -356,7 +356,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)) if ((pLocId.id.longId.h == pmH->regi) && (pLocId.id.longId.l == pmL->regi))
{ {
asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx); asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode, LOW_FIRST, pIcode/*idx*/, eUSE, next1); asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode, LOW_FIRST, pIcode, eUSE, *next1->ll());
icode.setRegDU( pmH->regi, USE_DEF); icode.setRegDU( pmH->regi, USE_DEF);
switch (icode.ll()->getOpcode()) switch (icode.ll()->getOpcode())
{ {
@ -404,7 +404,7 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be
pIcode->setRegDU( next1->ll()->src().getReg2(), eUSE); pIcode->setRegDU( next1->ll()->src().getReg2(), eUSE);
asgn.rhs = COND_EXPR::idLongIdx (loc_ident_idx); asgn.rhs = COND_EXPR::idLongIdx (loc_ident_idx);
asgn.lhs = COND_EXPR::idLong (&this->localId, DST, pIcode,HIGH_FIRST, pIcode, eDEF, next1); asgn.lhs = COND_EXPR::idLong (&this->localId, DST, pIcode,HIGH_FIRST, pIcode, eDEF, *next1->ll());
pIcode->setAsgn(asgn.lhs, asgn.rhs); pIcode->setAsgn(asgn.lhs, asgn.rhs);
next1->invalidate(); next1->invalidate();
@ -435,7 +435,7 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be
asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx); asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
pIcode->setRegDU( pmH->regi, USE_DEF); pIcode->setRegDU( pmH->regi, USE_DEF);
asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode, asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode,
LOW_FIRST, pIcode, eUSE, next1); LOW_FIRST, pIcode, eUSE, *next1->ll());
switch (pIcode->ll()->getOpcode()) { switch (pIcode->ll()->getOpcode()) {
case iAND: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, AND); case iAND: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, AND);
break; break;
@ -457,7 +457,7 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be
/* Check long conditional (i.e. 2 CMPs and 3 branches */ /* Check long conditional (i.e. 2 CMPs and 3 branches */
else if ((pIcode->ll()->getOpcode() == iCMP) && (isLong23 (pIcode->getParent(), long_loc, &arc))) else if ((pIcode->ll()->getOpcode() == iCMP) && (isLong23 (pIcode->getParent(), long_loc, &arc)))
{ {
if (checkLongRegEq (pLocId.id.longId, pIcode, loc_ident_idx, this, asgn, long_loc)) if (checkLongRegEq (pLocId.id.longId, pIcode, loc_ident_idx, this, asgn, *long_loc->ll()))
{ {
// reduce the advance by 1 here (loop increases) ? // reduce the advance by 1 here (loop increases) ?
advance(pIcode,longJCond23 (asgn.rhs, asgn.lhs, pIcode, arc, long_loc)); advance(pIcode,longJCond23 (asgn.rhs, asgn.lhs, pIcode, arc, long_loc));
@ -468,7 +468,7 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be
* 2 CMPs and 2 branches */ * 2 CMPs and 2 branches */
else if (pIcode->ll()->match(iCMP) && (isLong22 (pIcode, pEnd, long_loc))) else if (pIcode->ll()->match(iCMP) && (isLong22 (pIcode, pEnd, long_loc)))
{ {
if (checkLongRegEq (pLocId.id.longId, pIcode, loc_ident_idx, this, asgn, long_loc) ) if (checkLongRegEq (pLocId.id.longId, pIcode, loc_ident_idx, this, asgn, *long_loc->ll()) )
{ {
advance(pIcode,longJCond22 (asgn.rhs, asgn.lhs, pIcode,pEnd) - 1); advance(pIcode,longJCond22 (asgn.rhs, asgn.lhs, pIcode,pEnd) - 1);
} }