OSDN Git Service

Patch for 50341
authormeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 19 Sep 2011 16:27:57 +0000 (16:27 +0000)
committermeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 19 Sep 2011 16:27:57 +0000 (16:27 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178977 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/rs6000/rs6000.md

index 5c65c31..347d74e 100644 (file)
@@ -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
index 3db67a5..a2e6fdc 100644 (file)
 ;; 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