CIcodeRec is no longer an Array, it's now a list, will help with iterator stability

This commit is contained in:
Artur K
2012-02-28 03:06:34 +01:00
parent f131b7e619
commit 3cb26d99d2
26 changed files with 426 additions and 770 deletions

View File

@@ -170,21 +170,6 @@ int Idiom18::action() // action length
m_icodes[1]->invalidate();
m_icodes[2]->invalidate();
return 3;
/*
lhs = COND_EXPR::id (*(pIcode-1), SRC, this, pIcode, *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, pIcode, *(pIcode+2), eUSE);
exp = COND_EXPR::boolOp (lhs, rhs, condOpJCond[(pIcode+2)->ic.ll.opcode - iJB]);
(pIcode+2)->setJCond(exp);
(pIcode-1)->invalidate();
pIcode->invalidate();
(pIcode+1)->invalidate();
pIcode += 3;
*/
}
/*****************************************************************************
@@ -320,8 +305,7 @@ int Idiom20::action()
rhs = COND_EXPR::id (*m_icodes[2], SRC, m_func, m_icodes[0], *m_icodes[3], eUSE);
expr = COND_EXPR::boolOp (lhs, rhs, condOpJCond[m_icodes[3]->ic.ll.opcode - iJB]);
m_icodes[3]->setJCond(expr);
m_icodes[0]->invalidate();
m_icodes[1]->invalidate();
m_icodes[2]->invalidate();
for(int i=0; i<3; ++i)
m_icodes[i]->invalidate();
return 4;
}

View File

@@ -54,7 +54,7 @@ bool Idiom2::match(iICODE pIcode)
m_icodes.clear();
m_icodes.push_back(pIcode);
/* Get next icode, skip over holes in the icode array */
nicode = pIcode + 1;
nicode = ++iICODE(pIcode);
while (nicode->ic.ll.flg & NO_CODE && (nicode != m_end))
{
nicode++;
@@ -73,7 +73,8 @@ bool Idiom2::match(iICODE pIcode)
)
{
m_icodes.push_back(nicode); // Matched RET
popStkVars (pIcode-2); // will add optional pop di/si to m_icodes
advance(pIcode,-2); // move back before our start
popStkVars (pIcode); // and add optional pop di/si to m_icodes
return true;
}
}
@@ -108,15 +109,23 @@ bool Idiom4::match(iICODE pIcode)
/* Check for [POP DI]
* [POP SI] */
if(distance(m_func->Icode.begin(),pIcode)>=3)
popStkVars (pIcode-3);
{
iICODE search_at(pIcode);
advance(search_at,-3);
popStkVars(search_at);
}
if(pIcode != m_func->Icode.begin())
{
iICODE prev1=pIcode-1;
iICODE prev1 = --iICODE(pIcode);
/* Check for POP BP */
if (prev1->ic.ll.match(iPOP,rBP) && not prev1->ic.ll.anyFlagSet(I) )
m_icodes.push_back(prev1);
else if(prev1!=m_func->Icode.begin())
popStkVars (pIcode-2);
{
iICODE search_at(pIcode);
advance(search_at,-2);
popStkVars (search_at);
}
}
/* Check for RET(F) immed */

View File

@@ -134,40 +134,3 @@ int Idiom10::action()
return 2;
}
/*****************************************************************************
* idiom10 - Jump if not equal to 0
* OR reg, reg
* JNE labX
* Eg: OR ax, ax
* JNE labX
* => HLI_JCOND (ax != 0) labX
* Note: we also check that these instructions are not followed by
* CMP reg, kte
* JE lab
* because this is most likely a long conditional equality test.
* Found in Borland Turbo C.
****************************************************************************/
static boolT idiom10old (iICODE pIcode, iICODE pEnd)
{
if (pIcode < pEnd)
{
/* Check OR reg, reg */
if (((pIcode->ic.ll.flg & I) != I) &&
(pIcode->ic.ll.src. regi > 0) &&
(pIcode->ic.ll.src.regi < INDEXBASE) &&
(pIcode->ic.ll.src.regi == pIcode->ic.ll.dst.regi))
if ((pIcode+3) < pEnd)
{
if (((pIcode+1)->ic.ll.opcode == iJNE) &&
((pIcode+2)->ic.ll.opcode != iCMP) &&
((pIcode+3)->ic.ll.opcode != iJE))
return true;
}
else /* at the end of the procedure */
if (((pIcode+1) < pEnd) && ((pIcode+1)->ic.ll.opcode == iJNE))
return true;
}
return false;
}