renamed flag methods in LLInst
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user