moved struct DU_ICODE into ICODE, alse replaced newRegArg pointer params with iterators
This commit is contained in:
parent
fbf8cc3a7a
commit
e0503c71a3
@ -118,7 +118,7 @@ public:
|
||||
void structLoops(derSeq *derivedG);
|
||||
void buildCFG();
|
||||
void controlFlowAnalysis();
|
||||
void newRegArg(ICODE *picode, ICODE *ticode);
|
||||
void newRegArg(iICODE picode, iICODE ticode);
|
||||
protected:
|
||||
// TODO: replace those with friend visitor ?
|
||||
void propLongReg(Int loc_ident_idx, const ID &pLocId);
|
||||
|
||||
@ -247,17 +247,6 @@ struct DU
|
||||
byte u;
|
||||
};
|
||||
|
||||
/* Def/Use of registers and stack variables */
|
||||
struct DU_ICODE
|
||||
{
|
||||
std::bitset<32> def; // For Registers: position in bitset is reg index
|
||||
//dword def; // For Registers: position in dword is reg index
|
||||
//dword def; // For Registers: position in dword is reg index
|
||||
std::bitset<32> use; // For Registers: position in dword is reg index
|
||||
std::bitset<32> lastDefRegi;// Bit set if last def of this register in BB
|
||||
};
|
||||
|
||||
|
||||
/* Definition-use chain for level 1 (within a basic block) */
|
||||
#define MAX_REGS_DEF 2 /* 2 regs def'd for long-reg vars */
|
||||
#define MAX_USES 5
|
||||
@ -347,6 +336,13 @@ struct LLInst : public llvm::MCInst
|
||||
/* Icode definition: LOW_LEVEL and HIGH_LEVEL */
|
||||
struct ICODE
|
||||
{
|
||||
/* Def/Use of registers and stack variables */
|
||||
struct DU_ICODE
|
||||
{
|
||||
std::bitset<32> def; // For Registers: position in bitset is reg index
|
||||
std::bitset<32> use; // For Registers: position in dword is reg index
|
||||
std::bitset<32> lastDefRegi;// Bit set if last def of this register in BB
|
||||
};
|
||||
struct DU1
|
||||
{
|
||||
struct DefUse
|
||||
|
||||
@ -533,8 +533,8 @@ void Function::genDU1 ()
|
||||
|
||||
/* Substitutes the rhs (or lhs if rhs not possible) of ticode for the rhs
|
||||
* of picode. */
|
||||
static void forwardSubs (COND_EXPR *lhs, COND_EXPR *rhs, ICODE * picode,
|
||||
ICODE * ticode, LOCAL_ID *locsym, Int &numHlIcodes)
|
||||
static void forwardSubs (COND_EXPR *lhs, COND_EXPR *rhs, iICODE picode,
|
||||
iICODE ticode, LOCAL_ID *locsym, Int &numHlIcodes)
|
||||
{
|
||||
boolT res;
|
||||
|
||||
@ -688,15 +688,15 @@ void Function::findExps()
|
||||
{
|
||||
Int i, k, numHlIcodes;
|
||||
iICODE lastInst,
|
||||
picode, /* Current icode */
|
||||
ticode; /* Target icode */
|
||||
BB * pbb; /* Current and next basic block */
|
||||
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 */
|
||||
*lhs; /* exp ptr for return value of a HLI_CALL */
|
||||
//STKFRAME * args; /* pointer to arguments - for HLI_CALL */
|
||||
byte regi, regi2; /* register(s) to be forward substituted */
|
||||
ID *retVal; /* function return value */
|
||||
COND_EXPR *exp, // expression pointer - for HLI_POP and HLI_CALL */
|
||||
*lhs; // exp ptr for return value of a HLI_CALL */
|
||||
//STKFRAME * args; // pointer to arguments - for HLI_CALL */
|
||||
byte regi; // register(s) to be forward substituted */
|
||||
ID *retVal; // function return value
|
||||
|
||||
/* Initialize expression stack */
|
||||
g_exp_stk.init();
|
||||
@ -745,7 +745,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;
|
||||
|
||||
@ -763,7 +763,7 @@ void Function::findExps()
|
||||
break;
|
||||
|
||||
case HLI_CALL: /* register arguments */
|
||||
newRegArg (&(*picode), &(*ticode));
|
||||
newRegArg (picode, ticode);
|
||||
picode->invalidate();
|
||||
numHlIcodes--;
|
||||
break;
|
||||
@ -782,7 +782,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;
|
||||
|
||||
@ -822,7 +822,7 @@ void Function::findExps()
|
||||
&ticode->ic.hl.oper.asgn.lhs,
|
||||
picode->ic.hl.oper.call.proc->retVal.id.regi,
|
||||
&localId);
|
||||
/*** HERE missing: 2 regs ****/
|
||||
/*** TODO: HERE missing: 2 regs ****/
|
||||
picode->invalidate();
|
||||
numHlIcodes--;
|
||||
break;
|
||||
@ -899,7 +899,7 @@ void Function::findExps()
|
||||
break;
|
||||
|
||||
case HLI_CALL: /* register arguments */
|
||||
newRegArg ( &(*picode), &(*ticode));
|
||||
newRegArg ( picode, ticode);
|
||||
picode->invalidate();
|
||||
numHlIcodes--;
|
||||
break;
|
||||
|
||||
@ -94,7 +94,7 @@ void CALL_GRAPH::write()
|
||||
/* Updates the argument table by including the register(s) (ie. lhs of
|
||||
* picode) and the actual expression (ie. rhs of picode).
|
||||
* Note: register(s) are only included once in the table. */
|
||||
void Function::newRegArg(ICODE *picode, ICODE *ticode)
|
||||
void Function::newRegArg(iICODE picode, iICODE ticode)
|
||||
{
|
||||
COND_EXPR *lhs;
|
||||
STKFRAME * ps, *ts;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user