ip->op = op;
ip->cval = constVal;
ip->ic = ic;
-
+ updateSpillLocation(ic,1);
return ip;
}
set *lInvars = NULL;
int change = 0;
+ int fCallsInBlock;
/* if the preHeader does not exist then do nothing */
/* or no exits then do nothing ( have to think about this situation */
domsAllExits = (applyToSet (theLoop->exits, dominatedBy, lBlock) ==
elementsInSet (theLoop->exits));
+ /* find out if we have a function call in this block */
+ for (ic = lBlock->sch, fCallsInBlock=0; ic; ic = ic->next) {
+ if (SKIP_IC(ic)) {
+ fCallsInBlock++;
+ }
+ }
/* now we go thru the instructions of this block and */
/* collect those instructions with invariant operands */
int lin, rin;
cseDef *ivar;
+ /* if there are function calls in this block and this
+ is a pointer get, the function could have changed it
+ so skip, ISO-C99 according to David A. Long */
+ if (fCallsInBlock && POINTER_GET(ic)) {
+ continue;
+ }
+
if (SKIP_IC (ic) || POINTER_SET (ic) || ic->op == IFX)
continue;
continue;
lin = rin = 0;
-
+
/* special case */
/* if address of then it is an invariant */
if (ic->op == ADDRESS_OF &&
IS_SYMOP (IC_LEFT (ic)) &&
IS_AGGREGATE (operandType (IC_LEFT (ic))))
lin++;
- else
+ else {
/* check if left operand is an invariant */
- if ((lin = isOperandInvariant (IC_LEFT (ic), theLoop, lInvars)))
- /* if this is a pointer get then make sure
- that the pointer set does not exist in
- any of the blocks */
- if (POINTER_GET (ic) &&
- (applyToSet (theLoop->regBlocks, pointerAssigned, IC_LEFT (ic))))
- lin = 0;
-
+ if ((lin = isOperandInvariant (IC_LEFT (ic), theLoop, lInvars)))
+ /* if this is a pointer get then make sure
+ that the pointer set does not exist in
+ any of the blocks */
+ if (POINTER_GET (ic) &&
+ (applyToSet (theLoop->regBlocks,
+ pointerAssigned, IC_LEFT (ic))))
+ lin = 0;
+ }
+
/* do the same for right */
rin = isOperandInvariant (IC_RIGHT (ic), theLoop, lInvars);
-
+
/* if this is a POINTER_GET then special case, make sure all
usages within the loop are POINTER_GET any other usage
would mean that this is not an invariant , since the pointer
continue;
aSym = (IS_OP_LITERAL (IC_RIGHT (dic)) ?
- (litValue = operandLitValue (IC_RIGHT (dic)), IC_LEFT (dic)) :
- (litValue = operandLitValue (IC_LEFT (dic)), IC_RIGHT (dic)));
+ (litValue = (unsigned long) operandLitValue (IC_RIGHT (dic)), IC_LEFT (dic)) :
+ (litValue = (unsigned long) operandLitValue (IC_LEFT (dic)), IC_RIGHT (dic)));
if (!isOperandEqual (IC_RESULT (ic), aSym) &&
!isOperandEqual (IC_RIGHT (ic), aSym))
continue;
aSym = (IS_SYMOP (IC_LEFT (ic)) ?
- (lr = 1, litVal = operandLitValue (IC_RIGHT (ic)), IC_LEFT (ic)) :
- (litVal = operandLitValue (IC_LEFT (ic)), IC_RIGHT (ic)));
+ (lr = 1, litVal = (unsigned long) operandLitValue (IC_RIGHT (ic)), IC_LEFT (ic)) :
+ (litVal = (unsigned long) operandLitValue (IC_LEFT (ic)), IC_RIGHT (ic)));
ip = NULL;
/* check if this is an induction variable */
/* ask port for size not worth if native instruction
exist for multiply & divide */
- if (getSize (operandType (IC_LEFT (ic))) <= port->muldiv.native_below ||
- getSize (operandType (IC_RIGHT (ic))) <= port->muldiv.native_below)
+ if (getSize (operandType (IC_LEFT (ic))) <= (unsigned long) port->support.muldiv ||
+ getSize (operandType (IC_RIGHT (ic))) <= (unsigned long) port->support.muldiv)
continue;
/* if this is a division then the remainder should be zero