renamed flag methods in LLInst

This commit is contained in:
Artur K 2012-02-29 22:26:23 +01:00
parent 6b7d3f6209
commit 0ad46c3986
20 changed files with 179 additions and 179 deletions

View File

@ -184,11 +184,11 @@ public:
{
return (opcode >= iJB) && (opcode < iJCXZ);
}
bool isLlFlag(uint32_t x) const { return (flg & x)!=0;}
void SetLlFlag(uint32_t flag) {flg |= flag;}
void ClrLlFlag(uint32_t flag) {flg &= ~flag;}
bool testFlags(uint32_t x) const { return (flg & x)!=0;}
void setFlags(uint32_t flag) {flg |= flag;}
void clrFlags(uint32_t flag) {flg &= ~flag;}
uint32_t GetLlFlag() const {return flg;}
uint32_t getFlag() const {return flg;}
llIcode GetLlOpcode() const { return opcode; }
uint32_t GetLlLabel() const { return label;}
@ -206,7 +206,7 @@ public:
}
bool match(llIcode op,eReg dest,uint32_t flgs)
{
return (opcode==op) and (dst.regi==dest) and isLlFlag(flgs);
return (opcode==op) and (dst.regi==dest) and testFlags(flgs);
}
bool match(llIcode op,eReg dest,eReg src_reg)
{
@ -222,7 +222,7 @@ public:
}
bool match(llIcode op,uint32_t flgs)
{
return (opcode==op) and isLlFlag(flgs);
return (opcode==op) and testFlags(flgs);
}
void set(llIcode op,uint32_t flags)
{

View File

@ -258,7 +258,7 @@ COND_EXPR *COND_EXPR::idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst
int idx;
COND_EXPR *newExp = new COND_EXPR(IDENTIFIER);
/* Check for long constant and save it as a constant expression */
if ((sd == SRC) && pIcode->ll()->isLlFlag(I)) /* constant */
if ((sd == SRC) && pIcode->ll()->testFlags(I)) /* constant */
{
iICODE atOffset=pIcode;
advance(atOffset,off);
@ -348,8 +348,8 @@ COND_EXPR *COND_EXPR::id(const ICODE &pIcode, opLoc sd, Function * pProc, iICODE
const LLOperand &pm((sd == SRC) ? pIcode.ll()->src : pIcode.ll()->dst);
if ( ((sd == DST) && pIcode.ll()->isLlFlag(IM_DST)) or
((sd == SRC) && pIcode.ll()->isLlFlag(IM_SRC)) or
if ( ((sd == DST) && pIcode.ll()->testFlags(IM_DST)) or
((sd == SRC) && pIcode.ll()->testFlags(IM_SRC)) or
(sd == LHS_OP)) /* for MUL lhs */
{ /* implicit dx:ax */
idx = pProc->localId.newLongReg (TYPE_LONG_SIGN, rDX, rAX, ix_);
@ -358,20 +358,20 @@ COND_EXPR *COND_EXPR::id(const ICODE &pIcode, opLoc sd, Function * pProc, iICODE
duIcode.setRegDU (rAX, du);
}
else if ((sd == DST) && pIcode.ll()->isLlFlag(IM_TMP_DST))
else if ((sd == DST) && pIcode.ll()->testFlags(IM_TMP_DST))
{ /* implicit tmp */
newExp = COND_EXPR::idReg (rTMP, 0, &pProc->localId);
duIcode.setRegDU(rTMP, (operDu)eUSE);
}
else if ((sd == SRC) && pIcode.ll()->isLlFlag(I)) /* constant */
else if ((sd == SRC) && pIcode.ll()->testFlags(I)) /* constant */
newExp = COND_EXPR::idKte (pIcode.ll()->src.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.ll()->GetLlFlag() :
pIcode.ll()->GetLlFlag() & NO_SRC_B,
newExp = COND_EXPR::idReg (pm.regi, (sd == SRC) ? pIcode.ll()->getFlag() :
pIcode.ll()->getFlag() & NO_SRC_B,
&pProc->localId);
duIcode.setRegDU( pm.regi, du);
}
@ -433,7 +433,7 @@ condId ICODE::idType(opLoc sd)
{
LLOperand &pm((sd == SRC) ? ll()->src : ll()->dst);
if ((sd == SRC) && ll()->isLlFlag(I))
if ((sd == SRC) && ll()->testFlags(I))
return (CONSTANT);
else if (pm.regi == 0)
return (GLOB_VAR);

View File

@ -225,11 +225,11 @@ static void writeBitVector (const std::bitset<32> &regi)
* the code; that is, the target code has not been traversed yet. */
static void emitFwdGotoLabel (ICODE * pt, int indLevel)
{
if ( not pt->ll()->isLlFlag(HLL_LABEL)) /* node hasn't got a lab */
if ( not pt->ll()->testFlags(HLL_LABEL)) /* node hasn't got a lab */
{
/* Generate new label */
pt->ll()->hllLabNum = getNextLabel();
pt->ll()->SetLlFlag(HLL_LABEL);
pt->ll()->setFlags(HLL_LABEL);
}
cCode.appendCode( "%sgoto l%ld;\n", indent(indLevel), pt->ll()->hllLabNum);
}

View File

@ -180,7 +180,7 @@ static void findNodesInLoop(BB * latchNode,BB * head,Function * pProc,queue &int
head->loopFollow = latchNode->edges[ELSE].BBptr->dfsLastNum;
else
head->loopFollow = latchNode->edges[THEN].BBptr->dfsLastNum;
latchNode->back().ll()->SetLlFlag(JX_LOOP);
latchNode->back().ll()->setFlags(JX_LOOP);
}
else
{
@ -189,7 +189,7 @@ static void findNodesInLoop(BB * latchNode,BB * head,Function * pProc,queue &int
head->loopFollow = head->edges[ELSE].BBptr->dfsLastNum;
else
head->loopFollow = head->edges[THEN].BBptr->dfsLastNum;
head->back().ll()->SetLlFlag(JX_LOOP);
head->back().ll()->setFlags(JX_LOOP);
}
else /* head = anything besides 2-way, latch = 2-way */
{
@ -198,7 +198,7 @@ static void findNodesInLoop(BB * latchNode,BB * head,Function * pProc,queue &int
head->loopFollow = latchNode->edges[ELSE].BBptr->dfsLastNum;
else
head->loopFollow = latchNode->edges[THEN].BBptr->dfsLastNum;
latchNode->back().ll()->SetLlFlag(JX_LOOP);
latchNode->back().ll()->setFlags(JX_LOOP);
}
else /* latch = 1-way */
if (latchNode->nodeType == LOOP_NODE)
@ -237,7 +237,7 @@ static void findNodesInLoop(BB * latchNode,BB * head,Function * pProc,queue &int
}
if (pbb->dfsLastNum > head->dfsLastNum)
pProc->m_dfsLast[head->loopFollow]->loopHead = NO_NODE; /*****/
head->back().ll()->SetLlFlag(JX_LOOP);
head->back().ll()->setFlags(JX_LOOP);
}
else
{
@ -450,7 +450,7 @@ void Function::structIfs ()
if (currNode->flg & INVALID_BB) /* Do not process invalid BBs */
continue;
if ((currNode->nodeType == TWO_BRANCH) && (!currNode->back().ll()->isLlFlag(JX_LOOP)))
if ((currNode->nodeType == TWO_BRANCH) && (!currNode->back().ll()->testFlags(JX_LOOP)))
{
followInEdges = 0;
follow = 0;

View File

@ -83,9 +83,9 @@ int STKFRAME::getLocVar(int off)
/* Returns a string with the source operand of Icode */
static COND_EXPR *srcIdent (const ICODE &Icode, Function * pProc, iICODE i, ICODE & duIcode, operDu du)
{
if (Icode.ll()->isLlFlag(I)) /* immediate operand */
if (Icode.ll()->testFlags(I)) /* immediate operand */
{
if (Icode.ll()->isLlFlag(B))
if (Icode.ll()->testFlags(B))
return COND_EXPR::idKte (Icode.ll()->src.op(), 1);
return COND_EXPR::idKte (Icode.ll()->src.op(), 2);
}
@ -149,7 +149,7 @@ void Function::elimCondCodes ()
case iOR:
lhs = defAt->hl()->asgn.lhs->clone();
useAt->copyDU(*defAt, eUSE, eDEF);
if (defAt->ll()->isLlFlag(B))
if (defAt->ll()->testFlags(B))
rhs = COND_EXPR::idKte (0, 1);
else
rhs = COND_EXPR::idKte (0, 2);
@ -159,7 +159,7 @@ void Function::elimCondCodes ()
rhs = srcIdent (*defAt,this, befDefAt,*useAt, eUSE);
lhs = dstIdent (*defAt,this, befDefAt,*useAt, eUSE);
lhs = COND_EXPR::boolOp (lhs, rhs, AND);
if (defAt->ll()->isLlFlag(B))
if (defAt->ll()->testFlags(B))
rhs = COND_EXPR::idKte (0, 1);
else
rhs = COND_EXPR::idKte (0, 2);
@ -1040,7 +1040,7 @@ void Function::findExps()
if (cb)
for (k = 0; k < cb; numArgs++)
processCArg (pp, this, &(*picode), numArgs, &k);
else if ((cb == 0) && picode->ll()->isLlFlag(REST_STK))
else if ((cb == 0) && picode->ll()->testFlags(REST_STK))
while (! g_exp_stk.empty())
{
processCArg (pp, this, &(*picode), numArgs, &k);

View File

@ -214,7 +214,7 @@ void disassem(int pass, Function * ppProc)
for( ICODE &icode : pc)
{
LLInst *ll=icode.ll();
if (ll->isLlFlag(I) && ! ll->isLlFlag(JMP_ICODE) && JmpInst(ll->opcode))
if (ll->testFlags(I) && ! ll->testFlags(JMP_ICODE) && JmpInst(ll->opcode))
{
/* Replace the immediate operand with an icode index */
iICODE labTgt=pc.labelSrch(ll->src.op());
@ -222,13 +222,13 @@ void disassem(int pass, Function * ppProc)
{
ll->src.SetImmediateOp(labTgt->loc_ip);
/* This icode is the target of a jump */
labTgt->ll()->SetLlFlag(TARGET);
ll->SetLlFlag(JMP_ICODE); /* So its not done twice */
labTgt->ll()->setFlags(TARGET);
ll->setFlags(JMP_ICODE); /* So its not done twice */
}
else
{
/* This jump cannot be linked to a label */
ll->SetLlFlag(NO_LABEL);
ll->setFlags(NO_LABEL);
}
}
}
@ -276,16 +276,16 @@ static void dis1Line(ICODE &icode_iter, int pass)
* Do not try to display NO_CODE entries or synthetic instructions,
* other than JMPs, that have been introduced for def/use analysis. */
if ((option.asm1) &&
( _IcLL.isLlFlag(NO_CODE) ||
(_IcLL.isLlFlag(SYNTHETIC) && (_IcLL.opcode != iJMP))))
( _IcLL.testFlags(NO_CODE) ||
(_IcLL.testFlags(SYNTHETIC) && (_IcLL.opcode != iJMP))))
{
return;
}
else if (_IcLL.isLlFlag(NO_CODE))
else if (_IcLL.testFlags(NO_CODE))
{
return;
}
if (_IcLL.isLlFlag(TARGET | CASE))
if (_IcLL.testFlags(TARGET | CASE))
{
if (pass == 3)
cCode.appendCode("\n"); /* Print to c code buffer */
@ -294,7 +294,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
}
/* Find next instruction label and print hex bytes */
if (_IcLL.isLlFlag(SYNTHETIC))
if (_IcLL.testFlags(SYNTHETIC))
nextInst = _IcLL.label;
else
{
@ -321,7 +321,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
{
lab_contents << ':'; /* Also removes the null */
}
else if (_IcLL.isLlFlag(TARGET)) /* Symbols override Lnn labels */
else if (_IcLL.testFlags(TARGET)) /* Symbols override Lnn labels */
{
/* Print label */
if (pl.count(icode_iter.loc_ip)==0)
@ -332,7 +332,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
}
oper_stream<< lab_contents.str();
}
if (_IcLL.opcode == iSIGNEX && _IcLL.isLlFlag(B))
if (_IcLL.opcode == iSIGNEX && _IcLL.testFlags(B))
{
_IcLL.opcode = iCBW;
}
@ -342,7 +342,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
{
case iADD: case iADC: case iSUB: case iSBB: case iAND: case iOR:
case iXOR: case iTEST: case iCMP: case iMOV: case iLEA: case iXCHG:
strDst(oper_stream,_IcLL.GetLlFlag(), _IcLL.dst);
strDst(oper_stream,_IcLL.getFlag(), _IcLL.dst);
strSrc(oper_stream,_IcLL);
break;
@ -352,42 +352,42 @@ static void dis1Line(ICODE &icode_iter, int pass)
case iSAR: case iSHL: case iSHR: case iRCL: case iRCR: case iROL:
case iROR:
strDst(oper_stream,_IcLL.GetLlFlag() | I, _IcLL.dst);
if(_IcLL.isLlFlag(I))
strDst(oper_stream,_IcLL.getFlag() | I, _IcLL.dst);
if(_IcLL.testFlags(I))
strSrc(oper_stream,_IcLL);
else
oper_stream<<", cl";
break;
case iINC: case iDEC: case iNEG: case iNOT: case iPOP:
strDst(oper_stream,_IcLL.GetLlFlag() | I, _IcLL.dst);
strDst(oper_stream,_IcLL.getFlag() | I, _IcLL.dst);
break;
case iPUSH:
if (_IcLL.isLlFlag(I))
if (_IcLL.testFlags(I))
{
oper_stream<<strHex(_IcLL.src.op());
// strcpy(p + WID_PTR, strHex(pIcode->ll()->immed.op));
}
else
{
strDst(oper_stream,_IcLL.GetLlFlag() | I, _IcLL.dst);
strDst(oper_stream,_IcLL.getFlag() | I, _IcLL.dst);
}
break;
case iDIV: case iIDIV: case iMUL: case iIMUL: case iMOD:
if (_IcLL.isLlFlag(I))
if (_IcLL.testFlags(I))
{
strDst(oper_stream,_IcLL.GetLlFlag(), _IcLL.dst) <<", ";
formatRM(oper_stream, _IcLL.GetLlFlag(), _IcLL.src);
strDst(oper_stream,_IcLL.getFlag(), _IcLL.dst) <<", ";
formatRM(oper_stream, _IcLL.getFlag(), _IcLL.src);
strSrc(oper_stream,_IcLL);
}
else
strDst(oper_stream,_IcLL.GetLlFlag() | I, _IcLL.src);
strDst(oper_stream,_IcLL.getFlag() | I, _IcLL.src);
break;
case iLDS: case iLES: case iBOUND:
strDst(oper_stream,_IcLL.GetLlFlag(), _IcLL.dst)<<", dword ptr";
strDst(oper_stream,_IcLL.getFlag(), _IcLL.dst)<<", dword ptr";
strSrc(oper_stream,_IcLL,true);
break;
@ -409,12 +409,12 @@ static void dis1Line(ICODE &icode_iter, int pass)
}
}
if (_IcLL.isLlFlag(NO_LABEL))
if (_IcLL.testFlags(NO_LABEL))
{
//strcpy(p + WID_PTR, strHex(pIcode->ll()->immed.op));
oper_stream<<strHex(_IcLL.src.op());
}
else if (_IcLL.isLlFlag(I) )
else if (_IcLL.testFlags(I) )
{
j = _IcLL.src.op();
if (pl.count(j)==0) /* Forward jump */
@ -439,7 +439,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
break;
case iCALL: case iCALLF:
if (_IcLL.isLlFlag(I))
if (_IcLL.testFlags(I))
{
if((_IcLL.opcode == iCALL))
oper_stream<< "near";
@ -462,7 +462,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
break;
case iRET: case iRETF: case iINT:
if (_IcLL.isLlFlag(I))
if (_IcLL.testFlags(I))
{
oper_stream<<strHex(_IcLL.src.op());
}
@ -479,9 +479,9 @@ static void dis1Line(ICODE &icode_iter, int pass)
{
bool is_dx_src=(_IcLL.opcode == iOUTS || _IcLL.opcode == iREP_OUTS);
if(is_dx_src)
oper_stream<<"dx, "<<szPtr[_IcLL.GetLlFlag() & B];
oper_stream<<"dx, "<<szPtr[_IcLL.getFlag() & B];
else
oper_stream<<szPtr[_IcLL.GetLlFlag() & B];
oper_stream<<szPtr[_IcLL.getFlag() & B];
if (_IcLL.opcode == iLODS ||
_IcLL.opcode == iREP_LODS ||
_IcLL.opcode == iOUTS ||
@ -496,7 +496,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
oper_stream<<":[si]";
}
else
oper_stream<<(_IcLL.GetLlFlag() & B)? "B": "W";
oper_stream<<(_IcLL.getFlag() & B)? "B": "W";
break;
case iXLAT:
@ -508,13 +508,13 @@ static void dis1Line(ICODE &icode_iter, int pass)
break;
case iIN:
oper_stream<<(_IcLL.GetLlFlag() & B)?"al, ": "ax, ";
oper_stream<<(_IcLL.isLlFlag(I))? strHex(_IcLL.src.op()): "dx";
oper_stream<<(_IcLL.getFlag() & B)?"al, ": "ax, ";
oper_stream<<(_IcLL.testFlags(I))? strHex(_IcLL.src.op()): "dx";
break;
case iOUT:
oper_stream<<(_IcLL.isLlFlag(I))? strHex(_IcLL.src.op()): "dx";
oper_stream<<(_IcLL.GetLlFlag() & B)?", al": ", ax";
oper_stream<<(_IcLL.testFlags(I))? strHex(_IcLL.src.op()): "dx";
oper_stream<<(_IcLL.getFlag() & B)?", al": ", ax";
break;
default:
@ -522,7 +522,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
}
/* Comments */
if (_IcLL.isLlFlag(SYNTHETIC))
if (_IcLL.testFlags(SYNTHETIC))
{
fImpure = FALSE;
}
@ -542,13 +542,13 @@ static void dis1Line(ICODE &icode_iter, int pass)
{
result_stream <<"; "<<cbuf.str();
}
else if (fImpure || (_IcLL.isLlFlag(SWITCH | CASE | SEG_IMMED | IMPURE | SYNTHETIC | TERMINATES)))
else if (fImpure || (_IcLL.testFlags(SWITCH | CASE | SEG_IMMED | IMPURE | SYNTHETIC | TERMINATES)))
{
if (_IcLL.isLlFlag(CASE))
if (_IcLL.testFlags(CASE))
{
result_stream << ";Case l"<< _IcLL.caseTbl.numEntries;
}
if (_IcLL.isLlFlag(SWITCH))
if (_IcLL.testFlags(SWITCH))
{
result_stream << ";Switch ";
}
@ -556,15 +556,15 @@ static void dis1Line(ICODE &icode_iter, int pass)
{
result_stream << ";Accessed as data ";
}
if (_IcLL.isLlFlag(IMPURE))
if (_IcLL.testFlags(IMPURE))
{
result_stream << ";Impure operand ";
}
if (_IcLL.isLlFlag(SEG_IMMED))
if (_IcLL.testFlags(SEG_IMMED))
{
result_stream << ";Segment constant";
}
if (_IcLL.isLlFlag(TERMINATES))
if (_IcLL.testFlags(TERMINATES))
{
result_stream << ";Exit to DOS";
}
@ -578,7 +578,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
if(pass==3)
{
/* output to .b code buffer */
if (_IcLL.isLlFlag(SYNTHETIC))
if (_IcLL.testFlags(SYNTHETIC))
result_stream<<";Synthetic inst";
if (pass == 3) /* output to .b code buffer */
cCode.appendCode("%s\n", result_stream.str().c_str());
@ -586,7 +586,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
}
else
{
if (not _IcLL.isLlFlag(SYNTHETIC) )
if (not _IcLL.testFlags(SYNTHETIC) )
{
/* output to .a1 or .a2 file */
fprintf (fp, "%03ld %06lX %s\n", icode_iter.loc_ip, _IcLL.label, result_stream.str().c_str());
@ -670,12 +670,12 @@ static ostringstream &strSrc(ostringstream &os,const LLInst &l_ins,bool skip_com
static char buf[30] = {", "};
if(false==skip_comma)
os<<", ";
if (l_ins.isLlFlag(I))
if (l_ins.testFlags(I))
os<<strHex(l_ins.src.op());
else if (l_ins.isLlFlag(IM_SRC)) /* level 2 */
else if (l_ins.testFlags(IM_SRC)) /* level 2 */
os<<"dx:ax";
else
formatRM(os, l_ins.GetLlFlag(), l_ins.src);
formatRM(os, l_ins.getFlag(), l_ins.src);
return os;
}
@ -748,7 +748,7 @@ void flops(LLInst &pIcode,std::ostringstream &out)
}
}
formatRM(out, pIcode.GetLlFlag(), pIcode.dst);
formatRM(out, pIcode.getFlag(), pIcode.dst);
}
else
{

View File

@ -45,7 +45,7 @@ void Function::createCFG()
/* Stick a NOWHERE_NODE on the end if we terminate
* with anything other than a ret, jump or terminate */
if (ip + 1 == Icode.size() &&
(not ll->isLlFlag(TERMINATES)) &&
(not ll->testFlags(TERMINATES)) &&
ll->opcode != iJMP && ll->opcode != iJMPF &&
ll->opcode != iRET && ll->opcode != iRETF)
{
@ -53,7 +53,7 @@ void Function::createCFG()
}
/* Only process icodes that have valid instructions */
else if (not ll->isLlFlag(NO_CODE) )
else if (not ll->testFlags(NO_CODE) )
{
switch (ll->opcode) {
case iJB: case iJBE: case iJAE: case iJA:
@ -66,7 +66,7 @@ CondJumps:
start = ip + 1;
pBB->edges[0].ip = (uint32_t)start;
/* This is for jumps off into nowhere */
if ( ll->isLlFlag(NO_LABEL) )
if ( ll->testFlags(NO_LABEL) )
{
pBB->edges.pop_back();
}
@ -79,14 +79,14 @@ CondJumps:
goto CondJumps;
case iJMPF: case iJMP:
if (ll->isLlFlag(SWITCH))
if (ll->testFlags(SWITCH))
{
pBB = BB::Create(start, ip, MULTI_BRANCH, ll->caseTbl.numEntries, this);
for (i = 0; i < ll->caseTbl.numEntries; i++)
pBB->edges[i].ip = ll->caseTbl.entries[i];
hasCase = TRUE;
}
else if ((ll->GetLlFlag() & (I | NO_LABEL)) == I) //TODO: WHY NO_LABEL TESTIT
else if ((ll->getFlag() & (I | NO_LABEL)) == I) //TODO: WHY NO_LABEL TESTIT
{
pBB = BB::Create(start, ip, ONE_BRANCH, 1, this);
pBB->edges[0].ip = ll->src.op();
@ -118,7 +118,7 @@ CondJumps:
default:
/* Check for exit to DOS */
iICODE next1=++iICODE(pIcode);
if ( ll->isLlFlag(TERMINATES) )
if ( ll->testFlags(TERMINATES) )
{
pBB = BB::Create(start, ip, TERMINATE_NODE, 0, this);
start = ip + 1;
@ -127,7 +127,7 @@ CondJumps:
else if (next1 != Icode.end())
{
assert(next1->loc_ip==ip+1);
if (next1->ll()->isLlFlag(TARGET | CASE))
if (next1->ll()->testFlags(TARGET | CASE))
{
pBB = BB::Create(start, ip, FALL_NODE, 1, this);
start = ip + 1;
@ -167,14 +167,14 @@ void Function::markImpure()
SYM * psym;
for(ICODE &icod : Icode)
{
if ( not icod.ll()->isLlFlag(SYM_USE | SYM_DEF))
if ( not icod.ll()->testFlags(SYM_USE | SYM_DEF))
continue;
psym = &symtab[icod.ll()->caseTbl.numEntries];
for (int c = (int)psym->label; c < (int)psym->label+psym->size; c++)
{
if (BITMAP(c, BM_CODE))
{
icod.ll()->SetLlFlag(IMPURE);
icod.ll()->setFlags(IMPURE);
flg |= IMPURE;
break;
}
@ -287,7 +287,7 @@ BB *BB::rmJMP(int marker, BB * pBB)
}
else
{
pBB->front().ll()->SetLlFlag(NO_CODE);
pBB->front().ll()->setFlags(NO_CODE);
pBB->front().invalidate(); //pProc->Icode.SetLlInvalid(pBB->begin(), TRUE);
}
@ -304,9 +304,9 @@ BB *BB::rmJMP(int marker, BB * pBB)
pBB->inEdges.pop_back(); // was --numInedges
if (! pBB->inEdges.empty())
{
pBB->front().ll()->SetLlFlag(NO_CODE);
pBB->front().ll()->setFlags(NO_CODE);
pBB->front().invalidate();
// pProc->Icode.SetLlFlag(pBB->start, NO_CODE);
// pProc->Icode.setFlags(pBB->start, NO_CODE);
// pProc->Icode.SetLlInvalid(pBB->start, TRUE);
}
} while (pBB->nodeType != NOWHERE_NODE);
@ -340,11 +340,11 @@ void BB::mergeFallThrough( CIcodeRec &Icode)
if(back().loc_ip>pChild->front().loc_ip) // back edege
break;
auto iter=std::find_if(this->end2(),pChild->begin2(),[](ICODE &c)
{return not c.ll()->isLlFlag(NO_CODE);});
{return not c.ll()->testFlags(NO_CODE);});
if (iter != pChild->begin2())
break;
back().ll()->SetLlFlag(NO_CODE);
back().ll()->setFlags(NO_CODE);
back().invalidate();
nodeType = FALL_NODE;
length--;
@ -356,7 +356,7 @@ void BB::mergeFallThrough( CIcodeRec &Icode)
nodeType = pChild->nodeType;
length = (pChild->start - start) + pChild->length ;
pChild->front().ll()->ClrLlFlag(TARGET);
pChild->front().ll()->clrFlags(TARGET);
edges.swap(pChild->edges);
pChild->inEdges.clear();

View File

@ -142,11 +142,11 @@ void Function::highLevelGen()
assert(numIcode==Icode.size());
pIcode = i; //Icode.GetIcode(i)
LLInst *ll = pIcode->ll();
if ( ll->isLlFlag(NOT_HLL) )
if ( ll->testFlags(NOT_HLL) )
pIcode->invalidate();
if ((pIcode->type == LOW_LEVEL) && pIcode->valid() )
{
flg = ll->GetLlFlag();
flg = ll->getFlag();
if ((flg & IM_OPS) != IM_OPS) /* not processing IM_OPS yet */
if ((flg & NO_OPS) != NO_OPS) /* if there are opers */
{
@ -182,7 +182,7 @@ void Function::highLevelGen()
case iDIV:
case iIDIV:/* should be signed div */
rhs = COND_EXPR::boolOp (lhs, rhs, DIV);
if ( ll->isLlFlag(B) )
if ( ll->testFlags(B) )
{
lhs = COND_EXPR::idReg (rAL, 0, &localId);
pIcode->setRegDU( rAL, eDEF);
@ -214,7 +214,7 @@ void Function::highLevelGen()
case iMOD:
rhs = COND_EXPR::boolOp (lhs, rhs, MOD);
if ( ll->isLlFlag(B) )
if ( ll->testFlags(B) )
{
lhs = COND_EXPR::idReg (rAH, 0, &localId);
pIcode->setRegDU( rAH, eDEF);

View File

@ -70,11 +70,11 @@ extern bundle cCode;
* onto code in cCode.code */
void LLInst::emitGotoLabel (int indLevel)
{
if ( not isLlFlag(HLL_LABEL) ) /* node hasn't got a lab */
if ( not testFlags(HLL_LABEL) ) /* node hasn't got a lab */
{
/* Generate new label */
hllLabNum = getNextLabel();
SetLlFlag(HLL_LABEL);
setFlags(HLL_LABEL);
/* Node has been traversed already, so backpatch this label into
* the code */

View File

@ -231,11 +231,11 @@ void Function::bindIcodeOff()
for(ICODE &c : Icode)
{
LLInst *ll=c.ll();
if (ll->isLlFlag(I) && JmpInst(ll->opcode))
if (ll->testFlags(I) && JmpInst(ll->opcode))
{
iICODE loc=Icode.labelSrch(ll->src.op());
if (loc!=Icode.end())
loc->ll()->SetLlFlag(TARGET);
loc->ll()->setFlags(TARGET);
}
}
@ -248,16 +248,16 @@ void Function::bindIcodeOff()
LLInst *ll=icode.ll();
if (not JmpInst(ll->opcode))
continue;
if (ll->isLlFlag(I) )
if (ll->testFlags(I) )
{
uint32_t found;
if (! Icode.labelSrch(ll->src.op(), found))
ll->SetLlFlag( NO_LABEL );
ll->setFlags( NO_LABEL );
else
ll->src.SetImmediateOp(found);
}
else if (ll->isLlFlag(SWITCH) )
else if (ll->testFlags(SWITCH) )
{
p = ll->caseTbl.entries;
for (int j = 0; j < ll->caseTbl.numEntries; j++, p++)

View File

@ -22,21 +22,21 @@ bool Idiom3::match(iICODE picode)
/* Match ADD SP, immed */
for(int i=0; i<2; ++i)
m_icodes[i] = picode++;
if ( m_icodes[1]->ll()->isLlFlag(I) && m_icodes[1]->ll()->match(iADD,rSP))
if ( m_icodes[1]->ll()->testFlags(I) && m_icodes[1]->ll()->match(iADD,rSP))
{
m_param_count = m_icodes[1]->ll()->src.op();
return true;
}
else if (m_icodes[1]->ll()->match(iMOV,rSP,rBP))
{
m_icodes[0]->ll()->SetLlFlag(REST_STK);
m_icodes[0]->ll()->setFlags(REST_STK);
return true;
}
return 0;
}
int Idiom3::action()
{
if (m_icodes[0]->ll()->isLlFlag(I) )
if (m_icodes[0]->ll()->testFlags(I) )
{
m_icodes[0]->ll()->src.proc.proc->cbParam = (int16_t)m_param_count;
m_icodes[0]->ll()->src.proc.cb = m_param_count;
@ -96,7 +96,7 @@ bool Idiom17::match(iICODE picode)
}
int Idiom17::action()
{
if (m_icodes[0]->ll()->isLlFlag(I))
if (m_icodes[0]->ll()->testFlags(I))
{
m_icodes[0]->ll()->src.proc.proc->cbParam = (int16_t)m_param_count;
m_icodes[0]->ll()->src.proc.cb = m_param_count;

View File

@ -46,7 +46,7 @@ bool Idiom2::match(iICODE pIcode)
iICODE nicode;
if(pIcode==m_func->Icode.begin()) // pIcode->loc_ip == 0
return false;
if ( pIcode->ll()->isLlFlag(I) || (not pIcode->ll()->match(rSP,rBP)) )
if ( pIcode->ll()->testFlags(I) || (not pIcode->ll()->match(rSP,rBP)) )
return false;
if(distance(pIcode,m_end)<3)
return false;
@ -55,20 +55,20 @@ bool Idiom2::match(iICODE pIcode)
m_icodes.push_back(pIcode);
/* Get next icode, skip over holes in the icode array */
nicode = ++iICODE(pIcode);
while (nicode->ll()->isLlFlag(NO_CODE) && (nicode != m_end))
while (nicode->ll()->testFlags(NO_CODE) && (nicode != m_end))
{
nicode++;
}
if(nicode == m_end)
return false;
if (nicode->ll()->match(iPOP,rBP) && ! (nicode->ll()->isLlFlag(I | TARGET | CASE)) )
if (nicode->ll()->match(iPOP,rBP) && ! (nicode->ll()->testFlags(I | TARGET | CASE)) )
{
m_icodes.push_back(nicode++); // Matched POP BP
/* Match RET(F) */
if ( nicode != m_end &&
!(nicode->ll()->isLlFlag(I | TARGET | CASE)) &&
!(nicode->ll()->testFlags(I | TARGET | CASE)) &&
(nicode->ll()->match(iRET) || nicode->ll()->match(iRETF))
)
{
@ -118,7 +118,7 @@ bool Idiom4::match(iICODE pIcode)
{
iICODE prev1 = --iICODE(pIcode);
/* Check for POP BP */
if (prev1->ll()->match(iPOP,rBP) && not prev1->ll()->isLlFlag(I) )
if (prev1->ll()->match(iPOP,rBP) && not prev1->ll()->testFlags(I) )
m_icodes.push_back(prev1);
else if(prev1!=m_func->Icode.begin())
{
@ -129,7 +129,7 @@ bool Idiom4::match(iICODE pIcode)
}
/* Check for RET(F) immed */
if (pIcode->ll()->isLlFlag(I) )
if (pIcode->ll()->testFlags(I) )
{
m_param_count = (int16_t)pIcode->ll()->src.op();
}

View File

@ -60,13 +60,13 @@ bool Idiom1::match(iICODE picode)
m_icodes.clear();
m_min_off = 0;
/* PUSH BP as first instruction of procedure */
if ( (not picode->ll()->isLlFlag(I)) && picode->ll()->src.regi == rBP)
if ( (not picode->ll()->testFlags(I)) && picode->ll()->src.regi == rBP)
{
m_icodes.push_back( picode++ ); // insert iPUSH
if(picode==m_end)
return false;
/* MOV BP, SP as next instruction */
if ( !picode->ll()->isLlFlag(I | TARGET | CASE) && picode->ll()->match(iMOV ,rBP,rSP) )
if ( !picode->ll()->testFlags(I | TARGET | CASE) && picode->ll()->match(iMOV ,rBP,rSP) )
{
m_icodes.push_back( picode++ ); // insert iMOV
if(picode==m_end)
@ -75,7 +75,7 @@ bool Idiom1::match(iICODE picode)
/* Look for SUB SP, immed */
if (
picode->ll()->isLlFlag(I | TARGET | CASE) && picode->ll()->match(iSUB,rSP)
picode->ll()->testFlags(I | TARGET | CASE) && picode->ll()->match(iSUB,rSP)
)
{
m_icodes.push_back( picode++ ); // insert iSUB
@ -99,7 +99,7 @@ bool Idiom1::match(iICODE picode)
return false;
/* Look for MOV BP, SP */
if ( picode != m_end &&
!picode->ll()->isLlFlag(I | TARGET | CASE) &&
!picode->ll()->testFlags(I | TARGET | CASE) &&
picode->ll()->match(iMOV,rBP,rSP))
{
m_icodes.push_back(picode);

View File

@ -29,10 +29,10 @@ bool Idiom14::match(iICODE pIcode)
m_icodes[1]=pIcode++;
/* Check for regL */
m_regL = m_icodes[0]->ll()->dst.regi;
if (not m_icodes[0]->ll()->isLlFlag(I) && ((m_regL == rAX) || (m_regL ==rBX)))
if (not m_icodes[0]->ll()->testFlags(I) && ((m_regL == rAX) || (m_regL ==rBX)))
{
/* Check for XOR regH, regH */
if (m_icodes[1]->ll()->match(iXOR) && not m_icodes[1]->ll()->isLlFlag(I))
if (m_icodes[1]->ll()->match(iXOR) && not m_icodes[1]->ll()->testFlags(I))
{
m_regH = m_icodes[1]->ll()->dst.regi;
if (m_regH == m_icodes[1]->ll()->src.regi)
@ -81,10 +81,10 @@ bool Idiom13::match(iICODE pIcode)
/* Check for regL */
regi = m_icodes[0]->ll()->dst.regi;
if (not m_icodes[0]->ll()->isLlFlag(I) && (regi >= rAL) && (regi <= rBH))
if (not m_icodes[0]->ll()->testFlags(I) && (regi >= rAL) && (regi <= rBH))
{
/* Check for MOV regH, 0 */
if (m_icodes[1]->ll()->match(iMOV) && m_icodes[1]->ll()->isLlFlag(I) && (m_icodes[1]->ll()->src.op() == 0))
if (m_icodes[1]->ll()->match(iMOV) && m_icodes[1]->ll()->testFlags(I) && (m_icodes[1]->ll()->src.op() == 0))
{
if (m_icodes[1]->ll()->dst.regi == (regi + 4)) //TODO: based on distance between AH-AL,BH-BL etc.
{

View File

@ -93,7 +93,7 @@ bool Idiom16::match (iICODE picode)
int Idiom16::action()
{
COND_EXPR *lhs,*rhs;
lhs = COND_EXPR::idReg (m_icodes[0]->ll()->dst.regi, m_icodes[0]->ll()->GetLlFlag(),&m_func->localId);
lhs = COND_EXPR::idReg (m_icodes[0]->ll()->dst.regi, m_icodes[0]->ll()->getFlag(),&m_func->localId);
rhs = COND_EXPR::unary (NEGATION, lhs->clone());
m_icodes[0]->setAsgn(lhs, rhs);
m_icodes[1]->invalidate();

View File

@ -18,7 +18,7 @@ bool Idiom8::match(iICODE pIcode)
return false;
m_icodes[0]=pIcode++;
m_icodes[1]=pIcode++;
if (m_icodes[0]->ll()->isLlFlag(I) && (m_icodes[0]->ll()->src.op() == 1))
if (m_icodes[0]->ll()->testFlags(I) && (m_icodes[0]->ll()->src.op() == 1))
if ( m_icodes[1]->ll()->match(iRCR,I) &&
(m_icodes[1]->ll()->src.op() == 1))
return true;
@ -63,7 +63,7 @@ bool Idiom15::match(iICODE pIcode)
if(distance(pIcode,m_end)<2)
return false;
/* Match SHL reg, 1 */
if (not pIcode->ll()->isLlFlag(I) or (pIcode->ll()->src.op() != 1))
if (not pIcode->ll()->testFlags(I) or (pIcode->ll()->src.op() != 1))
return false;
m_icodes.clear();
regi = pIcode->ll()->dst.regi;
@ -82,7 +82,7 @@ int Idiom15::action()
{
COND_EXPR *lhs,*rhs,*exp;
lhs = COND_EXPR::idReg (m_icodes[0]->ll()->dst.regi,
m_icodes[0]->ll()->GetLlFlag() & NO_SRC_B,
m_icodes[0]->ll()->getFlag() & NO_SRC_B,
&m_func->localId);
rhs = COND_EXPR::idKte (m_icodes.size(), 2);
exp = COND_EXPR::boolOp (lhs, rhs, SHL);
@ -109,7 +109,7 @@ bool Idiom12::match(iICODE pIcode)
return false;
m_icodes[0]=pIcode++;
m_icodes[1]=pIcode++;
if (m_icodes[0]->ll()->isLlFlag(I) && (m_icodes[0]->ll()->src.op() == 1))
if (m_icodes[0]->ll()->testFlags(I) && (m_icodes[0]->ll()->src.op() == 1))
if (m_icodes[1]->ll()->match(iRCL,I) && (m_icodes[1]->ll()->src.op() == 1))
return true;
return false;
@ -148,7 +148,7 @@ bool Idiom9::match(iICODE pIcode)
return false;
m_icodes[0]=pIcode++;
m_icodes[1]=pIcode++;
if (m_icodes[0]->ll()->isLlFlag(I) && (m_icodes[0]->ll()->src.op() == 1))
if (m_icodes[0]->ll()->testFlags(I) && (m_icodes[0]->ll()->src.op() == 1))
if (m_icodes[1]->ll()->match(iRCR,I) && (m_icodes[1]->ll()->src.op() == 1))
return true;
return false;

View File

@ -23,7 +23,7 @@ bool Idiom21::match (iICODE picode)
m_icodes[0]=picode++;
m_icodes[1]=picode++;
if (not m_icodes[1]->ll()->isLlFlag(I))
if (not m_icodes[1]->ll()->testFlags(I))
return false;
dst = &m_icodes[0]->ll()->dst;
@ -87,7 +87,7 @@ int Idiom7::action()
rhs = COND_EXPR::idKte (0, 2);
m_icode->setAsgn(lhs, rhs);
m_icode->du.use = 0; /* clear register used in iXOR */
m_icode->ll()->SetLlFlag(I);
m_icode->ll()->setFlags(I);
return 1;
}
@ -113,7 +113,7 @@ bool Idiom10::match(iICODE pIcode)
m_icodes[0]=pIcode++;
m_icodes[1]=pIcode++;
/* Check OR reg, reg */
if (not m_icodes[0]->ll()->isLlFlag(I) &&
if (not m_icodes[0]->ll()->testFlags(I) &&
(m_icodes[0]->ll()->src.regi > 0) &&
(m_icodes[0]->ll()->src.regi < INDEXBASE) &&
(m_icodes[0]->ll()->src.regi == m_icodes[0]->ll()->dst.regi))
@ -127,7 +127,7 @@ bool Idiom10::match(iICODE pIcode)
int Idiom10::action()
{
m_icodes[0]->ll()->opcode = iCMP;
m_icodes[0]->ll()->SetLlFlag(I);
m_icodes[0]->ll()->setFlags(I);
m_icodes[0]->ll()->src.SetImmediateOp(0); // todo check if proc should be zeroed too
m_icodes[0]->du.def = 0;
m_icodes[0]->du1.numRegsDef = 0;

View File

@ -339,7 +339,7 @@ boolT checkLongEq (LONG_STKID_TYPE longId, iICODE pIcode, int i,
{
asgn.lhs = COND_EXPR::idLongIdx (i);
if ( not pIcode->ll()->isLlFlag(NO_SRC) )
if ( not pIcode->ll()->testFlags(NO_SRC) )
{
asgn.rhs = COND_EXPR::idLong (&pProc->localId, SRC, pIcode, HIGH_FIRST, pIcode, eUSE, off);
}
@ -379,7 +379,7 @@ boolT checkLongRegEq (LONGID_TYPE longId, iICODE pIcode, int i,
if ((longId.h == pmHdst->regi) && (longId.l == pmLdst->regi))
{
lhs = COND_EXPR::idLongIdx (i);
if ( not pIcode->ll()->isLlFlag(NO_SRC) )
if ( not pIcode->ll()->testFlags(NO_SRC) )
{
rhs = COND_EXPR::idLong (&pProc->localId, SRC, pIcode, HIGH_FIRST, pIcode, eUSE, off);
}

View File

@ -140,7 +140,7 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
process_operands(_Icode,pstate);
/* Keep track of interesting instruction flags in procedure */
flg |= (ll->GetLlFlag() & (NOT_HLL | FLOAT_OP));
flg |= (ll->getFlag() & (NOT_HLL | FLOAT_OP));
/* Check if this instruction has already been parsed */
iICODE labLoc = Icode.labelSrch(ll->label);
@ -160,20 +160,20 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
eIcode.type = LOW_LEVEL;
eIcode.ll()->opcode = iMOV;
eIcode.ll()->dst.regi = rTMP;
if (ll->isLlFlag(B) )
if (ll->testFlags(B) )
{
eIcode.ll()->SetLlFlag( B );
eIcode.ll()->setFlags( B );
eIcode.ll()->src.regi = rAX;
eIcode.setRegDU( rAX, eUSE);
}
else /* implicit dx:ax */
{
eIcode.ll()->SetLlFlag( IM_SRC );
eIcode.ll()->setFlags( IM_SRC );
eIcode.setRegDU( rAX, eUSE);
eIcode.setRegDU( rDX, eUSE);
}
eIcode.setRegDU( rTMP, eDEF);
eIcode.ll()->SetLlFlag( SYNTHETIC );
eIcode.ll()->setFlags( SYNTHETIC );
/* eIcode.ll()->label = SynthLab++; */
eIcode.ll()->label = _Icode.ll()->label;
Icode.addIcode(&eIcode);
@ -187,7 +187,7 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
eIcode.ll()->opcode = iMOD;
eIcode.ll()->src = _Icode.ll()->src;
eIcode.du = _Icode.du;
eIcode.ll()->SetLlFlag( ( ll->GetLlFlag() | SYNTHETIC) );
eIcode.ll()->setFlags( ( ll->getFlag() | SYNTHETIC) );
eIcode.ll()->label = SynthLab++;
pIcode = Icode.addIcode(&eIcode);
}
@ -201,14 +201,14 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
eIcode.ll()->src.regi = _Icode.ll()->dst.regi;
eIcode.setRegDU( rTMP, eDEF);
eIcode.setRegDU( eIcode.ll()->src.regi, eUSE);
eIcode.ll()->SetLlFlag( SYNTHETIC );
eIcode.ll()->setFlags( SYNTHETIC );
/* eIcode.ll()->label = SynthLab++; */
eIcode.ll()->label = _Icode.ll()->label;
Icode.addIcode(&eIcode);
/* MOV regDst, regSrc */
_Icode.ll()->opcode = iMOV;
ll->SetLlFlag( SYNTHETIC );
ll->setFlags( SYNTHETIC );
/* Icode.ll()->label = SynthLab++; */
Icode.addIcode(&_Icode);
ll->opcode = iXCHG; /* for next case */
@ -221,7 +221,7 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
eIcode.ll()->src.regi = rTMP;
eIcode.setRegDU( eIcode.ll()->dst.regi, eDEF);
eIcode.setRegDU( rTMP, eUSE);
eIcode.ll()->SetLlFlag(SYNTHETIC);
eIcode.ll()->setFlags(SYNTHETIC);
eIcode.ll()->label = SynthLab++;
pIcode = Icode.addIcode(&eIcode);
}
@ -246,7 +246,7 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
/* This sets up range check for indexed JMPs hopefully
* Handles JA/JAE for fall through and JB/JBE on branch
*/
if (ip > 0 && prev.ll()->opcode == iCMP && (prev.ll()->isLlFlag(I)))
if (ip > 0 && prev.ll()->opcode == iCMP && (prev.ll()->testFlags(I)))
{
pstate->JCond.immed = (int16_t)prev.ll()->src.op();
if (ll->opcode == iJA || ll->opcode == iJBE)
@ -328,7 +328,7 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
done = (boolT)(ll->src.op() == 0x20 ||
ll->src.op() == 0x27);
if (done)
pIcode->ll()->SetLlFlag(TERMINATES);
pIcode->ll()->setFlags(TERMINATES);
break;
case iMOV:
@ -342,7 +342,7 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
case iSHL:
if (pstate->JCond.regi == ll->dst.regi)
if ((ll->isLlFlag(I)) && ll->src.op() == 1)
if ((ll->testFlags(I)) && ll->src.op() == 1)
pstate->JCond.immed *= 2;
else
pstate->JCond.regi = 0;
@ -391,7 +391,7 @@ boolT Function::process_JMP (ICODE & pIcode, STATE *pstate, CALL_GRAPH * pcallGr
uint32_t i, k, seg, target;
uint32_t tmp;
if (pIcode.ll()->isLlFlag(I))
if (pIcode.ll()->testFlags(I))
{
if (pIcode.ll()->opcode == iJMPF)
pstate->setState( rCS, LH(prog.Image + pIcode.ll()->label + 3));
@ -410,7 +410,7 @@ boolT Function::process_JMP (ICODE & pIcode, STATE *pstate, CALL_GRAPH * pcallGr
seg = (pIcode.ll()->src.seg)? pIcode.ll()->src.seg: rDS;
/* Ensure we have a uint16_t offset & valid seg */
if (pIcode.ll()->match(iJMP) and (pIcode.ll()->isLlFlag(WORD_OFF)) &&
if (pIcode.ll()->match(iJMP) and (pIcode.ll()->testFlags(WORD_OFF)) &&
pstate->f[seg] &&
(pIcode.ll()->src.regi == INDEXBASE + 4 ||
pIcode.ll()->src.regi == INDEXBASE + 5 || /* Idx reg. BX, SI, DI */
@ -468,7 +468,7 @@ boolT Function::process_JMP (ICODE & pIcode, STATE *pstate, CALL_GRAPH * pcallGr
setBits(BM_DATA, offTable, endTable - offTable);
pIcode.ll()->SetLlFlag(SWITCH);
pIcode.ll()->setFlags(SWITCH);
pIcode.ll()->caseTbl.numEntries = (endTable - offTable) / 2;
psw = (uint32_t*)allocMem(pIcode.ll()->caseTbl.numEntries*sizeof(uint32_t));
pIcode.ll()->caseTbl.entries = psw;
@ -483,7 +483,7 @@ boolT Function::process_JMP (ICODE & pIcode, STATE *pstate, CALL_GRAPH * pcallGr
FollowCtrl (pcallGraph, &StCopy);
++last_current_insn;
last_current_insn->ll()->caseTbl.numEntries = k++;
last_current_insn->ll()->SetLlFlag(CASE);
last_current_insn->ll()->setFlags(CASE);
*psw++ = last_current_insn->ll()->GetLlLabel();
}
@ -519,7 +519,7 @@ boolT Function::process_CALL (ICODE & pIcode, CALL_GRAPH * pcallGraph, STATE *ps
/* For Indirect Calls, find the function address */
indirect = FALSE;
//pIcode.ll()->immed.proc.proc=fakeproc;
if ( not pIcode.ll()->isLlFlag(I) )
if ( not pIcode.ll()->testFlags(I) )
{
/* Not immediate, i.e. indirect call */
@ -550,12 +550,12 @@ boolT Function::process_CALL (ICODE & pIcode, CALL_GRAPH * pcallGraph, STATE *ps
else
tgtAddr= LH(&prog.Image[off]) + (uint32_t)(uint16_t)state.r[rCS] << 4;
pIcode.ll()->src.SetImmediateOp( tgtAddr );
pIcode.ll()->SetLlFlag(I);
pIcode.ll()->setFlags(I);
indirect = TRUE;
}
/* Process CALL. Function address is located in pIcode.ll()->immed.op */
if (pIcode.ll()->isLlFlag(I))
if (pIcode.ll()->testFlags(I))
{
/* Search procedure list for one with appropriate entry point */
ilFunction iter= std::find_if(pProcList.begin(),pProcList.end(),
@ -632,7 +632,7 @@ static void process_MOV(LLInst & ll, STATE * pstate)
uint8_t srcReg = ll.src.regi;
if (dstReg > 0 && dstReg < INDEXBASE)
{
if (ll.isLlFlag(I))
if (ll.testFlags(I))
pstate->setState( dstReg, (int16_t)ll.src.op());
else if (srcReg == 0) /* direct memory offset */
{
@ -655,7 +655,7 @@ static void process_MOV(LLInst & ll, STATE * pstate)
size=1;
psym = lookupAddr (&ll.dst, pstate, size, eDEF);
if (psym && ! (psym->duVal.val)) /* no initial value yet */
if (ll.isLlFlag(I)) /* immediate */
if (ll.testFlags(I)) /* immediate */
{
prog.Image[psym->label] = (uint8_t)ll.src.op();
if(psym->size>1)
@ -931,13 +931,13 @@ static void use (opLoc d, ICODE & pIcode, Function * pProc, STATE * pstate, int
else if (psym = lookupAddr(pm, pstate, size, eDuVal::USE))
{
setBits (BM_DATA, psym->label, (uint32_t)size);
pIcode.ll()->SetLlFlag(SYM_USE);
pIcode.ll()->setFlags(SYM_USE);
pIcode.ll()->caseTbl.numEntries = psym - &symtab[0];
}
}
/* Use of register */
else if ((d == DST) || ((d == SRC) && (not pIcode.ll()->isLlFlag(I))))
else if ((d == DST) || ((d == SRC) && (not pIcode.ll()->testFlags(I))))
pIcode.du.use |= duReg[pm->regi];
}
@ -980,13 +980,13 @@ static void def (opLoc d, ICODE & pIcode, Function * pProc, STATE * pstate, int
else if (psym = lookupAddr(pm, pstate, size, eDEF))
{
setBits(BM_DATA, psym->label, (uint32_t)size);
pIcode.ll()->SetLlFlag(SYM_DEF);
pIcode.ll()->setFlags(SYM_DEF);
pIcode.ll()->caseTbl.numEntries = psym - &symtab[0];
}
}
/* Definition of register */
else if ((d == DST) || ((d == SRC) && (not pIcode.ll()->isLlFlag(I))))
else if ((d == DST) || ((d == SRC) && (not pIcode.ll()->testFlags(I))))
{
pIcode.du.def |= duReg[pm->regi];
pIcode.du1.numRegsDef++;
@ -1019,8 +1019,8 @@ void Function::process_operands(ICODE & pIcode, STATE * pstate)
int ix=Icode.size();
int i;
int sseg = (pIcode.ll()->src.seg)? pIcode.ll()->src.seg: rDS;
int cb = pIcode.ll()->isLlFlag(B) ? 1: 2;
uint32_t Imm = (pIcode.ll()->isLlFlag(I));
int cb = pIcode.ll()->testFlags(B) ? 1: 2;
uint32_t Imm = (pIcode.ll()->testFlags(I));
switch (pIcode.ll()->opcode) {
case iAND: case iOR: case iXOR:
@ -1077,7 +1077,7 @@ void Function::process_operands(ICODE & pIcode, STATE * pstate)
break;
case iSIGNEX:
cb = pIcode.ll()->isLlFlag(SRC_B) ? 1 : 2;
cb = pIcode.ll()->testFlags(SRC_B) ? 1 : 2;
if (cb == 1) /* uint8_t */
{
pIcode.du.def |= duReg[rAX];

View File

@ -459,7 +459,7 @@ static void rm(int i)
case 0: /* No disp unless rm == 6 */
if (rm == 6) {
setAddress(i, TRUE, SegPrefix, 0, getWord());
pIcode->ll()->SetLlFlag(WORD_OFF);
pIcode->ll()->setFlags(WORD_OFF);
}
else
setAddress(i, TRUE, SegPrefix, rm + INDEXBASE, 0);
@ -471,7 +471,7 @@ static void rm(int i)
case 2: /* 2 uint8_t disp */
setAddress(i, TRUE, SegPrefix, rm + INDEXBASE, getWord());
pIcode->ll()->SetLlFlag(WORD_OFF);
pIcode->ll()->setFlags(WORD_OFF);
break;
case 3: /* reg */
@ -481,7 +481,7 @@ static void rm(int i)
if ((stateTable[i].flg & NSP) && (pIcode->ll()->src.regi==rSP ||
pIcode->ll()->dst.regi==rSP))
pIcode->ll()->SetLlFlag(NOT_HLL);
pIcode->ll()->setFlags(NOT_HLL);
}
@ -596,7 +596,7 @@ static void immed(int i)
rm(i);
if (pIcode->ll()->opcode == iADD || pIcode->ll()->opcode == iSUB)
pIcode->ll()->ClrLlFlag(NOT_HLL); /* Allow ADD/SUB SP, immed */
pIcode->ll()->clrFlags(NOT_HLL); /* Allow ADD/SUB SP, immed */
}
@ -639,9 +639,9 @@ static void trans(int i)
rm(i);
ll->src = pIcode->ll()->dst;
if (ll->opcode == iJMP || ll->opcode == iCALL || ll->opcode == iCALLF)
ll->SetLlFlag(NO_OPS);
ll->setFlags(NO_OPS);
else if (ll->opcode == iINC || ll->opcode == iPUSH || ll->opcode == iDEC)
ll->SetLlFlag(NO_SRC);
ll->setFlags(NO_SRC);
}
}
@ -676,12 +676,12 @@ static void arith(int i)
setAddress(i, TRUE, 0, rAX, 0); /* dst = AX */
}
else if (opcode == iNEG || opcode == iNOT)
pIcode->ll()->SetLlFlag(NO_SRC);
pIcode->ll()->setFlags(NO_SRC);
if ((opcode == iDIV) || (opcode == iIDIV))
{
if ( not pIcode->ll()->isLlFlag(B) )
pIcode->ll()->SetLlFlag(IM_TMP_DST);
if ( not pIcode->ll()->testFlags(B) )
pIcode->ll()->setFlags(IM_TMP_DST);
}
}
@ -692,7 +692,7 @@ static void arith(int i)
static void data1(int i)
{
pIcode->ll()->src.SetImmediateOp( (stateTable[i].flg & S_EXT)? signex(*pInst++): *pInst++ );
pIcode->ll()->SetLlFlag(I);
pIcode->ll()->setFlags(I);
}
@ -702,7 +702,7 @@ static void data1(int i)
static void data2(int )
{
if (relocItem(pInst))
pIcode->ll()->SetLlFlag(SEG_IMMED);
pIcode->ll()->setFlags(SEG_IMMED);
/* ENTER is a special case, it does not take a destination operand,
* but this field is being used as the number of bytes to allocate
@ -712,11 +712,11 @@ static void data2(int )
if (pIcode->ll()->opcode == iENTER)
{
pIcode->ll()->dst.off = getWord();
pIcode->ll()->SetLlFlag(NO_OPS);
pIcode->ll()->setFlags(NO_OPS);
}
else
pIcode->ll()->src.SetImmediateOp(getWord());
pIcode->ll()->SetLlFlag(I);
pIcode->ll()->setFlags(I);
}
@ -741,7 +741,7 @@ static void dispN(int )
still be positive; it is an offset from prog.Image. So this must be
treated as unsigned */
pIcode->ll()->src.SetImmediateOp((uint32_t)(off + (unsigned)(pInst - prog.Image)));
pIcode->ll()->SetLlFlag(I);
pIcode->ll()->setFlags(I);
}
@ -753,7 +753,7 @@ static void dispS(int )
long off = signex(*pInst++); /* Signed displacement */
pIcode->ll()->src.SetImmediateOp((uint32_t)(off + (unsigned)(pInst - prog.Image)));
pIcode->ll()->SetLlFlag(I);
pIcode->ll()->setFlags(I);
}
@ -766,7 +766,7 @@ static void dispF(int )
uint32_t seg = (unsigned)getWord();
pIcode->ll()->src.SetImmediateOp(off + ((uint32_t)(unsigned)seg << 4));
pIcode->ll()->SetLlFlag(I);
pIcode->ll()->setFlags(I);
}
@ -802,7 +802,7 @@ static void strop(int )
BumpOpcode(pIcode->ll()->opcode); // += 2
BumpOpcode(pIcode->ll()->opcode); // else += 1
if (pIcode->ll()->opcode == iREP_LODS)
pIcode->ll()->SetLlFlag(NOT_HLL);
pIcode->ll()->setFlags(NOT_HLL);
RepPrefix = 0;
}
}
@ -814,7 +814,7 @@ static void strop(int )
static void escop(int i)
{
pIcode->ll()->src.SetImmediateOp(REG(*pInst) + (uint32_t)((i & 7) << 3));
pIcode->ll()->SetLlFlag(I);
pIcode->ll()->setFlags(I);
rm(i);
}
@ -825,7 +825,7 @@ static void escop(int i)
static void const1(int )
{
pIcode->ll()->src.SetImmediateOp(1);
pIcode->ll()->SetLlFlag(I);
pIcode->ll()->setFlags(I);
}
@ -835,7 +835,7 @@ static void const1(int )
static void const3(int )
{
pIcode->ll()->src.SetImmediateOp(3);
pIcode->ll()->SetLlFlag(I);
pIcode->ll()->setFlags(I);
}
@ -852,8 +852,8 @@ static void none1(int )
****************************************************************************/
static void none2(int )
{
if ( pIcode->ll()->isLlFlag(I) )
pIcode->ll()->SetLlFlag(NO_OPS);
if ( pIcode->ll()->testFlags(I) )
pIcode->ll()->setFlags(NO_OPS);
}
/****************************************************************************
@ -868,7 +868,7 @@ static void checkInt(int )
Treat as if it is an ESC opcode */
pIcode->ll()->src.SetImmediateOp(wOp - 0x34);
pIcode->ll()->opcode = iESC;
pIcode->ll()->SetLlFlag(FLOAT_OP);
pIcode->ll()->setFlags(FLOAT_OP);
escop(wOp - 0x34 + 0xD8);