[patch] expr.h: Speed/clean up store_expr.

Kazu Hirata kazu@cs.umass.edu
Tue Dec 14 00:39:00 GMT 2004


Hi,

Attached is a patch to speed/clean up store_expr.

EXPAND_STACK_PARM is defined as 2 (as a micro-optimization) because
store_expr used to use a construct like so:

  want_value & 2 ? EXPAND_STACK_PARM : EXPAND_NORMAL

which was presumably optimized to

  want_value & 2

using the fact that EXPAND_NORMAL == 0.

After I cleaned up store_expr recently, the construct above has become

  call_param_p ? EXPAND_STACK_PARM : EXPAND_NORMAL

which is really

  call_param_p ? 2 : 0

Note that we cannot use STORE_FLAG_VALUE in a straightforward manner
on a machine where STORE_FLAG_VALUE is 1.

The patch removes this special "2" thing as it causes a
micro-pessimization and doesn't serve any purpose these days.

Tested on i686-pc-linux-gnu.  OK to apply?

Kazu Hirata

2004-12-13  Kazu Hirata  <kazu@cs.umass.edu>

	* expr.h (expand_modifier): Define EXPAND_STACK_PARM as 1.

Index: expr.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.h,v
retrieving revision 1.182
diff -u -d -p -r1.182 expr.h
--- expr.h	4 Dec 2004 00:20:30 -0000	1.182
+++ expr.h	5 Dec 2004 20:38:45 -0000
@@ -41,8 +41,7 @@ Software Foundation, 59 Temple Place - S
 
 /* This is the 4th arg to `expand_expr'.
    EXPAND_STACK_PARM means we are possibly expanding a call param onto
-   the stack.  Choosing a value of 2 isn't special;  It just allows
-   some code optimization in store_expr.
+   the stack.
    EXPAND_SUM means it is ok to return a PLUS rtx or MULT rtx.
    EXPAND_INITIALIZER is similar but also record any labels on forced_labels.
    EXPAND_CONST_ADDRESS means it is ok to return a MEM whose address
@@ -50,7 +49,7 @@ Software Foundation, 59 Temple Place - S
    EXPAND_WRITE means we are only going to write to the resulting rtx.
    EXPAND_MEMORY means we are interested in a memory result, even if
     the memory is constant and we could have propagated a constant value.  */
-enum expand_modifier {EXPAND_NORMAL = 0, EXPAND_STACK_PARM = 2, EXPAND_SUM,
+enum expand_modifier {EXPAND_NORMAL = 0, EXPAND_STACK_PARM, EXPAND_SUM,
 		      EXPAND_CONST_ADDRESS, EXPAND_INITIALIZER, EXPAND_WRITE,
 		      EXPAND_MEMORY};
 



More information about the Gcc-patches mailing list