return applyToSet(ebp->succList,delGetPointerSucc,op,dfnum);
}
+/*-----------------------------------------------------------------*/
+/* fixUpTypes - KLUGE HACK fixup a lowering problem */
+/*-----------------------------------------------------------------*/
+static void fixUpTypes(iCode *ic)
+{
+ link *t1 = operandType(IC_LEFT(ic)) ,*t2;
+ /* for pointer_gets if the types of result & left r the
+ same then change it type of result to next */
+ if (IS_PTR(t1) &&
+ checkType(t2=operandType(IC_RESULT(ic)),t1) == 1) {
+ setOperandType(IC_RESULT(ic),t2->next);
+ }
+}
+
/*-----------------------------------------------------------------*/
/* cseBBlock - common subexpression elimination for basic blocks */
/* this is the hackiest kludgiest routine in the whole */
/* do some algebraic optimizations if possible */
algebraicOpts (ic);
+ if (POINTER_GET(ic)) fixUpTypes(ic);
while (constFold(ic,cseSet));
/* small klugde */
(tree->opval.op == '&' && !tree->right) ||
tree->opval.op == PTR_OP) {
lvaluereq++;
- if (IS_ARRAY_OP(tree->left) && IS_ARRAY_OP(tree->left->left)) {
+ if (IS_ARRAY_OP(tree->left) && IS_ARRAY_OP(tree->left->left))
+ {
lvaluereq--;
left = operandFromAst(tree->left);
} else {
left = operandFromAst(tree->left);
lvaluereq--;
}
+ if (IS_DEREF_OP(tree) && IS_DEREF_OP(tree->left))
+ left = geniCodeRValue(left,TRUE);
} else {
left = operandFromAst(tree->left);
}
/* dumpraw if asked for */
if (options.dump_raw)
dumpEbbsToFileExt(".dumpcse",ebbs,count);
-
+
/* compute the data flow */
computeDataFlow (ebbs,saveCount);