public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [AArch64][TLSLE][5/N] Recognize -mtls-size
@ 2015-05-21 16:53 Jiong Wang
  2015-05-21 18:14 ` [AArch64][TLSLE][4/N] " Jiong Wang
  2015-06-26 15:25 ` [AArch64][TLSLE][5/N] " Marcus Shawcroft
  0 siblings, 2 replies; 10+ messages in thread
From: Jiong Wang @ 2015-05-21 16:53 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 763 bytes --]


This patch add -mtls-size option for AArch64. This option let user to do
finer control on code generation for various TLS model on AArch64.

For example, for TLS LE, user can specify smaller tls-size, for example
4K which is quite usual, to let AArch64 backend generate more efficient
instruction sequences.

Currently, -mtls-size accept all integer, then will translate it into
12(4K), 24(16M), 32(4G), 48(256TB) based on the value.

no functional change.

ok for trunk?

2015-05-20  Jiong Wang  <jiong.wang@arm.com>

gcc/
  * config/aarch64/aarch64.opt (mtls-size): New entry.
  * config/aarch64/aarch64.c (initialize_aarch64_tls_size): New function.
  * doc/invoke.texi (AArch64 Options): Document -mtls-size.
  
-- 
Regards,
Jiong


[-- Attachment #2: 1.patch --]
[-- Type: text/x-diff, Size: 3448 bytes --]

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 55b166c..e6aa0e1 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -6835,6 +6835,7 @@ aarch64_add_stmt_cost (void *data, int count, enum vect_cost_for_stmt kind,
 }
 
 static void initialize_aarch64_code_model (void);
+static void initialize_aarch64_tls_size (void);
 
 /* Parse the architecture extension string.  */
 
@@ -7068,6 +7069,7 @@ aarch64_override_options (void)
 #endif
 
   initialize_aarch64_code_model ();
+  initialize_aarch64_tls_size ();
 
   aarch64_build_bitmask_table ();
 
@@ -7173,6 +7175,36 @@ initialize_aarch64_code_model (void)
      aarch64_cmodel = aarch64_cmodel_var;
 }
 
+/* A checking mechanism for the implementation of the tls size.  */
+
+static void
+initialize_aarch64_tls_size (void)
+{
+  switch (aarch64_cmodel_var)
+    {
+    case AARCH64_CMODEL_TINY:
+      /* The maximum TLS size allowed under tiny is 1M.  */
+      if (aarch64_tls_size > 20)
+	aarch64_tls_size = 20;
+      break;
+    case AARCH64_CMODEL_SMALL:
+      /* The maximum TLS size allowed under small is 4G.  */
+      if (aarch64_tls_size > 32)
+	aarch64_tls_size = 32;
+      break;
+    case AARCH64_CMODEL_LARGE:
+      /* The maximum TLS size allowed under large is 16E.
+	 FIXME: 16E should be 64bit, we only support 48bit offset now.  */
+      if (aarch64_tls_size > 48)
+	aarch64_tls_size = 48;
+      break;
+    default:
+      gcc_unreachable ();
+    }
+
+  return;
+}
+
 /* Return true if SYMBOL_REF X binds locally.  */
 
 static bool
diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt
index 6d72ac2..e87a1f5 100644
--- a/gcc/config/aarch64/aarch64.opt
+++ b/gcc/config/aarch64/aarch64.opt
@@ -95,6 +95,11 @@ mtls-dialect=
 Target RejectNegative Joined Enum(tls_type) Var(aarch64_tls_dialect) Init(TLS_DESCRIPTORS)
 Specify TLS dialect
 
+mtls-size=
+Target RejectNegative Joined UInteger Var(aarch64_tls_size) Init(24)
+Specifies size of the TLS data area, default size is 16M. Accept any integer, but the value
+will be transformed into 12(4K), 24(16M), 32(4G), 48(256TB)
+
 march=
 Target RejectNegative ToLower Joined Var(aarch64_arch_string)
 -march=ARCH	Use features of architecture ARCH
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 117b5d9..1f96a4f 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -513,6 +513,7 @@ Objective-C and Objective-C++ Dialects}.
 -mstrict-align @gol
 -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer @gol
 -mtls-dialect=desc  -mtls-dialect=traditional @gol
+-mtls-size=@var{size} @gol
 -mfix-cortex-a53-835769  -mno-fix-cortex-a53-835769 @gol
 -mfix-cortex-a53-843419  -mno-fix-cortex-a53-843419 @gol
 -march=@var{name}  -mcpu=@var{name}  -mtune=@var{name}}
@@ -12390,6 +12391,13 @@ of TLS variables.  This is the default.
 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
 of TLS variables.
 
+@item -mtls-size=@var{size}
+@opindex mtls-size
+Specify the size of TLS area. You can specify smaller value to get better code
+generation for TLS variable access. Currently, we accept any integer, but will
+turn them into 12(4K), 24(16M), 32(4G), 48(256TB) according to the integer
+value.
+
 @item -mfix-cortex-a53-835769
 @itemx -mno-fix-cortex-a53-835769
 @opindex mfix-cortex-a53-835769

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-08-26 12:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-21 16:53 [AArch64][TLSLE][5/N] Recognize -mtls-size Jiong Wang
2015-05-21 18:14 ` [AArch64][TLSLE][4/N] " Jiong Wang
2015-06-26 15:25 ` [AArch64][TLSLE][5/N] " Marcus Shawcroft
2015-08-19 14:30   ` [AArch64][TLSLE][1/3] Add the option "-mtls-size" for AArch64 Jiong Wang
2015-08-19 14:37     ` [AArch64][TLSLE][2/3] " Jiong Wang
2015-08-19 16:34       ` [AArch64][TLSLE][2/3] Rename SYMBOL_TLSLE to SYMBOL_TLSLE24 Jiong Wang
2015-08-25  9:46       ` [AArch64][TLSLE][2/3] Add the option "-mtls-size" for AArch64 Marcus Shawcroft
2015-08-25 10:26     ` [AArch64][TLSLE][1/3] " Marcus Shawcroft
2015-08-25 14:19       ` Jiong Wang
2015-08-26 12:39         ` Marcus Shawcroft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).