more fixes

This commit is contained in:
Artur K
2012-03-08 21:47:59 +01:00
parent 69d848ca78
commit eb6c1ac939
43 changed files with 611 additions and 534 deletions

View File

@@ -105,7 +105,7 @@ bool Idiom18::match(iICODE picode)
/* not supported yet */
type = 0;
}
else if (m_icodes[1]->ll()->dst.regi < INDEXBASE) /* register */
else if (m_icodes[1]->ll()->dst.regi < INDEX_BX_SI) /* register */
{
if ((m_icodes[1]->ll()->dst.regi == rSI) && (m_func->flg & SI_REGVAR))
type = 1;
@@ -131,7 +131,7 @@ bool Idiom18::match(iICODE picode)
if (m_icodes[0]->ll()->match(iMOV) && (m_icodes[0]->ll()->src.regi == m_icodes[1]->ll()->dst.regi))
{
regi = m_icodes[0]->ll()->dst.regi;
if ((regi > 0) && (regi < INDEXBASE))
if ((regi > 0) && (regi < INDEX_BX_SI))
{
if ( m_icodes[2]->ll()->match(iCMP) && (m_icodes[2]->ll()->dst.regi == regi) &&
m_icodes[3]->ll()->conditionalJump() )
@@ -143,7 +143,7 @@ bool Idiom18::match(iICODE picode)
if (m_icodes[0]->ll()->match(iMOV) && (m_icodes[0]->ll()->src.off == m_icodes[1]->ll()->dst.off))
{
regi = m_icodes[0]->ll()->dst.regi;
if ((regi > 0) && (regi < INDEXBASE))
if ((regi > 0) && (regi < INDEX_BX_SI))
{
if ( m_icodes[2]->ll()->match(iCMP) && (m_icodes[2]->ll()->dst.regi == regi) &&
m_icodes[3]->ll()->conditionalJump() )
@@ -194,7 +194,7 @@ bool Idiom19::match(iICODE picode)
m_is_dec = m_icodes[0]->ll()->match(iDEC);
if (m_icodes[0]->ll()->dst.regi == 0) /* global variable */
/* not supported yet */ ;
else if (m_icodes[0]->ll()->dst.regi < INDEXBASE) /* register */
else if (m_icodes[0]->ll()->dst.regi < INDEX_BX_SI) /* register */
{
// if (((picode->ll()->dst.regi == rSI) && (pproc->flg & SI_REGVAR)) ||
// ((picode->ll()->dst.regi == rDI) && (pproc->flg & DI_REGVAR)))
@@ -253,7 +253,7 @@ bool Idiom20::match(iICODE picode)
{
/* not supported yet */ ;
}
else if (m_icodes[0]->ll()->dst.regi < INDEXBASE) /* register */
else if (m_icodes[0]->ll()->dst.regi < INDEX_BX_SI) /* register */
{
if ((m_icodes[0]->ll()->dst.regi == rSI) && (m_func->flg & SI_REGVAR))
type = 1;
@@ -275,7 +275,7 @@ bool Idiom20::match(iICODE picode)
(m_icodes[1]->ll()->src.regi == m_icodes[0]->ll()->dst.regi))
{
regi = m_icodes[1]->ll()->dst.regi;
if ((regi > 0) && (regi < INDEXBASE))
if ((regi > 0) && (regi < INDEX_BX_SI))
{
if (m_icodes[2]->ll()->match(iCMP,(eReg)regi) &&
m_icodes[3]->ll()->conditionalJump())
@@ -289,7 +289,7 @@ bool Idiom20::match(iICODE picode)
(m_icodes[1]->ll()->src.off == m_icodes[0]->ll()->dst.off))
{
regi = m_icodes[1]->ll()->dst.regi;
if ((regi > 0) && (regi < INDEXBASE))
if ((regi > 0) && (regi < INDEX_BX_SI))
{
if (m_icodes[2]->ll()->match(iCMP,(eReg)regi) &&
m_icodes[3]->ll()->conditionalJump())

View File

@@ -101,7 +101,7 @@ int Idiom17::action()
m_icodes[0]->ll()->src.proc.proc->cbParam = (int16_t)m_param_count;
m_icodes[0]->ll()->src.proc.cb = m_param_count;
m_icodes[0]->ll()->src.proc.proc->flg |= CALL_C;
for(int idx=1; idx<m_icodes.size(); ++idx)
for(size_t idx=1; idx<m_icodes.size(); ++idx)
{
m_icodes[idx]->invalidate();
}

View File

@@ -50,13 +50,13 @@ int Idiom1::checkStkVars (iICODE pIcode)
****************************************************************************/
bool Idiom1::match(iICODE picode)
{
uint8_t type = 0; /* type of variable: 1 = reg-var, 2 = local */
uint8_t regi; /* register of the MOV */
//uint8_t type = 0; /* type of variable: 1 = reg-var, 2 = local */
//uint8_t regi; /* register of the MOV */
if(m_func->flg & PROC_HLL)
return false;
if(picode==m_end)
return false;
int n;
//int n;
m_icodes.clear();
m_min_off = 0;
/* PUSH BP as first instruction of procedure */
@@ -114,7 +114,7 @@ bool Idiom1::match(iICODE picode)
}
else // push di [push si] / push si [push di]
{
n = checkStkVars (picode);
size_t n = checkStkVars (picode);
for(int i=0; i<n; ++i)
m_icodes.push_back(picode++);

View File

@@ -80,7 +80,7 @@ bool Idiom16::match (iICODE picode)
m_icodes[i]=picode++;
uint8_t regi = m_icodes[0]->ll()->dst.regi;
if ((regi >= rAX) && (regi < INDEXBASE))
if ((regi >= rAX) && (regi < INDEX_BX_SI))
{
if (m_icodes[1]->ll()->match(iSBB) && m_icodes[2]->ll()->match(iINC))
if ((m_icodes[1]->ll()->dst.regi == (m_icodes[1]->ll()->src.regi)) &&

View File

@@ -57,7 +57,7 @@ int Idiom8::action()
****************************************************************************/
bool Idiom15::match(iICODE pIcode)
{
int n = 1;
uint8_t regi;
if(distance(pIcode,m_end)<2)
@@ -72,7 +72,7 @@ bool Idiom15::match(iICODE pIcode)
pIcode->ll()->match(iSHL,(eReg)regi,I) and
(pIcode->ll()->src.op() == 1) )
{
n++;
m_icodes.push_back(pIcode++);
}
return m_icodes.size()>1;
@@ -80,13 +80,13 @@ bool Idiom15::match(iICODE pIcode)
int Idiom15::action()
{
COND_EXPR *lhs,*rhs,*exp;
COND_EXPR *lhs,*rhs,*_exp;
lhs = COND_EXPR::idReg (m_icodes[0]->ll()->dst.regi,
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);
m_icodes[0]->setAsgn(lhs, exp);
_exp = COND_EXPR::boolOp (lhs, rhs, SHL);
m_icodes[0]->setAsgn(lhs, _exp);
for (size_t i=1; i<m_icodes.size()-1; ++i)
{
m_icodes[i]->invalidate();

View File

@@ -28,7 +28,7 @@ bool Idiom21::match (iICODE picode)
dst = &m_icodes[0]->ll()->dst;
src = &m_icodes[0]->ll()->src;
if ((dst->regi == src->regi) && (dst->regi > 0) && (dst->regi < INDEXBASE))
if ((dst->regi == src->regi) && (dst->regi > 0) && (dst->regi < INDEX_BX_SI))
{
if ((dst->regi == rDX) && m_icodes[1]->ll()->match(rAX))
return true;
@@ -68,12 +68,12 @@ bool Idiom7::match(iICODE picode)
if ((dst->segValue == src->segValue) && (dst->off == src->off))
return true;
}
else if (dst->regi < INDEXBASE) /* register */
else if (dst->regi < INDEX_BX_SI) /* register */
{
if (dst->regi == src->regi)
return true;
}
else if ((dst->off) && (dst->seg == rSS) && (dst->regi == INDEXBASE + 6)) /* offset from BP */
else if ((dst->off) && (dst->seg == rSS) && (dst->regi == INDEX_BP)) /* offset from BP */
{
if ((dst->off == src->off) && (dst->seg == src->seg) && (dst->regi == src->regi))
return true;
@@ -115,7 +115,7 @@ bool Idiom10::match(iICODE pIcode)
/* Check OR reg, reg */
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 < INDEX_BX_SI) &&
(m_icodes[0]->ll()->src.regi == m_icodes[0]->ll()->dst.regi))
if (m_icodes[1]->ll()->match(iJNE)) //.conditionalJump()
{