public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, GCC][AArch64] Use Enums for TLS dialect option selection
@ 2012-06-01  8:57 Sofiane Naci
  2012-06-08  7:27 ` Marcus Shawcroft
  0 siblings, 1 reply; 3+ messages in thread
From: Sofiane Naci @ 2012-06-01  8:57 UTC (permalink / raw)
  To: gcc-patches

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

Hi,

This patch re-factors TLS dialect option selection in the AArch64 port to
use the generic support for enumerated option arguments.

Thanks
Sofiane

-----

2012-06-01  Sofiane Naci <sofiane.naci@arm.com>

	[AArch64] Use Enums for TLS option selection.

	* config/aarch64/aarch64-opts.h (enum aarch64_tls_type): New.
	* config/aarch64/aarch64.c
	(aarch64_tls_dialect): Remove.
	(tls_symbolic_operand_type): Update comment.
	(aarch64_override_options): Remove TLS option setup code.
	* config/aarch64/aarch64.h
	(TARGET_TLS_TRADITIONAL): Remove.
	(TARGET_TLS_DESC): Update definition.
	(enum tls_dialect): Remove.
	(enum tls_dialect aarch64_tls_dialect) Remove.
	* config/aarch64/aarch64.opt
	(tls_type): New.
	(mtls-dialect): Update.

[-- Attachment #2: aarch64-use-enums-for-tls.patch --]
[-- Type: application/octet-stream, Size: 3836 bytes --]

diff --git a/gcc/config/aarch64/aarch64-opts.h b/gcc/config/aarch64/aarch64-opts.h
index 98d4519..b5bdf37 100644
--- a/gcc/config/aarch64/aarch64-opts.h
+++ b/gcc/config/aarch64/aarch64-opts.h
@@ -35,4 +35,10 @@ enum aarch64_processor
   aarch64_none
 };
 
+/* TLS types.  */
+enum aarch64_tls_type {
+  TLS_TRADITIONAL,
+  TLS_DESCRIPTORS
+};
+
 #endif
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 34d0475..129684b 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -188,9 +188,6 @@ static const struct aarch64_option_extension all_extensions[] =
    increment address.  */
 static enum machine_mode aarch64_memory_reference_mode;
 
-/* TLS dialects.  */
-enum tls_dialect aarch64_tls_dialect = TLS_DIALECT_DESC;
-
 /* Used to force GTY into this file.  */
 static GTY(()) int gty_dummy;
 
@@ -390,7 +387,7 @@ tls_symbolic_operand_type (rtx addr)
    add  dest, tmp, #:tlsgd_lo12:imm
    bl   __tls_get_addr
 
-   Global Dynamic - TLS Desc:
+   Global Dynamic - TLS Descriptors:
    adrp dest, :tlsdesc:imm
    ldr  tmp, [dest, #:tlsdesc_lo12:imm]
    add  dest, dest, #:tlsdesc_lo12:imm
@@ -4625,16 +4622,6 @@ aarch64_override_options (void)
 
   aarch64_build_bitmask_table ();
 
-  if (aarch64_tls_dialect_string)
-    {
-      if (strcmp (aarch64_tls_dialect_string, "traditional") == 0)
-        aarch64_tls_dialect = TLS_DIALECT_TRADITIONAL;
-      else if (strcmp (aarch64_tls_dialect_string, "desc") == 0)
-        aarch64_tls_dialect = TLS_DIALECT_DESC;
-      else
-        error ("bad value (%s) for -mtls-dialect", aarch64_tls_dialect_string);
-    }
-
   /* This target defaults to strict volatile bitfields.  */
   if (flag_strict_volatile_bitfields < 0 && abi_version_at_least (2))
     flag_strict_volatile_bitfields = 1;
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index 4a39d0b..7ad18d1 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -792,14 +792,8 @@ enum aarch64_builtins
 #define HARD_REGNO_CALL_PART_CLOBBERED(REGNO, MODE) \
 		(FP_REGNUM_P (REGNO) && GET_MODE_SIZE (MODE) > 8)
 
-#define TARGET_TLS_TRADITIONAL	(aarch64_tls_dialect == TLS_DIALECT_TRADITIONAL)
-#define TARGET_TLS_DESC		(aarch64_tls_dialect == TLS_DIALECT_DESC)
-
-enum tls_dialect
-{
-  TLS_DIALECT_TRADITIONAL,
-  TLS_DIALECT_DESC
-};
+/* Check TLS Descriptors mechanism is selected.  */
+#define TARGET_TLS_DESC (aarch64_tls_dialect == TLS_DESCRIPTORS)
 
 /* Used for the code generation strategy dependent on the
    memory model being used.
@@ -831,8 +825,6 @@ enum aarch64_memory_model
   AARCH64_MEM_MODEL_LARGE_PIC
 };
 
-extern enum tls_dialect aarch64_tls_dialect;
-
 extern enum aarch64_memory_model aarch64_default_mem_model;
 
 /* When using the tiny addressing model conditional and unconditional branches
diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt
index 3cdd335..64e9ba8 100644
--- a/gcc/config/aarch64/aarch64.opt
+++ b/gcc/config/aarch64/aarch64.opt
@@ -21,6 +21,18 @@
 HeaderInclude
 config/aarch64/aarch64-opts.h
 
+; The TLS dialect names to use with -mtls-dialect.
+
+Enum
+Name(tls_type) Type(enum aarch64_tls_type)
+The possible TLS dialects:
+
+EnumValue
+Enum(tls_type) String(trad) Value(TLS_TRADITIONAL)
+
+EnumValue
+Enum(tls_type) String(desc) Value(TLS_DESCRIPTORS)
+
 ; The cpu/arch option names to use in cpu/arch selection.
 
 Variable
@@ -57,8 +69,8 @@ Target Report Save Var(flag_omit_leaf_frame_pointer) Init(1)
 Omit the frame pointer in leaf functions
 
 mtls-dialect=
-Target RejectNegative Joined Var(aarch64_tls_dialect_string)
-Use given thread-local storage dialect
+Target RejectNegative Joined Enum(tls_type) Var(aarch64_tls_dialect) Init(TLS_DESCRIPTORS)
+Specify TLS dialect
 
 march=
 Target RejectNegative Joined Var(aarch64_arch_string)

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

* Re: [PATCH, GCC][AArch64] Use Enums for TLS dialect option selection
  2012-06-01  8:57 [PATCH, GCC][AArch64] Use Enums for TLS dialect option selection Sofiane Naci
@ 2012-06-08  7:27 ` Marcus Shawcroft
  2012-06-22 17:36   ` Tejas Belagod
  0 siblings, 1 reply; 3+ messages in thread
From: Marcus Shawcroft @ 2012-06-08  7:27 UTC (permalink / raw)
  To: Sofiane Naci; +Cc: gcc-patches

On 01/06/12 09:56, Sofiane Naci wrote:
> Hi,
>
> This patch re-factors TLS dialect option selection in the AArch64 port to
> use the generic support for enumerated option arguments.
>
> Thanks
> Sofiane
>
> -----
>
> 2012-06-01  Sofiane Naci<sofiane.naci@arm.com>
>
> 	[AArch64] Use Enums for TLS option selection.
>
> 	* config/aarch64/aarch64-opts.h (enum aarch64_tls_type): New.
> 	* config/aarch64/aarch64.c
> 	(aarch64_tls_dialect): Remove.
> 	(tls_symbolic_operand_type): Update comment.
> 	(aarch64_override_options): Remove TLS option setup code.
> 	* config/aarch64/aarch64.h
> 	(TARGET_TLS_TRADITIONAL): Remove.
> 	(TARGET_TLS_DESC): Update definition.
> 	(enum tls_dialect): Remove.
> 	(enum tls_dialect aarch64_tls_dialect) Remove.
> 	* config/aarch64/aarch64.opt
> 	(tls_type): New.
> 	(mtls-dialect): Update.

OK for aarch64 branch.
/Marcus

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

* Re: [PATCH, GCC][AArch64] Use Enums for TLS dialect option selection
  2012-06-08  7:27 ` Marcus Shawcroft
@ 2012-06-22 17:36   ` Tejas Belagod
  0 siblings, 0 replies; 3+ messages in thread
From: Tejas Belagod @ 2012-06-22 17:36 UTC (permalink / raw)
  To: gcc-patches; +Cc: Marcus Shawcroft, Sofiane Naci

Marcus Shawcroft wrote:
> On 01/06/12 09:56, Sofiane Naci wrote:
>> Hi,
>>
>> This patch re-factors TLS dialect option selection in the AArch64 port to
>> use the generic support for enumerated option arguments.
>>
>> Thanks
>> Sofiane
>>
>> -----
>>
>> 2012-06-01  Sofiane Naci<sofiane.naci@arm.com>
>>
>> 	[AArch64] Use Enums for TLS option selection.
>>
>> 	* config/aarch64/aarch64-opts.h (enum aarch64_tls_type): New.
>> 	* config/aarch64/aarch64.c
>> 	(aarch64_tls_dialect): Remove.
>> 	(tls_symbolic_operand_type): Update comment.
>> 	(aarch64_override_options): Remove TLS option setup code.
>> 	* config/aarch64/aarch64.h
>> 	(TARGET_TLS_TRADITIONAL): Remove.
>> 	(TARGET_TLS_DESC): Update definition.
>> 	(enum tls_dialect): Remove.
>> 	(enum tls_dialect aarch64_tls_dialect) Remove.
>> 	* config/aarch64/aarch64.opt
>> 	(tls_type): New.
>> 	(mtls-dialect): Update.
> 
> OK for aarch64 branch.
> /Marcus
> 
> 

I've committed this on the aarch64-branch for Sofiane.

Tejas.


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

end of thread, other threads:[~2012-06-22 17:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-01  8:57 [PATCH, GCC][AArch64] Use Enums for TLS dialect option selection Sofiane Naci
2012-06-08  7:27 ` Marcus Shawcroft
2012-06-22 17:36   ` Tejas Belagod

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).