Patchwork RX: Add TARGET_BUILTIN_DECL

login
register
mail settings
Submitter Nick Clifton
Date May 12, 2011, 10:34 a.m.
Message ID <m3boz88awm.fsf@redhat.com>
Download mbox | patch
Permalink /patch/95282/
State New
Headers show

Comments

Nick Clifton - May 12, 2011, 10:34 a.m.
Hi Guys,

  I am checking in this patch, created by DJ Delorie, to add
  TARGET_BUILTIN_DECL to the RX backend.

Cheers
  Nick

gcc/ChangeLog
2011-05-12  DJ Delorie  <dj@redhat.com>

	(rx_builtins): New arrays - holds builtin functions.
	(ADD_RX_BUILTIN1, ADD_RX_BUILTIN2, ADD_RX_BUILTIN3): Install
	created builtin into rx_builtins array.
	(rx_builtin_decl): New function.
	(TARGET_BUITLIN_DECL): Define.
	Include gt-rx.h.

Patch

Index: gcc/config/rx/rx.c
===================================================================
--- gcc/config/rx/rx.c	(revision 173695)
+++ gcc/config/rx/rx.c	(working copy)
@@ -1930,10 +1930,13 @@ 
   RX_BUILTIN_max
 };
 
+static GTY(()) tree rx_builtins[(int) RX_BUILTIN_max];
+
 static void
 rx_init_builtins (void)
 {
 #define ADD_RX_BUILTIN1(UC_NAME, LC_NAME, RET_TYPE, ARG_TYPE)		\
+   rx_builtins[RX_BUILTIN_##UC_NAME] =					\
    add_builtin_function ("__builtin_rx_" LC_NAME,			\
 			build_function_type_list (RET_TYPE##_type_node, \
 						  ARG_TYPE##_type_node, \
@@ -1942,6 +1945,7 @@ 
 			BUILT_IN_MD, NULL, NULL_TREE)
 
 #define ADD_RX_BUILTIN2(UC_NAME, LC_NAME, RET_TYPE, ARG_TYPE1, ARG_TYPE2) \
+  rx_builtins[RX_BUILTIN_##UC_NAME] =					\
   add_builtin_function ("__builtin_rx_" LC_NAME,			\
 			build_function_type_list (RET_TYPE##_type_node, \
 						  ARG_TYPE1##_type_node,\
@@ -1951,6 +1955,7 @@ 
 			BUILT_IN_MD, NULL, NULL_TREE)
 
 #define ADD_RX_BUILTIN3(UC_NAME,LC_NAME,RET_TYPE,ARG_TYPE1,ARG_TYPE2,ARG_TYPE3) \
+  rx_builtins[RX_BUILTIN_##UC_NAME] =					\
   add_builtin_function ("__builtin_rx_" LC_NAME,			\
 			build_function_type_list (RET_TYPE##_type_node, \
 						  ARG_TYPE1##_type_node,\
@@ -1982,6 +1987,17 @@ 
   ADD_RX_BUILTIN1 (WAIT,    "wait",    void,  void);
 }
 
+/* Return the RX builtin for CODE.  */
+
+static tree
+rx_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
+{
+  if (code >= RX_BUILTIN_max)
+    return error_mark_node;
+
+  return rx_builtins[code];
+}
+
 static rtx
 rx_expand_void_builtin_1_arg (rtx arg, rtx (* gen_func)(rtx), bool reg)
 {
@@ -2955,6 +2971,9 @@ 
 #undef  TARGET_INIT_BUILTINS
 #define TARGET_INIT_BUILTINS		rx_init_builtins
 
+#undef  TARGET_BUILTIN_DECL
+#define TARGET_BUILTIN_DECL		rx_builtin_decl
+
 #undef  TARGET_EXPAND_BUILTIN
 #define TARGET_EXPAND_BUILTIN		rx_expand_builtin
 
@@ -3068,4 +3087,4 @@ 
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
-/* #include "gt-rx.h" */
+#include "gt-rx.h"