Branch: Tag:

1997-03-05

1997-03-05 05:22:56 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

peephole optimizer improved

Rev: bin/mkpeep.pike:1.2
Rev: src/docode.c:1.12
Rev: src/las.c:1.29
Rev: src/peep.c:1.6
Rev: src/peep.h:1.2
Rev: src/peep.in:1.4

4:   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: las.c,v 1.28 1997/03/01 02:37:03 hubbe Exp $"); + RCSID("$Id: las.c,v 1.29 1997/03/05 05:22:55 hubbe Exp $");      #include "language.h"   #include "interpret.h"
311:    if(b) b->parent = res;    if(!num_parse_error) optimize(res);    + #ifdef DEBUG +  if(d_flag > 3) +  verify_shared_strings_tables(); + #endif +     return res;   }   
390:    res->token = F_LOCAL;    copy_shared_string(res->type, local_variables->variable[var].type);    res->node_info = OPT_NOT_CONST; +  res->tree_info=res->node_info;   #ifdef __CHECKER__    CDR(res)=0;   #endif
411:    }else{    res->node_info = OPT_NOT_CONST;    } +  res->tree_info=res->node_info;      #ifdef __CHECKER__    CDR(res)=0;
1368:    }    current_line = n->line_number;    -  if(!n->parent) break; +        n->tree_info = n->node_info;    if(car_is_node(n)) n->tree_info |= CAR(n)->tree_info;    if(cdr_is_node(n)) n->tree_info |= CDR(n)->tree_info;    -  +  if(!n->parent) break; +     if(n->tree_info & (OPT_NOT_CONST|    OPT_SIDE_EFFECT|    OPT_EXTERNAL_DEPEND|
1409:    fix_type_field(n);      #ifdef DEBUG -  if(l_flag > 3) +  if(l_flag > 3 && n)    { -  fprintf(stderr,"Optimizing: "); +  fprintf(stderr,"Optimizing (tree info=%x):",n->tree_info);    print_tree(n);    }   #endif
1425:    CAR(n)->u.sval.u.efun->optimize)    {    if(tmp1=CAR(n)->u.sval.u.efun->optimize(n)) +  {    goto use_tmp1;    } -  +  }    break;       case F_ARG_LIST:
1793:    struct svalue *save_sp = sp;    int ret;    + #ifdef DEBUG +  if(l_flag > 3 && n) +  { +  fprintf(stderr,"Evaluating (tree info=%x):",n->tree_info); +  print_tree(n); +  } + #endif +     if(num_parse_error) return -1;    setup_fake_program();   
2047:      INT32 get_opt_info() { return last_function_opt_info; }    +