]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
predicates.md (call_register_no_elim_operand): New predicate.
authorUros Bizjak <ubizjak@gmail.com>
Sat, 14 Nov 2009 16:43:22 +0000 (17:43 +0100)
committerUros Bizjak <uros@gcc.gnu.org>
Sat, 14 Nov 2009 16:43:22 +0000 (17:43 +0100)
* 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: r154180

gcc/ChangeLog
gcc/config/i386/predicates.md

index 50045a5bc252936c2194669f1c0a15cf51a9f36d..efbcb8554430f22c529293bf49b1a7719b105f71 100644 (file)
@@ -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  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/41900
index 5a81557c63928eb0d28d5cab40cd8955c7cc062c..0d2b54a794d77382b7bb02aca48d701a4dde88ad 100644 (file)
                        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"
 ;; 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.