summaryrefslogtreecommitdiff
path: root/gcc/config/rs6000/rs6000.md
diff options
context:
space:
mode:
authorsegher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-02 01:29:26 +0000
committersegher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-02 01:29:26 +0000
commita255a4c3ad6682d39af62a36f90d7ea9797e0cc4 (patch)
treefe5d904153fd085c40646af0676d98536020e37e /gcc/config/rs6000/rs6000.md
parentf8e2139be1bdcde875e41c69ad00a18bf6449172 (diff)
downloadgcc-a255a4c3ad6682d39af62a36f90d7ea9797e0cc4.tar.gz
rs6000: Add "cannot_copy" attribute, use it (PR67788, PR67789)
After the shrink-wrapping patches the prologue will often be pushed "deeper" into the function, which in turn means the software trace cache pass will more often want to duplicate the basic block containing the prologue. This caused failures for 32-bit SVR4 with -msecure-plt PIC. This configuration uses the load_toc_v4_PIC_1 instruction, which creates assembler labels without using the normal machinery for that. If now the compiler decides to duplicate the insn, it will emit the same label twice. Boom. It isn't so easy to fix this to use labels the compiler knows about (let alone test that properly). Instead, this patch wires up a "cannot_copy" attribute to be used by TARGET_CANNOT_COPY_P, and sets that attribute on these insns we do not want copied. 2015-10-01 Segher Boessenkool <segher@kernel.crashing.org> PR target/67788 PR target/67789 * config/rs6000/rs6000.c (TARGET_CANNOT_COPY_INSN_P): New. (rs6000_cannot_copy_insn_p): New function. * config/rs6000/rs6000.md (cannot_copy): New attribute. (load_toc_v4_PIC_1_normal): Set cannot_copy. (load_toc_v4_PIC_1_476): Ditto. gcc/testsuite/ PR target/67788 PR target/67789 * gcc.target/powerpc/pr67789.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228366 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/rs6000/rs6000.md')
-rw-r--r--gcc/config/rs6000/rs6000.md9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index cfdb286a2cb..8c53c40aba7 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -226,6 +226,9 @@
(const_string "no"))
(const_string "no")))
+;; Is copying of this instruction disallowed?
+(define_attr "cannot_copy" "no,yes" (const_string "no"))
+
;; Define floating point instruction sub-types for use with Xfpu.md
(define_attr "fp_type" "fp_default,fp_addsub_s,fp_addsub_d,fp_mul_s,fp_mul_d,fp_div_s,fp_div_d,fp_maddsub_s,fp_maddsub_d,fp_sqrt_s,fp_sqrt_d" (const_string "fp_default"))
@@ -9130,7 +9133,8 @@
&& (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
"bcl 20,31,%0\\n%0:"
[(set_attr "type" "branch")
- (set_attr "length" "4")])
+ (set_attr "length" "4")
+ (set_attr "cannot_copy" "yes")])
(define_insn "load_toc_v4_PIC_1_476"
[(set (reg:SI LR_REGNO)
@@ -9148,7 +9152,8 @@
return templ;
}"
[(set_attr "type" "branch")
- (set_attr "length" "4")])
+ (set_attr "length" "4")
+ (set_attr "cannot_copy" "yes")])
(define_expand "load_toc_v4_PIC_1b"
[(parallel [(set (reg:SI LR_REGNO)