aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2011-09-20 01:57:57 +0930
committerMichael Meissner <meissner@gcc.gnu.org>2011-09-19 16:27:57 +0000
commit0b5f3ce78fafdd62e9949f6dd697465cc437c23c (patch)
treea66f6ce676d317754ff1f8b7995795b6ff262655
parent5a1357fbe0ab7a5090d52796850e07b354dcef90 (diff)
downloadgcc-0b5f3ce78fafdd62e9949f6dd697465cc437c23c.zip
gcc-0b5f3ce78fafdd62e9949f6dd697465cc437c23c.tar.gz
gcc-0b5f3ce78fafdd62e9949f6dd697465cc437c23c.tar.bz2
Patch for 50341
Co-Authored-By: Michael Meissner <meissner@linux.vnet.ibm.com> From-SVN: r178977
-rw-r--r--gcc/ChangeLog16
-rw-r--r--gcc/config/rs6000/rs6000.md124
2 files changed, 30 insertions, 110 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5c65c31..347d74e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,19 @@
+2011-09-19 Alan Modra <amodra@gmail.com>
+ Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/50341
+ * config/rs6000/rs6000.md (call_indirect_aix<ptrsize>): Do not
+ split the load of the indirect function's TOC from the call to
+ prevent the compiler from moving the load of the new TOC above
+ code that references the current function's TOC.
+ (call_indirect_aix<ptrsize>_internal): Ditto.
+ (call_indirect_aix<ptrsize>_nor11): Ditto.
+ (call_indirect_aix<ptrsize>_internal2): Ditto.
+ (call_value_indirect_aix<ptrsize>): Ditto.
+ (call_value_indirect_aix<ptrsize>_internal): Ditto.
+ (call_value_indirect_aix<ptrsize>_nor11): Ditto.
+ (call_value_indirect_aix<ptrsize>_internal2): Ditto.
+
2011-09-19 Jakub Jelinek <jakub@redhat.com>
* config/i386/sse.md (*sse4_1_extractps): Change into
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 3db67a53..a2e6fdc 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -12379,169 +12379,73 @@
;; Operand2 is the location in the function descriptor to load r2 from
;; Operand3 is the stack location to hold the current TOC pointer
-(define_insn_and_split "call_indirect_aix<ptrsize>"
+(define_insn "call_indirect_aix<ptrsize>"
[(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
(match_operand 1 "" "g,g"))
(use (match_operand:P 2 "memory_operand" "m,m"))
- (use (match_operand:P 3 "memory_operand" "m,m"))
+ (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "m,m"))
(use (reg:P STATIC_CHAIN_REGNUM))
(clobber (reg:P LR_REGNO))]
"DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
- "#"
- "&& reload_completed"
- [(set (reg:P TOC_REGNUM) (match_dup 2))
- (parallel [(call (mem:SI (match_dup 0))
- (match_dup 1))
- (use (reg:P TOC_REGNUM))
- (use (reg:P STATIC_CHAIN_REGNUM))
- (use (match_dup 3))
- (set (reg:P TOC_REGNUM) (match_dup 3))
- (clobber (reg:P LR_REGNO))])]
- ""
+ "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
[(set_attr "type" "jmpreg")
(set_attr "length" "12")])
-(define_insn "*call_indirect_aix<ptrsize>_internal"
- [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
- (match_operand 1 "" "g,g"))
- (use (reg:P TOC_REGNUM))
- (use (reg:P STATIC_CHAIN_REGNUM))
- (use (match_operand:P 2 "memory_operand" "m,m"))
- (set (reg:P TOC_REGNUM) (match_dup 2))
- (clobber (reg:P LR_REGNO))]
- "DEFAULT_ABI == ABI_AIX && reload_completed
- && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
- "b%T0l\;<ptrload> 2,%2"
- [(set_attr "type" "jmpreg")
- (set_attr "length" "8")])
-
-;; Like call_indirect_aix<ptrsize>, except don't load the static chain
+;; Like call_indirect_aix<ptrsize>, but no use of the static chain
;; Operand0 is the addresss of the function to call
;; Operand1 is the flag for System V.4 for unprototyped or FP registers
;; Operand2 is the location in the function descriptor to load r2 from
;; Operand3 is the stack location to hold the current TOC pointer
-(define_insn_and_split "call_indirect_aix<ptrsize>_nor11"
+(define_insn "call_indirect_aix<ptrsize>_nor11"
[(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
(match_operand 1 "" "g,g"))
(use (match_operand:P 2 "memory_operand" "m,m"))
- (use (match_operand:P 3 "memory_operand" "m,m"))
+ (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "m,m"))
(clobber (reg:P LR_REGNO))]
"DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
- "#"
- "&& reload_completed"
- [(set (reg:P TOC_REGNUM) (match_dup 2))
- (parallel [(call (mem:SI (match_dup 0))
- (match_dup 1))
- (use (reg:P TOC_REGNUM))
- (use (match_dup 3))
- (set (reg:P TOC_REGNUM) (match_dup 3))
- (clobber (reg:P LR_REGNO))])]
- ""
+ "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
[(set_attr "type" "jmpreg")
(set_attr "length" "12")])
-(define_insn "*call_indirect_aix<ptrsize>_internal2"
- [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
- (match_operand 1 "" "g,g"))
- (use (reg:P TOC_REGNUM))
- (use (match_operand:P 2 "memory_operand" "m,m"))
- (set (reg:P TOC_REGNUM) (match_dup 2))
- (clobber (reg:P LR_REGNO))]
- "DEFAULT_ABI == ABI_AIX && reload_completed
- && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
- "b%T0l\;<ptrload> 2,%2"
- [(set_attr "type" "jmpreg")
- (set_attr "length" "8")])
-
;; Operand0 is the return result of the function
;; Operand1 is the addresss of the function to call
;; Operand2 is the flag for System V.4 for unprototyped or FP registers
;; Operand3 is the location in the function descriptor to load r2 from
;; Operand4 is the stack location to hold the current TOC pointer
-(define_insn_and_split "call_value_indirect_aix<ptrsize>"
+(define_insn "call_value_indirect_aix<ptrsize>"
[(set (match_operand 0 "" "")
(call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
(match_operand 2 "" "g,g")))
(use (match_operand:P 3 "memory_operand" "m,m"))
- (use (match_operand:P 4 "memory_operand" "m,m"))
+ (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "m,m"))
(use (reg:P STATIC_CHAIN_REGNUM))
(clobber (reg:P LR_REGNO))]
"DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
- "#"
- "&& reload_completed"
- [(set (reg:P TOC_REGNUM) (match_dup 3))
- (parallel [(set (match_dup 0)
- (call (mem:SI (match_dup 1))
- (match_dup 2)))
- (use (reg:P TOC_REGNUM))
- (use (reg:P STATIC_CHAIN_REGNUM))
- (use (match_dup 4))
- (set (reg:P TOC_REGNUM) (match_dup 4))
- (clobber (reg:P LR_REGNO))])]
- ""
+ "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
[(set_attr "type" "jmpreg")
(set_attr "length" "12")])
-(define_insn "*call_value_indirect_aix<ptrsize>_internal"
- [(set (match_operand 0 "" "")
- (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
- (match_operand 2 "" "g,g")))
- (use (reg:P TOC_REGNUM))
- (use (reg:P STATIC_CHAIN_REGNUM))
- (use (match_operand:P 3 "memory_operand" "m,m"))
- (set (reg:P TOC_REGNUM) (match_dup 3))
- (clobber (reg:P LR_REGNO))]
- "DEFAULT_ABI == ABI_AIX && reload_completed
- && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
- "b%T1l\;<ptrload> 2,%3"
- [(set_attr "type" "jmpreg")
- (set_attr "length" "8")])
-
-;; Like call_value_indirect_aix<ptrsize>, but don't load the static chain
+;; Like call_value_indirect_aix<ptrsize>, but no use of the static chain
;; Operand0 is the return result of the function
;; Operand1 is the addresss of the function to call
;; Operand2 is the flag for System V.4 for unprototyped or FP registers
;; Operand3 is the location in the function descriptor to load r2 from
;; Operand4 is the stack location to hold the current TOC pointer
-(define_insn_and_split "call_value_indirect_aix<ptrsize>_nor11"
+(define_insn "call_value_indirect_aix<ptrsize>_nor11"
[(set (match_operand 0 "" "")
(call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
(match_operand 2 "" "g,g")))
(use (match_operand:P 3 "memory_operand" "m,m"))
- (use (match_operand:P 4 "memory_operand" "m,m"))
+ (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "m,m"))
(clobber (reg:P LR_REGNO))]
"DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
- "#"
- "&& reload_completed"
- [(set (reg:P TOC_REGNUM) (match_dup 3))
- (parallel [(set (match_dup 0)
- (call (mem:SI (match_dup 1))
- (match_dup 2)))
- (use (reg:P TOC_REGNUM))
- (use (match_dup 4))
- (set (reg:P TOC_REGNUM) (match_dup 4))
- (clobber (reg:P LR_REGNO))])]
- ""
+ "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
[(set_attr "type" "jmpreg")
(set_attr "length" "12")])
-(define_insn "*call_value_indirect_aix<ptrsize>_internal2"
- [(set (match_operand 0 "" "")
- (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
- (match_operand 2 "" "g,g")))
- (use (reg:P TOC_REGNUM))
- (use (match_operand:P 3 "memory_operand" "m,m"))
- (set (reg:P TOC_REGNUM) (match_dup 3))
- (clobber (reg:P LR_REGNO))]
- "DEFAULT_ABI == ABI_AIX && reload_completed
- && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
- "b%T1l\;<ptrload> 2,%3"
- [(set_attr "type" "jmpreg")
- (set_attr "length" "8")])
-
;; Call to function which may be in another module. Restore the TOC
;; pointer (r2) after the call unless this is System V.
;; Operand2 is nonzero if we are using the V.4 calling sequence and