Rename icodeType entries
Following 2f80f16e6f76e3794ddc35ac9a6c1a86cb11cd28
This commit is contained in:
parent
73cf949e25
commit
e71c8051c3
@ -90,9 +90,9 @@ enum eLLFlags
|
|||||||
/* Types of icodes */
|
/* Types of icodes */
|
||||||
enum icodeType
|
enum icodeType
|
||||||
{
|
{
|
||||||
NOT_SCANNED = 0, // not even scanned yet
|
NOT_SCANNED_ICODE = 0, // not even scanned yet
|
||||||
LOW_LEVEL, // low-level icode
|
LOW_LEVEL_ICODE, // low-level icode
|
||||||
HIGH_LEVEL // high-level icode
|
HIGH_LEVEL_ICODE // high-level icode
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -474,8 +474,8 @@ public:
|
|||||||
bool operator()(ICODE *ic) {return (ic->type==TYPE) and (ic->valid());}
|
bool operator()(ICODE *ic) {return (ic->type==TYPE) and (ic->valid());}
|
||||||
bool operator()(ICODE &ic) {return (ic.type==TYPE) and ic.valid();}
|
bool operator()(ICODE &ic) {return (ic.type==TYPE) and ic.valid();}
|
||||||
};
|
};
|
||||||
static TypeFilter<HIGH_LEVEL> select_high_level;
|
static TypeFilter<HIGH_LEVEL_ICODE> select_high_level;
|
||||||
static TypeAndValidFilter<HIGH_LEVEL> select_valid_high_level;
|
static TypeAndValidFilter<HIGH_LEVEL_ICODE> select_valid_high_level;
|
||||||
/* Def/Use of registers and stack variables */
|
/* Def/Use of registers and stack variables */
|
||||||
struct DU_ICODE
|
struct DU_ICODE
|
||||||
{
|
{
|
||||||
@ -577,7 +577,7 @@ public:
|
|||||||
// set this icode to be an assign
|
// set this icode to be an assign
|
||||||
void setAsgn(Expr *lhs, Expr *rhs)
|
void setAsgn(Expr *lhs, Expr *rhs)
|
||||||
{
|
{
|
||||||
type=HIGH_LEVEL;
|
type=HIGH_LEVEL_ICODE;
|
||||||
hlU()->setAsgn(lhs,rhs);
|
hlU()->setAsgn(lhs,rhs);
|
||||||
}
|
}
|
||||||
void setUnary(hlIcode op, Expr *_exp);
|
void setUnary(hlIcode op, Expr *_exp);
|
||||||
@ -594,7 +594,7 @@ public:
|
|||||||
{
|
{
|
||||||
return hlU()->call.newStkArg(exp,opcode,pproc);
|
return hlU()->call.newStkArg(exp,opcode,pproc);
|
||||||
}
|
}
|
||||||
ICODE() : m_ll(this),Parent(0),invalid(false),type(NOT_SCANNED),loc_ip(0)
|
ICODE() : m_ll(this),Parent(0),invalid(false),type(NOT_SCANNED_ICODE),loc_ip(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -391,7 +391,7 @@ void BB::writeBB(QTextStream &ostr,int lev, Function * pProc, int *numLoc)
|
|||||||
|
|
||||||
for(ICODE &pHli : instructions)
|
for(ICODE &pHli : instructions)
|
||||||
{
|
{
|
||||||
if ((pHli.type == HIGH_LEVEL) and ( pHli.valid() )) //TODO: use filtering range here.
|
if ((pHli.type == HIGH_LEVEL_ICODE) and ( pHli.valid() )) //TODO: use filtering range here.
|
||||||
{
|
{
|
||||||
QString line = pHli.hl()->write1HlIcode(pProc, numLoc);
|
QString line = pHli.hl()->write1HlIcode(pProc, numLoc);
|
||||||
if (not line.isEmpty())
|
if (not line.isEmpty())
|
||||||
|
|||||||
@ -148,7 +148,7 @@ void Function::elimCondCodes ()
|
|||||||
{
|
{
|
||||||
llIcode useAtOp = llIcode(useAt->ll()->getOpcode());
|
llIcode useAtOp = llIcode(useAt->ll()->getOpcode());
|
||||||
use = useAt->ll()->flagDU.u;
|
use = useAt->ll()->flagDU.u;
|
||||||
if ((useAt->type != LOW_LEVEL) or ( not useAt->valid() ) or ( 0 == use ))
|
if ((useAt->type != LOW_LEVEL_ICODE) or ( not useAt->valid() ) or ( 0 == use ))
|
||||||
continue;
|
continue;
|
||||||
/* Find definition within the same basic block */
|
/* Find definition within the same basic block */
|
||||||
defAt=useAt;
|
defAt=useAt;
|
||||||
@ -271,7 +271,7 @@ void Function::genLiveKtes ()
|
|||||||
continue; // skip invalid BBs
|
continue; // skip invalid BBs
|
||||||
for(ICODE &insn : *pbb)
|
for(ICODE &insn : *pbb)
|
||||||
{
|
{
|
||||||
if ((insn.type == HIGH_LEVEL) and ( insn.valid() ))
|
if ((insn.type == HIGH_LEVEL_ICODE) and ( insn.valid() ))
|
||||||
{
|
{
|
||||||
liveUse |= (insn.du.use - def);
|
liveUse |= (insn.du.use - def);
|
||||||
def |= insn.du.def;
|
def |= insn.du.def;
|
||||||
@ -886,7 +886,7 @@ void BB::findBBExps(LOCAL_ID &locals,Function *fnc)
|
|||||||
numHlIcodes = 0;
|
numHlIcodes = 0;
|
||||||
assert(&fnc->localId==&locals);
|
assert(&fnc->localId==&locals);
|
||||||
// register(s) to be forward substituted */
|
// register(s) to be forward substituted */
|
||||||
auto valid_and_highlevel = instructions | filtered(ICODE::TypeAndValidFilter<HIGH_LEVEL>());
|
auto valid_and_highlevel = instructions | filtered(ICODE::TypeAndValidFilter<HIGH_LEVEL_ICODE>());
|
||||||
for (auto picode = valid_and_highlevel.begin(); picode != valid_and_highlevel.end(); picode++)
|
for (auto picode = valid_and_highlevel.begin(); picode != valid_and_highlevel.end(); picode++)
|
||||||
{
|
{
|
||||||
ICODE &_ic(*picode);
|
ICODE &_ic(*picode);
|
||||||
|
|||||||
@ -29,7 +29,7 @@ void ICODE::checkHlCall()
|
|||||||
/* Places the new HLI_CALL high-level operand in the high-level icode array */
|
/* Places the new HLI_CALL high-level operand in the high-level icode array */
|
||||||
void ICODE::newCallHl()
|
void ICODE::newCallHl()
|
||||||
{
|
{
|
||||||
type = HIGH_LEVEL;
|
type = HIGH_LEVEL_ICODE;
|
||||||
hlU()->setCall(ll()->src().proc.proc);
|
hlU()->setCall(ll()->src().proc.proc);
|
||||||
|
|
||||||
if (ll()->src().proc.cb != 0)
|
if (ll()->src().proc.cb != 0)
|
||||||
@ -48,7 +48,7 @@ void ICODE::newCallHl()
|
|||||||
* array */
|
* array */
|
||||||
void ICODE::setUnary(hlIcode op, Expr *_exp)
|
void ICODE::setUnary(hlIcode op, Expr *_exp)
|
||||||
{
|
{
|
||||||
type = HIGH_LEVEL;
|
type = HIGH_LEVEL_ICODE;
|
||||||
hlU()->set(op,_exp);
|
hlU()->set(op,_exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ void ICODE::setUnary(hlIcode op, Expr *_exp)
|
|||||||
/* Places the new HLI_JCOND high-level operand in the high-level icode array */
|
/* Places the new HLI_JCOND high-level operand in the high-level icode array */
|
||||||
void ICODE::setJCond(Expr *cexp)
|
void ICODE::setJCond(Expr *cexp)
|
||||||
{
|
{
|
||||||
type = HIGH_LEVEL;
|
type = HIGH_LEVEL_ICODE;
|
||||||
hlU()->set(HLI_JCOND,cexp);
|
hlU()->set(HLI_JCOND,cexp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,7 +320,7 @@ void Function::highLevelGen()
|
|||||||
LLOperand *src_ll = ll->get(SRC);
|
LLOperand *src_ll = ll->get(SRC);
|
||||||
if ( ll->testFlags(NOT_HLL) )
|
if ( ll->testFlags(NOT_HLL) )
|
||||||
pIcode->invalidate();
|
pIcode->invalidate();
|
||||||
if ((pIcode->type != LOW_LEVEL) or not pIcode->valid() )
|
if ((pIcode->type != LOW_LEVEL_ICODE) or not pIcode->valid() )
|
||||||
continue;
|
continue;
|
||||||
_flg = ll->getFlag();
|
_flg = ll->getFlag();
|
||||||
if (not ll->testFlags(IM_OPS)) /* not processing IM_OPS yet */
|
if (not ll->testFlags(IM_OPS)) /* not processing IM_OPS yet */
|
||||||
@ -353,7 +353,7 @@ void Function::highLevelGen()
|
|||||||
|
|
||||||
case iCALL:
|
case iCALL:
|
||||||
case iCALLF:
|
case iCALLF:
|
||||||
pIcode->type = HIGH_LEVEL;
|
pIcode->type = HIGH_LEVEL_ICODE;
|
||||||
pIcode->hl( ll->createCall() );
|
pIcode->hl( ll->createCall() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
ICODE::TypeFilter<HIGH_LEVEL> ICODE::select_high_level;
|
ICODE::TypeFilter<HIGH_LEVEL_ICODE> ICODE::select_high_level;
|
||||||
ICODE::TypeAndValidFilter<HIGH_LEVEL> ICODE::select_valid_high_level;
|
ICODE::TypeAndValidFilter<HIGH_LEVEL_ICODE> ICODE::select_valid_high_level;
|
||||||
CIcodeRec::CIcodeRec()
|
CIcodeRec::CIcodeRec()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,7 +42,7 @@ ICODE * Function::translate_DIV(LLInst *ll, ICODE &_Icode)
|
|||||||
|
|
||||||
ICODE eIcode = ICODE();
|
ICODE eIcode = ICODE();
|
||||||
|
|
||||||
eIcode.type = LOW_LEVEL;
|
eIcode.type = LOW_LEVEL_ICODE;
|
||||||
eIcode.ll()->set(iMOV,0,rTMP);
|
eIcode.ll()->set(iMOV,0,rTMP);
|
||||||
if (ll->testFlags(B) )
|
if (ll->testFlags(B) )
|
||||||
{
|
{
|
||||||
@ -66,7 +66,7 @@ ICODE * Function::translate_DIV(LLInst *ll, ICODE &_Icode)
|
|||||||
|
|
||||||
/* iMOD */
|
/* iMOD */
|
||||||
eIcode = ICODE();
|
eIcode = ICODE();
|
||||||
eIcode.type = LOW_LEVEL;
|
eIcode.type = LOW_LEVEL_ICODE;
|
||||||
eIcode.ll()->set(iMOD,ll->getFlag() | SYNTHETIC | IM_TMP_DST);
|
eIcode.ll()->set(iMOD,ll->getFlag() | SYNTHETIC | IM_TMP_DST);
|
||||||
eIcode.ll()->replaceSrc(_Icode.ll()->src());
|
eIcode.ll()->replaceSrc(_Icode.ll()->src());
|
||||||
eIcode.du = _Icode.du;
|
eIcode.du = _Icode.du;
|
||||||
@ -77,7 +77,7 @@ ICODE *Function::translate_XCHG(LLInst *ll,ICODE &_Icode)
|
|||||||
{
|
{
|
||||||
/* MOV rTMP, regDst */
|
/* MOV rTMP, regDst */
|
||||||
ICODE eIcode;
|
ICODE eIcode;
|
||||||
eIcode.type = LOW_LEVEL;
|
eIcode.type = LOW_LEVEL_ICODE;
|
||||||
eIcode.ll()->set(iMOV,SYNTHETIC,rTMP,ll->m_dst);
|
eIcode.ll()->set(iMOV,SYNTHETIC,rTMP,ll->m_dst);
|
||||||
eIcode.setRegDU( rTMP, eDEF);
|
eIcode.setRegDU( rTMP, eDEF);
|
||||||
if(eIcode.ll()->src().getReg2())
|
if(eIcode.ll()->src().getReg2())
|
||||||
@ -97,7 +97,7 @@ ICODE *Function::translate_XCHG(LLInst *ll,ICODE &_Icode)
|
|||||||
|
|
||||||
/* MOV regSrc, rTMP */
|
/* MOV regSrc, rTMP */
|
||||||
eIcode = ICODE();
|
eIcode = ICODE();
|
||||||
eIcode.type = LOW_LEVEL;
|
eIcode.type = LOW_LEVEL_ICODE;
|
||||||
eIcode.ll()->set(iMOV,SYNTHETIC);
|
eIcode.ll()->set(iMOV,SYNTHETIC);
|
||||||
eIcode.ll()->replaceDst(ll->src());
|
eIcode.ll()->replaceDst(ll->src());
|
||||||
if(eIcode.ll()->m_dst.regi)
|
if(eIcode.ll()->m_dst.regi)
|
||||||
@ -157,7 +157,7 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
|
|||||||
iICODE labLoc = Icode.labelSrch(ll->label);
|
iICODE labLoc = Icode.labelSrch(ll->label);
|
||||||
if (Icode.end()!=labLoc)
|
if (Icode.end()!=labLoc)
|
||||||
{ /* Synthetic jump */
|
{ /* Synthetic jump */
|
||||||
_Icode.type = LOW_LEVEL;
|
_Icode.type = LOW_LEVEL_ICODE;
|
||||||
ll->set(iJMP,I | SYNTHETIC | NO_OPS);
|
ll->set(iJMP,I | SYNTHETIC | NO_OPS);
|
||||||
ll->replaceSrc(LLOperand::CreateImm2(labLoc->ll()->GetLlLabel()));
|
ll->replaceSrc(LLOperand::CreateImm2(labLoc->ll()->GetLlLabel()));
|
||||||
ll->label = SynthLab++;
|
ll->label = SynthLab++;
|
||||||
|
|||||||
@ -248,7 +248,7 @@ void Function::propLongStk (int i, const ID &pLocId)
|
|||||||
next1 = ++iICODE(pIcode);
|
next1 = ++iICODE(pIcode);
|
||||||
if(next1==pEnd)
|
if(next1==pEnd)
|
||||||
break;
|
break;
|
||||||
if ((pIcode->type == HIGH_LEVEL) or ( not pIcode->valid() ))
|
if ((pIcode->type == HIGH_LEVEL_ICODE) or ( not pIcode->valid() ))
|
||||||
continue;
|
continue;
|
||||||
if (pIcode->ll()->getOpcode() == next1->ll()->getOpcode())
|
if (pIcode->ll()->getOpcode() == next1->ll()->getOpcode())
|
||||||
{
|
{
|
||||||
@ -323,7 +323,7 @@ int Function::findBackwarLongDefs(int loc_ident_idx, const ID &pLocId, iICODE be
|
|||||||
ICODE &icode(*pIcode);
|
ICODE &icode(*pIcode);
|
||||||
|
|
||||||
|
|
||||||
if ((icode.type == HIGH_LEVEL) or ( not icode.valid() ))
|
if ((icode.type == HIGH_LEVEL_ICODE) or ( not icode.valid() ))
|
||||||
continue;
|
continue;
|
||||||
if (icode.ll()->getOpcode() != next1->ll()->getOpcode())
|
if (icode.ll()->getOpcode() != next1->ll()->getOpcode())
|
||||||
continue;
|
continue;
|
||||||
@ -401,7 +401,7 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be
|
|||||||
LLOperand * pmH,* pmL; /* Pointers to dst LOW_LEVEL icodes */
|
LLOperand * pmH,* pmL; /* Pointers to dst LOW_LEVEL icodes */
|
||||||
int arc;
|
int arc;
|
||||||
|
|
||||||
if ((pIcode->type == HIGH_LEVEL) or ( not pIcode->valid() ))
|
if ((pIcode->type == HIGH_LEVEL_ICODE) or ( not pIcode->valid() ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pIcode->ll()->getOpcode() == next1->ll()->getOpcode())
|
if (pIcode->ll()->getOpcode() == next1->ll()->getOpcode())
|
||||||
|
|||||||
@ -537,7 +537,7 @@ eErrorId scan(uint32_t ip, ICODE &p)
|
|||||||
PROG &prog(Project::get()->prog);
|
PROG &prog(Project::get()->prog);
|
||||||
int op;
|
int op;
|
||||||
p = ICODE();
|
p = ICODE();
|
||||||
p.type = LOW_LEVEL;
|
p.type = LOW_LEVEL_ICODE;
|
||||||
p.ll()->label = ip; /* ip is absolute offset into image*/
|
p.ll()->label = ip; /* ip is absolute offset into image*/
|
||||||
if (ip >= (uint32_t)prog.cbImage)
|
if (ip >= (uint32_t)prog.cbImage)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user