pop_operand

Richard Henderson rth@cygnus.com
Tue Jan 19 22:41:00 GMT 1999


This adds a pop_operand to mirror push_operand.


r~


        * recog.c (pop_operand): New function.
        * recog.h (pop_operand): Declare it.
        * genrecog.c (preds): Define it.

Index: recog.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/recog.c,v
retrieving revision 1.64
retrieving revision 1.64.4.1
diff -c -p -d -r1.64 -r1.64.4.1
*** recog.c	1998/11/23 08:14:19	1.64
--- recog.c	1998/12/07 22:50:56	1.64.4.1
*************** Boston, MA 02111-1307, USA.  */
*** 41,46 ****
--- 41,54 ----
  #endif
  #endif
  
+ #ifndef STACK_POP_CODE
+ #ifdef STACK_GROWS_DOWNWARD
+ #define STACK_POP_CODE POST_INC
+ #else
+ #define STACK_POP_CODE POST_DEC
+ #endif
+ #endif
+ 
  static void validate_replace_rtx_1	PROTO((rtx *, rtx, rtx, rtx));
  static rtx *find_single_use_1		PROTO((rtx, rtx *));
  static rtx *find_constant_term_loc	PROTO((rtx *));
*************** push_operand (op, mode)
*** 1174,1179 ****
--- 1182,1212 ----
    op = XEXP (op, 0);
  
    if (GET_CODE (op) != STACK_PUSH_CODE)
+     return 0;
+ 
+   return XEXP (op, 0) == stack_pointer_rtx;
+ }
+ 
+ /* Return 1 if OP is a valid operand that stands for popping a
+    value of mode MODE off the stack.
+ 
+    The main use of this function is as a predicate in match_operand
+    expressions in the machine description.  */
+ 
+ int
+ pop_operand (op, mode)
+      rtx op;
+      enum machine_mode mode;
+ {
+   if (GET_CODE (op) != MEM)
+     return 0;
+ 
+   if (GET_MODE (op) != mode)
+     return 0;
+ 
+   op = XEXP (op, 0);
+ 
+   if (GET_CODE (op) != STACK_POP_CODE)
      return 0;
  
    return XEXP (op, 0) == stack_pointer_rtx;
Index: recog.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/recog.h,v
retrieving revision 1.18
retrieving revision 1.18.4.1
diff -c -p -d -r1.18 -r1.18.4.1
*** recog.h	1998/11/23 08:14:19	1.18
--- recog.h	1998/12/07 22:50:56	1.18.4.1
*************** extern int const_double_operand		PROTO((
*** 53,58 ****
--- 53,59 ----
  extern int nonimmediate_operand		PROTO((rtx, enum machine_mode));
  extern int nonmemory_operand		PROTO((rtx, enum machine_mode));
  extern int push_operand			PROTO((rtx, enum machine_mode));
+ extern int pop_operand			PROTO((rtx, enum machine_mode));
  extern int memory_operand		PROTO((rtx, enum machine_mode));
  extern int indirect_operand		PROTO((rtx, enum machine_mode));
  extern int mode_independent_operand	PROTO((rtx, enum machine_mode));
Index: genrecog.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/genrecog.c,v
retrieving revision 1.28
diff -c -p -d -r1.28 genrecog.c
*** genrecog.c	1999/01/19 20:24:22	1.28
--- genrecog.c	1999/01/20 05:54:39
*************** static struct pred_table
*** 161,166 ****
--- 161,167 ----
       {"nonmemory_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF,
  			    LABEL_REF, SUBREG, REG}},
       {"push_operand", {MEM}},
+      {"pop_operand", {MEM}},
       {"memory_operand", {SUBREG, MEM}},
       {"indirect_operand", {SUBREG, MEM}},
       {"comparison_operator", {EQ, NE, LE, LT, GE, GT, LEU, LTU, GEU, GTU}},



More information about the Gcc-patches mailing list