Branch: Tag:

1999-01-29

1999-01-29 12:29:02 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

some optimization bugfixes

Rev: src/las.c:1.72

4:   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: las.c,v 1.71 1998/11/22 11:02:56 hubbe Exp $"); + RCSID("$Id: las.c,v 1.72 1999/01/29 12:29:02 hubbe Exp $");      #include "language.h"   #include "interpret.h"
1862:    break;       case F_ADD_EQ: -  if(CDR(n)->type == int_type_string) -  { +     if(CDR(n)->token == F_CONSTANT && CDR(n)->u.sval.type == T_INT)    {    /* a+=0 -> a */ -  if(n->u.sval.u.integer == 0) goto use_car; +  if(CDR(n)->u.sval.u.integer == 0) goto use_car;       /* a+=1 -> ++a */ -  if(n->u.sval.u.integer == 1) +  if(CDR(n)->u.sval.u.integer == 1)    { -  tmp1=mknode(F_INC,CDR(n),0); -  CDR(n)=0; +  tmp1=mknode(F_INC,CAR(n),0); +  CAR(n)=0;    goto use_tmp1;    }       /* a+=-1 -> --a */ -  if(n->u.sval.u.integer == -1) +  if(CDR(n)->u.sval.u.integer == -1)    { -  tmp1=mknode(F_DEC, CDR(n), 0); -  CDR(n)=0; +  tmp1=mknode(F_DEC, CAR(n), 0); +  CAR(n)=0;    goto use_tmp1;    }    } -  } +     break;       case F_SUB_EQ: -  if(CDR(n)->type == int_type_string) -  { +     if(CDR(n)->token == F_CONSTANT && CDR(n)->u.sval.type == T_INT)    {    /* a-=0 -> a */ -  if(n->u.sval.u.integer == 0) goto use_car; +  if(CDR(n)->u.sval.u.integer == 0) goto use_car;       /* a-=-1 -> ++a */ -  if(n->u.sval.u.integer == -1) +  if(CDR(n)->u.sval.u.integer == -1)    { -  tmp1=mknode(F_INC, CDR(n), 0); -  CDR(n)=0; +  tmp1=mknode(F_INC, CAR(n), 0); +  CAR(n)=0;    goto use_tmp1;    }       /* a-=-1 -> --a */ -  if(n->u.sval.u.integer == 1) +  if(CDR(n)->u.sval.u.integer == 1)    { -  tmp1=mknode(F_DEC, CDR(n), 0); -  CDR(n)=0; +  tmp1=mknode(F_DEC, CAR(n), 0); +  CAR(n)=0;    goto use_tmp1;    }    } -  } +     break;       case F_ARROW:
2066:    if(!node_is_eq(*arg1,CAR(tmp1)) || /* x == z */    depend_p(*arg2,*arg2) || /* does y depend on y? */    depend_p(*arg2,*arg1) || /* does y depend on x? */ -  depend_p(*arg2,CADR(n))) /* does y depend on p? */ +  depend_p(*arg2,CADR(n)) || /* does y depend on p? */ +  depend_p(*arg2,tmp1)) /* does y depend on z? */    { -  /* it was not on the form for(; x op y; x++) p; */ +  /* it was not on the form for(; x op y; z++) p; */    if(!node_is_eq(*arg2,CAR(tmp1)) || /* y == z */ -  depend_p(*arg1,*arg2) || /* does x depend on y? */ -  depend_p(*arg1,*arg1) || /* does x depend on x? */ -  depend_p(*arg1,CADR(n)) /* does x depend on p? */ -  ) +  depend_p(*arg1,*arg2) || /* does x depend on y? */ +  depend_p(*arg1,*arg1) || /* does x depend on x? */ +  depend_p(*arg1,CADR(n)) || /* does x depend on p? */ +  depend_p(*arg1,tmp1)) /* does x depend on z? */    {    /* it was not on the form for(; x op y; y++) p; */    break;