Branch: Tag:

2004-08-23

2004-08-23 14:03:36 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Added some new rules, and cleaned up some old ones.

Rev: src/peep.in:1.71

2:   // This file is part of Pike. For copyright information see COPYRIGHT.   // Pike is distributed under GPL, LGPL and MPL. See the file COPYING   // for more information. - // $Id: peep.in,v 1.70 2004/04/30 20:42:05 grubba Exp $ + // $Id: peep.in,v 1.71 2004/08/23 14:03:36 grubba Exp $      NOP :   POP_N_ELEMS (0) :
23:   ASSIGN_LOCAL POP_VALUE : ASSIGN_LOCAL_AND_POP($1a)   RECUR POP_VALUE : RECUR_AND_POP($1a)    + // Negation and complement of constants.   NUMBER(0) : CONST0   NUMBER(1) : CONST1   NUMBER(-1) : CONST_1
31:   CONST1 NEGATE : CONST_1   CONST_1 NEGATE : CONST1   NUMBER NEGATE : NEG_NUMBER($1a) - NUMBER [$1a < 0 && (-$1a)>0] : NEG_NUMBER (-$1a) +    NEG_NUMBER NEGATE : NUMBER ($1a) -  + NUMBER [$1a < 0 && (-$1a)>0] : NEG_NUMBER (-$1a) + NEG_NUMBER [$1a < 0 && (-$1a)>0] : NUMBER (-$1a)   NEGATE NEGATE :   COMPL COMPL :   NEGATE CONST_1 ADD_INTS : COMPL   NEGATE CONST1 SUBTRACT : COMPL -  + NUMBER ASSIGN_LOCAL NEGATE: NUMBER($1a) ASSIGN_LOCAL_AND_POP($2a) NEG_NUMBER($1a) + NEG_NUMBER ASSIGN_LOCAL NEGATE: NEG_NUMBER($1a) ASSIGN_LOCAL_AND_POP($2a) NUMBER($1a) + CONST1 ASSIGN_LOCAL NEGATE: CONST1 ASSIGN_LOCAL_AND_POP($2a) CONST_1 + CONST_1 ASSIGN_LOCAL NEGATE: CONST_1 ASSIGN_LOCAL_AND_POP($2a) CONST1 +    CONST0 ASSIGN_LOCAL_AND_POP : CLEAR_LOCAL($2a) -  + CONST0 ASSIGN_LOCAL: CLEAR_LOCAL($2a) CONST0      LOCAL_2_LOCAL [$1a == $1b] : -  + GLOBAL ASSIGN_GLOBAL_AND_POP($1a) :    -  +    // Remove clearing of locals from the beginning of functions   // But don't remove clearing of arguments!   BYTE ENTRY START_FUNCTION LABEL(0) CLEAR_LOCAL [$1a <= $5a] : BYTE($1a) ENTRY START_FUNCTION LABEL(0)
51:   BYTE ENTRY START_FUNCTION CLEAR_2_LOCAL [$1a <= $4a] : BYTE($1a) ENTRY START_FUNCTION   BYTE ENTRY START_FUNCTION CLEAR_4_LOCAL [$1a <= $4a] : BYTE($1a) ENTRY START_FUNCTION    - CLEAR_LOCAL NUMBER(0) ASSIGN_LOCAL_AND_POP ($1a) : CLEAR_LOCAL($1a) - CLEAR_LOCAL NUMBER(0) ASSIGN_LOCAL_AND_POP ($1a+1) : CLEAR_2_LOCAL($1a) + CLEAR_LOCAL CLEAR_LOCAL($1a) : CLEAR_LOCAL($1a) + CLEAR_LOCAL CLEAR_LOCAL($1a+1) : CLEAR_2_LOCAL($1a)   CLEAR_2_LOCAL CLEAR_2_LOCAL($1a+2) : CLEAR_4_LOCAL($1a)      // CONST_1 MULTIPLY : NEGATE
111:   DEC_LOCAL POP_VALUE : DEC_LOCAL_AND_POP ($1a)   POST_DEC_LOCAL POP_VALUE : DEC_LOCAL_AND_POP ($1a)    - ASSIGN_LOCAL_AND_POP LOCAL ($1a) RETURN: ASSIGN_LOCAL($1a) RETURN - ASSIGN_LOCAL_AND_POP LOCAL ($1a) VOLATILE_RETURN: ASSIGN_LOCAL($1a) VOLATILE_RETURN - ASSIGN_LOCAL_AND_POP LOCAL ($1a) RETURN [!(Pike_compiler->compiler_frame->lexical_scope & SCOPE_SCOPED)]: RETURN - ASSIGN_LOCAL_AND_POP LOCAL ($1a) VOLATILE_RETURN [!(Pike_compiler->compiler_frame->lexical_scope & SCOPE_SCOPED)]: VOLATILE_RETURN + ASSIGN_LOCAL RETURN [!(Pike_compiler->compiler_frame->lexical_scope & SCOPE_SCOPED)]: RETURN + ASSIGN_LOCAL VOLATILE_RETURN [!(Pike_compiler->compiler_frame->lexical_scope & SCOPE_SCOPED)]: VOLATILE_RETURN      ASSIGN_LOCAL BRANCH_WHEN_ZERO LOCAL($1a) RETURN LABEL($2a): ASSIGN_LOCAL($1a) RETURN_IF_TRUE LABEL($2a)   ASSIGN_LOCAL BRANCH_WHEN_ZERO LOCAL($1a) VOLATILE_RETURN LABEL($2a): ASSIGN_LOCAL($1a) RETURN_IF_TRUE LABEL($2a)
133:   CONST0 BRANCH_WHEN_ZERO: BRANCH($2a)   CONST1 BRANCH_WHEN_NON_ZERO: BRANCH($2a)   CONST0 BRANCH_WHEN_NON_ZERO: + NUMBER [$1a] BRANCH_WHEN_ZERO: + NUMBER [$1a] BRANCH_WHEN_NON_ZERO: BRANCH($2a)      // These optimizations are now handled in optimize_eq   // CONST0 BRANCH_WHEN_EQ: BRANCH_WHEN_ZERO($2a)
191:   CONST0 INDEX: POS_INT_INDEX (0)   CONST_1 INDEX: NEG_INT_INDEX (1)   CONST1 INDEX: POS_INT_INDEX (1) + NUMBER INDEX: POS_INT_INDEX ($1a) + NEG_NUMBER INDEX: NEG_INT_INDEX ($1a)    - NUMBER [$1a < 0 && ($1a != -$1a)] INDEX: NEG_INT_INDEX (-$1a) - NUMBER [$1a >= 0] INDEX: POS_INT_INDEX ($1a) - NEG_NUMBER [$1a >= 0] INDEX: NEG_INT_INDEX ($1a) - NEG_NUMBER [$1a < 0 && ($1a != -$1a)] INDEX: POS_INT_INDEX (-$1a) -  +    BRANCH_WHEN_ZERO BRANCH LABEL ($1a): BRANCH_WHEN_NON_ZERO($2a) LABEL($1a)   BRANCH_WHEN_NON_ZERO BRANCH LABEL ($1a): BRANCH_WHEN_ZERO($2a) LABEL($1a)   
213:   CONST0 ADD_INTS: ADD_INT (0)   CONST1 ADD_INTS: ADD_INT (1)   CONST_1 ADD_INTS: ADD_NEG_INT (1) - NUMBER [$1a >= 0] ADD_INTS : ADD_INT ($1a) - NUMBER [$1a < 0 && ($1a != -$1a)] ADD_INTS : ADD_NEG_INT (-$1a) + NUMBER ADD_INTS : ADD_INT ($1a) + NEG_NUMBER ADD_INTS : ADD_NEG_INT ($1a)      CONST0 ADD: ADD_INT (0)   CONST1 ADD: ADD_INT (1)   CONST_1 ADD: ADD_NEG_INT (1) - NUMBER [$1a >= 0] ADD : ADD_INT ($1a) - NUMBER [$1a < 0 && ($1a != -$1a) ] ADD : ADD_NEG_INT (-$1a) + NUMBER ADD : ADD_INT ($1a) + NEG_NUMBER ADD : ADD_NEG_INT ($1a)      CONST0 SUBTRACT: ADD_INT (0)   CONST1 SUBTRACT: ADD_NEG_INT (-1)   CONST_1 SUBTRACT: ADD_INT (1) - NUMBER [$1a >= 0] SUBTRACT : ADD_NEG_INT ($1a) - NUMBER [$1a < 0 && ($1a != -$1a)] SUBTRACT : ADD_INT (-$1a) + NUMBER SUBTRACT : ADD_NEG_INT ($1a) + NEG_NUMBER SUBTRACT : ADD_INT ($1a)      // This set of optimizations is broken. Consider the case:   // STRING ADD_INT ADD_INT
239:   // ADD_INT ADD_NEG_INT [$2a > $1a]: ADD_NEG_INT ($2a-$1a)      CONST0 ADD_INT : NUMBER ($2a) - CONST0 ADD_NEG_INT : NUMBER($2a) + CONST0 ADD_NEG_INT : NEG_NUMBER($2a)      // FIXME: BIGNUMS?   //
450:   OPT_TYPEP(f_multisetp, T_MULTISET)   #endif    + // Move lvalues up on the stack. + NUMBER ASSIGN_LOCAL_AND_POP LOCAL_LVALUE: LOCAL_LVALUE($3a) NUMBER($1a) ASSIGN_LOCAL_AND_POP($2a) + NEG_NUMBER ASSIGN_LOCAL_AND_POP LOCAL_LVALUE: LOCAL_LVALUE($3a) NEG_NUMBER($1a) ASSIGN_LOCAL_AND_POP($2a) + CONST0 ASSIGN_LOCAL_AND_POP LOCAL_LVALUE: LOCAL_LVALUE($3a) CLEAR_LOCAL($2a) + CONST1 ASSIGN_LOCAL_AND_POP LOCAL_LVALUE: LOCAL_LVALUE($3a) CONST1 ASSIGN_LOCAL_AND_POP($2a) + CONST_1 ASSIGN_LOCAL_AND_POP LOCAL_LVALUE: LOCAL_LVALUE($3a) CONST_1 ASSIGN_LOCAL_AND_POP($2a) +  + // Move marks to where they're relevant. + MARK CLEAR_LOCAL: CLEAR_LOCAL($2a) MARK + MARK NUMBER ASSIGN_LOCAL_AND_POP: NUMBER($2a) ASSIGN_LOCAL_AND_POP($3a) MARK + MARK NUMBER ASSIGN_GLOBAL_AND_POP: NUMBER($2a) ASSIGN_GLOBAL_AND_POP($3a) MARK + MARK NEG_NUMBER ASSIGN_LOCAL_AND_POP: NEG_NUMBER($2a) ASSIGN_LOCAL_AND_POP($3a) MARK + MARK NEG_NUMBER ASSIGN_GLOBAL_AND_POP: NEG_NUMBER($2a) ASSIGN_GLOBAL_AND_POP($3a) MARK + MARK CONST1 ASSIGN_LOCAL_AND_POP: CONST1 ASSIGN_LOCAL_AND_POP($3a) MARK + MARK CONST1 ASSIGN_GLOBAL_AND_POP: CONST1 ASSIGN_GLOBAL_AND_POP($3a) MARK + MARK CONST_1 ASSIGN_LOCAL_AND_POP: CONST_1 ASSIGN_LOCAL_AND_POP($3a) MARK + MARK CONST_1 ASSIGN_GLOBAL_AND_POP: CONST_1 ASSIGN_GLOBAL_AND_POP($3a) MARK +