cseDef *cdp = item;
iCodeTable *icTab ;
+ (void)ap;
+
if (!cdp->sym)
fprintf(stdout,"**null op**");
printOperand(cdp->sym,stdout);
for (lic = ic ; lic ; lic = lic->next ) {
int siaddr ;
+ /* do the special cases first */
+ if (lic->op == IFX) {
+ if (IS_SYMOP(to) &&
+ IC_COND(lic)->key == from->key) {
+
+ bitVectUnSetBit (OP_USES(from),lic->key);
+ OP_USES(to) = bitVectSetBit(OP_USES(to),lic->key);
+ siaddr = IC_COND(lic)->isaddr ;
+ IC_COND(lic) = operandFromOperand(to);
+ IC_COND(lic)->isaddr = siaddr ;
+
+ }
+ continue ;
+ }
+
+ if (lic->op == JUMPTABLE) {
+ if (IS_SYMOP(to) &&
+ IC_JTCOND(lic)->key == from->key) {
+
+ bitVectUnSetBit (OP_USES(from),lic->key);
+ OP_USES(to) = bitVectSetBit(OP_USES(to),lic->key);
+ siaddr = IC_COND(lic)->isaddr ;
+ IC_JTCOND(lic) = operandFromOperand(to);
+ IC_JTCOND(lic)->isaddr = siaddr ;
+
+ }
+ continue ;
+ }
+
if (IC_RESULT(lic) && IC_RESULT(lic)->key == from->key ) {
/* maintain du chains */
if (POINTER_SET(lic)) {
IC_RESULT(lic)->isaddr = siaddr ;
}
- if (IC_RIGHT(lic) && IC_RIGHT(lic)->key == from->key ) {
+ if (IS_SYMOP(to) &&
+ IC_RIGHT(lic) && IC_RIGHT(lic)->key == from->key ) {
bitVectUnSetBit (OP_USES(from),lic->key);
OP_USES(to) = bitVectSetBit(OP_USES(to),lic->key);
siaddr = IC_RIGHT(lic)->isaddr ;
IC_RIGHT(lic)->isaddr = siaddr ;
}
- if (IC_LEFT(lic) && IC_LEFT(lic)->key == from->key ) {
+ if (IS_SYMOP(to) &&
+ IC_LEFT(lic) && IC_LEFT(lic)->key == from->key ) {
bitVectUnSetBit (OP_USES(from),lic->key);
OP_USES(to) = bitVectSetBit(OP_USES(to),lic->key);
siaddr = IC_LEFT(lic)->isaddr ;
/* if the conditional is a literal then */
if (IS_OP_LITERAL(IC_COND(ic))) {
- if ( operandLitValue(IC_COND(ic)) && IC_TRUE(ic)) {
+ if ( (operandLitValue(IC_COND(ic)) != 0.0) && IC_TRUE(ic)) {
/* change to a goto */
ic->op = GOTO ;
if (SKIP_IC2(ic))
continue ;
+ /* if this is an assignment from true symbol
+ to a temp then do pointer post inc/dec optimzation */
+ if (ic->op == '=' && !POINTER_SET(ic) &&
+ IS_TRUE_SYMOP(IC_RIGHT(ic)) && IS_ITEMP(IC_RESULT(ic)) &&
+ IS_PTR(operandType(IC_RESULT(ic)))) {
+ ptrPostIncDecOpt(ic);
+ }
+
/* clear the def & use chains for the operands involved */
/* in this operation . since it can change due to opts */
unsetDefsAndUses (ic);