removed some more dependencies on array indices, refactored out forward Long Defs checking

This commit is contained in:
Artur K
2012-02-26 00:11:55 +01:00
parent 9a6788fd2d
commit 268a015d01
40 changed files with 242 additions and 2339 deletions

View File

@@ -48,17 +48,17 @@ void ICODE::setRegDU (byte regi, operDu du_in)
case eDEF:
du.def |= duReg[regi];
du1.numRegsDef++;
printf("%s du.def |= %x\n",__FUNCTION__,duReg[regi]);
// printf("%s du.def |= %x\n",__FUNCTION__,duReg[regi]);
break;
case eUSE:
du.use |= duReg[regi];
printf("%s du.use |= %x\n",__FUNCTION__,duReg[regi]);
// printf("%s du.use |= %x\n",__FUNCTION__,duReg[regi]);
break;
case USE_DEF:
du.def |= duReg[regi];
du1.numRegsDef++;
printf("%s du.def |= %x\n",__FUNCTION__,duReg[regi]);
printf("%s du.use |= %x\n",__FUNCTION__,duReg[regi]);
// printf("%s du.def |= %x\n",__FUNCTION__,duReg[regi]);
// printf("%s du.use |= %x\n",__FUNCTION__,duReg[regi]);
du.use |= duReg[regi];
break;
case NONE: /* do nothing */
@@ -259,7 +259,8 @@ COND_EXPR *COND_EXPR::idLongIdx (Int idx)
/* Returns an identifier conditional expression node of type LONG_VAR */
COND_EXPR *COND_EXPR::idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, Int off)
{
printf("**************** is equal %s ***************** \n",pIcode==ix ? "yes":"no");
//assert(pIcode==ix);
//printf("**************** Not EQUAL ***************** \n");
Int idx;
COND_EXPR *newExp = new COND_EXPR(IDENTIFIER);

View File

@@ -137,17 +137,19 @@ Int LOCAL_ID::newLongReg(hlType t, byte regH, byte regL, iICODE ix_)
/* Check for entry in the table */
for (idx = 0; idx < id_arr.size(); idx++)
{
ID &entry(id_arr[idx]);
if (/*(locSym->id[idx].type == t) && Not checking type */
(id_arr[idx].id.longId.h == regH) &&
(id_arr[idx].id.longId.l == regL))
(entry.id.longId.h == regH) &&
(entry.id.longId.l == regL))
{
/* Check for occurrence in the list */
if (id_arr[idx].idx.inList(ix_))
if (entry.idx.inList(ix_)) //count(
return (idx);
else
{
/* Insert icode index in list */
id_arr[idx].idx.push_back(ix_);
entry.idx.push_back(ix_);
//entry.idx.insert(ix_);
return (idx);
}
}
@@ -155,7 +157,7 @@ Int LOCAL_ID::newLongReg(hlType t, byte regH, byte regL, iICODE ix_)
/* Not in the table, create new identifier */
newIdent (t, REG_FRAME);
id_arr[id_arr.size()-1].idx.push_back(ix_);
id_arr[id_arr.size()-1].idx.push_back(ix_);//insert(ix_);
idx = id_arr.size() - 1;
id_arr[idx].id.longId.h = regH;
id_arr[idx].id.longId.l = regL;
@@ -306,7 +308,7 @@ Int LOCAL_ID::newLong(opLoc sd, ICODE *pIcode, hlFirst f, iICODE ix,operDu du, I
* idx : idx into icode array
* pProc : ptr to current procedure record
* rhs, lhs : return expressions if successful. */
boolT checkLongEq (LONG_STKID_TYPE longId, iICODE pIcode, Int i, Int idx,
boolT checkLongEq (LONG_STKID_TYPE longId, iICODE pIcode, Int i,
Function * pProc, COND_EXPR **rhs, COND_EXPR **lhs, Int off)
{
LLOperand *pmHdst, *pmLdst, *pmHsrc, *pmLsrc; /* pointers to LOW_LEVEL icodes */
@@ -347,8 +349,8 @@ boolT checkLongEq (LONG_STKID_TYPE longId, iICODE pIcode, Int i, Int idx,
* idx : idx into icode array
* pProc : ptr to current procedure record
* rhs, lhs : return expressions if successful. */
boolT checkLongRegEq (LONGID_TYPE longId, iICODE pIcode, Int i, Int idx,
Function * pProc, COND_EXPR *&rhs, COND_EXPR *&lhs, Int off)
boolT checkLongRegEq (LONGID_TYPE longId, iICODE pIcode, Int i,
Function * pProc, COND_EXPR *&rhs, COND_EXPR *&lhs, Int off)
{
LLOperand *pmHdst, *pmLdst, *pmHsrc, *pmLsrc; /* pointers to LOW_LEVEL icodes */

View File

@@ -56,6 +56,40 @@ static boolT isLong23 (Int i, BB * pbb, Int *off, Int *arc)
}
return false;
}
static boolT isLong23 (iICODE iter, BB * pbb, Int *off, Int *arc)
{
BB * t, * e, * obb2;
if (pbb->nodeType != TWO_BRANCH)
return false;
t = pbb->edges[THEN].BBptr;
e = pbb->edges[ELSE].BBptr;
/* Check along the THEN path */
if ((t->size() == 1) && (t->nodeType == TWO_BRANCH) && (t->inEdges.size() == 1))
{
obb2 = t->edges[THEN].BBptr;
if ((obb2->size() == 2) && (obb2->nodeType == TWO_BRANCH) && (obb2->front().ic.ll.opcode == iCMP))
{
*off = std::distance(iter,obb2->begin2());
*arc = THEN;
return true;
}
}
/* Check along the ELSE path */
else if ((e->size() == 1) && (e->nodeType == TWO_BRANCH) && (e->inEdges.size() == 1))
{
obb2 = e->edges[THEN].BBptr;
if ((obb2->size() == 2) && (obb2->nodeType == TWO_BRANCH) && (obb2->front().ic.ll.opcode == iCMP))
{
*off = std::distance(iter,obb2->begin2());//obb2->front().loc_ip - i;
*arc = ELSE;
return true;
}
}
return false;
}
/* Returns whether the conditions for a 2-2 long variable are satisfied */
@@ -77,14 +111,16 @@ static boolT isLong22 (iICODE pIcode, iICODE pEnd, Int *off)
}
/* Creates a long conditional <=, >=, <, or > at (pIcode+1).
/** Creates a long conditional <=, >=, <, or > at (pIcode+1).
* Removes excess nodes from the graph by flagging them, and updates
* the new edges for the remaining nodes. */
static void longJCond23 (COND_EXPR *rhs, COND_EXPR *lhs, iICODE pIcode,
Int *idx, Int arc, Int off)
* the new edges for the remaining nodes.
* @return number of ICODEs to skip
*/
static int longJCond23 (COND_EXPR *rhs, COND_EXPR *lhs, iICODE pIcode, Int arc, Int off)
{
BB * pbb, * obb1, * obb2, * tbb;
int skipped_insn=0;
if (arc == THEN)
{
/* Find intermediate basic blocks and target block */
@@ -109,7 +145,7 @@ static void longJCond23 (COND_EXPR *rhs, COND_EXPR *lhs, iICODE pIcode,
assert(iter!=tbb->inEdges.end());
tbb->inEdges.erase(iter); /* looses 1 arc */
/* Update icode index */
(*idx) += 5;
skipped_insn = 5;
}
else /* ELSE arc */
{
@@ -135,31 +171,34 @@ static void longJCond23 (COND_EXPR *rhs, COND_EXPR *lhs, iICODE pIcode,
pbb->edges[ELSE].BBptr = tbb;
/* Update icode index */
(*idx) += 2;
skipped_insn = 2;
}
/* Create new HLI_JCOND and condition */
lhs = COND_EXPR::boolOp (lhs, rhs, condOpJCond[(pIcode+off+1)->ic.ll.opcode-iJB]);
(pIcode+1)->setJCond(lhs);
(pIcode+1)->copyDU(*pIcode, eUSE, eUSE);
(pIcode+1)->du.use |= (pIcode+off)->du.use;
/* Create new HLI_JCOND and condition */
lhs = COND_EXPR::boolOp (lhs, rhs, condOpJCond[(pIcode+off+1)->ic.ll.opcode-iJB]);
(pIcode+1)->setJCond(lhs);
(pIcode+1)->copyDU(*pIcode, eUSE, eUSE);
(pIcode+1)->du.use |= (pIcode+off)->du.use;
/* Update statistics */
obb1->flg |= INVALID_BB;
obb2->flg |= INVALID_BB;
stats.numBBaft -= 2;
/* Update statistics */
obb1->flg |= INVALID_BB;
obb2->flg |= INVALID_BB;
stats.numBBaft -= 2;
pIcode->invalidate();
obb1->front().invalidate();
obb2->front().invalidate();
(obb2->begin2()+1)->invalidate();
pIcode->invalidate();
obb1->front().invalidate();
obb2->front().invalidate();
(obb2->begin2()+1)->invalidate();
return skipped_insn;
}
/* Creates a long conditional equality or inequality at (pIcode+1).
/** Creates a long conditional equality or inequality at (pIcode+1).
* Removes excess nodes from the graph by flagging them, and updates
* the new edges for the remaining nodes. */
static void longJCond22 (COND_EXPR *rhs, COND_EXPR *lhs, iICODE pIcode, Int *idx)
* the new edges for the remaining nodes.
* @return number of ICODE's to skip
*/
static int longJCond22 (COND_EXPR *rhs, COND_EXPR *lhs, iICODE pIcode)
{
Int j;
BB * pbb, * obb1, * tbb;
@@ -174,7 +213,7 @@ static void longJCond22 (COND_EXPR *rhs, COND_EXPR *lhs, iICODE pIcode, Int *idx
/* Adjust outEdges[0] to the new target basic block */
pbb = pIcode->inBB;
if (pbb->back().loc_ip == (*idx + 1))
if (pbb->back().loc_ip == next1->loc_ip)
{
/* Find intermediate and target basic blocks */
obb1 = pbb->edges[THEN].BBptr;
@@ -209,7 +248,7 @@ static void longJCond22 (COND_EXPR *rhs, COND_EXPR *lhs, iICODE pIcode, Int *idx
pIcode->invalidate();
next2->invalidate();
next3->invalidate();
(*idx) += 4;
return 4;
}
/* Propagates TYPE_LONG_(UN)SIGN icode information to the current pIcode
@@ -236,7 +275,7 @@ void Function::propLongStk (Int i, ID *pLocId)
switch (pIcode->ic.ll.opcode)
{
case iMOV:
if (checkLongEq (pLocId->id.longStkId, pIcode, i, idx, this,
if (checkLongEq (pLocId->id.longStkId, pIcode, i, this,
&rhs, &lhs, 1) == TRUE)
{
pIcode->setAsgn(lhs, rhs);
@@ -246,7 +285,7 @@ void Function::propLongStk (Int i, ID *pLocId)
break;
case iAND: case iOR: case iXOR:
if (checkLongEq (pLocId->id.longStkId, pIcode, i, idx, this,
if (checkLongEq (pLocId->id.longStkId, pIcode, i, this,
&rhs, &lhs, 1) == TRUE)
{
switch (pIcode->ic.ll.opcode)
@@ -265,7 +304,7 @@ void Function::propLongStk (Int i, ID *pLocId)
break;
case iPUSH:
if (checkLongEq (pLocId->id.longStkId, pIcode, i, idx, this,
if (checkLongEq (pLocId->id.longStkId, pIcode, i, this,
&rhs, &lhs, 1) == TRUE)
{
pIcode->setUnary( HLI_PUSH, lhs);
@@ -279,30 +318,32 @@ void Function::propLongStk (Int i, ID *pLocId)
/* Check long conditional (i.e. 2 CMPs and 3 branches */
else if ((pIcode->ic.ll.opcode == iCMP) && (isLong23 (idx, pIcode->inBB, &off, &arc)))
{
if (checkLongEq (pLocId->id.longStkId, pIcode, i, idx, this, &rhs, &lhs, off) == TRUE)
longJCond23 (rhs, lhs, pIcode, &idx, arc, off);
if ( checkLongEq (pLocId->id.longStkId, pIcode, i, this, &rhs, &lhs, off) )
{
idx += longJCond23 (rhs, lhs, pIcode, arc, off); //
}
}
/* Check for long conditional equality or inequality. This requires
* 2 CMPs and 2 branches */
else if ((pIcode->ic.ll.opcode == iCMP) &&
isLong22 (pIcode, pEnd, &off))
else if ((pIcode->ic.ll.opcode == iCMP) && isLong22 (pIcode, pEnd, &off))
{
if (checkLongEq (pLocId->id.longStkId, pIcode, i, idx, this,
&rhs, &lhs, off) == TRUE)
longJCond22 (rhs, lhs, pIcode, &idx);
if ( checkLongEq (pLocId->id.longStkId, pIcode, i, this,&rhs, &lhs, off) )
{
idx += longJCond22 (rhs, lhs, pIcode); // maybe this should have -1 to offset loop autoincrement?
}
}
}
}
void checkBack();
int Function::checkBackwarLongDefs(int loc_ident_idx, ID *pLocId, int pLocId_idx,Assignment &asgn)
int Function::checkBackwarLongDefs(int loc_ident_idx, const ID &pLocId, iICODE beg,Assignment &asgn)
{
int idx;
LLOperand * pmH,* pmL;
iICODE pIcode;
for (idx = pLocId_idx - 1; idx > 0 ; idx--)
riICODE rev(beg);
bool forced_finish=false;
for (; not forced_finish and rev!=Icode.rend();rev++) //idx = pLocId_idx - 1; idx > 0 ; idx--
{
pIcode = Icode.begin()+(idx-1);
pIcode = (rev+1).base();//Icode.begin()+(idx-1);
if ((pIcode->type == HIGH_LEVEL) || (pIcode->invalid == TRUE))
continue;
@@ -313,28 +354,28 @@ int Function::checkBackwarLongDefs(int loc_ident_idx, ID *pLocId, int pLocId
case iMOV:
pmH = &pIcode->ic.ll.dst;
pmL = &(pIcode+1)->ic.ll.dst;
if ((pLocId->id.longId.h == pmH->regi) && (pLocId->id.longId.l == pmL->regi))
if ((pLocId.id.longId.h == pmH->regi) && (pLocId.id.longId.l == pmL->regi))
{
asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
this->localId.id_arr[loc_ident_idx].idx.push_back(pIcode);//idx-1
this->localId.id_arr[loc_ident_idx].idx.push_back(pIcode);//idx-1//insert
pIcode->setRegDU( pmL->regi, eDEF);
asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode, HIGH_FIRST, pIcode/*idx*/, eUSE, 1);
pIcode->setAsgn(asgn.lhs, asgn.rhs);
(pIcode+1)->invalidate();
idx = 0; /* to exit the loop */
forced_finish=true; /* to exit the loop */
}
break;
case iPOP:
pmH = &(pIcode+1)->ic.ll.dst;
pmL = &pIcode->ic.ll.dst;
if ((pLocId->id.longId.h == pmH->regi) && (pLocId->id.longId.l == pmL->regi))
if ((pLocId.id.longId.h == pmH->regi) && (pLocId.id.longId.l == pmL->regi))
{
asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
pIcode->setRegDU( pmH->regi, eDEF);
pIcode->setUnary(HLI_POP, asgn.lhs);
(pIcode+1)->invalidate();
idx = 0; /* to exit the loop */
forced_finish=true; /* to exit the loop */
}
break;
@@ -343,7 +384,7 @@ int Function::checkBackwarLongDefs(int loc_ident_idx, ID *pLocId, int pLocId
case iAND: case iOR: case iXOR:
pmL = &pIcode->ic.ll.dst;
pmH = &(pIcode+1)->ic.ll.dst;
if ((pLocId->id.longId.h == pmH->regi) && (pLocId->id.longId.l == pmL->regi))
if ((pLocId.id.longId.h == pmH->regi) && (pLocId.id.longId.l == pmL->regi))
{
asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
pIcode->setRegDU( pmH->regi, USE_DEF);
@@ -359,12 +400,127 @@ int Function::checkBackwarLongDefs(int loc_ident_idx, ID *pLocId, int pLocId
} /* eos */
pIcode->setAsgn(asgn.lhs, asgn.rhs);
(pIcode+1)->invalidate();
idx = 0;
forced_finish=true; /* to exit the loop */
}
break;
} /* eos */
}
return idx;
return rev!=Icode.rend();
}
int Function::checkForwardLongDefs(int loc_ident_idx, const ID &pLocId, iICODE beg,Assignment &asgn)
{
bool forced_finish=false;
auto pEnd=Icode.end();
for (auto pIcode=beg; not forced_finish and ((pIcode+1)!=Icode.end()); ++pIcode)
{
iICODE next1(pIcode+1);
LLOperand * pmH,* pmL; /* Pointers to dst LOW_LEVEL icodes */
int off,arc;
if ((pIcode->type == HIGH_LEVEL) || (pIcode->invalid == TRUE))
continue;
if (pIcode->ic.ll.opcode == next1->ic.ll.opcode)
switch (pIcode->ic.ll.opcode)
{
case iMOV:
if ((pLocId.id.longId.h == pIcode->ic.ll.src.regi) &&
(pLocId.id.longId.l == next1->ic.ll.src.regi))
{
asgn.rhs = COND_EXPR::idLongIdx (loc_ident_idx);
pIcode->setRegDU( next1->ic.ll.src.regi, eUSE);
asgn.lhs = COND_EXPR::idLong (&this->localId, DST, pIcode,HIGH_FIRST, pIcode, eDEF, 1);
pIcode->setAsgn(asgn.lhs, asgn.rhs);
next1->invalidate();
forced_finish =true; /* to exit the loop */
}
break;
case iPUSH:
if ((pLocId.id.longId.h == pIcode->ic.ll.src.regi) &&
(pLocId.id.longId.l == next1->ic.ll.src.regi))
{
asgn.rhs = COND_EXPR::idLongIdx (loc_ident_idx);
pIcode->setRegDU( next1->ic.ll.src.regi, eUSE);
pIcode->setUnary(HLI_PUSH, asgn.lhs);
next1->invalidate();
}
forced_finish =true; /* to exit the loop */
break;
/*** others missing ****/
case iAND: case iOR: case iXOR:
pmL = &pIcode->ic.ll.dst;
pmH = &next1->ic.ll.dst;
if ((pLocId.id.longId.h == pmH->regi) &&
(pLocId.id.longId.l == pmL->regi))
{
asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
pIcode->setRegDU( pmH->regi, USE_DEF);
asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode,
LOW_FIRST, pIcode/*idx*/, eUSE, 1);
switch (pIcode->ic.ll.opcode) {
case iAND: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, AND);
break;
case iOR: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, OR);
break;
case iXOR: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, XOR);
break;
}
pIcode->setAsgn(asgn.lhs, asgn.rhs);
(pIcode+1)->invalidate();
// ftw loop restart ????
//idx = 0;
// maybe this should end the loop instead
forced_finish =true; /* to exit the loop */
}
break;
} /* eos */
/* Check long conditional (i.e. 2 CMPs and 3 branches */
else if ((pIcode->ic.ll.opcode == iCMP) && (isLong23 (pIcode, pIcode->inBB, &off, &arc)))
{
if (checkLongRegEq (pLocId.id.longId, pIcode, loc_ident_idx, this,
asgn.rhs, asgn.lhs, off) == TRUE)
{
pIcode += longJCond23 (asgn.rhs, asgn.lhs, pIcode, arc, off);
}
}
/* Check for long conditional equality or inequality. This requires
* 2 CMPs and 2 branches */
else if ((pIcode->ic.ll.opcode == iCMP) &&
(isLong22 (pIcode, pEnd, &off)))
{
if (checkLongRegEq (pLocId.id.longId, pIcode, loc_ident_idx, this,
asgn.rhs, asgn.lhs, off) == TRUE)
{
pIcode += longJCond22 (asgn.rhs, asgn.lhs, pIcode);
}
}
/* Check for OR regH, regL
* JX lab
* => HLI_JCOND (regH:regL X 0) lab
* This is better code than HLI_JCOND (HI(regH:regL) | LO(regH:regL)) */
else if ((pIcode->ic.ll.opcode == iOR) && (next1 < pEnd) &&
(isJCond (next1->ic.ll.opcode)))
{
if ((pIcode->ic.ll.dst.regi == pLocId.id.longId.h) &&
(pIcode->ic.ll.src.regi == pLocId.id.longId.l))
{
asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
asgn.rhs = COND_EXPR::idKte (0, 4); /* long 0 */
asgn.lhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, condOpJCond[next1->ic.ll.opcode - iJB]);
next1->setJCond(asgn.lhs);
next1->copyDU(*pIcode, eUSE, eUSE);
pIcode->invalidate();
}
}
} /* end for */
}
/* Finds the definition of the long register pointed to by pLocId, and
@@ -372,129 +528,28 @@ int Function::checkBackwarLongDefs(int loc_ident_idx, ID *pLocId, int pLocId
* Arguments: i : index into the local identifier table
* pLocId: ptr to the long local identifier
* pProc : ptr to current procedure's record. */
void Function::propLongReg (Int loc_ident_idx, ID *pLocId)
void Function::propLongReg (Int loc_ident_idx, const ID *pLocId)
{
Int idx;
iICODE pEnd;
/* Process all definitions/uses of long registers at an icode position */
pEnd = this->Icode.end();
const IDX_ARRAY &lidx(pLocId->idx);
// for (int pLocId_idx : pLocId->idx)
// WARNING: this loop modifies the iterated-over container.
for (int j = 0; j < pLocId->idx.size(); j++)
{
int pLocId_idx=std::distance(Icode.begin(),pLocId->idx[j]);
auto idx_iter=lidx.begin();
std::advance(idx_iter,j);
//assert(*idx_iter==lidx.z[j]);
int pLocId_idx=std::distance(Icode.begin(),*idx_iter);
Assignment asgn;
/* Check backwards for a definition of this long register */
idx = checkBackwarLongDefs(loc_ident_idx,pLocId,pLocId_idx,asgn);
/* If no definition backwards, check forward for a use of this long reg */
if (idx > 0)
if (checkBackwarLongDefs(loc_ident_idx,*pLocId,*idx_iter,asgn))
continue;
for (idx = pLocId_idx + 1; idx < Icode.size() - 1; idx++)
{
iICODE pIcode(Icode.begin()),next1(Icode.begin());
LLOperand * pmH,* pmL; /* Pointers to dst LOW_LEVEL icodes */
int off,arc;
std::advance(pIcode,idx);
std::advance(next1,idx+1);
if ((pIcode->type == HIGH_LEVEL) || (pIcode->invalid == TRUE))
continue;
if (pIcode->ic.ll.opcode == next1->ic.ll.opcode)
switch (pIcode->ic.ll.opcode)
{
case iMOV:
if ((pLocId->id.longId.h == pIcode->ic.ll.src.regi) &&
(pLocId->id.longId.l == next1->ic.ll.src.regi))
{
asgn.rhs = COND_EXPR::idLongIdx (loc_ident_idx);
pIcode->setRegDU( next1->ic.ll.src.regi, eUSE);
asgn.lhs = COND_EXPR::idLong (&this->localId, DST, pIcode,HIGH_FIRST, pIcode/*idx*/, eDEF, 1);
pIcode->setAsgn(asgn.lhs, asgn.rhs);
next1->invalidate();
idx = this->Icode.size(); /* to exit the loop */
}
break;
case iPUSH:
if ((pLocId->id.longId.h == pIcode->ic.ll.src.regi) &&
(pLocId->id.longId.l == next1->ic.ll.src.regi))
{
asgn.rhs = COND_EXPR::idLongIdx (loc_ident_idx);
pIcode->setRegDU( next1->ic.ll.src.regi, eUSE);
pIcode->setUnary(HLI_PUSH, asgn.lhs);
next1->invalidate();
}
idx = this->Icode.size(); /* to exit the loop */
break;
/*** others missing ****/
case iAND: case iOR: case iXOR:
pmL = &pIcode->ic.ll.dst;
pmH = &next1->ic.ll.dst;
if ((pLocId->id.longId.h == pmH->regi) &&
(pLocId->id.longId.l == pmL->regi))
{
asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
pIcode->setRegDU( pmH->regi, USE_DEF);
asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode,
LOW_FIRST, pIcode/*idx*/, eUSE, 1);
switch (pIcode->ic.ll.opcode) {
case iAND: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, AND);
break;
case iOR: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, OR);
break;
case iXOR: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, XOR);
break;
}
pIcode->setAsgn(asgn.lhs, asgn.rhs);
(pIcode+1)->invalidate();
idx = 0;
}
break;
} /* eos */
/* Check long conditional (i.e. 2 CMPs and 3 branches */
else if ((pIcode->ic.ll.opcode == iCMP) && (isLong23 (idx, pIcode->inBB, &off, &arc)))
{
if (checkLongRegEq (pLocId->id.longId, pIcode, loc_ident_idx, idx, this,
asgn.rhs, asgn.lhs, off) == TRUE)
longJCond23 (asgn.rhs, asgn.lhs, pIcode, &idx, arc, off);
}
/* Check for long conditional equality or inequality. This requires
* 2 CMPs and 2 branches */
else if ((pIcode->ic.ll.opcode == iCMP) &&
(isLong22 (pIcode, pEnd, &off)))
{
if (checkLongRegEq (pLocId->id.longId, pIcode, loc_ident_idx, idx, this,
asgn.rhs, asgn.lhs, off) == TRUE)
longJCond22 (asgn.rhs, asgn.lhs, pIcode, &idx);
}
/* Check for OR regH, regL
* JX lab
* => HLI_JCOND (regH:regL X 0) lab
* This is better code than HLI_JCOND (HI(regH:regL) | LO(regH:regL)) */
else if ((pIcode->ic.ll.opcode == iOR) && (next1 < pEnd) &&
(isJCond (next1->ic.ll.opcode)))
{
if ((pIcode->ic.ll.dst.regi == pLocId->id.longId.h) &&
(pIcode->ic.ll.src.regi == pLocId->id.longId.l))
{
asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
asgn.rhs = COND_EXPR::idKte (0, 4); /* long 0 */
asgn.lhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, condOpJCond[next1->ic.ll.opcode - iJB]);
next1->setJCond(asgn.lhs);
next1->copyDU(*pIcode, eUSE, eUSE);
pIcode->invalidate();
}
}
} /* end for */
/* If no definition backwards, check forward for a use of this long reg */
checkForwardLongDefs(loc_ident_idx,*pLocId,*idx_iter,asgn);
} /* end for */
}