aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2009-11-14 15:31:13 +0100
committerUros Bizjak <uros@gcc.gnu.org>2009-11-14 15:31:13 +0100
commit618cc62edbc70a017483bb686beac3ac3978a172 (patch)
tree3f155a1e3a33493ada0609f2c14854768d7821a5
parent2622268e442df72c1f26d2288f9dedaac00b05c5 (diff)
downloadgcc-618cc62edbc70a017483bb686beac3ac3978a172.zip
gcc-618cc62edbc70a017483bb686beac3ac3978a172.tar.gz
gcc-618cc62edbc70a017483bb686beac3ac3978a172.tar.bz2
predicates.md (call_register_no_elim_operand): New predicate.
* config/i386/predicates.md (call_register_no_elim_operand): New predicate. Reject stack register as valid call operand for 32bit targets. (call_insn_operand): Use call_register_no_elim_operand. From-SVN: r154178
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/i386/predicates.md18
2 files changed, 24 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 22640fa..ed5f059 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2009-11-14 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/predicates.md (call_register_no_elim_operand):
+ New predicate. Reject stack register as valid call operand
+ for 32bit targets.
+ (call_insn_operand): Use call_register_no_elim_operand.
+
2009-11-13 Richard Henderson <rth@redhat.com>
* function.c (stack_protect_prologue): Don't bypass expand_expr
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index b21e895..3ade8f5 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -533,6 +533,22 @@
FIRST_PSEUDO_REGISTER, LAST_VIRTUAL_REGISTER));
})
+;; P6 processors will jump to the address after the decrement when %esp
+;; is used as a call operand, so they will execute return address as a code.
+;; See Pentium Pro errata 70, Pentium 2 errata A33 and Pentium 3 errata E17.
+
+(define_predicate "call_register_no_elim_operand"
+ (match_operand 0 "register_operand")
+{
+ if (GET_CODE (op) == SUBREG)
+ op = SUBREG_REG (op);
+
+ if (!TARGET_64BIT && op == stack_pointer_rtx)
+ return 0;
+
+ return register_no_elim_operand (op, mode);
+})
+
;; Similarly, but include the stack pointer. This is used to prevent esp
;; from being used as an index reg.
(define_predicate "index_register_operand"
@@ -561,7 +577,7 @@
;; Test for a valid operand for a call instruction.
(define_predicate "call_insn_operand"
(ior (match_operand 0 "constant_call_address_operand")
- (ior (match_operand 0 "index_register_operand")
+ (ior (match_operand 0 "call_register_no_elim_operand")
(match_operand 0 "memory_operand"))))
;; Similarly, but for tail calls, in which we cannot allow memory references.