OSDN Git Service

2009-02-27 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / langhooks.c
index 2285ac1..cdf1b6a 100644 (file)
@@ -1,5 +1,5 @@
 /* Default language-specific hooks.
-   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
    Contributed by Alexandre Oliva  <aoliva@redhat.com>
 
@@ -133,7 +133,7 @@ lhd_warn_unused_global_decl (const_tree decl)
   /* This is what used to exist in check_global_declarations.  Probably
      not many of these actually apply to non-C languages.  */
 
-  if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INLINE (decl))
+  if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (decl))
     return false;
   if (TREE_CODE (decl) == VAR_DECL && TREE_READONLY (decl))
     return false;
@@ -227,18 +227,6 @@ lhd_expand_expr (tree ARG_UNUSED (t), rtx ARG_UNUSED (r),
   gcc_unreachable ();
 }
 
-/* The default language-specific function for expanding a decl.  After
-   the language-independent cases are handled, this function will be
-   called.  If this function is not defined, it is assumed that
-   declarations other than those for variables and labels do not require
-   any RTL generation.  */
-
-int
-lhd_expand_decl (tree ARG_UNUSED (t))
-{
-  return 0;
-}
-
 /* This is the default decl_printable_name function.  */
 
 const char *
@@ -449,7 +437,7 @@ lhd_print_error_function (diagnostic_context *context, const char *file,
                  while (block && TREE_CODE (block) == BLOCK)
                    block = BLOCK_SUPERCONTEXT (block);
 
-                 if (TREE_CODE (block) == FUNCTION_DECL)
+                 if (block && TREE_CODE (block) == FUNCTION_DECL)
                    fndecl = block;
                  abstract_origin = NULL;
                }
@@ -540,13 +528,16 @@ lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *c 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)
+/* Common function for add_builtin_function and
+   add_builtin_function_ext_scope.  */
+static tree
+add_builtin_function_common (const char *name,
+                            tree type,
+                            int function_code,
+                            enum built_in_class cl,
+                            const char *library_name,
+                            tree attrs,
+                            tree (*hook) (tree))
 {
   tree   id = get_identifier (name);
   tree decl = build_decl (FUNCTION_DECL, id, type);
@@ -571,8 +562,43 @@ add_builtin_function (const char *name,
   else
     decl_attributes (&decl, NULL_TREE, 0);
 
-  return lang_hooks.builtin_function (decl);
+  return hook (decl);
+
+}
 
+/* Create a builtin function.  */
+
+tree
+add_builtin_function (const char *name,
+                     tree type,
+                     int function_code,
+                     enum built_in_class cl,
+                     const char *library_name,
+                     tree attrs)
+{
+  return add_builtin_function_common (name, type, function_code, cl,
+                                     library_name, attrs,
+                                     lang_hooks.builtin_function);
+}
+
+/* Like add_builtin_function, but make sure the scope is the external scope.
+   This is used to delay putting in back end builtin functions until the ISA
+   that defines the builtin is declared via function specific target options,
+   which can save memory for machines like the x86_64 that have multiple ISAs.
+   If this points to the same function as builtin_function, the backend must
+   add all of the builtins at program initialization time.  */
+
+tree
+add_builtin_function_ext_scope (const char *name,
+                               tree type,
+                               int function_code,
+                               enum built_in_class cl,
+                               const char *library_name,
+                               tree attrs)
+{
+  return add_builtin_function_common (name, type, function_code, cl,
+                                     library_name, attrs,
+                                     lang_hooks.builtin_function_ext_scope);
 }
 
 tree