Patchwork [3/6] Thread pointer built-in functions, arm

login
register
mail settings
Submitter Chung-Lin Tang
Date July 12, 2012, 6:52 a.m.
Message ID <4FFE7432.8020402@codesourcery.com>
Download mbox | patch
Permalink /patch/170580/
State New
Headers show

Comments

Chung-Lin Tang - July 12, 2012, 6:52 a.m.
ARM parts, no further notes.

Thanks,
Chung-Lin

        * config/arm/arm.c (arm_builtins): Remove
        ARM_BUILTIN_THREAD_POINTER.
        (arm_init_tls_builtins): Remove function.
        (arm_init_builtins): Remove call to arm_init_tls_builtins().
        (arm_expand_builtin): Remove ARM_BUILTIN_THREAD_POINTER case.
        (arm_expand_builtin_thread_pointer): Add hook function for
        TARGET_EXPAND_BUILTIN_THREAD_POINTER.
Ramana Radhakrishnan - July 12, 2012, 9:47 a.m.
On 12 July 2012 07:52, Chung-Lin Tang <cltang@codesourcery.com> wrote:
> ARM parts, no further notes.
>

ARM parts are ok, modulo approval for generic parts  and no
regressions with testing on arm-linux-gnueabi.

Thanks,
Ramana

> Thanks,
> Chung-Lin
>
>         * config/arm/arm.c (arm_builtins): Remove
>         ARM_BUILTIN_THREAD_POINTER.
>         (arm_init_tls_builtins): Remove function.
>         (arm_init_builtins): Remove call to arm_init_tls_builtins().
>         (arm_expand_builtin): Remove ARM_BUILTIN_THREAD_POINTER case.
>         (arm_expand_builtin_thread_pointer): Add hook function for
>         TARGET_EXPAND_BUILTIN_THREAD_POINTER.

Patch

Index: config/arm/arm.c
===================================================================
--- config/arm/arm.c	(revision 189431)
+++ config/arm/arm.c	(working copy)
@@ -267,6 +267,8 @@  static int arm_cortex_a5_branch_cost (bool, bool);
 static bool arm_vectorize_vec_perm_const_ok (enum machine_mode vmode,
 					     const unsigned char *sel);
 
+static rtx arm_expand_builtin_thread_pointer (rtx);
+
 
 /* Table of machine attributes.  */
 static const struct attribute_spec arm_attribute_table[] =
@@ -617,6 +619,10 @@  static const struct attribute_spec arm_attribute_t
 #define TARGET_VECTORIZE_VEC_PERM_CONST_OK \
   arm_vectorize_vec_perm_const_ok
 
+#undef TARGET_EXPAND_BUILTIN_THREAD_POINTER
+#define TARGET_EXPAND_BUILTIN_THREAD_POINTER \
+  arm_expand_builtin_thread_pointer
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* Obstack for minipool constant handling.  */
@@ -18980,8 +18986,6 @@  enum arm_builtins
 
   ARM_BUILTIN_WMERGE,
 
-  ARM_BUILTIN_THREAD_POINTER,
-
   ARM_BUILTIN_NEON_BASE,
 
   ARM_BUILTIN_MAX = ARM_BUILTIN_NEON_BASE + ARRAY_SIZE (neon_builtin_data)
@@ -20021,20 +20025,6 @@  arm_init_iwmmxt_builtins (void)
 }
 
 static void
-arm_init_tls_builtins (void)
-{
-  tree ftype, decl;
-
-  ftype = build_function_type (ptr_type_node, void_list_node);
-  decl = add_builtin_function ("__builtin_thread_pointer", ftype,
-			       ARM_BUILTIN_THREAD_POINTER, BUILT_IN_MD,
-			       NULL, NULL_TREE);
-  TREE_NOTHROW (decl) = 1;
-  TREE_READONLY (decl) = 1;
-  arm_builtin_decls[ARM_BUILTIN_THREAD_POINTER] = decl;
-}
-
-static void
 arm_init_fp16_builtins (void)
 {
   tree fp16_type = make_node (REAL_TYPE);
@@ -20046,8 +20036,6 @@  arm_init_fp16_builtins (void)
 static void
 arm_init_builtins (void)
 {
-  arm_init_tls_builtins ();
-
   if (TARGET_REALLY_IWMMXT)
     arm_init_iwmmxt_builtins ();
 
@@ -21150,9 +21138,6 @@  arm_expand_builtin (tree exp,
 	}
       return arm_expand_binop_builtin (icode, exp, target);
 
-    case ARM_BUILTIN_THREAD_POINTER:
-      return arm_load_tp (target);
-
     default:
       break;
     }
@@ -26331,4 +26316,10 @@  arm_validize_comparison (rtx *comparison, rtx * op
 
 }
 
+static rtx
+arm_expand_builtin_thread_pointer (rtx target)
+{
+  return arm_load_tp (target);
+}
+
 #include "gt-arm.h"