summaryrefslogtreecommitdiff
path: root/gcc/langhooks.c
diff options
context:
space:
mode:
authormeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-30 23:50:40 +0000
committermeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-30 23:50:40 +0000
commit2447005502283065f2232ce09edf1b3c808a1c7f (patch)
treeb3ee120a2ecf25d00fba24415c8566f83135a110 /gcc/langhooks.c
parentac785357337a7e170d547963987890e6284185b0 (diff)
downloadgcc-2447005502283065f2232ce09edf1b3c808a1c7f.tar.gz
Change attribute((option(...))) to attribute((target(...))); Do not allocate tree nodes on x86 for builtins until we generate code for the ISA; Delete hot/cold functions changing optimization; Make C++ support target specific functions; Add #pragma GCC {push_options,pop_options,reset_options} instead of #pragma GCC {target,optimize} {push,reset,pop}
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139812 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/langhooks.c')
-rw-r--r--gcc/langhooks.c54
1 files changed, 46 insertions, 8 deletions
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index 30e5bfa9f61..4d441029802 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -540,13 +540,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 +574,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