summaryrefslogtreecommitdiff
path: root/gcc/recog.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/recog.c')
-rw-r--r--gcc/recog.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/recog.c b/gcc/recog.c
index da80b864655..6d8db93e918 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -41,6 +41,14 @@ Boston, MA 02111-1307, USA. */
#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 *));
@@ -1200,6 +1208,31 @@ push_operand (op, mode)
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;
+}
+
/* Return 1 if ADDR is a valid memory address for mode MODE. */
int