On 27 August 2015 at 10:54, Jiong Wang <[email protected]> wrote:
>
> As described this is the main implementaion patch.
>
> 2015-08-26 Jiong Wang <[email protected]>
>
> gcc/
> * configure.ac: Add check for binutils global dynamic tiny code model
> relocation support.
> * configure: Regenerate.
> * config.in: Regenerate.
> * config/aarch64/aarch64.md (tlsgd_tiny): New define_insn.
> * config/aarch64/aarch64-protos.h (aarch64_symbol_type): New
> enumeration SYMBOL_TINY_TLSGD.
> (aarch64_symbol_context): New comment on SYMBOL_TINY_TLSGD.
> * config/aarch64/aarch64.c (aarch64_classify_tls_symbol): Support
> SYMBOL_TINY_TLSGD.
> (aarch64_print_operand): Likewise.
> (aarch64_expand_mov_immediate): Likewise.
> (aarch64_load_symref_appropriately): Likewise.
>
> gcc/testsuite/
> * lib/target-supports.exp (check_effective_target_aarch64_tlsgdtiny):
> New effective check.
> * gcc.target/aarch64/tlsgd_small_1.c: New testcase.
> * gcc.target/aarch64/tlsgd_tiny_1.c: Likewise.
>
+#ifdef HAVE_AS_TINY_TLSGD_RELOCS
+ return SYMBOL_TINY_TLSGD;
+#else
+ return SYMBOL_SMALL_TLSGD;
+#endif
Rather than introduce blocks of conditional compilation it is better
to gate different behaviours with a test on a constant expression. In
this case add something like this:
#if define(HAVE_AS_TINY_TLSGD_RELOCS)
#define USE_TINY_TLSGD 1
#else
#define USE_TINY_TLSGD 0
#endif
up near the definition of TARGET_HAVE_TLS then write the above
fragment without using the preprocessor:
return USE_TINY_TLSGD ? SYMBOL_TINY_TLSGD : SYMBOL_SMALL_TLSGD;
or similar.
@@ -1024,6 +1024,7 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm,
return;
}
+ case SYMBOL_TINY_TLSGD:
case SYMBOL_SMALL_TLSGD:
{
rtx_insn *insns;
@@ -1031,7 +1032,10 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm,
rtx resolver = aarch64_tls_get_addr ();
start_sequence ();
- aarch64_emit_call_insn (gen_tlsgd_small (result, imm, resolver));
+ if (type == SYMBOL_SMALL_TLSGD)
+ aarch64_emit_call_insn (gen_tlsgd_small (result, imm, resolver));
+ else
+ aarch64_emit_call_insn (gen_tlsgd_tiny (result, imm, resolver));
insns = get_insns ();
end_sequence ();
Add a separate case statment for SYMBOL_TINY_TLSGD rather than reusing
the case statement for SYMBOL_SMALL_TLSGD and then needing to add
another test against symbol type within the body of the case
statement.
+(define_insn "tlsgd_tiny"
+ [(set (match_operand 0 "register_operand" "")
+ (call (mem:DI (match_operand:DI 2 "" "")) (const_int 1)))
+ (unspec:DI [(match_operand:DI 1 "aarch64_valid_symref" "S")]
UNSPEC_GOTTINYTLS)
+ (clobber (reg:DI LR_REGNUM))
+ ]
+ ""
+ "adr\tx0, %A1;bl\t%2;nop";
+ [(set_attr "type" "multiple")
+ (set_attr "length" "12")])
I don't think the explicit clobber LR_REGNUM is required since your
change last September:
https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02654.html
Thanks
/Marcus