Message ID | n99oaha7bl8.fsf@arm.com |
---|---|
State | New |
Headers | show |
On 10/09/15 12:28, Jiong Wang wrote: > TLS instruction sequences are always with fixed format, there is no need > to use operand modifier, we can hardcode the relocation modifiers into > instruction pattern, all those redundant checks in aarch64_print_operand > can be removed. > > OK for trunk? > > 2015-09-10 Jiong Wang <jiong.wang@arm.com> > > gcc/ > * config/aarch64/aarch64.md (ldr_got_tiny): Hardcode relocation > modifers. > (tlsgd_small): Likewise. > (tlsgd_tiny): Likewise. > (tlsie_small_<mode>): Likewise. > (tlsie_small_sidi): Likewise. > (tlsie_tiny_<mode>): Likewise. > (tlsie_tiny_sidi): Likewise. > (tlsle12_<mode>): Likewise. > (tlsle24_<mode>): Likewise. > (tlsdesc_small_<mode>): Likewise. > (tlsdesc_small_pseudo_<mode>): Likewise. > (tlsdesc_tiny_<mode>): Likewise. > (tlsdesc_tiny_pseudo_<mode>): Likewise. > * config/aarch64/aarch64.c (aarch64_print_operand): Delete useless > check on 'A', 'L', 'G'. > Ping ~ There is no functional change by this patch, but just cleanup of those unnecessary use of output modifiers. All these instruction sequences are always with fixed format, we can just hardcode the relocation modifiers into instruction patterns, then all those redundant checks in aarch64_print_operand can be removed.
On 10 September 2015 at 12:28, Jiong Wang <jiong.wang@arm.com> wrote: > > TLS instruction sequences are always with fixed format, there is no need > to use operand modifier, we can hardcode the relocation modifiers into > instruction pattern, all those redundant checks in aarch64_print_operand > can be removed. > > OK for trunk? > > 2015-09-10 Jiong Wang <jiong.wang@arm.com> > > gcc/ > * config/aarch64/aarch64.md (ldr_got_tiny): Hardcode relocation > modifers. > (tlsgd_small): Likewise. > (tlsgd_tiny): Likewise. > (tlsie_small_<mode>): Likewise. > (tlsie_small_sidi): Likewise. > (tlsie_tiny_<mode>): Likewise. > (tlsie_tiny_sidi): Likewise. > (tlsle12_<mode>): Likewise. > (tlsle24_<mode>): Likewise. > (tlsdesc_small_<mode>): Likewise. > (tlsdesc_small_pseudo_<mode>): Likewise. > (tlsdesc_tiny_<mode>): Likewise. > (tlsdesc_tiny_pseudo_<mode>): Likewise. > * config/aarch64/aarch64.c (aarch64_print_operand): Delete useless > check on 'A', 'L', 'G'. Hi, Is there a particular reason for wanting to change this? Cheers /Marcus
On 17/12/15 11:44, Marcus Shawcroft wrote: > On 10 September 2015 at 12:28, Jiong Wang <jiong.wang@arm.com> wrote: >> TLS instruction sequences are always with fixed format, there is no need >> to use operand modifier, we can hardcode the relocation modifiers into >> instruction pattern, all those redundant checks in aarch64_print_operand >> can be removed. >> >> OK for trunk? >> >> 2015-09-10 Jiong Wang <jiong.wang@arm.com> >> >> gcc/ >> * config/aarch64/aarch64.md (ldr_got_tiny): Hardcode relocation >> modifers. >> (tlsgd_small): Likewise. >> (tlsgd_tiny): Likewise. >> (tlsie_small_<mode>): Likewise. >> (tlsie_small_sidi): Likewise. >> (tlsie_tiny_<mode>): Likewise. >> (tlsie_tiny_sidi): Likewise. >> (tlsle12_<mode>): Likewise. >> (tlsle24_<mode>): Likewise. >> (tlsdesc_small_<mode>): Likewise. >> (tlsdesc_small_pseudo_<mode>): Likewise. >> (tlsdesc_tiny_<mode>): Likewise. >> (tlsdesc_tiny_pseudo_<mode>): Likewise. >> * config/aarch64/aarch64.c (aarch64_print_operand): Delete useless >> check on 'A', 'L', 'G'. > Hi, Is there a particular reason for wanting to change this? It's because operand modifier is only need if "different variants of the assembler require different syntax." These TLS RTL patterns have fixed assembler string, we just need to output them literally. If we don't do this cleanup, we will end up doing redundant checking in aarch64_print_operand. For example, the 'L' operand modifier is used by various TLS patterns, if it's for "tlsie_tiny_sidi" then we should output ":gottprel:", if it's for tlsie_small_sidi, we should output ":gottprel_lo12:", and similar for quite a few others. We have classified those symbols into different types, so different TLS unspec patterns generated for each one. The use of operand modifer 'L' is purely revert the classification we have done, and re-do the classification in aarch64_print_operand uncessarily. case 'L': switch (aarch64_classify_symbolic_expression (x)) { case SYMBOL_SMALL_GOT_4G: ... case SYMBOL_SMALL_TLSGD: ... case SYMBOL_SMALL_TLSDESC: ... case SYMBOL_SMALL_TLSIE: ... }
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 5ba0215..5945d9c 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -4640,23 +4640,6 @@ aarch64_print_operand (FILE *f, rtx x, char code) asm_fprintf (asm_out_file, ":tlsgd:"); break; - case SYMBOL_TINY_TLSDESC: - case SYMBOL_SMALL_TLSDESC: - asm_fprintf (asm_out_file, ":tlsdesc:"); - break; - - case SYMBOL_SMALL_TLSIE: - asm_fprintf (asm_out_file, ":gottprel:"); - break; - - case SYMBOL_TLSLE24: - asm_fprintf (asm_out_file, ":tprel:"); - break; - - case SYMBOL_TINY_GOT: - gcc_unreachable (); - break; - default: break; } @@ -4666,38 +4649,9 @@ aarch64_print_operand (FILE *f, rtx x, char code) case 'L': switch (aarch64_classify_symbolic_expression (x)) { - case SYMBOL_SMALL_GOT_4G: - asm_fprintf (asm_out_file, ":lo12:"); - break; - case SYMBOL_SMALL_TLSGD: asm_fprintf (asm_out_file, ":tlsgd_lo12:"); break; - - case SYMBOL_SMALL_TLSDESC: - asm_fprintf (asm_out_file, ":tlsdesc_lo12:"); - break; - - case SYMBOL_SMALL_TLSIE: - asm_fprintf (asm_out_file, ":gottprel_lo12:"); - break; - - case SYMBOL_TLSLE12: - asm_fprintf (asm_out_file, ":tprel_lo12:"); - break; - - case SYMBOL_TLSLE24: - asm_fprintf (asm_out_file, ":tprel_lo12_nc:"); - break; - - case SYMBOL_TINY_GOT: - asm_fprintf (asm_out_file, ":got:"); - break; - - case SYMBOL_TINY_TLSIE: - asm_fprintf (asm_out_file, ":gottprel:"); - break; - default: break; } @@ -4705,15 +4659,6 @@ aarch64_print_operand (FILE *f, rtx x, char code) break; case 'G': - - switch (aarch64_classify_symbolic_expression (x)) - { - case SYMBOL_TLSLE24: - asm_fprintf (asm_out_file, ":tprel_hi12:"); - break; - default: - break; - } output_addr_const (asm_out_file, x); break; diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 4a6bf2d..b808f84 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -4529,7 +4529,7 @@ (unspec:DI [(match_operand:DI 1 "aarch64_valid_symref" "S")] UNSPEC_GOTTINYPIC))] "" - "ldr\\t%0, %L1" + "ldr\\t%0, :got:%1" [(set_attr "type" "load1")] ) @@ -4571,7 +4571,7 @@ (unspec:PTR [(match_operand 1 "aarch64_tls_ie_symref" "S")] UNSPEC_GOTSMALLTLS))] "" - "adrp\\t%0, %A1\;ldr\\t%<w>0, [%0, #%L1]" + "adrp\\t%0, :gottprel:%1\;ldr\\t%<w>0, [%0, #:gottprel_lo12:%1]" [(set_attr "type" "load1") (set_attr "length" "8")] ) @@ -4582,7 +4582,7 @@ (unspec:SI [(match_operand 1 "aarch64_tls_ie_symref" "S")] UNSPEC_GOTSMALLTLS)))] "" - "adrp\\t%0, %A1\;ldr\\t%w0, [%0, #%L1]" + "adrp\\t%0, :gottprel:%1\;ldr\\t%w0, [%0, #:gottprel_lo12:%1]" [(set_attr "type" "load1") (set_attr "length" "8")] ) @@ -4593,7 +4593,7 @@ (match_operand:PTR 2 "register_operand" "r")] UNSPEC_GOTTINYTLS))] "" - "ldr\\t%<w>0, %L1\;add\\t%<w>0, %<w>0, %<w>2" + "ldr\\t%<w>0, :gottprel:%1\;add\\t%<w>0, %<w>0, %<w>2" [(set_attr "type" "multiple") (set_attr "length" "8")] ) @@ -4606,7 +4606,7 @@ ] UNSPEC_GOTTINYTLS)))] "" - "ldr\\t%w0, %L1\;add\\t%<w>0, %<w>0, %<w>2" + "ldr\\t%w0, :gottprel:%1\;add\\t%<w>0, %<w>0, %<w>2" [(set_attr "type" "multiple") (set_attr "length" "8")] ) @@ -4617,7 +4617,7 @@ (match_operand 2 "aarch64_tls_le_symref" "S")] UNSPEC_TLSLE12))] "" - "add\\t%<w>0, %<w>1, #%L2"; + "add\\t%<w>0, %<w>1, #:tprel_lo12:%2"; [(set_attr "type" "alu_sreg") (set_attr "length" "4")] ) @@ -4628,7 +4628,7 @@ (match_operand 2 "aarch64_tls_le_symref" "S")] UNSPEC_TLSLE24))] "" - "add\\t%<w>0, %<w>1, #%G2, lsl #12\;add\\t%<w>0, %<w>0, #%L2" + "add\\t%<w>0, %<w>1, #:tprel_hi12:%2, lsl #12\;add\\t%<w>0, %<w>0, #:tprel_lo12_nc:%2" [(set_attr "type" "multiple") (set_attr "length" "8")] ) @@ -4661,7 +4661,7 @@ (clobber (reg:CC CC_REGNUM)) (clobber (match_scratch:DI 1 "=r"))] "TARGET_TLS_DESC" - "adrp\\tx0, %A0\;ldr\\t%<w>1, [x0, #%L0]\;add\\t<w>0, <w>0, %L0\;.tlsdesccall\\t%0\;blr\\t%1" + "adrp\\tx0, :tlsdesc:%0\;ldr\\t%<w>1, [x0, #:tlsdesc_lo12:%0]\;add\\t<w>0, <w>0, :tlsdesc_lo12:%0\;.tlsdesccall\\t%0\;blr\\t%1" [(set_attr "type" "call") (set_attr "length" "16")]) @@ -4680,7 +4680,7 @@ (clobber (reg:CC CC_REGNUM)) (clobber (match_scratch:DI 2 "=r"))] "TARGET_TLS_DESC" - "adrp\\t<w>0, %A1\;ldr\\t%<w>2, [%<w>0, #%L1]\;add\\t%<w>0, %<w>0, %L1\;.tlsdesccall\\t%1\;blr\\t%2" + "adrp\\t<w>0, :tlsdesc:%1\;ldr\\t%<w>2, [%<w>0, #:tlsdesc_lo12:%1]\;add\\t%<w>0, %<w>0, :tlsdesc_lo12:%1\;.tlsdesccall\\t%1\;blr\\t%2" [(set_attr "type" "call") (set_attr "length" "16")]) @@ -4692,7 +4692,7 @@ (clobber (reg:CC CC_REGNUM)) (clobber (match_scratch:DI 1 "=r"))] "TARGET_TLS_DESC" - "ldr\t%<w>1, #%A0;adr\t<w>0, %A0;.tlsdesccall\t%0;blr\t%1" + "ldr\t%<w>1, #:tlsdesc:%0;adr\t<w>0, :tlsdesc:%0;.tlsdesccall\t%0;blr\t%1" [(set_attr "type" "multiple") (set_attr "length" "12")]) @@ -4704,7 +4704,7 @@ (clobber (reg:CC CC_REGNUM)) (clobber (match_scratch:DI 2 "=r"))] "TARGET_TLS_DESC" - "ldr\t%<w>2, #%A1;adr\t%<w>0, %A1;.tlsdesccall\t%1;blr\t%2" + "ldr\t%<w>2, #:tlsdesc:%1;adr\t%<w>0, :tlsdesc:%1;.tlsdesccall\t%1;blr\t%2" [(set_attr "type" "multiple") (set_attr "length" "16")])