diff mbox

PING [ARM] [3/3] Implement TARGET_BUILTIN_DECL

Message ID 4D1353D8.9030507@codesourcery.com
State New
Headers show

Commit Message

Jie Zhang Dec. 23, 2010, 1:51 p.m. UTC
http://gcc.gnu.org/ml/gcc-patches/2010-10/msg00852.html

Just updated the patch for the latest trunk.


Regards,

Comments

Jie Zhang Jan. 10, 2011, 2:57 a.m. UTC | #1
PING 2

Jie

On 12/23/2010 09:51 PM, Jie Zhang wrote:
> http://gcc.gnu.org/ml/gcc-patches/2010-10/msg00852.html
>
> Just updated the patch for the latest trunk.
>
Jie Zhang Jan. 17, 2011, 1:58 a.m. UTC | #2
PING 3

Jie

On 01/10/2011 10:57 AM, Jie Zhang wrote:
> PING 2
>
> Jie
>
> On 12/23/2010 09:51 PM, Jie Zhang wrote:
>> http://gcc.gnu.org/ml/gcc-patches/2010-10/msg00852.html
>>
>> Just updated the patch for the latest trunk.
>>
diff mbox

Patch


	* config/arm/arm.c (arm_builtin_decl): Declare.
	(TARGET_BUILTIN_DECL): Define.
	(enum arm_builtins): Correct ARM_BUILTIN_MAX.
	(arm_builtin_decls[]): New.
	(arm_init_neon_builtins): Store builtin declarations in
	arm_builtin_decls[].
	(arm_init_iwmmxt_builtins): Likewise.
	(arm_init_tls_builtins): Likewise.
	(arm_builtin_decl): New.

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 549b116..923c6b4 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -160,6 +160,7 @@  static rtx safe_vector_operand (rtx, enum machine_mode);
 static rtx arm_expand_binop_builtin (enum insn_code, tree, rtx);
 static rtx arm_expand_unop_builtin (enum insn_code, tree, rtx, int);
 static rtx arm_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
+static tree arm_builtin_decl (unsigned, bool);
 static void emit_constant_insn (rtx cond, rtx pattern);
 static rtx emit_set_insn (rtx, rtx);
 static int arm_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
@@ -403,6 +404,8 @@  static const struct default_options arm_option_optimization_table[] =
 #define TARGET_INIT_BUILTINS  arm_init_builtins
 #undef  TARGET_EXPAND_BUILTIN
 #define TARGET_EXPAND_BUILTIN arm_expand_builtin
+#undef  TARGET_BUILTIN_DECL
+#define TARGET_BUILTIN_DECL arm_builtin_decl
 
 #undef TARGET_INIT_LIBFUNCS
 #define TARGET_INIT_LIBFUNCS arm_init_libfuncs
@@ -18184,14 +18187,16 @@  enum arm_builtins
 
   ARM_BUILTIN_NEON_BASE,
 
-  ARM_BUILTIN_MAX = ARM_BUILTIN_NEON_BASE  /* FIXME: Wrong!  */
+  ARM_BUILTIN_MAX = ARM_BUILTIN_NEON_BASE + ARRAY_SIZE (neon_builtin_data)
 };
 
+static GTY(()) tree arm_builtin_decls[ARM_BUILTIN_MAX];
 
 static void
 arm_init_neon_builtins (void)
 {
-  unsigned int i, fcode = ARM_BUILTIN_NEON_BASE;
+  unsigned int i, fcode;
+  tree decl;
 
   tree neon_intQI_type_node;
   tree neon_intHI_type_node;
@@ -18439,7 +18444,9 @@  arm_init_neon_builtins (void)
         }
     }
 
-  for (i = 0; i < ARRAY_SIZE (neon_builtin_data); i++)
+  for (i = 0, fcode = ARM_BUILTIN_NEON_BASE;
+       i < ARRAY_SIZE (neon_builtin_data);
+       i++, fcode++)
     {
       neon_builtin_datum *d = &neon_builtin_data[i];
       const char* const modenames[] = {
@@ -18671,8 +18678,9 @@  arm_init_neon_builtins (void)
 
       sprintf (namebuf, "__builtin_neon_%s%s", d->name, modenames[d->mode]);
 
-      add_builtin_function (namebuf, ftype, fcode++, BUILT_IN_MD, NULL,
-			    NULL_TREE);
+      decl = add_builtin_function (namebuf, ftype, fcode, BUILT_IN_MD, NULL,
+				   NULL_TREE);
+      arm_builtin_decls[fcode] = decl;
     }
 }
 
@@ -18680,8 +18688,11 @@  arm_init_neon_builtins (void)
   do									\
     {									\
       if ((MASK) & insn_flags)						\
-        add_builtin_function ((NAME), (TYPE), (CODE),			\
-			     BUILT_IN_MD, NULL, NULL_TREE);		\
+	{								\
+	  decl = add_builtin_function ((NAME), (TYPE), (CODE),		\
+				       BUILT_IN_MD, NULL, NULL_TREE);	\
+	  arm_builtin_decls[CODE] = decl;				\
+	}								\
     }									\
   while (0)
 
@@ -18827,6 +18838,7 @@  arm_init_iwmmxt_builtins (void)
 {
   const struct builtin_description * d;
   size_t i;
+  tree decl;
   tree endlink = void_list_node;
 
   tree V2SI_type_node = build_vector_type_for_mode (intSI_type_node, V2SImode);
@@ -19156,6 +19168,7 @@  arm_init_tls_builtins (void)
 			       NULL, NULL_TREE);
   TREE_NOTHROW (decl) = 1;
   TREE_READONLY (decl) = 1;
+  arm_builtin_decls[ARM_BUILTIN_THREAD_POINTER] = decl;
 }
 
 static void
@@ -19182,6 +19195,17 @@  arm_init_builtins (void)
     arm_init_fp16_builtins ();
 }
 
+/* Return the ARM builtin for CODE.  */
+
+static tree
+arm_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
+{
+  if (code >= ARM_BUILTIN_MAX)
+    return error_mark_node;
+
+  return arm_builtin_decls[code];
+}
+
 /* Implement TARGET_INVALID_PARAMETER_TYPE.  */
 
 static const char *