aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRafael Avila de Espindola <espindola@google.com>2009-04-02 12:03:48 +0000
committerRafael Espindola <espindola@gcc.gnu.org>2009-04-02 12:03:48 +0000
commitbbf7ce1102df37e77231586abee685e96c19f25c (patch)
treeada50fd14e79e9d014f08296118dd44ba72f361a /gcc
parent47e4dfcf4a4770e17ade0a4a1d10cc41e2675554 (diff)
downloadgcc-bbf7ce1102df37e77231586abee685e96c19f25c.zip
gcc-bbf7ce1102df37e77231586abee685e96c19f25c.tar.gz
gcc-bbf7ce1102df37e77231586abee685e96c19f25c.tar.bz2
builtins.c (is_builtin_name): New.
2009-04-02 Rafael Avila de Espindola <espindola@google.com> * builtins.c (is_builtin_name): New. (called_as_built_in): Use is_builtin_name. * tree.h (is_builtin_name): New. * varasm.c (incorporeal_function_p): Use is_builtin_name From-SVN: r145444
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/builtins.c22
-rw-r--r--gcc/tree.h1
-rw-r--r--gcc/varasm.c2
4 files changed, 25 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2afe2bb..af401e7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2009-04-02 Rafael Avila de Espindola <espindola@google.com>
+
+ * builtins.c (is_builtin_name): New.
+ (called_as_built_in): Use is_builtin_name.
+ * tree.h (is_builtin_name): New.
+ * varasm.c (incorporeal_function_p): Use is_builtin_name
+
2009-04-02 Andrew Stubbs <ams@codesourcery.com>
* config/sh/linux-unwind.h: Disable when inhibit_libc is defined.
diff --git a/gcc/builtins.c b/gcc/builtins.c
index e22c5f5..9f0f4ac 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -241,13 +241,9 @@ static tree do_mpfr_bessel_n (tree, tree, tree,
static tree do_mpfr_remquo (tree, tree, tree);
static tree do_mpfr_lgamma_r (tree, tree, tree);
-/* Return true if NODE should be considered for inline expansion regardless
- of the optimization level. This means whenever a function is invoked with
- its "internal" name, which normally contains the prefix "__builtin". */
-
-static bool called_as_built_in (tree node)
+bool
+is_builtin_name (const char *name)
{
- const char *name = IDENTIFIER_POINTER (DECL_NAME (node));
if (strncmp (name, "__builtin_", 10) == 0)
return true;
if (strncmp (name, "__sync_", 7) == 0)
@@ -255,6 +251,20 @@ static bool called_as_built_in (tree node)
return false;
}
+/* Return true if NODE should be considered for inline expansion regardless
+ of the optimization level. This means whenever a function is invoked with
+ its "internal" name, which normally contains the prefix "__builtin". */
+
+static bool
+called_as_built_in (tree node)
+{
+ /* Note that we must use DECL_NAME, not DECL_ASSEMBLER_NAME_SET_P since
+ we want the name used to call the function, not the name it
+ will have. */
+ const char *name = IDENTIFIER_POINTER (DECL_NAME (node));
+ return is_builtin_name (name);
+}
+
/* Return the alignment in bits of EXP, an object.
Don't return more than MAX_ALIGN no matter what, ALIGN is the inital
guessed alignment e.g. from type alignment. */
diff --git a/gcc/tree.h b/gcc/tree.h
index 4e67c6a..1f262f6 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4896,6 +4896,7 @@ extern tree build_string_literal (int, const char *);
extern bool validate_arglist (const_tree, ...);
extern rtx builtin_memset_read_str (void *, HOST_WIDE_INT, enum machine_mode);
extern int get_pointer_alignment (tree, unsigned int);
+extern bool is_builtin_name(const char*);
extern int get_object_alignment (tree, unsigned int, unsigned int);
extern tree fold_call_stmt (gimple, bool);
extern tree gimple_fold_builtin_snprintf_chk (gimple, tree, enum built_in_function);
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 16d8782..4e41444 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2256,7 +2256,7 @@ incorporeal_function_p (tree decl)
return true;
name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
- if (strncmp (name, "__builtin_", strlen ("__builtin_")) == 0)
+ if (is_builtin_name (name))
return true;
}
return false;