CodeInitFor(nd, priority)
register struct node *nd;
{
- /* Push init-value or final-value, the value may only be evaluated
+ /* Push final-value, the value may only be evaluated
once, so generate a temporary for it, when not a constant.
*/
return (arith) 0;
}
-CodeFor(nd, stepsize, l1, l2, tmp1)
+CodeFor(nd, stepsize, l1, l2)
struct node *nd;
label l1, l2;
- arith tmp1;
{
/* Test if loop has to be done */
if( stepsize == 1 ) /* TO */
else /* DOWNTO */
C_blt(l2);
- /* Store init-value in control-variable */
- if( tmp1 )
- C_lol(tmp1);
- else
- CodePExpr(nd->nd_left);
-
/* Label at begin of the body */
C_df_ilb(l1);
int stepsize;
label l1 = ++text_label;
label l2 = ++text_label;
- arith tmp1 = (arith) 0;
arith tmp2 = (arith) 0;
} :
FOR
Expression(&(nd->nd_right))
{ ChkForStat(nd);
if( !err_occurred ) {
- tmp1 = CodeInitFor(nd->nd_left, 0);
+ CodePExpr(nd->nd_left);
+ C_dup(int_size);
tmp2 = CodeInitFor(nd->nd_right, 2);
- CodeFor(nd, stepsize, l1, l2, tmp1);
+ CodeFor(nd, stepsize, l1, l2);
}
}
DO
EndForStat(nd);
chk_labels(slevel + 1);
FreeNode(nd);
- if( tmp1 ) FreeInt(tmp1);
if( tmp2 ) FreeInt(tmp2);
}
;