diff mbox

[AArch64,TLSLE,1/N] Rename SYMBOL_SMALL_TPREL to SYMBOL_TLSLE

Message ID n99egmbwl6x.fsf@arm.com
State New
Headers show

Commit Message

Jiong Wang May 20, 2015, 10:56 a.m. UTC
For AArch64, TLS local-exec mode for all memory model (tiny/small/large)
is actually the same.

TLS LE Instruction generation depends on how big tls section is instead
of the memory model used.

The four instruction sequences we can implement based on relocations
provided:

sequence 1
==========
  add  t0, tp, #:tprel_lo12:x1           R_AARCH64_TLSLE_ADD_TPREL_LO12       x1

sequence 2
==========
  add  t0, tp, #:tprel_hi12:x1, lsl #12  R_AARCH64_TLSLE_ADD_TPREL_HI12       x2
  add  t0, #:tprel_lo12_nc:x1            R_AARCH64_TLSLE_ADD_TPREL_LO12_NC    x2

sequence 2
==========
  movz t0, #:tprel_g1:x3                 R_AARCH64_TLSLE_MOVW_TPREL_G1        x3
  movk t0, #:tprel_g0_nc:x3              R_AARCH64_TLSLE_MOVW_TPREL_G0_NC     x3
  add  t0, tp, t0

sequence 4
==========
  movz t0, #:tprel_g2:x4                 R_AARCH64_TLSLE_MOVW_TPREL_G2        x4
  movk t0, #:tprel_g1_nc:x4              R_AARCH64_TLSLE_MOVW_TPREL_G1_NC     x4
  movk t0, #:tprel_g0_nc:x4              R_AARCH64_TLSLE_MOVW_TPREL_G0_NC     x4
  add  t0, t0, tp

Under tiny model, we still can't use the simplest sequence 1, because
the allowed loadable segment size is 1M, while 12bit offset (4K) still
can't access.

While even under large model, if the tls-size is small than 4K, we still can use
the simplest sequence 1 for local-exec.

This is the first patch to cleanup TLSLE support which generalize
TLSE variable/marco name for all memory models.

OK for trunk?

2015-05-19  Marcus Shawcroft  <marcus.shawcroft@arm.com>
            Jiong Wang  <jiong.wang@arm.com>

gcc/
  * config/aarch64/aarch64-protos.h (arch64_symbol_type): Rename
  SYMBOL_SMALL_TPREL to SYMBOL_TLSLE.
  (aarch64_symbol_context): Ditto.
  * config/aarch64/aarch64.c (aarch64_load_symref_appropriately): Ditto.
  (aarch64_expand_mov_immediate): Ditto.
  (aarch64_print_operand): Ditto.
  (aarch64_classify_tls_symbol): Ditto.

Comments

Marcus Shawcroft June 26, 2015, 2:28 p.m. UTC | #1
On 20 May 2015 at 11:56, Jiong Wang <jiong.wang@arm.com> wrote:

> 2015-05-19  Marcus Shawcroft  <marcus.shawcroft@arm.com>
>             Jiong Wang  <jiong.wang@arm.com>
>
> gcc/
>   * config/aarch64/aarch64-protos.h (arch64_symbol_type): Rename
>   SYMBOL_SMALL_TPREL to SYMBOL_TLSLE.
>   (aarch64_symbol_context): Ditto.
>   * config/aarch64/aarch64.c (aarch64_load_symref_appropriately): Ditto.
>   (aarch64_expand_mov_immediate): Ditto.
>   (aarch64_print_operand): Ditto.
>   (aarch64_classify_tls_symbol): Ditto.
> --
> Regards,
> Jiong
>

OK /Marcus
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index 931c8b8..12cc5ee 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -64,7 +64,7 @@  enum aarch64_symbol_context
    SYMBOL_SMALL_TLSGD
    SYMBOL_SMALL_TLSDESC
    SYMBOL_SMALL_GOTTPREL
-   SYMBOL_SMALL_TPREL
+   SYMBOL_TLSLE
    Each of of these represents a thread-local symbol, and corresponds to the
    thread local storage relocation operator for the symbol being referred to.
 
@@ -98,9 +98,9 @@  enum aarch64_symbol_type
   SYMBOL_SMALL_TLSGD,
   SYMBOL_SMALL_TLSDESC,
   SYMBOL_SMALL_GOTTPREL,
-  SYMBOL_SMALL_TPREL,
   SYMBOL_TINY_ABSOLUTE,
   SYMBOL_TINY_GOT,
+  SYMBOL_TLSLE,
   SYMBOL_FORCE_TO_MEM
 };
 
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index c7b936d..99a534c 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -978,7 +978,7 @@  aarch64_load_symref_appropriately (rtx dest, rtx imm,
 	return;
       }
 
-    case SYMBOL_SMALL_TPREL:
+    case SYMBOL_TLSLE:
       {
 	rtx tp = aarch64_load_tp (NULL);
 
@@ -1537,9 +1537,9 @@  aarch64_expand_mov_immediate (rtx dest, rtx imm)
 	    }
 	  /* FALLTHRU */
 
-        case SYMBOL_SMALL_TPREL:
 	case SYMBOL_SMALL_ABSOLUTE:
 	case SYMBOL_TINY_ABSOLUTE:
+	case SYMBOL_TLSLE:
 	  aarch64_load_symref_appropriately (dest, imm, sty);
 	  return;
 
@@ -4416,7 +4416,7 @@  aarch64_print_operand (FILE *f, rtx x, char code)
 	  asm_fprintf (asm_out_file, ":gottprel:");
 	  break;
 
-	case SYMBOL_SMALL_TPREL:
+	case SYMBOL_TLSLE:
 	  asm_fprintf (asm_out_file, ":tprel:");
 	  break;
 
@@ -4449,7 +4449,7 @@  aarch64_print_operand (FILE *f, rtx x, char code)
 	  asm_fprintf (asm_out_file, ":gottprel_lo12:");
 	  break;
 
-	case SYMBOL_SMALL_TPREL:
+	case SYMBOL_TLSLE:
 	  asm_fprintf (asm_out_file, ":tprel_lo12_nc:");
 	  break;
 
@@ -4467,7 +4467,7 @@  aarch64_print_operand (FILE *f, rtx x, char code)
 
       switch (aarch64_classify_symbolic_expression (x, SYMBOL_CONTEXT_ADR))
 	{
-	case SYMBOL_SMALL_TPREL:
+	case SYMBOL_TLSLE:
 	  asm_fprintf (asm_out_file, ":tprel_hi12:");
 	  break;
 	default:
@@ -7212,7 +7212,7 @@  aarch64_classify_tls_symbol (rtx x)
       return SYMBOL_SMALL_GOTTPREL;
 
     case TLS_MODEL_LOCAL_EXEC:
-      return SYMBOL_SMALL_TPREL;
+      return SYMBOL_TLSLE;
 
     case TLS_MODEL_EMULATED:
     case TLS_MODEL_NONE: