more iterators in other places

This commit is contained in:
Artur K 2011-12-14 00:17:10 +01:00
parent 01ae1229bb
commit f009e33799
9 changed files with 279 additions and 166 deletions

View File

@ -8,6 +8,7 @@
static const int operandSize=20;
#include <cstring>
#include "Enums.h"
#include "icode.h"
/* The following definitions and types define the Conditional Expression
* attributed syntax tree, as defined by the following EBNF:
CondExp ::= CondTerm AND CondTerm | CondTerm
@ -59,10 +60,10 @@ public:
static COND_EXPR *idOther(byte seg, byte regi, int16 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, ICODE *pIcode, hlFirst f, Int ix, operDu du, Int off);
static COND_EXPR *idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst f, Int ix, operDu du, Int off);
static COND_EXPR *idFunc(Function *pproc, STKFRAME *args);
static COND_EXPR *idID(const ID *retVal, LOCAL_ID *locsym, Int ix);
static COND_EXPR *id(ICODE *pIcode, opLoc sd, Function *pProc, Int i, ICODE *duIcode, operDu du);
static COND_EXPR *id(const ICODE &pIcode, opLoc sd, Function *pProc, Int i, ICODE &duIcode, operDu du);
static COND_EXPR *boolOp(COND_EXPR *lhs, COND_EXPR *rhs, condOp op);
public:
COND_EXPR *clone();
@ -78,6 +79,7 @@ public:
type=UNKNOWN_OP;
memset(&expr,0,sizeof(_exprNode));
}
public:
};
/* Sequence of conditional expression data type */

View File

@ -211,8 +211,8 @@ Int power2 (Int);
void inverseCondOp (COND_EXPR **);
/* Exported funcions from locident.c */
boolT checkLongEq (LONG_STKID_TYPE, ICODE *, Int, Int, Function *, COND_EXPR **,COND_EXPR **, Int);
boolT checkLongRegEq (LONGID_TYPE, ICODE *, Int, Int, Function *, COND_EXPR **,COND_EXPR **, Int);
boolT checkLongEq (LONG_STKID_TYPE, iICODE, Int, Int, Function *, COND_EXPR **,COND_EXPR **, Int);
boolT checkLongRegEq (LONGID_TYPE, iICODE, Int, Int, Function *, COND_EXPR **,COND_EXPR **, Int);
byte otherLongRegi (byte, Int, LOCAL_ID *);
void insertIdx (IDX_ARRAY *, Int);

View File

@ -282,7 +282,7 @@ struct HLTYPE
} oper; /* operand */
} ;
typedef struct
struct LLTYPE
{
llIcode opcode; /* llIcode instruction */
byte numBytes; /* Number of bytes this instr */
@ -303,7 +303,11 @@ typedef struct
dword *entries; /* array of offsets */
} caseTbl;
Int hllLabNum; /* label # for hll codegen */
} LLTYPE;
bool conditionalJump()
{
return (opcode >= iJB) && (opcode < iJCXZ);
}
};
/* Icode definition: LOW_LEVEL and HIGH_LEVEL */
struct ICODE

View File

@ -279,7 +279,7 @@ 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, ICODE *pIcode, hlFirst f, Int ix, operDu du, Int off)
COND_EXPR *COND_EXPR::idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst f, Int ix, operDu du, Int off)
{
COND_EXPR *newExp;
Int idx;
@ -301,7 +301,7 @@ COND_EXPR *COND_EXPR::idLong(LOCAL_ID *localId, opLoc sd, ICODE *pIcode, hlFirst
/* Save it as a long expression (reg, stack or glob) */
else
{
idx = localId->newLong(sd, pIcode, f, ix, du, off);
idx = localId->newLong(sd, &(*pIcode), f, ix, du, off);
newExp->expr.ident.idType = LONG_VAR;
newExp->expr.ident.idNode.longIdx = idx;
}
@ -367,41 +367,41 @@ COND_EXPR *COND_EXPR::idID (const ID *retVal, LOCAL_ID *locsym, Int ix)
* Arguments: i : index into the icode array, used for newLongRegId only.
* duIcode: icode instruction that needs the du set.
* du: operand is defined or used in current instruction. */
COND_EXPR *COND_EXPR::id(ICODE *pIcode, opLoc sd, Function * pProc, Int i,ICODE *duIcode, operDu du)
COND_EXPR *COND_EXPR::id(const ICODE &pIcode, opLoc sd, Function * pProc, Int i,ICODE &duIcode, operDu du)
{
COND_EXPR *newExp;
ICODEMEM * pm;
Int idx; /* idx into pIcode->localId table */
pm = (sd == SRC) ? &pIcode->ic.ll.src : &pIcode->ic.ll.dst;
const ICODEMEM * pm = (sd == SRC) ? &pIcode.ic.ll.src : &pIcode.ic.ll.dst;
if (((sd == DST) && (pIcode->ic.ll.flg & IM_DST) == IM_DST) ||
((sd == SRC) && (pIcode->ic.ll.flg & IM_SRC)) ||
if (((sd == DST) && (pIcode.ic.ll.flg & IM_DST) == IM_DST) ||
((sd == SRC) && (pIcode.ic.ll.flg & IM_SRC)) ||
(sd == LHS_OP)) /* for MUL lhs */
{ /* implicit dx:ax */
idx = pProc->localId.newLongReg (TYPE_LONG_SIGN, rDX, rAX, i);
newExp = COND_EXPR::idLongIdx (idx);
duIcode->setRegDU (rDX, du);
duIcode->setRegDU (rAX, du);
duIcode.setRegDU (rDX, du);
duIcode.setRegDU (rAX, du);
}
else if ((sd == DST) && (pIcode->ic.ll.flg & IM_TMP_DST) == IM_TMP_DST)
else if ((sd == DST) && (pIcode.ic.ll.flg & IM_TMP_DST) == IM_TMP_DST)
{ /* implicit tmp */
newExp = COND_EXPR::idReg (rTMP, 0, &pProc->localId);
duIcode->setRegDU(rTMP, (operDu)eUSE);
duIcode.setRegDU(rTMP, (operDu)eUSE);
}
else if ((sd == SRC) && ((pIcode->ic.ll.flg & I) == I)) /* constant */
newExp = COND_EXPR::idKte (pIcode->ic.ll.immed.op, 2);
else if ((sd == SRC) && ((pIcode.ic.ll.flg & I) == I)) /* constant */
newExp = COND_EXPR::idKte (pIcode.ic.ll.immed.op, 2);
else if (pm->regi == 0) /* global variable */
newExp = COND_EXPR::idGlob(pm->segValue, pm->off);
else if (pm->regi < INDEXBASE) /* register */
{
newExp = COND_EXPR::idReg (pm->regi, (sd == SRC) ? pIcode->ic.ll.flg :
pIcode->ic.ll.flg & NO_SRC_B, &pProc->localId);
duIcode->setRegDU( pm->regi, du);
newExp = COND_EXPR::idReg (pm->regi, (sd == SRC) ? pIcode.ic.ll.flg :
pIcode.ic.ll.flg & NO_SRC_B, &pProc->localId);
duIcode.setRegDU( pm->regi, du);
}
else if (pm->off) /* offset */
@ -419,7 +419,7 @@ COND_EXPR *COND_EXPR::id(ICODE *pIcode, opLoc sd, Function * pProc, Int i,ICODE
newExp = idCondExpIdxGlob (pm->segValue, pm->off, rBX,&pProc->localId);
else
newExp = COND_EXPR::idOther (pm->seg, pm->regi, pm->off);
duIcode->setRegDU( rBX, eUSE);
duIcode.setRegDU( rBX, eUSE);
}
else /* idx <> bp, bx */
newExp = COND_EXPR::idOther (pm->seg, pm->regi, pm->off);
@ -432,15 +432,15 @@ COND_EXPR *COND_EXPR::id(ICODE *pIcode, opLoc sd, Function * pProc, Int i,ICODE
{
switch (pm->regi) {
case INDEXBASE + 4: newExp = COND_EXPR::idReg(rSI, 0, &pProc->localId);
duIcode->setRegDU( rSI, du);
duIcode.setRegDU( rSI, du);
break;
case INDEXBASE + 5: newExp = COND_EXPR::idReg(rDI, 0, &pProc->localId);
duIcode->setRegDU( rDI, du);
duIcode.setRegDU( rDI, du);
break;
case INDEXBASE + 6: newExp = COND_EXPR::idReg(rBP, 0, &pProc->localId);
break;
case INDEXBASE + 7: newExp = COND_EXPR::idReg(rBX, 0, &pProc->localId);
duIcode->setRegDU( rBX, du);
duIcode.setRegDU( rBX, du);
break;
default:
newExp = 0;

View File

@ -23,16 +23,16 @@ Int STKFRAME::getLocVar(Int off)
/* Returns a string with the source operand of Icode */
static COND_EXPR *srcIdent (ICODE * Icode, Function * pProc, Int i, ICODE * duIcode, operDu du)
static COND_EXPR *srcIdent (const ICODE &Icode, Function * pProc, Int i, ICODE & duIcode, operDu du)
{
COND_EXPR *n;
if (Icode->ic.ll.flg & I) /* immediate operand */
if (Icode.ic.ll.flg & I) /* immediate operand */
{
if (Icode->ic.ll.flg & B)
n = COND_EXPR::idKte (Icode->ic.ll.immed.op, 1);
if (Icode.ic.ll.flg & B)
n = COND_EXPR::idKte (Icode.ic.ll.immed.op, 1);
else
n = COND_EXPR::idKte (Icode->ic.ll.immed.op, 2);
n = COND_EXPR::idKte (Icode.ic.ll.immed.op, 2);
}
else
n = COND_EXPR::id (Icode, SRC, pProc, i, duIcode, du);
@ -41,11 +41,10 @@ static COND_EXPR *srcIdent (ICODE * Icode, Function * pProc, Int i, ICODE * duIc
/* Returns the destination operand */
static COND_EXPR *dstIdent (ICODE * pIcode, Function * pProc, Int i, ICODE * duIcode,
operDu du)
{ COND_EXPR *n;
n = COND_EXPR::id (pIcode, DST, pProc, i, duIcode, du);
static COND_EXPR *dstIdent (const ICODE & Icode, Function * pProc, Int i, ICODE & duIcode, operDu du)
{
COND_EXPR *n;
n = COND_EXPR::id (Icode, DST, pProc, i, duIcode, du);
/** Is it needed? (pIcode->ic.ll.flg) & NO_SRC_B **/
return (n);
}
@ -90,8 +89,8 @@ void Function::elimCondCodes ()
switch (defAt->GetLlOpcode())
{
case iCMP:
rhs = srcIdent (&(*defAt), this, defAt->loc_ip,&(*useAt), eUSE);
lhs = dstIdent (&(*defAt), this, defAt->loc_ip,&(*useAt), eUSE);
rhs = srcIdent (*defAt, this, defAt->loc_ip,*useAt, eUSE);
lhs = dstIdent (*defAt, this, defAt->loc_ip,*useAt, eUSE);
break;
case iOR:
@ -104,8 +103,8 @@ void Function::elimCondCodes ()
break;
case iTEST:
rhs = srcIdent (&(*defAt),this, defAt->loc_ip,&(*useAt), eUSE);
lhs = dstIdent (&(*defAt),this, defAt->loc_ip,&(*useAt), eUSE);
rhs = srcIdent (*defAt,this, defAt->loc_ip,*useAt, eUSE);
lhs = dstIdent (*defAt,this, defAt->loc_ip,*useAt, eUSE);
lhs = COND_EXPR::boolOp (lhs, rhs, AND);
if (defAt->isLlFlag(B))
rhs = COND_EXPR::idKte (0, 1);
@ -637,8 +636,8 @@ void Function::findExps()
{
Int i, k, numHlIcodes;
iICODE lastInst,
picode; /* Current icode */
ICODE * ticode; /* Target icode */
picode, /* Current icode */
ticode; /* Target icode */
BB * pbb; /* Current and next basic block */
boolT res;
COND_EXPR *exp, /* expression pointer - for HLI_POP and HLI_CALL */
@ -681,7 +680,7 @@ void Function::findExps()
case HLI_ASSIGN:
/* Replace rhs of current icode into target
* icode expression */
ticode = &Icode[picode->du1.idx[0][0]];
ticode = Icode.begin()+picode->du1.idx[0][0];
if ((picode->du.lastDefRegi & duReg[regi]) &&
((ticode->ic.hl.opcode != HLI_CALL) &&
(ticode->ic.hl.opcode != HLI_RET)))
@ -694,7 +693,7 @@ void Function::findExps()
case HLI_ASSIGN:
forwardSubs (picode->ic.hl.oper.asgn.lhs,
picode->ic.hl.oper.asgn.rhs,
&(*picode), ticode, &localId,
&(*picode), &(*ticode), &localId,
&numHlIcodes);
break;
@ -712,7 +711,7 @@ void Function::findExps()
break;
case HLI_CALL: /* register arguments */
newRegArg (&(*picode), ticode);
newRegArg (&(*picode), &(*ticode));
picode->invalidate();
numHlIcodes--;
break;
@ -721,7 +720,7 @@ void Function::findExps()
break;
case HLI_POP:
ticode = Icode.GetIcode(picode->du1.idx[0][0]);
ticode = Icode.begin()+(picode->du1.idx[0][0]);
if ((picode->du.lastDefRegi & duReg[regi]) &&
((ticode->ic.hl.opcode != HLI_CALL) &&
(ticode->ic.hl.opcode != HLI_RET)))
@ -731,7 +730,7 @@ void Function::findExps()
switch (ticode->ic.hl.opcode) {
case HLI_ASSIGN:
forwardSubs (picode->ic.hl.oper.exp, exp,
&(*picode), ticode, &localId,
&(*picode), &(*ticode), &localId,
&numHlIcodes);
break;
@ -756,7 +755,7 @@ void Function::findExps()
break;
case HLI_CALL:
ticode = Icode.GetIcode(picode->du1.idx[0][0]);
ticode = Icode.begin()+(picode->du1.idx[0][0]);
switch (ticode->ic.hl.opcode) {
case HLI_ASSIGN:
exp = COND_EXPR::idFunc (
@ -824,7 +823,7 @@ void Function::findExps()
* icode expression */
if (picode->du1.idx[0][0] == picode->du1.idx[1][0])
{
ticode = Icode.GetIcode(picode->du1.idx[0][0]);
ticode = Icode.begin()+(picode->du1.idx[0][0]);
if ((picode->du.lastDefRegi & duReg[regi]) &&
((ticode->ic.hl.opcode != HLI_CALL) &&
(ticode->ic.hl.opcode != HLI_RET)))
@ -834,7 +833,7 @@ void Function::findExps()
case HLI_ASSIGN:
forwardSubsLong (picode->ic.hl.oper.asgn.lhs->expr.ident.idNode.longIdx,
picode->ic.hl.oper.asgn.rhs, &(*picode),
ticode, &numHlIcodes);
&(*ticode), &numHlIcodes);
break;
case HLI_JCOND: case HLI_PUSH: case HLI_RET:
@ -850,7 +849,7 @@ void Function::findExps()
break;
case HLI_CALL: /* register arguments */
newRegArg ( &(*picode), ticode);
newRegArg ( &(*picode), &(*ticode));
picode->invalidate();
numHlIcodes--;
break;
@ -861,7 +860,7 @@ void Function::findExps()
case HLI_POP:
if (picode->du1.idx[0][0] == picode->du1.idx[1][0])
{
ticode = Icode.GetIcode(picode->du1.idx[0][0]);
ticode = Icode.begin()+(picode->du1.idx[0][0]);
if ((picode->du.lastDefRegi & duReg[regi]) &&
((ticode->ic.hl.opcode != HLI_CALL) &&
(ticode->ic.hl.opcode != HLI_RET)))
@ -871,7 +870,7 @@ void Function::findExps()
switch (ticode->ic.hl.opcode) {
case HLI_ASSIGN:
forwardSubsLong (picode->ic.hl.oper.exp->expr.ident.idNode.longIdx,
exp, &(*picode), ticode, &numHlIcodes);
exp, &(*picode), &(*ticode), &numHlIcodes);
break;
case HLI_JCOND: case HLI_PUSH:
res = insertSubTreeLongReg (exp,
@ -890,7 +889,7 @@ void Function::findExps()
break;
case HLI_CALL: /* check for function return */
ticode = Icode.GetIcode(picode->du1.idx[0][0]);
ticode = Icode.begin()+(picode->du1.idx[0][0]);
switch (ticode->ic.hl.opcode)
{
case HLI_ASSIGN:

View File

@ -143,8 +143,8 @@ void Function::highLevelGen()
if ((flg & NO_OPS) != NO_OPS) /* if there are opers */
{
if ((flg & NO_SRC) != NO_SRC) /* if there is src op */
rhs = COND_EXPR::id (pIcode, SRC, this, i, pIcode, NONE);
lhs = COND_EXPR::id (pIcode, DST, this, i, pIcode, NONE);
rhs = COND_EXPR::id (*pIcode, SRC, this, i, *pIcode, NONE);
lhs = COND_EXPR::id (*pIcode, DST, this, i, *pIcode, NONE);
}
switch (pIcode->ic.ll.opcode) {
@ -183,7 +183,7 @@ void Function::highLevelGen()
break;
case iIMUL: rhs = COND_EXPR::boolOp (lhs, rhs, MUL);
lhs = COND_EXPR::id (pIcode, LHS_OP, this, i, pIcode, NONE);
lhs = COND_EXPR::id (*pIcode, LHS_OP, this, i, *pIcode, NONE);
pIcode->setAsgn(lhs, rhs);
break;
@ -214,7 +214,7 @@ void Function::highLevelGen()
break;
case iMUL: rhs = COND_EXPR::boolOp (lhs, rhs, MUL);
lhs = COND_EXPR::id (pIcode, LHS_OP, this, i, pIcode, NONE);
lhs = COND_EXPR::id (*pIcode, LHS_OP, this, i, *pIcode, NONE);
pIcode->setAsgn(lhs, rhs);
break;

View File

@ -35,7 +35,7 @@ boolT JmpInst(llIcode opcode)
* [PUSH SI]
* In which case, the stack variable flags are set
****************************************************************************/
static Int checkStkVars (ICODE * pIcode, ICODE * pEnd, Function * pProc)
static Int checkStkVars (iICODE pIcode, iICODE pEnd, Function * pProc)
{
/* Look for PUSH SI */
if ((pIcode < pEnd) && (pIcode->ic.ll.opcode == iPUSH) &&
@ -70,7 +70,42 @@ static Int checkStkVars (ICODE * pIcode, ICODE * pEnd, Function * pProc)
}
return 0;
}
typedef std::list<ICODE>::iterator cITER;
static Int checkStkVars (cITER pIcode, cITER pEnd, Function * pProc)
{
/* Look for PUSH SI */
if ((pIcode != pEnd) && (pIcode->ic.ll.opcode == iPUSH) &&
(pIcode->ic.ll.dst.regi == rSI))
{
pProc->flg |= SI_REGVAR;
/* Look for PUSH DI */
++pIcode;
if (pIcode != pEnd && (pIcode->ic.ll.opcode == iPUSH) && (pIcode->ic.ll.dst.regi == rDI))
{
pProc->flg |= DI_REGVAR;
return 2;
}
else
return 1;
}
else if ((pIcode != pEnd) && (pIcode->ic.ll.opcode == iPUSH) &&
(pIcode->ic.ll.dst.regi == rDI))
{
pProc->flg |= DI_REGVAR;
/* Look for PUSH SI */
++pIcode;
if ((pIcode != pEnd) && (pIcode->ic.ll.opcode == iPUSH) && (pIcode->ic.ll.dst.regi == rSI))
{
pProc->flg |= SI_REGVAR;
return 2;
}
else
return 1;
}
return 0;
}
/*****************************************************************************
* idiom1 - HLL procedure prologue; Returns number of instructions matched.
@ -88,14 +123,17 @@ static Int checkStkVars (ICODE * pIcode, ICODE * pEnd, Function * pProc)
* [PUSH SI]
* [PUSH DI]
****************************************************************************/
static Int idiom1(ICODE * pIcode, ICODE * pEnd, Function * pProc)
{ Int n;
static Int idiom1(iICODE pIcode, iICODE pEnd, Function * pProc)
{
std::vector<iICODE> entries;
Int n;
/* PUSH BP as first instruction of procedure */
if ( !(pIcode->ic.ll.flg & I) && pIcode->ic.ll.src.regi == rBP)
{
/* MOV BP, SP as next instruction */
if (++pIcode < pEnd && ! (pIcode->ic.ll.flg & (I | TARGET | CASE))
pIcode++;
if (pIcode < pEnd && ! (pIcode->ic.ll.flg & (I | TARGET | CASE))
&& pIcode->ic.ll.opcode == iMOV && pIcode->ic.ll.dst.regi == rBP
&& pIcode->ic.ll.src.regi == rSP)
{
@ -140,7 +178,61 @@ static Int idiom1(ICODE * pIcode, ICODE * pEnd, Function * pProc)
else
return (checkStkVars (pIcode, pEnd, pProc));
}
static Int idiom1x(cITER pIcode, cITER pEnd, Function * pProc)
{
Int n;
/* PUSH BP as first instruction of procedure */
if ( !(pIcode->ic.ll.flg & I) && pIcode->ic.ll.src.regi == rBP)
{
/* MOV BP, SP as next instruction */
pIcode++;
if (pIcode != pEnd && ! (pIcode->ic.ll.flg & (I | TARGET | CASE))
&& pIcode->ic.ll.opcode == iMOV && pIcode->ic.ll.dst.regi == rBP
&& pIcode->ic.ll.src.regi == rSP)
{
pProc->args.minOff = 2;
pProc->flg |= PROC_IS_HLL;
/* Look for SUB SP, immed */
++pIcode;
if ((pIcode != pEnd) &&
(pIcode->ic.ll.flg & (I | TARGET | CASE)) == I &&
pIcode->ic.ll.opcode == iSUB && pIcode->ic.ll.dst.regi == rSP)
{
return (3 + checkStkVars (++pIcode, pEnd, pProc));
}
else
return (2 + checkStkVars (pIcode, pEnd, pProc));
}
/* PUSH SI
* [PUSH DI]
* MOV BP, SP */
else
{
n = checkStkVars (pIcode, pEnd, pProc);
if (n > 0)
{
/* Look for MOV BP, SP */
std::advance(pIcode,n);
if (pIcode != pEnd &&
! (pIcode->ic.ll.flg & (I | TARGET | CASE)) &&
pIcode->ic.ll.opcode == iMOV &&
pIcode->ic.ll.dst.regi == rBP &&
pIcode->ic.ll.src.regi == rSP)
{
pProc->args.minOff = 2 + (n * 2);
return (2 + n);
}
else return 0; // Cristina: check this please!
}
else return 0; // Cristina: check this please!
}
}
else
return (checkStkVars (pIcode, pEnd, pProc));
}
/*****************************************************************************
* popStkVars - checks for
@ -149,7 +241,7 @@ static Int idiom1(ICODE * pIcode, ICODE * pEnd, Function * pProc)
* or [POP SI]
* [POP DI]
****************************************************************************/
static void popStkVars (ICODE * pIcode, ICODE * pEnd, Function * pProc)
static void popStkVars (iICODE pIcode, iICODE pEnd, Function * pProc)
{
/* Match [POP DI] */
if (pIcode->ic.ll.opcode == iPOP)
@ -175,8 +267,9 @@ static void popStkVars (ICODE * pIcode, ICODE * pEnd, Function * pProc)
* POP BP
* RET(F)
*****************************************************************************/
static Int idiom2(ICODE * pIcode, ICODE * pEnd, Int ip, Function * pProc)
{ ICODE * nicode;
static Int idiom2(iICODE pIcode, iICODE pEnd, Int ip, Function * pProc)
{
iICODE nicode;
/* Match MOV SP, BP */
if (ip != 0 && ((pIcode->ic.ll.flg & I) != I) &&
@ -224,7 +317,7 @@ static Int idiom2(ICODE * pIcode, ICODE * pEnd, Int ip, Function * pProc)
* Used by compilers to restore the stack when invoking a procedure using
* the C calling convention.
****************************************************************************/
static Int idiom3(ICODE * pIcode, ICODE * pEnd)
static Int idiom3(iICODE pIcode, iICODE pEnd)
{
/* Match ADD SP, immed */
++pIcode;
@ -250,8 +343,9 @@ static Int idiom3(ICODE * pIcode, ICODE * pEnd)
* Found in Turbo C when restoring the stack for a procedure that uses the
* C calling convention. Used to restore the stack of 2 or 4 bytes args.
****************************************************************************/
static Int idiom17 (ICODE * pIcode, ICODE * pEnd)
{ Int i = 0; /* Count on # pops */
static Int idiom17 (iICODE pIcode, iICODE pEnd)
{
Int i = 0; /* Count on # pops */
byte regi;
/* Match POP reg */
@ -293,7 +387,7 @@ static Int idiom17 (ICODE * pIcode, ICODE * pEnd)
* [POP SI]
* RET(F) [immed]
****************************************************************************/
static void idiom4 (ICODE * pIcode, ICODE * pEnd, Function * pProc)
static void idiom4 (iICODE pIcode, iICODE pEnd, Function * pProc)
{
/* Check for [POP DI]
* [POP SI] */
@ -326,7 +420,7 @@ static void idiom4 (ICODE * pIcode, ICODE * pEnd, Function * pProc)
* Found in Borland Turbo C code.
* Commonly used idiom for long addition.
****************************************************************************/
static boolT idiom5 (ICODE * pIcode, ICODE * pEnd)
static boolT idiom5 (iICODE pIcode, iICODE pEnd)
{
if (pIcode < pEnd)
if ((pIcode+1)->ic.ll.opcode == iADC)
@ -345,7 +439,7 @@ static boolT idiom5 (ICODE * pIcode, ICODE * pEnd)
* Found in Borland Turbo C code.
* Commonly used idiom for long substraction.
****************************************************************************/
static boolT idiom6 (ICODE * pIcode, ICODE * pEnd)
static boolT idiom6 (iICODE pIcode, iICODE pEnd)
{
if (pIcode < pEnd)
if ((pIcode+1)->ic.ll.opcode == iSBB)
@ -361,7 +455,7 @@ static boolT idiom6 (ICODE * pIcode, ICODE * pEnd)
* => ax = 0
* Found in Borland Turbo C and Microsoft C code.
****************************************************************************/
static boolT idiom7 (ICODE * pIcode)
static boolT idiom7 (iICODE pIcode)
{
ICODEMEM *dst, *src;
@ -401,7 +495,7 @@ static boolT idiom7 (ICODE * pIcode)
* cx:bx
* Found in Borland Turbo C code.
****************************************************************************/
static boolT idiom21 (ICODE * picode, ICODE * pend)
static boolT idiom21 (iICODE picode, iICODE pend)
{ ICODEMEM *dst, *src;
dst = &picode->ic.ll.dst;
@ -430,7 +524,7 @@ static boolT idiom21 (ICODE * picode, ICODE * pend)
* => dx:ax = dx:ax >> 1 (dx:ax are signed long)
* Found in Microsoft C code for long signed variable shift right.
****************************************************************************/
static boolT idiom8 (ICODE * pIcode, ICODE * pEnd)
static boolT idiom8 (iICODE pIcode, iICODE pEnd)
{
if (pIcode < pEnd)
{
@ -455,7 +549,7 @@ static boolT idiom8 (ICODE * pIcode, ICODE * pEnd)
* => ax = ax << 2
* Found in Borland Turbo C code to index an array (array multiplication)
****************************************************************************/
static Int idiom15 (ICODE * picode, ICODE * pend)
static Int idiom15 (iICODE picode, iICODE pend)
{ Int n = 1;
byte regi;
@ -494,7 +588,7 @@ static Int idiom15 (ICODE * picode, ICODE * pend)
* => dx:ax = dx:ax << 1
* Found in Borland Turbo C code for long variable shift left.
****************************************************************************/
static boolT idiom12 (ICODE * pIcode, ICODE * pEnd)
static boolT idiom12 (iICODE pIcode, iICODE pEnd)
{
if (pIcode < pEnd)
{
@ -517,7 +611,7 @@ static boolT idiom12 (ICODE * pIcode, ICODE * pEnd)
* => dx:ax = dx:ax >> 1 (dx:ax are unsigned long)
* Found in Microsoft C code for long unsigned variable shift right.
****************************************************************************/
static boolT idiom9 (ICODE * pIcode, ICODE * pEnd)
static boolT idiom9 (iICODE pIcode, iICODE pEnd)
{
if (pIcode < pEnd)
{
@ -544,7 +638,7 @@ static boolT idiom9 (ICODE * pIcode, ICODE * pEnd)
* because this is most likely a long conditional equality test.
* Found in Borland Turbo C.
****************************************************************************/
static boolT idiom10old (ICODE * pIcode, ICODE * pEnd)
static boolT idiom10old (iICODE pIcode, iICODE pEnd)
{
if (pIcode < pEnd)
{
@ -582,7 +676,7 @@ static boolT idiom10old (ICODE * pIcode, ICODE * pEnd)
* modified to simplify the analysis.
* Found in Borland Turbo C.
****************************************************************************/
static void idiom10 (ICODE * pIcode, ICODE * pEnd)
static void idiom10 (iICODE pIcode, iICODE pEnd)
{
if (pIcode < pEnd)
{
@ -613,7 +707,7 @@ static void idiom10 (ICODE * pIcode, ICODE * pEnd)
* Found in Borland Turbo C, used for multiplication and division of
* byte operands (ie. they need to be extended to words).
****************************************************************************/
static byte idiom13 (ICODE * picode, ICODE * pend)
static byte idiom13 (iICODE picode, iICODE pend)
{ byte regi;
if (picode < pend)
@ -654,7 +748,7 @@ static byte idiom13 (ICODE * picode, ICODE * pend)
* Found in Borland Turbo C, used for division of unsigned integer
* operands.
****************************************************************************/
static boolT idiom14 (ICODE * picode, ICODE * pend, byte *regL, byte *regH)
static boolT idiom14 (iICODE picode, iICODE pend, byte *regL, byte *regH)
{
if (picode < pend)
{
@ -691,7 +785,7 @@ static boolT idiom14 (ICODE * picode, ICODE * pend, byte *regL, byte *regH)
* => dx:ax = - dx:ax
* Found in Borland Turbo C.
****************************************************************************/
static boolT idiom11 (ICODE * pIcode, ICODE * pEnd)
static boolT idiom11 (iICODE pIcode, iICODE pEnd)
{ condId type; /* type of argument */
if ((pIcode + 2) < pEnd)
@ -738,7 +832,7 @@ static boolT idiom11 (ICODE * pIcode, ICODE * pEnd)
* => ax = !ax
* Found in Borland Turbo C when negating bitwise.
****************************************************************************/
static boolT idiom16 (ICODE * picode, ICODE * pend)
static boolT idiom16 (iICODE picode, iICODE pend)
{ byte regi;
if ((picode+2) < pend)
@ -761,10 +855,11 @@ static boolT idiom16 (ICODE * picode, ICODE * pend)
/*****************************************************************************
* idiom 18: Post-increment or post-decrement in a conditional jump
* MOV reg, var (including register variables)
* INC var or DEC var
* CMP var, Y
* JX label
* Used
* 0 MOV reg, var (including register variables)
* 1 INC var or DEC var <------------------------- input point
* 2 CMP var, Y
* 3 JX label
* => HLI_JCOND (var++ X Y)
* Eg: MOV ax, si
* INC si
@ -773,59 +868,72 @@ static boolT idiom16 (ICODE * picode, ICODE * pend)
* => HLI_JCOND (si++ < 8)
* Found in Borland Turbo C. Intrinsic to C languages.
****************************************************************************/
static boolT idiom18 (ICODE * picode, ICODE * pend, Function * pproc)
{ boolT type = 0; /* type of variable: 1 = reg-var, 2 = local */
static boolT idiom18 (iICODE picode, iICODE pend, Function * pproc)
{
assert(picode+2<=pend);
std::vector<iICODE> used;
for(int i=0; i<4; i++)
{
used.push_back(picode-1+i);
}
int type = -1; /* type of variable: 1 = reg-var, 2 = local */
byte regi; /* register of the MOV */
/* Get variable */
if (picode->ic.ll.dst.regi == 0) /* global variable */
/* not supported yet */ ;
else if (picode->ic.ll.dst.regi < INDEXBASE) /* register */
if (used[1]->ic.ll.dst.regi == 0) /* global variable */
{
if ((picode->ic.ll.dst.regi == rSI) && (pproc->flg & SI_REGVAR))
/* not supported yet */
type = 0;
}
else if (used[1]->ic.ll.dst.regi < INDEXBASE) /* register */
{
if ((used[1]->ic.ll.dst.regi == rSI) && (pproc->flg & SI_REGVAR))
type = 1;
else if ((picode->ic.ll.dst.regi == rDI) && (pproc->flg & DI_REGVAR))
else if ((used[1]->ic.ll.dst.regi == rDI) && (pproc->flg & DI_REGVAR))
type = 1;
}
else if (picode->ic.ll.dst.off) /* local variable */
else if (used[1]->ic.ll.dst.off) /* local variable */
type = 2;
else /* indexed */
/* not supported yet */ ;
/* Check previous instruction for a MOV */
if (type == 1) /* register variable */
{
if (((picode-1)->ic.ll.opcode == iMOV) &&
((picode-1)->ic.ll.src.regi == picode->ic.ll.dst.regi))
{
regi = (picode-1)->ic.ll.dst.regi;
if ((regi > 0) && (regi < INDEXBASE))
{
if ((picode < pend) && ((picode+1) < pend) &&
((picode+1)->ic.ll.opcode == iCMP) &&
((picode+1)->ic.ll.dst.regi == regi) &&
(((picode+2)->ic.ll.opcode >= iJB) &&
((picode+2)->ic.ll.opcode < iJCXZ)))
return true;
}
}
type=3;
/* not supported yet */
printf("Unsupported idiom18 type: indexed");
}
else if (type == 2) /* local */
switch(type)
{
if (((picode-1)->ic.ll.opcode == iMOV) &&
((picode-1)->ic.ll.src.off == picode->ic.ll.dst.off))
{
regi = (picode-1)->ic.ll.dst.regi;
if ((regi > 0) && (regi < INDEXBASE))
case 0: // global
printf("Unsupported idiom18 type: global variable");
break;
case 1: /* register variable */
/* Check previous instruction for a MOV */
if ((used[0]->ic.ll.opcode == iMOV) && (used[0]->ic.ll.src.regi == used[1]->ic.ll.dst.regi))
{
if ((picode < pend) && ((picode+1) < pend) &&
((picode+1)->ic.ll.opcode == iCMP) &&
((picode+1)->ic.ll.dst.regi == regi) &&
(((picode+2)->ic.ll.opcode >= iJB) &&
((picode+2)->ic.ll.opcode < iJCXZ)))
return true;
regi = used[0]->ic.ll.dst.regi;
if ((regi > 0) && (regi < INDEXBASE))
{
if ( (used[2]->ic.ll.opcode == iCMP) && (used[2]->ic.ll.dst.regi == regi) &&
used[3]->ic.ll.conditionalJump() )
return true;
}
}
}
break;
case 2: /* local */
if ((used[0]->ic.ll.opcode == iMOV) && (used[0]->ic.ll.src.off == used[1]->ic.ll.dst.off))
{
regi = used[0]->ic.ll.dst.regi;
if ((regi > 0) && (regi < INDEXBASE))
{
if ( (used[2]->ic.ll.opcode == iCMP) && (used[2]->ic.ll.dst.regi == regi) &&
used[3]->ic.ll.conditionalJump() )
return true;
}
}
break;
case 3: // indexed
printf("Unsupported idiom18 type: indexed");
break;
}
return false;
}
@ -842,7 +950,7 @@ static boolT idiom18 (ICODE * picode, ICODE * pend, Function * pproc)
* => HLI_JCOND (++[bp+4] > 0)
* Found in Borland Turbo C. Intrinsic to C language.
****************************************************************************/
static boolT idiom19 (ICODE * picode, ICODE * pend, Function * pproc)
static boolT idiom19 (iICODE picode, iICODE pend, Function * pproc)
{
if (picode->ic.ll.dst.regi == 0) /* global variable */
/* not supported yet */ ;
@ -881,7 +989,7 @@ static boolT idiom19 (ICODE * picode, ICODE * pend, Function * pproc)
* => HLI_JCOND (++si < 2)
* Found in Turbo C. Intrinsic to C language.
****************************************************************************/
static boolT idiom20 (ICODE * picode, ICODE * pend, Function * pproc)
static boolT idiom20 (iICODE picode, iICODE pend, Function * pproc)
{ boolT type = 0; /* type of variable: 1 = reg-var, 2 = local */
byte regi; /* register of the MOV */
@ -945,29 +1053,30 @@ static boolT idiom20 (ICODE * picode, ICODE * pend, Function * pproc)
void Function::findIdioms()
{
Int ip; /* Index to current icode */
ICODE * pEnd, * pIcode; /* Pointers to end of BB and current icodes */
iICODE pEnd, pIcode; /* Pointers to end of BB and current icodes */
int16 delta;
COND_EXPR *rhs, *lhs; /* Pointers to left and right hand side exps */
COND_EXPR *exp; /* Pointer to temporal expression */
Int idx; /* Index into local identifier table */
byte regH, regL; /* High and low registers for long word reg */
pIcode = &Icode.front();
pEnd = pIcode + Icode.GetNumIcodes();
pIcode = Icode.begin();
pEnd = Icode.end();
ip = 0;
while (pIcode < pEnd)
{
switch (pIcode->ic.ll.opcode) {
switch (pIcode->ic.ll.opcode)
{
case iDEC: case iINC:
if (idiom18 (pIcode, pEnd, this))
{
lhs = COND_EXPR::id (pIcode-1, SRC, this, ip, pIcode, eUSE);
lhs = COND_EXPR::id (*(pIcode-1), SRC, this, ip, *pIcode, eUSE);
if (pIcode->ic.ll.opcode == iDEC)
lhs = COND_EXPR::unary (POST_DEC, lhs);
else
lhs = COND_EXPR::unary (POST_INC, lhs);
rhs = COND_EXPR::id (pIcode+1, SRC, this, ip, pIcode+2, eUSE);
rhs = COND_EXPR::id (*(pIcode+1), SRC, this, ip, *(pIcode+2), eUSE);
exp = COND_EXPR::boolOp (lhs, rhs,
condOpJCond[(pIcode+2)->ic.ll.opcode - iJB]);
(pIcode+2)->setJCond(exp);
@ -980,7 +1089,7 @@ void Function::findIdioms()
}
else if (idiom19 (pIcode, pEnd, this))
{
lhs = COND_EXPR::id (pIcode, DST, this, ip, pIcode+1, eUSE);
lhs = COND_EXPR::id (*pIcode, DST, this, ip, *(pIcode+1), eUSE);
if (pIcode->ic.ll.opcode == iDEC)
lhs = COND_EXPR::unary (PRE_DEC, lhs);
else
@ -995,12 +1104,12 @@ void Function::findIdioms()
}
else if (idiom20 (pIcode, pEnd, this))
{
lhs = COND_EXPR::id (pIcode+1, SRC, this, ip, pIcode, eUSE);
lhs = COND_EXPR::id (*(pIcode+1), SRC, this, ip, *pIcode, eUSE);
if (pIcode->ic.ll.opcode == iDEC)
lhs = COND_EXPR::unary (PRE_DEC, lhs);
else
lhs = COND_EXPR::unary (PRE_INC, lhs);
rhs = COND_EXPR::id (pIcode+2, SRC, this, ip, pIcode+3, eUSE);
rhs = COND_EXPR::id (*(pIcode+2), SRC, this, ip, *(pIcode+3), eUSE);
exp = COND_EXPR::boolOp (lhs, rhs,
condOpJCond[(pIcode+3)->ic.ll.opcode - iJB]);
(pIcode+3)->setJCond(exp);
@ -1042,7 +1151,7 @@ void Function::findIdioms()
idx = localId.newLongReg (TYPE_LONG_SIGN, regH, regL, ip);
lhs = COND_EXPR::idLongIdx (idx);
pIcode->setRegDU( regH, eDEF);
rhs = COND_EXPR::id (pIcode, SRC, this, ip, pIcode, NONE);
rhs = COND_EXPR::id (*pIcode, SRC, this, ip, *pIcode, NONE);
pIcode->setAsgn(lhs, rhs);
(pIcode+1)->invalidate();
pIcode += 2;
@ -1053,7 +1162,7 @@ void Function::findIdioms()
lhs = COND_EXPR::idReg (idx, 0, &localId);
pIcode->setRegDU( idx, eDEF);
pIcode->du1.numRegsDef--; /* prev byte reg def */
rhs = COND_EXPR::id (pIcode, SRC, this, ip, pIcode, NONE);
rhs = COND_EXPR::id (*pIcode, SRC, this, ip, *pIcode, NONE);
pIcode->setAsgn(lhs, rhs);
(pIcode+1)->invalidate();
pIcode += 2;
@ -1276,7 +1385,7 @@ void Function::findIdioms()
}
else if (idiom7 (pIcode))
{
lhs = COND_EXPR::id (pIcode, DST, this, ip, pIcode, NONE);
lhs = COND_EXPR::id (*pIcode, DST, this, ip, *pIcode, NONE);
rhs = COND_EXPR::idKte (0, 2);
pIcode->setAsgn(lhs, rhs);
pIcode->du.use = 0; /* clear register used in iXOR */
@ -1310,12 +1419,12 @@ void Function::findIdioms()
void Function::bindIcodeOff()
{
Int i, j; /* idx into icode array */
ICODE * pIcode; /* ptr icode array */
iICODE pIcode; /* ptr icode array */
dword *p; /* for case table */
if (! Icode.GetNumIcodes()) /* No Icode */
return;
pIcode = Icode.GetFirstIcode();
pIcode = Icode.begin();
/* Flag all jump targets for BB construction and disassembly stage 2 */
for (i = 0; i < Icode.GetNumIcodes(); i++)
@ -1330,20 +1439,19 @@ void Function::bindIcodeOff()
/* Finally bind jump targets to Icode offsets. Jumps for which no label
* is found (no code at dest. of jump) are simply left unlinked and
* flagged as going nowhere. */
pIcode = Icode.GetFirstIcode();
for (i = 0; i < Icode.GetNumIcodes(); i++)
if (JmpInst(pIcode[i].ic.ll.opcode))
for (pIcode = Icode.begin(); pIcode!= Icode.end(); pIcode++)
if (JmpInst(pIcode->ic.ll.opcode))
{
if (pIcode[i].ic.ll.flg & I)
if (pIcode->ic.ll.flg & I)
{
if (! Icode.labelSrch(pIcode[i].ic.ll.immed.op,
(Int *)&pIcode[i].ic.ll.immed.op))
pIcode[i].ic.ll.flg |= NO_LABEL;
if (! Icode.labelSrch(pIcode->ic.ll.immed.op, (Int *)&pIcode->ic.ll.immed.op))
pIcode->ic.ll.flg |= NO_LABEL;
}
else if (pIcode[i].ic.ll.flg & SWITCH)
else if (pIcode->ic.ll.flg & SWITCH)
{
p = pIcode[i].ic.ll.caseTbl.entries;
for (j = 0; j < pIcode[i].ic.ll.caseTbl.numEntries; j++, p++)
p = pIcode->ic.ll.caseTbl.entries;
for (j = 0; j < pIcode->ic.ll.caseTbl.numEntries; j++, p++)
Icode.labelSrch(*p, (Int *)p);
}
}

View File

@ -296,8 +296,6 @@ Int LOCAL_ID::newLong(opLoc sd, ICODE *pIcode, hlFirst f, Int ix,operDu du, Int
}
boolT checkLongEq (LONG_STKID_TYPE longId, ICODE *pIcode, Int i, Int idx,
Function * pProc, COND_EXPR **rhs, COND_EXPR **lhs, Int off)
/* Checks whether the long stack identifier is equivalent to the source or
* destination operands of pIcode and pIcode+1 (ie. these are LOW_LEVEL
* icodes at present). If so, returns the rhs and lhs of this instruction.
@ -307,6 +305,8 @@ boolT checkLongEq (LONG_STKID_TYPE longId, ICODE *pIcode, Int i, Int idx,
* idx : idx into icode array
* pProc : ptr to current procedure record
* rhs, lhs : return expressions if successful. */
boolT checkLongEq (LONG_STKID_TYPE longId, iICODE pIcode, Int i, Int idx,
Function * pProc, COND_EXPR **rhs, COND_EXPR **lhs, Int off)
{
ICODEMEM *pmHdst, *pmLdst, *pmHsrc, *pmLsrc; /* pointers to LOW_LEVEL icodes */
@ -343,7 +343,7 @@ boolT checkLongEq (LONG_STKID_TYPE longId, ICODE *pIcode, Int i, Int idx,
* idx : idx into icode array
* pProc : ptr to current procedure record
* rhs, lhs : return expressions if successful. */
boolT checkLongRegEq (LONGID_TYPE longId, ICODE *pIcode, Int i, Int idx,
boolT checkLongRegEq (LONGID_TYPE longId, iICODE pIcode, Int i, Int idx,
Function * pProc, COND_EXPR **rhs, COND_EXPR **lhs, Int off)
{
ICODEMEM *pmHdst, *pmLdst, *pmHsrc, *pmLsrc; /* pointers to LOW_LEVEL icodes */

View File

@ -11,9 +11,9 @@
#include "dcc.h"
static boolT isJCond (llIcode opcode)
/* Returns whether the given icode opcode is within the range of valid
* high-level conditional jump icodes (iJB..iJG) */
static boolT isJCond (llIcode opcode)
{
if ((opcode >= iJB) && (opcode <= iJG))
return true;
@ -59,7 +59,7 @@ static boolT isLong23 (Int i, BB * pbb, Int *off, Int *arc)
/* Returns whether the conditions for a 2-2 long variable are satisfied */
static boolT isLong22 (ICODE * pIcode, ICODE * pEnd, Int *off)
static boolT isLong22 (iICODE pIcode, iICODE pEnd, Int *off)
{
if (((pIcode+2) < pEnd) && ((pIcode+2)->ic.ll.opcode == iCMP) &&
(isJCond ((pIcode+1)->ic.ll.opcode)) &&
@ -75,7 +75,7 @@ static boolT isLong22 (ICODE * pIcode, ICODE * pEnd, Int *off)
/* Creates a long conditional <=, >=, <, or > at (pIcode+1).
* Removes excess nodes from the graph by flagging them, and updates
* the new edges for the remaining nodes. */
static void longJCond23 (COND_EXPR *rhs, COND_EXPR *lhs, ICODE * pIcode,
static void longJCond23 (COND_EXPR *rhs, COND_EXPR *lhs, iICODE pIcode,
Int *idx, Function * pProc, Int arc, Int off)
{ Int j;
BB * pbb, * obb1, * obb2, * tbb;
@ -162,7 +162,7 @@ static void longJCond23 (COND_EXPR *rhs, COND_EXPR *lhs, ICODE * pIcode,
/* Creates a long conditional equality or inequality at (pIcode+1).
* Removes excess nodes from the graph by flagging them, and updates
* the new edges for the remaining nodes. */
static void longJCond22 (COND_EXPR *rhs, COND_EXPR *lhs, ICODE * pIcode, Int *idx)
static void longJCond22 (COND_EXPR *rhs, COND_EXPR *lhs, iICODE pIcode, Int *idx)
{
Int j;
BB * pbb, * obb1, * tbb;
@ -225,13 +225,13 @@ void Function::propLongStk (Int i, ID *pLocId)
{
Int idx, off, arc;
COND_EXPR *lhs, *rhs; /* Pointers to left and right hand expression */
ICODE * pIcode, * pEnd;
iICODE pIcode, pEnd;
/* Check all icodes for offHi:offLo */
pEnd = this->Icode.GetIcode(this->Icode.GetNumIcodes() -1);
pEnd = Icode.end();
for (idx = 0; idx < (this->Icode.GetNumIcodes() - 1); idx++)
{
pIcode = this->Icode.GetIcode(idx);
pIcode = Icode.begin()+idx;
if ((pIcode->type == HIGH_LEVEL) || (pIcode->invalid == TRUE))
continue;
@ -307,17 +307,17 @@ void Function::propLongReg (Int i, ID *pLocId)
{
COND_EXPR *lhs, *rhs;
Int idx, j, off, arc;
ICODE * pIcode, * pEnd;
iICODE pIcode, pEnd;
ICODEMEM * pmH,* pmL; /* Pointers to dst LOW_LEVEL icodes */
/* Process all definitions/uses of long registers at an icode position */
pEnd = this->Icode.GetIcode(this->Icode.GetNumIcodes() -1);
pEnd = this->Icode.end();
for (j = 0; j < pLocId->idx.size(); j++)
{
/* Check backwards for a definition of this long register */
for (idx = pLocId->idx[j] - 1; idx > 0 ; idx--)
{
pIcode = this->Icode.GetIcode(idx-1);
pIcode = Icode.begin()+(idx-1);
if ((pIcode->type == HIGH_LEVEL) || (pIcode->invalid == TRUE))
continue;
@ -383,7 +383,7 @@ void Function::propLongReg (Int i, ID *pLocId)
if (idx <= 0)
for (idx = pLocId->idx[j] + 1; idx < this->Icode.GetNumIcodes() - 1; idx++)
{
pIcode = this->Icode.GetIcode(idx);
pIcode = Icode.begin()+(idx);
if ((pIcode->type == HIGH_LEVEL) || (pIcode->invalid == TRUE))
continue;