This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] factor code common to all builtin_function implementations


On 6/29/06, Geoff Keating <geoffk@geoffk.org> wrote:
Hi Rafael,
Hi Geoff

This large patch:

2006-05-02 Rafael Ãvila de EspÃndola <rafael.espindola@gmail.com>

        * gcc/java/decl.c: Include langhooks.h.
        (builtin_function): Remove.
        (java_init_decl_processing): Replace calls to builtin_function
        with add_builtin_function.
...

is OK.

For trunk or LTO? Should I way untill trunk is in stage1?


I have updated the patch (attached). I am re-testing it.

Best Regards,
Rafael
Index: gcc/java/decl.c
===================================================================
--- gcc/java/decl.c	(revision 115097)
+++ gcc/java/decl.c	(working copy)
@@ -49,6 +49,7 @@ The Free Software Foundation is independ
 #include "target.h"
 #include "version.h"
 #include "tree-iterator.h"
+#include "langhooks.h"
 
 #if defined (DEBUG_JAVA_BINDING_LEVELS)
 extern void indent (void);
@@ -465,34 +466,6 @@ push_promoted_type (const char *name, tr
   return type;
 }
 
-/* Return a definition for a builtin function named NAME and whose data type
-   is TYPE.  TYPE should be a function type with argument types.
-   FUNCTION_CODE tells later passes how to compile calls to this function.
-   See tree.h for its possible values.
-
-   If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME,
-   the name to be called if we can't opencode the function.  If
-   ATTRS is nonzero, use that for the function's attribute list.  */
-
-tree
-builtin_function (const char *name,
-		  tree type,
-		  int function_code,
-		  enum built_in_class cl,
-		  const char *library_name,
-		  tree ARG_UNUSED (attrs))
-{
-  tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
-  DECL_EXTERNAL (decl) = 1;
-  TREE_PUBLIC (decl) = 1;
-  if (library_name)
-    SET_DECL_ASSEMBLER_NAME (decl, get_identifier (library_name));
-  pushdecl (decl);
-  DECL_BUILT_IN_CLASS (decl) = cl;
-  DECL_FUNCTION_CODE (decl) = function_code;
-  return decl;
-}
-
 /* Return tree that represents a vtable for a primitive array.  */
 static tree
 create_primitive_vtable (const char *name)
@@ -942,50 +915,50 @@ java_init_decl_processing (void)
   endlink = end_params_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
 
   t = tree_cons (NULL_TREE, class_ptr_type, endlink);
-  alloc_object_node = builtin_function ("_Jv_AllocObject",
-					build_function_type (ptr_type_node, t),
-					0, NOT_BUILT_IN, NULL, NULL_TREE);
+  alloc_object_node = add_builtin_function ("_Jv_AllocObject",
+					    build_function_type (ptr_type_node, t),
+					    0, NOT_BUILT_IN, NULL, NULL_TREE);
   DECL_IS_MALLOC (alloc_object_node) = 1;
-  alloc_no_finalizer_node = 
-    builtin_function ("_Jv_AllocObjectNoFinalizer",
-		      build_function_type (ptr_type_node, t),
-		      0, NOT_BUILT_IN, NULL, NULL_TREE);
+  alloc_no_finalizer_node =
+    add_builtin_function ("_Jv_AllocObjectNoFinalizer",
+			  build_function_type (ptr_type_node, t),
+			  0, NOT_BUILT_IN, NULL, NULL_TREE);
   DECL_IS_MALLOC (alloc_no_finalizer_node) = 1;
 
   t = tree_cons (NULL_TREE, ptr_type_node, endlink);
-  soft_initclass_node = builtin_function ("_Jv_InitClass",
-					  build_function_type (void_type_node,
-							       t),
-					  0, NOT_BUILT_IN, NULL, NULL_TREE);
+  soft_initclass_node = add_builtin_function ("_Jv_InitClass",
+					      build_function_type (void_type_node,
+								   t),
+					      0, NOT_BUILT_IN, NULL, NULL_TREE);
   t = tree_cons (NULL_TREE, class_ptr_type,
 		 tree_cons (NULL_TREE, int_type_node, endlink));
-  soft_resolvepoolentry_node 
-    = builtin_function ("_Jv_ResolvePoolEntry", 
-			build_function_type (ptr_type_node, t),
-			0,NOT_BUILT_IN, NULL, NULL_TREE);
+  soft_resolvepoolentry_node
+    = add_builtin_function ("_Jv_ResolvePoolEntry",
+			    build_function_type (ptr_type_node, t),
+			    0,NOT_BUILT_IN, NULL, NULL_TREE);
   DECL_IS_PURE (soft_resolvepoolentry_node) = 1;
-  throw_node = builtin_function ("_Jv_Throw",
-				 build_function_type (void_type_node, t),
-				 0, NOT_BUILT_IN, NULL, NULL_TREE);
+  throw_node = add_builtin_function ("_Jv_Throw",
+				     build_function_type (void_type_node, t),
+				     0, NOT_BUILT_IN, NULL, NULL_TREE);
   /* Mark throw_nodes as `noreturn' functions with side effects.  */
   TREE_THIS_VOLATILE (throw_node) = 1;
   TREE_SIDE_EFFECTS (throw_node) = 1;
 
   t = build_function_type (void_type_node, tree_cons (NULL_TREE, ptr_type_node,
 						      endlink));
-  soft_monitorenter_node 
-    = builtin_function ("_Jv_MonitorEnter", t, 0, NOT_BUILT_IN,
-			NULL, NULL_TREE);
-  soft_monitorexit_node 
-    = builtin_function ("_Jv_MonitorExit", t, 0, NOT_BUILT_IN,
-			NULL, NULL_TREE);
+  soft_monitorenter_node
+    = add_builtin_function ("_Jv_MonitorEnter", t, 0, NOT_BUILT_IN,
+			    NULL, NULL_TREE);
+  soft_monitorexit_node
+    = add_builtin_function ("_Jv_MonitorExit", t, 0, NOT_BUILT_IN,
+			    NULL, NULL_TREE);
 
-  t = tree_cons (NULL_TREE, ptr_type_node, 
+  t = tree_cons (NULL_TREE, ptr_type_node,
 		 tree_cons (NULL_TREE, int_type_node, endlink));
   soft_newarray_node
-      = builtin_function ("_Jv_NewPrimArray",
-			  build_function_type (ptr_type_node, t),
-			  0, NOT_BUILT_IN, NULL, NULL_TREE);
+      = add_builtin_function ("_Jv_NewPrimArray",
+			      build_function_type (ptr_type_node, t),
+			      0, NOT_BUILT_IN, NULL, NULL_TREE);
   DECL_IS_MALLOC (soft_newarray_node) = 1;
 
   t = tree_cons (NULL_TREE, int_type_node,
@@ -993,9 +966,9 @@ java_init_decl_processing (void)
 			    tree_cons (NULL_TREE, object_ptr_type_node,
 				       endlink)));
   soft_anewarray_node
-      = builtin_function ("_Jv_NewObjectArray",
-			  build_function_type (ptr_type_node, t),
-			  0, NOT_BUILT_IN, NULL, NULL_TREE);
+      = add_builtin_function ("_Jv_NewObjectArray",
+			      build_function_type (ptr_type_node, t),
+			      0, NOT_BUILT_IN, NULL, NULL_TREE);
   DECL_IS_MALLOC (soft_anewarray_node) = 1;
 
   /* There is no endlink here because _Jv_NewMultiArray is a varargs
@@ -1003,43 +976,43 @@ java_init_decl_processing (void)
   t = tree_cons (NULL_TREE, ptr_type_node,
 		 tree_cons (NULL_TREE, int_type_node, NULL_TREE));
   soft_multianewarray_node
-      = builtin_function ("_Jv_NewMultiArray",
-			  build_function_type (ptr_type_node, t),
-			  0, NOT_BUILT_IN, NULL, NULL_TREE);
+      = add_builtin_function ("_Jv_NewMultiArray",
+			      build_function_type (ptr_type_node, t),
+			      0, NOT_BUILT_IN, NULL, NULL_TREE);
   DECL_IS_MALLOC (soft_multianewarray_node) = 1;
 
   t = build_function_type (void_type_node, 
 			   tree_cons (NULL_TREE, int_type_node, endlink));
   soft_badarrayindex_node
-      = builtin_function ("_Jv_ThrowBadArrayIndex", t, 
-			  0, NOT_BUILT_IN, NULL, NULL_TREE);
+      = add_builtin_function ("_Jv_ThrowBadArrayIndex", t,
+			      0, NOT_BUILT_IN, NULL, NULL_TREE);
   /* Mark soft_badarrayindex_node as a `noreturn' function with side
      effects.  */
   TREE_THIS_VOLATILE (soft_badarrayindex_node) = 1;
   TREE_SIDE_EFFECTS (soft_badarrayindex_node) = 1;
 
   soft_nullpointer_node
-    = builtin_function ("_Jv_ThrowNullPointerException",
-			build_function_type (void_type_node, endlink),
-			0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function ("_Jv_ThrowNullPointerException",
+			    build_function_type (void_type_node, endlink),
+			    0, NOT_BUILT_IN, NULL, NULL_TREE);
   /* Mark soft_nullpointer_node as a `noreturn' function with side
      effects.  */
   TREE_THIS_VOLATILE (soft_nullpointer_node) = 1;
   TREE_SIDE_EFFECTS (soft_nullpointer_node) = 1;
 
   soft_abstractmethod_node
-    = builtin_function ("_Jv_ThrowAbstractMethodError",
-			build_function_type (void_type_node, endlink),
-			0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function ("_Jv_ThrowAbstractMethodError",
+			    build_function_type (void_type_node, endlink),
+			    0, NOT_BUILT_IN, NULL, NULL_TREE);
   /* Mark soft_abstractmethod_node as a `noreturn' function with side
      effects.  */
   TREE_THIS_VOLATILE (soft_abstractmethod_node) = 1;
   TREE_SIDE_EFFECTS (soft_abstractmethod_node) = 1;
 
   soft_nosuchfield_node
-    = builtin_function ("_Jv_ThrowNoSuchFieldError",
-			build_function_type (void_type_node, endlink),
-			0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function ("_Jv_ThrowNoSuchFieldError",
+			    build_function_type (void_type_node, endlink),
+			    0, NOT_BUILT_IN, NULL, NULL_TREE);
   /* Mark soft_nosuchfield_node as a `noreturn' function with side
      effects.  */
   TREE_THIS_VOLATILE (soft_nosuchfield_node) = 1;
@@ -1048,85 +1021,85 @@ java_init_decl_processing (void)
   t = tree_cons (NULL_TREE, class_ptr_type,
 		 tree_cons (NULL_TREE, object_ptr_type_node, endlink));
   soft_checkcast_node
-    = builtin_function ("_Jv_CheckCast",
-			build_function_type (ptr_type_node, t),
-			0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function ("_Jv_CheckCast",
+			    build_function_type (ptr_type_node, t),
+			    0, NOT_BUILT_IN, NULL, NULL_TREE);
   t = tree_cons (NULL_TREE, object_ptr_type_node,
 		 tree_cons (NULL_TREE, class_ptr_type, endlink));
   soft_instanceof_node
-    = builtin_function ("_Jv_IsInstanceOf",
-			build_function_type (boolean_type_node, t),
-			0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function ("_Jv_IsInstanceOf",
+			    build_function_type (boolean_type_node, t),
+			    0, NOT_BUILT_IN, NULL, NULL_TREE);
   DECL_IS_PURE (soft_instanceof_node) = 1;
   t = tree_cons (NULL_TREE, object_ptr_type_node,
 		 tree_cons (NULL_TREE, object_ptr_type_node, endlink));
   soft_checkarraystore_node
-    = builtin_function ("_Jv_CheckArrayStore",
-			build_function_type (void_type_node, t),
-			0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function ("_Jv_CheckArrayStore",
+			    build_function_type (void_type_node, t),
+			    0, NOT_BUILT_IN, NULL, NULL_TREE);
   t = tree_cons (NULL_TREE, ptr_type_node,
 		 tree_cons (NULL_TREE, ptr_type_node,
 			    tree_cons (NULL_TREE, int_type_node, endlink)));
-  soft_lookupinterfacemethod_node 
-    = builtin_function ("_Jv_LookupInterfaceMethodIdx",
-			build_function_type (ptr_type_node, t),
-			0, NOT_BUILT_IN, NULL, NULL_TREE);
+  soft_lookupinterfacemethod_node
+    = add_builtin_function ("_Jv_LookupInterfaceMethodIdx",
+			    build_function_type (ptr_type_node, t),
+			    0, NOT_BUILT_IN, NULL, NULL_TREE);
   DECL_IS_PURE (soft_lookupinterfacemethod_node) = 1;
   t = tree_cons (NULL_TREE, ptr_type_node,
 		 tree_cons (NULL_TREE, ptr_type_node,
 			    tree_cons (NULL_TREE, ptr_type_node, endlink)));
-  soft_lookupinterfacemethodbyname_node 
-    = builtin_function ("_Jv_LookupInterfaceMethod",
-			build_function_type (ptr_type_node, t),
-			0, NOT_BUILT_IN, NULL, NULL_TREE);
+  soft_lookupinterfacemethodbyname_node
+    = add_builtin_function ("_Jv_LookupInterfaceMethod",
+			    build_function_type (ptr_type_node, t),
+			    0, NOT_BUILT_IN, NULL, NULL_TREE);
   t = tree_cons (NULL_TREE, object_ptr_type_node,
 		 tree_cons (NULL_TREE, ptr_type_node,
 			    tree_cons (NULL_TREE, ptr_type_node, 
 			               tree_cons (NULL_TREE, int_type_node, 
 				                  endlink))));
   soft_lookupjnimethod_node
-    = builtin_function ("_Jv_LookupJNIMethod",
-			build_function_type (ptr_type_node, t),
-			0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function ("_Jv_LookupJNIMethod",
+			    build_function_type (ptr_type_node, t),
+			    0, NOT_BUILT_IN, NULL, NULL_TREE);
   t = tree_cons (NULL_TREE, ptr_type_node, endlink);
   soft_getjnienvnewframe_node
-    = builtin_function ("_Jv_GetJNIEnvNewFrame",
-			build_function_type (ptr_type_node, t),
-			0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function ("_Jv_GetJNIEnvNewFrame",
+			    build_function_type (ptr_type_node, t),
+			    0, NOT_BUILT_IN, NULL, NULL_TREE);
   soft_jnipopsystemframe_node
-    = builtin_function ("_Jv_JNI_PopSystemFrame",
-			build_function_type (void_type_node, t),
-			0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function ("_Jv_JNI_PopSystemFrame",
+			    build_function_type (void_type_node, t),
+			    0, NOT_BUILT_IN, NULL, NULL_TREE);
 
   t = tree_cons (NULL_TREE, object_ptr_type_node, endlink);
   soft_unwrapjni_node
-    = builtin_function ("_Jv_UnwrapJNIweakReference",
-			build_function_type (object_ptr_type_node, t),
-			0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function ("_Jv_UnwrapJNIweakReference",
+			    build_function_type (object_ptr_type_node, t),
+			    0, NOT_BUILT_IN, NULL, NULL_TREE);
 
   t = tree_cons (NULL_TREE, int_type_node,
 		 tree_cons (NULL_TREE, int_type_node, endlink));
   soft_idiv_node
-    = builtin_function ("_Jv_divI",
-			build_function_type (int_type_node, t),
-			0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function ("_Jv_divI",
+			    build_function_type (int_type_node, t),
+			    0, NOT_BUILT_IN, NULL, NULL_TREE);
 
   soft_irem_node
-    = builtin_function ("_Jv_remI",
-			build_function_type (int_type_node, t),
-			0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function ("_Jv_remI",
+			    build_function_type (int_type_node, t),
+			    0, NOT_BUILT_IN, NULL, NULL_TREE);
 
   t = tree_cons (NULL_TREE, long_type_node,
 		 tree_cons (NULL_TREE, long_type_node, endlink));
   soft_ldiv_node
-    = builtin_function ("_Jv_divJ",
-			build_function_type (long_type_node, t),
-			0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function ("_Jv_divJ",
+			    build_function_type (long_type_node, t),
+			    0, NOT_BUILT_IN, NULL, NULL_TREE);
 
   soft_lrem_node
-    = builtin_function ("_Jv_remJ",
-			build_function_type (long_type_node, t),
-			0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function ("_Jv_remJ",
+			    build_function_type (long_type_node, t),
+			    0, NOT_BUILT_IN, NULL, NULL_TREE);
 
   /* Initialize variables for except.c.  */
   eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS
Index: gcc/java/Make-lang.in
===================================================================
--- gcc/java/Make-lang.in	(revision 115097)
+++ gcc/java/Make-lang.in	(working copy)
@@ -131,10 +131,10 @@ jvspec.o-warn = -Wno-error
 java/parse-scan.o-warn = -Wno-error
 java/parse.o-warn = -Wno-error
 
-jc1$(exeext): $(JAVA_OBJS) $(BACKEND) $(LIBDEPS)
+jc1$(exeext): $(JAVA_OBJS) $(BACKEND) $(LIBDEPS) attribs.o
 	rm -f $@
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
-		$(JAVA_OBJS) $(BACKEND) $(ZLIB) $(LIBICONV) $(LIBS)
+		$(JAVA_OBJS) $(BACKEND) $(ZLIB) $(LIBICONV) $(LIBS) attribs.o
 
 gcjh$(exeext): $(GCJH_OBJS) $(LIBDEPS)
 	rm -f $@
@@ -309,7 +309,7 @@ java/constants.o: java/constants.c $(CON
 java/decl.o: java/decl.c $(CONFIG_H) $(JAVA_TREE_H) $(RTL_H) java/jcf.h \
   toplev.h flags.h $(SYSTEM_H) coretypes.h $(TM_H) function.h $(EXPR_H) \
   libfuncs.h except.h java/java-except.h $(GGC_H) real.h gt-java-decl.h \
-  $(TARGET_H) cgraph.h
+  $(TARGET_H) cgraph.h langhooks.h
 java/except.o: java/except.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h real.h \
   $(RTL_H) java/javaop.h java/java-opcodes.h except.h java/java-except.h \
   toplev.h $(SYSTEM_H) coretypes.h $(TM_H) function.h 
Index: gcc/java/java-tree.h
===================================================================
--- gcc/java/java-tree.h	(revision 115097)
+++ gcc/java/java-tree.h	(working copy)
@@ -1402,9 +1402,6 @@ extern void gen_indirect_dispatch_tables
 extern int split_qualified_name (tree *left, tree *right, tree source);
 extern int in_same_package (tree, tree);
 
-extern tree builtin_function (const char *, tree, int, enum built_in_class,
-			      const char *, tree);
-
 #define DECL_FINAL(DECL) DECL_LANG_FLAG_3 (DECL)
 
 /* Access flags etc for a method (a FUNCTION_DECL): */
Index: gcc/tree.c
===================================================================
--- gcc/tree.c	(revision 115097)
+++ gcc/tree.c	(working copy)
@@ -6530,8 +6530,8 @@ local_define_builtin (const char *name, 
 {
   tree decl;
 
-  decl = lang_hooks.builtin_function (name, type, code, BUILT_IN_NORMAL,
-				      library_name, NULL_TREE);
+  decl = add_builtin_function (name, type, code, BUILT_IN_NORMAL,
+			       library_name, NULL_TREE);
   if (ecf_flags & ECF_CONST)
     TREE_READONLY (decl) = 1;
   if (ecf_flags & ECF_PURE)
Index: gcc/objc/objc-act.c
===================================================================
--- gcc/objc/objc-act.c	(revision 115097)
+++ gcc/objc/objc-act.c	(working copy)
@@ -1616,18 +1616,18 @@ synth_module_prologue (void)
 			       tree_cons (NULL_TREE, objc_object_type,
 					  tree_cons (NULL_TREE, objc_selector_type,
 						     NULL_TREE)));
-      umsg_decl = builtin_function (TAG_MSGSEND,
-				    type, 0, NOT_BUILT_IN,
-				    NULL, NULL_TREE);
-      umsg_nonnil_decl = builtin_function (TAG_MSGSEND_NONNIL,
-					   type, 0, NOT_BUILT_IN,
-					   NULL, NULL_TREE);
-      umsg_stret_decl = builtin_function (TAG_MSGSEND_STRET,
-					  type, 0, NOT_BUILT_IN,
-					  NULL, NULL_TREE);
-      umsg_nonnil_stret_decl = builtin_function (TAG_MSGSEND_NONNIL_STRET,
-						 type, 0, NOT_BUILT_IN,
-						 NULL, NULL_TREE);
+      umsg_decl = add_builtin_function (TAG_MSGSEND,
+					type, 0, NOT_BUILT_IN,
+					NULL, NULL_TREE);
+      umsg_nonnil_decl = add_builtin_function (TAG_MSGSEND_NONNIL,
+					       type, 0, NOT_BUILT_IN,
+					       NULL, NULL_TREE);
+      umsg_stret_decl = add_builtin_function (TAG_MSGSEND_STRET,
+					      type, 0, NOT_BUILT_IN,
+					      NULL, NULL_TREE);
+      umsg_nonnil_stret_decl = add_builtin_function (TAG_MSGSEND_NONNIL_STRET,
+						     type, 0, NOT_BUILT_IN,
+						     NULL, NULL_TREE);
 
       /* These can throw, because the function that gets called can throw
 	 in Obj-C++, or could itself call something that can throw even
@@ -1640,9 +1640,9 @@ synth_module_prologue (void)
       /* id objc_msgSend_Fast (id, SEL, ...)
 	   __attribute__ ((hard_coded_address (OFFS_MSGSEND_FAST))); */
 #ifdef OFFS_MSGSEND_FAST
-      umsg_fast_decl = builtin_function (TAG_MSGSEND_FAST,
-					 type, 0, NOT_BUILT_IN,
-					 NULL, NULL_TREE);
+      umsg_fast_decl = add_builtin_function (TAG_MSGSEND_FAST,
+					     type, 0, NOT_BUILT_IN,
+					     NULL, NULL_TREE);
       TREE_NOTHROW (umsg_fast_decl) = 0;
       DECL_ATTRIBUTES (umsg_fast_decl) 
 	= tree_cons (get_identifier ("hard_coded_address"), 
@@ -1660,12 +1660,12 @@ synth_module_prologue (void)
 			       tree_cons (NULL_TREE, objc_super_type,
 					  tree_cons (NULL_TREE, objc_selector_type,
 						     NULL_TREE)));
-      umsg_super_decl = builtin_function (TAG_MSGSENDSUPER,
-					  type, 0, NOT_BUILT_IN,
-					  NULL, NULL_TREE);
-      umsg_super_stret_decl = builtin_function (TAG_MSGSENDSUPER_STRET,
-						type, 0, NOT_BUILT_IN, 0,
-						NULL_TREE);
+      umsg_super_decl = add_builtin_function (TAG_MSGSENDSUPER,
+					      type, 0, NOT_BUILT_IN,
+					      NULL, NULL_TREE);
+      umsg_super_stret_decl = add_builtin_function (TAG_MSGSENDSUPER_STRET,
+						    type, 0, NOT_BUILT_IN, 0,
+						    NULL_TREE);
       TREE_NOTHROW (umsg_super_decl) = 0;
       TREE_NOTHROW (umsg_super_stret_decl) = 0;
     }
@@ -1687,9 +1687,9 @@ synth_module_prologue (void)
 			       tree_cons (NULL_TREE, objc_object_type,
 					  tree_cons (NULL_TREE, objc_selector_type,
 						     OBJC_VOID_AT_END)));
-      umsg_decl = builtin_function (TAG_MSGSEND,
-				    type, 0, NOT_BUILT_IN,
-				    NULL, NULL_TREE);
+      umsg_decl = add_builtin_function (TAG_MSGSEND,
+					type, 0, NOT_BUILT_IN,
+					NULL, NULL_TREE);
       TREE_NOTHROW (umsg_decl) = 0;
 
       /* IMP objc_msg_lookup_super (struct objc_super *, SEL); */
@@ -1698,9 +1698,9 @@ synth_module_prologue (void)
 			       tree_cons (NULL_TREE, objc_super_type,
 					  tree_cons (NULL_TREE, objc_selector_type,
 						     OBJC_VOID_AT_END)));
-      umsg_super_decl = builtin_function (TAG_MSGSENDSUPER,
-					  type, 0, NOT_BUILT_IN,
-					  NULL, NULL_TREE);
+      umsg_super_decl = add_builtin_function (TAG_MSGSENDSUPER,
+					      type, 0, NOT_BUILT_IN,
+					      NULL, NULL_TREE);
       TREE_NOTHROW (umsg_super_decl) = 0;
 
       /* The following GNU runtime entry point is called to initialize
@@ -1711,9 +1711,9 @@ synth_module_prologue (void)
 	= build_function_type (void_type_node,
 			       tree_cons (NULL_TREE, ptr_type_node,
 					  OBJC_VOID_AT_END));
-      execclass_decl = builtin_function (TAG_EXECCLASS,
-					 type, 0, NOT_BUILT_IN,
-					 NULL, NULL_TREE);
+      execclass_decl = add_builtin_function (TAG_EXECCLASS,
+					     type, 0, NOT_BUILT_IN,
+					     NULL, NULL_TREE);
     }
 
   /* id objc_getClass (const char *); */
@@ -1724,13 +1724,13 @@ synth_module_prologue (void)
 					      OBJC_VOID_AT_END));
 
   objc_get_class_decl
-    = builtin_function (TAG_GETCLASS, type, 0, NOT_BUILT_IN,
-			NULL, NULL_TREE);
+    = add_builtin_function (TAG_GETCLASS, type, 0, NOT_BUILT_IN,
+			    NULL, NULL_TREE);
 
   /* id objc_getMetaClass (const char *); */
 
   objc_get_meta_class_decl
-    = builtin_function (TAG_GETMETACLASS, type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function (TAG_GETMETACLASS, type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
 
   build_class_template ();
   build_super_template ();
@@ -3997,7 +3997,7 @@ build_next_objc_exception_stuff (void)
      'int _setjmp(jmp_buf);' */
   temp_type = build_function_type (integer_type_node, NULL_TREE);
   objc_setjmp_decl
-    = builtin_function (TAG_SETJMP, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function (TAG_SETJMP, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
 
   /* id objc_exception_extract(struct _objc_exception_data *); */
   temp_type
@@ -4006,7 +4006,8 @@ build_next_objc_exception_stuff (void)
 				      build_pointer_type (objc_exception_data_template),
 				      OBJC_VOID_AT_END));
   objc_exception_extract_decl
-    = builtin_function (TAG_EXCEPTIONEXTRACT, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function (TAG_EXCEPTIONEXTRACT, temp_type, 0, NOT_BUILT_IN, NULL,
+			    NULL_TREE);
   /* void objc_exception_try_enter(struct _objc_exception_data *); */
   /* void objc_exception_try_exit(struct _objc_exception_data *); */
   temp_type
@@ -4015,9 +4016,11 @@ build_next_objc_exception_stuff (void)
 				      build_pointer_type (objc_exception_data_template),
 				      OBJC_VOID_AT_END));
   objc_exception_try_enter_decl
-    = builtin_function (TAG_EXCEPTIONTRYENTER, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function (TAG_EXCEPTIONTRYENTER, temp_type, 0, NOT_BUILT_IN, NULL,
+			    NULL_TREE);
   objc_exception_try_exit_decl
-    = builtin_function (TAG_EXCEPTIONTRYEXIT, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function (TAG_EXCEPTIONTRYEXIT, temp_type, 0, NOT_BUILT_IN, NULL,
+			    NULL_TREE);
 
   /* int objc_exception_match(id, id); */
   temp_type 
@@ -4026,7 +4029,8 @@ build_next_objc_exception_stuff (void)
 				      tree_cons (NULL_TREE, objc_object_type,
 						 OBJC_VOID_AT_END)));
   objc_exception_match_decl
-    = builtin_function (TAG_EXCEPTIONMATCH, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function (TAG_EXCEPTIONMATCH, temp_type, 0, NOT_BUILT_IN, NULL,
+			    NULL_TREE);
 
   /* id objc_assign_ivar (id, id, unsigned int); */
   /* id objc_assign_ivar_Fast (id, id, unsigned int)
@@ -4040,12 +4044,12 @@ build_next_objc_exception_stuff (void)
 						  unsigned_type_node,
 						  OBJC_VOID_AT_END))));
   objc_assign_ivar_decl
-    = builtin_function (TAG_ASSIGNIVAR, temp_type, 0, NOT_BUILT_IN,
-			NULL, NULL_TREE);
+    = add_builtin_function (TAG_ASSIGNIVAR, temp_type, 0, NOT_BUILT_IN,
+			    NULL, NULL_TREE);
 #ifdef OFFS_ASSIGNIVAR_FAST
   objc_assign_ivar_fast_decl
-    = builtin_function (TAG_ASSIGNIVAR_FAST, temp_type, 0,
-			NOT_BUILT_IN, NULL, NULL_TREE);
+    = add_builtin_function (TAG_ASSIGNIVAR_FAST, temp_type, 0,
+			    NOT_BUILT_IN, NULL, NULL_TREE);
   DECL_ATTRIBUTES (objc_assign_ivar_fast_decl) 
     = tree_cons (get_identifier ("hard_coded_address"), 
 		 build_int_cst (NULL_TREE, OFFS_ASSIGNIVAR_FAST),
@@ -4062,9 +4066,11 @@ build_next_objc_exception_stuff (void)
 		    tree_cons (NULL_TREE, build_pointer_type (objc_object_type),
 			OBJC_VOID_AT_END)));
   objc_assign_global_decl
-	= builtin_function (TAG_ASSIGNGLOBAL, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
+	= add_builtin_function (TAG_ASSIGNGLOBAL, temp_type, 0, NOT_BUILT_IN, NULL,
+				NULL_TREE);
   objc_assign_strong_cast_decl
-	= builtin_function (TAG_ASSIGNSTRONGCAST, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
+	= add_builtin_function (TAG_ASSIGNSTRONGCAST, temp_type, 0, NOT_BUILT_IN, NULL,
+				NULL_TREE);
 }
 
 static void
@@ -4082,14 +4088,14 @@ build_objc_exception_stuff (void)
 				   tree_cons (NULL_TREE, objc_object_type,
 					      OBJC_VOID_AT_END));
   objc_exception_throw_decl
-    = builtin_function (TAG_EXCEPTIONTHROW, temp_type, 0, NOT_BUILT_IN, NULL,
-			noreturn_list);
+    = add_builtin_function (TAG_EXCEPTIONTHROW, temp_type, 0, NOT_BUILT_IN, NULL,
+			    noreturn_list);
   objc_sync_enter_decl
-    = builtin_function (TAG_SYNCENTER, temp_type, 0, NOT_BUILT_IN,
-			NULL, nothrow_list);
+    = add_builtin_function (TAG_SYNCENTER, temp_type, 0, NOT_BUILT_IN,
+			    NULL, nothrow_list);
   objc_sync_exit_decl
-    = builtin_function (TAG_SYNCEXIT, temp_type, 0, NOT_BUILT_IN,
-			NULL, nothrow_list);
+    = add_builtin_function (TAG_SYNCEXIT, temp_type, 0, NOT_BUILT_IN,
+			    NULL, nothrow_list);
 }
 
 /* Construct a C struct corresponding to ObjC class CLASS, with the same
Index: gcc/objcp/objcp-decl.h
===================================================================
--- gcc/objcp/objcp-decl.h	(revision 115097)
+++ gcc/objcp/objcp-decl.h	(working copy)
@@ -29,8 +29,6 @@ extern void objcp_finish_function (void)
 extern tree objcp_build_function_call (tree, tree);
 extern tree objcp_xref_tag (enum tree_code, tree);
 extern int objcp_comptypes (tree, tree);
-extern tree objcp_builtin_function (const char *, tree, int, 
-				    enum built_in_class, const char *, tree);
 extern tree objcp_begin_compound_stmt (int);
 extern tree objcp_end_compound_stmt (tree, int);
 
Index: gcc/cp/decl.c
===================================================================
--- gcc/cp/decl.c	(revision 115097)
+++ gcc/cp/decl.c	(working copy)
@@ -64,10 +64,7 @@ static tree grok_reference_init (tree, t
 static tree grokvardecl (tree, tree, const cp_decl_specifier_seq *,
 			 int, int, tree);
 static void record_unknown_type (tree, const char *);
-static tree builtin_function_1 (const char *, tree, tree,
-				enum built_in_function code,
-				enum built_in_class cl, const char *,
-				tree);
+static tree builtin_function_1 (tree, tree);
 static tree build_library_fn_1 (tree, enum tree_code, tree);
 static int member_function_or_else (tree, tree, enum overload_flags);
 static void bad_specifiers (tree, const char *, int, int, int, int,
@@ -3363,90 +3360,55 @@ cp_make_fname_decl (tree id, int type_de
   return decl;
 }
 
-/* Make a definition for a builtin function named NAME in the current
-   namespace, whose data type is TYPE and whose context is CONTEXT.
-   TYPE should be a function type with argument types.
-
-   CLASS and CODE tell later passes how to compile calls to this function.
-   See tree.h for possible values.
-
-   If LIBNAME is nonzero, use that for DECL_ASSEMBLER_NAME,
-   the name to be called if we can't opencode the function.
-   If ATTRS is nonzero, use that for the function's attribute
-   list.  */
-
 static tree
-builtin_function_1 (const char* name,
-		    tree type,
-		    tree context,
-		    enum built_in_function code,
-		    enum built_in_class class,
-		    const char* libname,
-		    tree attrs)
-{
-  tree decl = build_library_fn_1 (get_identifier (name), ERROR_MARK, type);
-  DECL_BUILT_IN_CLASS (decl) = class;
-  DECL_FUNCTION_CODE (decl) = code;
+builtin_function_1 (tree decl, tree context)
+{
+  tree          id = DECL_NAME (decl);
+  const char *name = IDENTIFIER_POINTER (id);
+
+  retrofit_lang_decl (decl);
+
+  /* All nesting of C++ functions is lexical; there is never a "static
+     chain" in the sense of GNU C nested functions.  */
+  DECL_NO_STATIC_CHAIN (decl) = 1;
+
+  DECL_ARTIFICIAL (decl) = 1;
+  SET_OVERLOADED_OPERATOR_CODE (decl, ERROR_MARK);
+  SET_DECL_LANGUAGE (decl, lang_c);
+  /* Runtime library routines are, by definition, available in an
+     external shared object.  */
+  DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
+  DECL_VISIBILITY_SPECIFIED (decl) = 1;
+
   DECL_CONTEXT (decl) = context;
 
   pushdecl (decl);
 
-  /* Since `pushdecl' relies on DECL_ASSEMBLER_NAME instead of DECL_NAME,
-     we cannot change DECL_ASSEMBLER_NAME until we have installed this
-     function in the namespace.  */
-  if (libname)
-    SET_DECL_ASSEMBLER_NAME (decl, get_identifier (libname));
-
   /* A function in the user's namespace should have an explicit
      declaration before it is used.  Mark the built-in function as
      anticipated but not actually declared.  */
   if (name[0] != '_' || name[1] != '_')
     DECL_ANTICIPATED (decl) = 1;
 
-  /* Possibly apply some default attributes to this built-in function.  */
-  if (attrs)
-    decl_attributes (&decl, attrs, ATTR_FLAG_BUILT_IN);
-  else
-    decl_attributes (&decl, NULL_TREE, 0);
-
   return decl;
 }
 
-/* Entry point for the benefit of c_common_nodes_and_builtins.
-
-   Make a definition for a builtin function named NAME and whose data type
-   is TYPE.  TYPE should be a function type with argument types.  This
-   function places the anticipated declaration in the global namespace
-   and additionally in the std namespace if appropriate.
-
-   CLASS and CODE tell later passes how to compile calls to this function.
-   See tree.h for possible values.
-
-   If LIBNAME is nonzero, use that for DECL_ASSEMBLER_NAME,
-   the name to be called if we can't opencode the function.
-
-   If ATTRS is nonzero, use that for the function's attribute
-   list.  */
-
 tree
-builtin_function (const char* name,
-		  tree type,
-		  int code,
-		  enum built_in_class cl,
-		  const char* libname,
-		  tree attrs)
+cxx_builtin_function (tree decl)
 {
+  tree          id = DECL_NAME (decl);
+  const char *name = IDENTIFIER_POINTER (id);
+  tree       decl2 = copy_node(decl);
   /* All builtins that don't begin with an '_' should additionally
      go in the 'std' namespace.  */
   if (name[0] != '_')
     {
       push_namespace (std_identifier);
-      builtin_function_1 (name, type, std_node, code, cl, libname, attrs);
+      builtin_function_1 (decl, std_node);
       pop_namespace ();
     }
 
-  return builtin_function_1 (name, type, NULL_TREE, code,
-			     cl, libname, attrs);
+  return builtin_function_1 (decl2, NULL_TREE);
 }
 
 /* Generate a FUNCTION_DECL with the typical flags for a runtime library
Index: gcc/cp/call.c
===================================================================
--- gcc/cp/call.c	(revision 115097)
+++ gcc/cp/call.c	(working copy)
@@ -39,6 +39,7 @@ Boston, MA 02110-1301, USA.  */
 #include "intl.h"
 #include "target.h"
 #include "convert.h"
+#include "langhooks.h"
 
 /* The various kinds of conversion.  */
 
@@ -5057,9 +5058,9 @@ build_java_interface_fn_ref (tree fn, tr
 				     tree_cons (NULL_TREE, java_int_type_node,
 						endlink)));
       java_iface_lookup_fn
-	= builtin_function ("_Jv_LookupInterfaceMethodIdx",
-			    build_function_type (ptr_type_node, t),
-			    0, NOT_BUILT_IN, NULL, NULL_TREE);
+	= add_builtin_function ("_Jv_LookupInterfaceMethodIdx",
+				build_function_type (ptr_type_node, t),
+				0, NOT_BUILT_IN, NULL, NULL_TREE);
     }
 
   /* Look up the pointer to the runtime java.lang.Class object for `instance'.
Index: gcc/cp/Make-lang.in
===================================================================
--- gcc/cp/Make-lang.in	(revision 115097)
+++ gcc/cp/Make-lang.in	(working copy)
@@ -250,7 +250,7 @@ cp/typeck.o: cp/typeck.c $(CXX_TREE_H) $
 cp/class.o: cp/class.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) \
   $(TARGET_H) convert.h $(CGRAPH_H) $(TREE_DUMP_H)
 cp/call.o: cp/call.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) \
-  $(EXPR_H) diagnostic.h intl.h gt-cp-call.h convert.h $(TARGET_H)
+  $(EXPR_H) diagnostic.h intl.h gt-cp-call.h convert.h $(TARGET_H) langhooks.h
 cp/friend.o: cp/friend.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) toplev.h \
   $(EXPR_H)
 cp/init.o: cp/init.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) $(EXPR_H) \
Index: gcc/cp/cp-objcp-common.h
===================================================================
--- gcc/cp/cp-objcp-common.h	(revision 115097)
+++ gcc/cp/cp-objcp-common.h	(working copy)
@@ -85,6 +85,8 @@ extern tree objcp_tsubst_copy_and_build 
 #define LANG_HOOKS_WRITE_GLOBALS lhd_do_nothing
 #undef LANG_HOOKS_COMDAT_GROUP
 #define LANG_HOOKS_COMDAT_GROUP cxx_comdat_group
+#undef  LANG_HOOKS_BUILTIN_FUNCTION
+#define LANG_HOOKS_BUILTIN_FUNCTION cxx_builtin_function
 
 #undef LANG_HOOKS_FUNCTION_INIT
 #define LANG_HOOKS_FUNCTION_INIT cxx_push_function_context
Index: gcc/cp/cp-tree.h
===================================================================
--- gcc/cp/cp-tree.h	(revision 115097)
+++ gcc/cp/cp-tree.h	(working copy)
@@ -3930,11 +3930,7 @@ extern int nonstatic_local_decl_p		(tree
 extern tree register_dtor_fn			(tree);
 extern tmpl_spec_kind current_tmpl_spec_kind	(int);
 extern tree cp_fname_init			(const char *, tree *);
-extern tree builtin_function			(const char *name, tree type,
-						 int code,
-						 enum built_in_class cl,
-						 const char *libname,
-						 tree attrs);
+extern tree cxx_builtin_function		(tree decl);
 extern tree check_elaborated_type_specifier	(enum tag_types, tree, bool);
 extern void warn_extern_redeclared_static	(tree, tree);
 extern const char *cxx_comdat_group		(tree);
Index: gcc/c-objc-common.h
===================================================================
--- gcc/c-objc-common.h	(revision 115097)
+++ gcc/c-objc-common.h	(working copy)
@@ -74,6 +74,8 @@ extern void c_initialize_diagnostics (di
 #define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P c_missing_noreturn_ok_p
 #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
 #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL c_dup_lang_specific_decl
+#undef  LANG_HOOKS_BUILTIN_FUNCTION
+#define LANG_HOOKS_BUILTIN_FUNCTION c_builtin_function
 
 /* Attribute hooks.  */
 #undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
Index: gcc/c-tree.h
===================================================================
--- gcc/c-tree.h	(revision 115097)
+++ gcc/c-tree.h	(working copy)
@@ -469,8 +469,7 @@ extern void push_parm_decl (const struct
 extern struct c_declarator *set_array_declarator_inner (struct c_declarator *,
 							struct c_declarator *,
 							bool);
-extern tree builtin_function (const char *, tree, int, enum built_in_class,
-			      const char *, tree);
+extern tree c_builtin_function (tree);
 extern void shadow_tag (const struct c_declspecs *);
 extern void shadow_tag_warned (const struct c_declspecs *, int);
 extern tree start_enum (tree);
Index: gcc/ada/utils.c
===================================================================
--- gcc/ada/utils.c	(revision 115097)
+++ gcc/ada/utils.c	(working copy)
@@ -1802,32 +1802,11 @@ gnat_gimplify_function (tree fndecl)
     gnat_gimplify_function (cgn->decl);
 }
 
-/* Return a definition for a builtin function named NAME and whose data type
-   is TYPE.  TYPE should be a function type with argument types.
-   FUNCTION_CODE tells later passes how to compile calls to this function.
-   See tree.h for its possible values.
-
-   If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME,
-   the name to be called if we can't opencode the function.  If
-   ATTRS is nonzero, use that for the function attribute list.  */
 
 tree
-builtin_function (const char *name, tree type, int function_code,
-                  enum built_in_class class, const char *library_name,
-                  tree attrs)
-{
-  tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
-
-  DECL_EXTERNAL (decl) = 1;
-  TREE_PUBLIC (decl) = 1;
-  if (library_name)
-    SET_DECL_ASSEMBLER_NAME (decl, get_identifier (library_name));
-
+gnat_builtin_function (tree decl)
+{
   gnat_pushdecl (decl, Empty);
-  DECL_BUILT_IN_CLASS (decl) = class;
-  DECL_FUNCTION_CODE (decl) = function_code;
-  if (attrs)
-      decl_attributes (&decl, attrs, ATTR_FLAG_BUILT_IN);
   return decl;
 }
 
Index: gcc/ada/misc.c
===================================================================
--- gcc/ada/misc.c	(revision 115097)
+++ gcc/ada/misc.c	(working copy)
@@ -161,6 +161,8 @@ static tree gnat_type_max_size		(tree);
 #define LANG_HOOKS_UNSIGNED_TYPE	gnat_unsigned_type
 #undef  LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
 #define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE gnat_signed_or_unsigned_type
+#undef  LANG_HOOKS_BUILTIN_FUNCTION
+#define LANG_HOOKS_BUILTIN_FUNCTION        gnat_builtin_function
 
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
 
Index: gcc/ada/gigi.h
===================================================================
--- gcc/ada/gigi.h	(revision 115097)
+++ gcc/ada/gigi.h	(working copy)
@@ -762,9 +762,7 @@ extern tree fill_vms_descriptor (tree ex
 extern bool gnat_mark_addressable (tree expr_node);
 
 /* Implementation of the builtin_function langhook.  */
-extern tree builtin_function (const char *name, tree type, int function_code,
-                              enum built_in_class class,
-			      const char *library_name, tree attrs);
+extern tree gnat_builtin_function (tree decl);
 
 /* Search the chain of currently reachable declarations for a builtin
    FUNCTION_DECL node corresponding to function NAME (an IDENTIFIER_NODE).
Index: gcc/c-decl.c
===================================================================
--- gcc/c-decl.c	(revision 115097)
+++ gcc/c-decl.c	(working copy)
@@ -2797,30 +2797,15 @@ c_make_fname_decl (tree id, int type_dep
   return decl;
 }
 
-/* Return a definition for a builtin function named NAME and whose data type
-   is TYPE.  TYPE should be a function type with argument types.
-   FUNCTION_CODE tells later passes how to compile calls to this function.
-   See tree.h for its possible values.
-
-   If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME,
-   the name to be called if we can't opencode the function.  If
-   ATTRS is nonzero, use that for the function's attribute list.  */
-
 tree
-builtin_function (const char *name, tree type, int function_code,
-		  enum built_in_class cl, const char *library_name,
-		  tree attrs)
-{
-  tree id = get_identifier (name);
-  tree decl = build_decl (FUNCTION_DECL, id, type);
-  TREE_PUBLIC (decl) = 1;
-  DECL_EXTERNAL (decl) = 1;
+c_builtin_function (tree decl)
+{
+  tree type = TREE_TYPE (decl);
+  tree   id = DECL_NAME (decl);
+
+  const char *name = IDENTIFIER_POINTER (id);
   DECL_LANG_SPECIFIC (decl) = GGC_CNEW (struct lang_decl);
-  DECL_BUILT_IN_CLASS (decl) = cl;
-  DECL_FUNCTION_CODE (decl) = function_code;
   C_DECL_BUILTIN_PROTOTYPE (decl) = (TYPE_ARG_TYPES (type) != 0);
-  if (library_name)
-    SET_DECL_ASSEMBLER_NAME (decl, get_identifier (library_name));
 
   /* Should never be called on a symbol with a preexisting meaning.  */
   gcc_assert (!I_SYMBOL_BINDING (id));
@@ -2835,12 +2820,6 @@ builtin_function (const char *name, tree
       visible_builtins = decl;
     }
 
-  /* Possibly apply some default attributes to this built-in function.  */
-  if (attrs)
-    decl_attributes (&decl, attrs, ATTR_FLAG_BUILT_IN);
-  else
-    decl_attributes (&decl, NULL_TREE, 0);
-
   return decl;
 }
 
Index: gcc/fortran/Make-lang.in
===================================================================
--- gcc/fortran/Make-lang.in	(revision 115097)
+++ gcc/fortran/Make-lang.in	(working copy)
@@ -105,9 +105,9 @@ gfortran-cross$(exeext): gfortran$(exeex
 
 # The compiler itself is called f951.
 f951$(exeext): $(F95_OBJS) \
-		$(BACKEND) $(LIBDEPS)
+		$(BACKEND) $(LIBDEPS) attribs.o
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
-		$(F95_OBJS) $(BACKEND) $(F95_LIBS)
+		$(F95_OBJS) $(BACKEND) $(F95_LIBS) attribs.o
 
 gt-fortran-trans.h    : s-gtype; @true
 #
Index: gcc/fortran/trans.h
===================================================================
--- gcc/fortran/trans.h	(revision 115097)
+++ gcc/fortran/trans.h	(working copy)
@@ -445,8 +445,7 @@ void pushlevel (int);
 tree poplevel (int, int, int);
 tree getdecls (void);
 tree gfc_truthvalue_conversion (tree);
-tree builtin_function (const char *, tree, int, enum built_in_class,
-		       const char *, tree);
+tree gfc_builtin_function (tree);
 
 /* In trans-openmp.c */
 bool gfc_omp_privatize_by_reference (tree);
Index: gcc/fortran/f95-lang.c
===================================================================
--- gcc/fortran/f95-lang.c	(revision 115097)
+++ gcc/fortran/f95-lang.c	(working copy)
@@ -124,6 +124,7 @@ static HOST_WIDE_INT gfc_get_alias_set (
 #undef LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR
 #undef LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE
 #undef LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES
+#undef LANG_HOOKS_BUILTIN_FUNCTION
 
 /* Define lang hooks.  */
 #define LANG_HOOKS_NAME                 "GNU F95"
@@ -150,6 +151,7 @@ static HOST_WIDE_INT gfc_get_alias_set (
 #define LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE	gfc_omp_private_debug_clause
 #define LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES \
   gfc_omp_firstprivatize_type_sizes
+#define LANG_HOOKS_BUILTIN_FUNCTION          gfc_builtin_function
 
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
 
@@ -723,43 +725,11 @@ int ggc_p = 1;
 
 /* Builtin function initialization.  */
 
-/* Return a definition for a builtin function named NAME and whose data type
-   is TYPE.  TYPE should be a function type with argument types.
-   FUNCTION_CODE tells later passes how to compile calls to this function.
-   See tree.h for its possible values.
-
-   If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME,
-   the name to be called if we can't opencode the function.  If
-   ATTRS is nonzero, use that for the function's attribute list.  */
-
 tree
-builtin_function (const char *name,
-		  tree type,
-		  int function_code,
-		  enum built_in_class class,
-		  const char *library_name,
-		  tree attrs)
-{
-  tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
-  DECL_EXTERNAL (decl) = 1;
-  TREE_PUBLIC (decl) = 1;
-  if (library_name)
-    SET_DECL_ASSEMBLER_NAME (decl, get_identifier (library_name));
+gfc_builtin_function (tree decl)
+{
   make_decl_rtl (decl);
   pushdecl (decl);
-  DECL_BUILT_IN_CLASS (decl) = class;
-  DECL_FUNCTION_CODE (decl) = function_code;
-
-  /* Possibly apply some default attributes to this built-in function.  */
-  if (attrs)
-    {
-      /* FORNOW the only supported attribute is "const".  If others need
-         to be supported then see the more general solution in procedure
-         builtin_function in c-decl.c  */
-      if (lookup_attribute ( "const", attrs ))
-        TREE_READONLY (decl) = 1;
-    }
-
   return decl;
 }
 
@@ -773,8 +743,8 @@ gfc_define_builtin (const char * name,
 {
   tree decl;
 
-  decl = builtin_function (name, type, code, BUILT_IN_NORMAL,
-			   library_name, NULL_TREE);
+  decl = add_builtin_function (name, type, code, BUILT_IN_NORMAL,
+			       library_name, NULL_TREE);
   if (const_p)
     TREE_READONLY (decl) = 1;
 
Index: gcc/langhooks.c
===================================================================
--- gcc/langhooks.c	(revision 115097)
+++ gcc/langhooks.c	(working copy)
@@ -588,3 +588,41 @@ lhd_omp_firstprivatize_type_sizes (struc
 				   tree t ATTRIBUTE_UNUSED)
 {
 }
+
+tree
+add_builtin_function (const char *name,
+		      tree type,
+		      int function_code,
+		      enum built_in_class cl,
+		      const char *library_name,
+		      tree attrs)
+{
+  tree   id = get_identifier (name);
+  tree decl = build_decl (FUNCTION_DECL, id, type);
+
+  TREE_PUBLIC (decl)         = 1;
+  DECL_EXTERNAL (decl)       = 1;
+  DECL_BUILT_IN_CLASS (decl) = cl;
+  DECL_FUNCTION_CODE (decl)  = function_code;
+
+  if (library_name) {
+    tree libname = get_identifier (library_name);
+    SET_DECL_ASSEMBLER_NAME (decl, libname);
+  }
+
+  /* Possibly apply some default attributes to this built-in function.  */
+  if (attrs)
+    decl_attributes (&decl, attrs, ATTR_FLAG_BUILT_IN);
+  else
+    decl_attributes (&decl, NULL_TREE, 0);
+
+  return lang_hooks.builtin_function (decl);
+
+}
+
+tree
+lhd_builtin_function (tree decl)
+{
+  lang_hooks.decls.pushdecl (decl);
+  return decl;
+}
Index: gcc/langhooks.h
===================================================================
--- gcc/langhooks.h	(revision 115097)
+++ gcc/langhooks.h	(working copy)
@@ -443,17 +443,8 @@ struct lang_hooks
      KNOWN_TYPE carries the true type of the OBJ_TYPE_REF_OBJECT.  */
   tree (*fold_obj_type_ref) (tree, tree);
 
-  /* Return a definition for a builtin function named NAME and whose data type
-     is TYPE.  TYPE should be a function type with argument types.
-     FUNCTION_CODE tells later passes how to compile calls to this function.
-     See tree.h for its possible values.
-
-     If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME,
-     the name to be called if we can't opencode the function.  If
-     ATTRS is nonzero, use that for the function's attribute list.  */
-  tree (*builtin_function) (const char *name, tree type, int function_code,
-			    enum built_in_class bt_class,
-			    const char *library_name, tree attrs);
+  /* Do language specific processing in the builtin function DECL  */
+  tree (*builtin_function) (tree decl);
 
   /* Used to set up the tree_contains_structure array for a frontend. */
   void (*init_ts) (void);
@@ -470,5 +461,9 @@ struct lang_hooks
 
 /* Each front end provides its own.  */
 extern const struct lang_hooks lang_hooks;
+extern tree add_builtin_function (const char *name, tree type,
+				  int function_code, enum built_in_class cl,
+				  const char *library_name,
+				  tree attrs);
 
 #endif /* GCC_LANG_HOOKS_H */
Index: gcc/treelang/treetree.c
===================================================================
--- gcc/treelang/treetree.c	(revision 115097)
+++ gcc/treelang/treetree.c	(working copy)
@@ -138,10 +138,6 @@ static tree pushdecl (tree decl);
 static tree* getstmtlist (void);
 
 /* Langhooks.  */
-static tree builtin_function (const char *name, tree type, int function_code,
-			      enum built_in_class class,
-			      const char *library_name,
-			      tree attrs);
 extern const struct attribute_spec treelang_attribute_table[];
 static tree getdecls (void);
 static int global_bindings_p (void);
@@ -1224,41 +1220,6 @@ const struct attribute_spec treelang_att
   { NULL, 0, 0, false, false, false, NULL },
 };
 
-/* Return a definition for a builtin function named NAME and whose data type
-   is TYPE.  TYPE should be a function type with argument types.
-   FUNCTION_CODE tells later passes how to compile calls to this function.
-   See tree.h for its possible values.
-
-   If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME,
-   the name to be called if we can't opencode the function.  If
-   ATTRS is nonzero, use that for the function's attribute list.
-
-   copied from gcc/c-decl.c
-*/
-
-static tree
-builtin_function (const char *name, tree type, int function_code,
-		  enum built_in_class class, const char *library_name,
-		  tree attrs)
-{
-  tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
-  DECL_EXTERNAL (decl) = 1;
-  TREE_PUBLIC (decl) = 1;
-  if (library_name)
-    SET_DECL_ASSEMBLER_NAME (decl, get_identifier (library_name));
-  pushdecl (decl);
-  DECL_BUILT_IN_CLASS (decl) = class;
-  DECL_FUNCTION_CODE (decl) = function_code;
-
-  /* Possibly apply some default attributes to this built-in function.  */
-  if (attrs)
-    decl_attributes (&decl, attrs, ATTR_FLAG_BUILT_IN);
-  else
-    decl_attributes (&decl, NULL_TREE, 0);
-
-  return decl;
-}
-
 /* Treelang expand function langhook.  */
 
 static void
Index: gcc/tree-ssa-loop-prefetch.c
===================================================================
--- gcc/tree-ssa-loop-prefetch.c	(revision 115097)
+++ gcc/tree-ssa-loop-prefetch.c	(working copy)
@@ -1029,9 +1029,9 @@ tree_ssa_prefetch_arrays (struct loops *
 				       tree_cons (NULL_TREE,
 						  const_ptr_type_node,
 						  NULL_TREE));
-      tree decl = lang_hooks.builtin_function ("__builtin_prefetch", type,
-			BUILT_IN_PREFETCH, BUILT_IN_NORMAL,
-			NULL, NULL_TREE);
+      tree decl = add_builtin_function ("__builtin_prefetch", type,
+					BUILT_IN_PREFETCH, BUILT_IN_NORMAL,
+					NULL, NULL_TREE);
       DECL_IS_NOVOPS (decl) = true;
       built_in_decls[BUILT_IN_PREFETCH] = decl;
     }
Index: gcc/c-common.c
===================================================================
--- gcc/c-common.c	(revision 115097)
+++ gcc/c-common.c	(working copy)
@@ -3495,14 +3495,14 @@ def_builtin_1 (enum built_in_function fn
 			   strlen ("__builtin_")));
 
   libname = name + strlen ("__builtin_");
-  decl = lang_hooks.builtin_function (name, fntype, fncode, fnclass,
-				      (fallback_p ? libname : NULL),
-				      fnattrs);
+  decl = add_builtin_function (name, fntype, fncode, fnclass,
+			       (fallback_p ? libname : NULL),
+			       fnattrs);
   if (both_p
       && !flag_no_builtin && !builtin_function_disabled_p (libname)
       && !(nonansi_p && flag_no_nonansi_builtin))
-    lang_hooks.builtin_function (libname, libtype, fncode, fnclass,
-				 NULL, fnattrs);
+    add_builtin_function (libname, libtype, fncode, fnclass,
+			  NULL, fnattrs);
 
   built_in_decls[(int) fncode] = decl;
   if (implicit_p)
Index: gcc/config/alpha/alpha.c
===================================================================
--- gcc/config/alpha/alpha.c	(revision 115097)
+++ gcc/config/alpha/alpha.c	(working copy)
@@ -6523,8 +6523,8 @@ alpha_init_builtins (void)
   p = zero_arg_builtins;
   for (i = 0; i < ARRAY_SIZE (zero_arg_builtins); ++i, ++p)
     if ((target_flags & p->target_mask) == p->target_mask)
-      lang_hooks.builtin_function (p->name, ftype, p->code, BUILT_IN_MD,
-				   NULL, attrs[p->is_const]);
+      add_builtin_function (p->name, ftype, p->code, BUILT_IN_MD,
+			    NULL, attrs[p->is_const]);
 
   ftype = build_function_type_list (dimode_integer_type_node,
 				    dimode_integer_type_node, NULL_TREE);
@@ -6532,8 +6532,8 @@ alpha_init_builtins (void)
   p = one_arg_builtins;
   for (i = 0; i < ARRAY_SIZE (one_arg_builtins); ++i, ++p)
     if ((target_flags & p->target_mask) == p->target_mask)
-      lang_hooks.builtin_function (p->name, ftype, p->code, BUILT_IN_MD,
-				   NULL, attrs[p->is_const]);
+      add_builtin_function (p->name, ftype, p->code, BUILT_IN_MD,
+			    NULL, attrs[p->is_const]);
 
   ftype = build_function_type_list (dimode_integer_type_node,
 				    dimode_integer_type_node,
@@ -6542,18 +6542,18 @@ alpha_init_builtins (void)
   p = two_arg_builtins;
   for (i = 0; i < ARRAY_SIZE (two_arg_builtins); ++i, ++p)
     if ((target_flags & p->target_mask) == p->target_mask)
-      lang_hooks.builtin_function (p->name, ftype, p->code, BUILT_IN_MD,
-				   NULL, attrs[p->is_const]);
+      add_builtin_function (p->name, ftype, p->code, BUILT_IN_MD,
+			    NULL, attrs[p->is_const]);
 
   ftype = build_function_type (ptr_type_node, void_list_node);
-  lang_hooks.builtin_function ("__builtin_thread_pointer", ftype,
-			       ALPHA_BUILTIN_THREAD_POINTER, BUILT_IN_MD,
-			       NULL, attrs[0]);
+  add_builtin_function ("__builtin_thread_pointer", ftype,
+			ALPHA_BUILTIN_THREAD_POINTER, BUILT_IN_MD,
+			NULL, attrs[0]);
 
   ftype = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
-  lang_hooks.builtin_function ("__builtin_set_thread_pointer", ftype,
-			       ALPHA_BUILTIN_SET_THREAD_POINTER, BUILT_IN_MD,
-			       NULL, attrs[0]);
+  add_builtin_function ("__builtin_set_thread_pointer", ftype,
+			ALPHA_BUILTIN_SET_THREAD_POINTER, BUILT_IN_MD,
+			NULL, attrs[0]);
 
   alpha_v8qi_u = build_vector_type (unsigned_intQI_type_node, 8);
   alpha_v8qi_s = build_vector_type (intQI_type_node, 8);
Index: gcc/config/frv/frv.c
===================================================================
--- gcc/config/frv/frv.c	(revision 115097)
+++ gcc/config/frv/frv.c	(working copy)
@@ -8148,7 +8148,7 @@ frv_reorg (void)
 }
 
 #define def_builtin(name, type, code) \
-  lang_hooks.builtin_function ((name), (type), (code), BUILT_IN_MD, NULL, NULL)
+  add_builtin_function ((name), (type), (code), BUILT_IN_MD, NULL, NULL)
 
 struct builtin_description
 {
Index: gcc/config/s390/s390.c
===================================================================
--- gcc/config/s390/s390.c	(revision 115097)
+++ gcc/config/s390/s390.c	(working copy)
@@ -8181,14 +8181,14 @@ s390_init_builtins (void)
   tree ftype;
 
   ftype = build_function_type (ptr_type_node, void_list_node);
-  lang_hooks.builtin_function ("__builtin_thread_pointer", ftype,
-			       S390_BUILTIN_THREAD_POINTER, BUILT_IN_MD,
-			       NULL, NULL_TREE);
+  add_builtin_function ("__builtin_thread_pointer", ftype,
+			S390_BUILTIN_THREAD_POINTER, BUILT_IN_MD,
+			NULL, NULL_TREE);
 
   ftype = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
-  lang_hooks.builtin_function ("__builtin_set_thread_pointer", ftype,
-			       S390_BUILTIN_SET_THREAD_POINTER, BUILT_IN_MD,
-			       NULL, NULL_TREE);
+  add_builtin_function ("__builtin_set_thread_pointer", ftype,
+			S390_BUILTIN_SET_THREAD_POINTER, BUILT_IN_MD,
+			NULL, NULL_TREE);
 }
 
 /* Expand an expression EXP that calls a built-in function,
Index: gcc/config/sparc/sparc.c
===================================================================
--- gcc/config/sparc/sparc.c	(revision 115097)
+++ gcc/config/sparc/sparc.c	(working copy)
@@ -7868,8 +7868,8 @@ sparc_init_libfuncs (void)
 }
 
 #define def_builtin(NAME, CODE, TYPE) \
-  lang_hooks.builtin_function((NAME), (TYPE), (CODE), BUILT_IN_MD, NULL, \
-                              NULL_TREE)
+  add_builtin_function((NAME), (TYPE), (CODE), BUILT_IN_MD, NULL, \
+                       NULL_TREE)
 
 /* Implement the TARGET_INIT_BUILTINS target hook.
    Create builtin functions for special SPARC instructions.  */
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c	(revision 115097)
+++ gcc/config/i386/i386.c	(working copy)
@@ -14477,8 +14477,8 @@ enum ix86_builtins
 do {									\
   if ((MASK) & target_flags						\
       && (!((MASK) & MASK_64BIT) || TARGET_64BIT))			\
-    lang_hooks.builtin_function ((NAME), (TYPE), (CODE), BUILT_IN_MD,	\
-				 NULL, NULL_TREE);			\
+    add_builtin_function ((NAME), (TYPE), (CODE), BUILT_IN_MD,	\
+			 NULL, NULL_TREE);			\
 } while (0)
 
 /* Bits for builtin_description.flag.  */
Index: gcc/config/sh/sh.c
===================================================================
--- gcc/config/sh/sh.c	(revision 115097)
+++ gcc/config/sh/sh.c	(working copy)
@@ -9469,8 +9469,8 @@ sh_media_init_builtins (void)
 	  if (signature < SH_BLTIN_NUM_SHARED_SIGNATURES)
 	    shared[signature] = type;
 	}
-      lang_hooks.builtin_function (d->name, type, d - bdesc, BUILT_IN_MD,
-				   NULL, NULL_TREE);
+      add_builtin_function (d->name, type, d - bdesc, BUILT_IN_MD,
+			    NULL, NULL_TREE);
     }
 }
 
Index: gcc/config/c4x/c4x.c
===================================================================
--- gcc/config/c4x/c4x.c	(revision 115097)
+++ gcc/config/c4x/c4x.c	(working copy)
@@ -4339,52 +4339,52 @@ c4x_init_builtins (void)
 {
   tree endlink = void_list_node;
 
-  lang_hooks.builtin_function ("fast_ftoi",
-			       build_function_type 
-			       (integer_type_node,
-				tree_cons (NULL_TREE, double_type_node,
-					   endlink)),
-			       C4X_BUILTIN_FIX, BUILT_IN_MD, NULL, NULL_TREE);
-  lang_hooks.builtin_function ("ansi_ftoi",
-			       build_function_type 
-			       (integer_type_node, 
-				tree_cons (NULL_TREE, double_type_node,
-					   endlink)),
-			       C4X_BUILTIN_FIX_ANSI, BUILT_IN_MD, NULL,
-			       NULL_TREE);
+  add_builtin_function ("fast_ftoi",
+			build_function_type 
+			(integer_type_node,
+			 tree_cons (NULL_TREE, double_type_node,
+				    endlink)),
+			C4X_BUILTIN_FIX, BUILT_IN_MD, NULL, NULL_TREE);
+  add_builtin_function ("ansi_ftoi",
+			build_function_type 
+			(integer_type_node, 
+			 tree_cons (NULL_TREE, double_type_node,
+				    endlink)),
+			C4X_BUILTIN_FIX_ANSI, BUILT_IN_MD, NULL,
+			NULL_TREE);
   if (TARGET_C3X)
-    lang_hooks.builtin_function ("fast_imult",
-				 build_function_type
-				 (integer_type_node, 
-				  tree_cons (NULL_TREE, integer_type_node,
-					     tree_cons (NULL_TREE,
-							integer_type_node,
-							endlink))),
-				 C4X_BUILTIN_MPYI, BUILT_IN_MD, NULL,
-				 NULL_TREE);
+    add_builtin_function ("fast_imult",
+			  build_function_type
+			  (integer_type_node, 
+			   tree_cons (NULL_TREE, integer_type_node,
+				      tree_cons (NULL_TREE,
+						 integer_type_node,
+						 endlink))),
+			  C4X_BUILTIN_MPYI, BUILT_IN_MD, NULL,
+			  NULL_TREE);
   else
     {
-      lang_hooks.builtin_function ("toieee",
-				   build_function_type 
-				   (double_type_node,
-				    tree_cons (NULL_TREE, double_type_node,
-					       endlink)),
-				   C4X_BUILTIN_TOIEEE, BUILT_IN_MD, NULL,
-				   NULL_TREE);
-      lang_hooks.builtin_function ("frieee",
-				   build_function_type
-				   (double_type_node, 
-				    tree_cons (NULL_TREE, double_type_node,
-					       endlink)),
-				   C4X_BUILTIN_FRIEEE, BUILT_IN_MD, NULL,
-				   NULL_TREE);
-      lang_hooks.builtin_function ("fast_invf",
-				   build_function_type 
-				   (double_type_node, 
-				    tree_cons (NULL_TREE, double_type_node,
-					       endlink)),
-				   C4X_BUILTIN_RCPF, BUILT_IN_MD, NULL,
-				   NULL_TREE);
+      add_builtin_function ("toieee",
+			    build_function_type 
+			    (double_type_node,
+			     tree_cons (NULL_TREE, double_type_node,
+					endlink)),
+			    C4X_BUILTIN_TOIEEE, BUILT_IN_MD, NULL,
+			    NULL_TREE);
+      add_builtin_function ("frieee",
+			    build_function_type
+			    (double_type_node, 
+			     tree_cons (NULL_TREE, double_type_node,
+					endlink)),
+			    C4X_BUILTIN_FRIEEE, BUILT_IN_MD, NULL,
+			    NULL_TREE);
+      add_builtin_function ("fast_invf",
+			    build_function_type 
+			    (double_type_node, 
+			     tree_cons (NULL_TREE, double_type_node,
+					endlink)),
+			    C4X_BUILTIN_RCPF, BUILT_IN_MD, NULL,
+			    NULL_TREE);
     }
 }
 
Index: gcc/config/stormy16/stormy16.c
===================================================================
--- gcc/config/stormy16/stormy16.c	(revision 115097)
+++ gcc/config/stormy16/stormy16.c	(working copy)
@@ -2334,9 +2334,9 @@ xstormy16_init_builtins (void)
 	  else
 	    args = tree_cons (NULL_TREE, arg, args);
 	}
-      lang_hooks.builtin_function (s16builtins[i].name,
-				   build_function_type (ret_type, args),
-				   i, BUILT_IN_MD, NULL, NULL);
+      add_builtin_function (s16builtins[i].name,
+			    build_function_type (ret_type, args),
+			    i, BUILT_IN_MD, NULL, NULL);
     }
 }
 
Index: gcc/config/iq2000/iq2000.c
===================================================================
--- gcc/config/iq2000/iq2000.c	(revision 115097)
+++ gcc/config/iq2000/iq2000.c	(working copy)
@@ -2436,8 +2436,8 @@ iq2000_output_conditional_branch (rtx in
 }
 
 #define def_builtin(NAME, TYPE, CODE)					\
-  lang_hooks.builtin_function ((NAME), (TYPE), (CODE), BUILT_IN_MD,	\
-			       NULL, NULL_TREE)
+  add_builtin_function ((NAME), (TYPE), (CODE), BUILT_IN_MD,	\
+		       NULL, NULL_TREE)
 
 static void
 iq2000_init_builtins (void)
Index: gcc/config/ia64/ia64.c
===================================================================
--- gcc/config/ia64/ia64.c	(revision 115097)
+++ gcc/config/ia64/ia64.c	(working copy)
@@ -9089,8 +9089,8 @@ ia64_init_builtins (void)
 					       "__float128");
 
 #define def_builtin(name, type, code)					\
-  lang_hooks.builtin_function ((name), (type), (code), BUILT_IN_MD,	\
-			       NULL, NULL_TREE)
+  add_builtin_function ((name), (type), (code), BUILT_IN_MD,	\
+		       NULL, NULL_TREE)
 
   def_builtin ("__builtin_ia64_bsp",
 	       build_function_type (ptr_type_node, void_list_node),
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 115097)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -6036,8 +6036,8 @@ def_builtin (int mask, const char *name,
 	abort ();
 
       rs6000_builtin_decls[code] =
-        lang_hooks.builtin_function (name, type, code, BUILT_IN_MD,
-				     NULL, NULL_TREE);
+        add_builtin_function (name, type, code, BUILT_IN_MD,
+			      NULL, NULL_TREE);
     }
 }
 
@@ -8561,12 +8561,12 @@ altivec_init_builtins (void)
       /* Initialize target builtin that implements
          targetm.vectorize.builtin_mask_for_load.  */
 
-      decl = lang_hooks.builtin_function ("__builtin_altivec_mask_for_load",
-                               v16qi_ftype_long_pcvoid,
-                               ALTIVEC_BUILTIN_MASK_FOR_LOAD,
-                               BUILT_IN_MD, NULL,
-                               tree_cons (get_identifier ("const"),
-                                          NULL_TREE, NULL_TREE));
+      decl = add_builtin_function ("__builtin_altivec_mask_for_load",
+				   v16qi_ftype_long_pcvoid,
+				   ALTIVEC_BUILTIN_MASK_FOR_LOAD,
+				   BUILT_IN_MD, NULL,
+				   tree_cons (get_identifier ("const"),
+					      NULL_TREE, NULL_TREE));
       /* Record the decl. Will be used by rs6000_builtin_mask_for_load.  */
       altivec_builtin_mask_for_load = decl;
     }
Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c	(revision 115097)
+++ gcc/config/arm/arm.c	(working copy)
@@ -12052,8 +12052,8 @@ arm_debugger_arg_offset (int value, rtx 
   do									\
     {									\
       if ((MASK) & insn_flags)						\
-        lang_hooks.builtin_function ((NAME), (TYPE), (CODE),		\
-				     BUILT_IN_MD, NULL, NULL_TREE);	\
+        add_builtin_function ((NAME), (TYPE), (CODE),			\
+			     BUILT_IN_MD, NULL, NULL_TREE);		\
     }									\
   while (0)
 
@@ -12525,9 +12525,9 @@ arm_init_tls_builtins (void)
   tree const_nothrow = tree_cons (get_identifier ("const"), NULL, nothrow);
 
   ftype = build_function_type (ptr_type_node, void_list_node);
-  lang_hooks.builtin_function ("__builtin_thread_pointer", ftype,
-			       ARM_BUILTIN_THREAD_POINTER, BUILT_IN_MD,
-			       NULL, const_nothrow);
+  add_builtin_function ("__builtin_thread_pointer", ftype,
+			ARM_BUILTIN_THREAD_POINTER, BUILT_IN_MD,
+			NULL, const_nothrow);
 }
 
 static void
Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	(revision 115097)
+++ gcc/config/mips/mips.c	(working copy)
@@ -10549,9 +10549,9 @@ mips_init_builtins (void)
       if (m->proc == PROCESSOR_MAX || (m->proc == mips_arch))
 	for (d = m->bdesc; d < &m->bdesc[m->size]; d++)
 	  if ((d->target_flags & target_flags) == d->target_flags)
-	    lang_hooks.builtin_function (d->name, types[d->function_type],
-					 d - m->bdesc + offset,
-					 BUILT_IN_MD, NULL, NULL);
+	    add_builtin_function (d->name, types[d->function_type],
+				  d - m->bdesc + offset,
+				  BUILT_IN_MD, NULL, NULL);
       offset += m->size;
     }
 }
Index: gcc/config/bfin/bfin.c
===================================================================
--- gcc/config/bfin/bfin.c	(revision 115097)
+++ gcc/config/bfin/bfin.c	(working copy)
@@ -3928,8 +3928,8 @@ enum bfin_builtins
 
 #define def_builtin(NAME, TYPE, CODE)					\
 do {									\
-  lang_hooks.builtin_function ((NAME), (TYPE), (CODE), BUILT_IN_MD,	\
-			       NULL, NULL_TREE);			\
+  add_builtin_function ((NAME), (TYPE), (CODE), BUILT_IN_MD,		\
+		       NULL, NULL_TREE);				\
 } while (0)
 
 /* Set up all builtin functions for this target.  */
Index: gcc/langhooks-def.h
===================================================================
--- gcc/langhooks-def.h	(revision 115097)
+++ gcc/langhooks-def.h	(working copy)
@@ -71,6 +71,7 @@ extern tree lhd_expr_size (tree);
 extern size_t lhd_tree_size (enum tree_code);
 extern HOST_WIDE_INT lhd_to_target_charset (HOST_WIDE_INT);
 extern tree lhd_expr_to_decl (tree, bool *, bool *, bool *);
+extern tree lhd_builtin_function (tree decl);
 
 /* Declarations of default tree inlining hooks.  */
 extern tree lhd_tree_inlining_walk_subtrees (tree *, int *, walk_tree_fn,
@@ -130,7 +131,7 @@ extern void lhd_omp_firstprivatize_type_
 #define LANG_HOOKS_EXPR_SIZE		lhd_expr_size
 #define LANG_HOOKS_TREE_SIZE		lhd_tree_size
 #define LANG_HOOKS_TYPES_COMPATIBLE_P	lhd_types_compatible_p
-#define LANG_HOOKS_BUILTIN_FUNCTION	builtin_function
+#define LANG_HOOKS_BUILTIN_FUNCTION	lhd_builtin_function
 #define LANG_HOOKS_EXPR_TO_DECL		lhd_expr_to_decl
 #define LANG_HOOKS_TO_TARGET_CHARSET	lhd_to_target_charset
 #define LANG_HOOKS_INIT_TS		lhd_do_nothing

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]