summaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-03 21:10:11 +0000
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-03 21:10:11 +0000
commit7bfefa9d2c82e804ef4e59772f4060ac325bf99a (patch)
tree3a9882bd235e5026410e5397a5e46a97ece50b48 /gcc/builtins.c
parent7271d48ec9cd1a9aa3893d1d95e1d4a1c5882c37 (diff)
downloadgcc-7bfefa9d2c82e804ef4e59772f4060ac325bf99a.tar.gz
Merge lto branch into trunk.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152434 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 64840e1f620..c9bc23010a1 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -230,6 +230,8 @@ 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 NAME starts with __builtin_ or __sync_. */
+
bool
is_builtin_name (const char *name)
{
@@ -240,6 +242,16 @@ is_builtin_name (const char *name)
return false;
}
+
+/* Return true if DECL is a function symbol representing a built-in. */
+
+bool
+is_builtin_fn (tree decl)
+{
+ return TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl);
+}
+
+
/* 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". */
@@ -13856,3 +13868,41 @@ fold_call_stmt (gimple stmt, bool ignore)
}
return NULL_TREE;
}
+
+/* Look up the function in built_in_decls that corresponds to DECL
+ and set ASMSPEC as its user assembler name. DECL must be a
+ function decl that declares a builtin. */
+
+void
+set_builtin_user_assembler_name (tree decl, const char *asmspec)
+{
+ tree builtin;
+ gcc_assert (TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
+ && asmspec != 0);
+
+ builtin = built_in_decls [DECL_FUNCTION_CODE (decl)];
+ set_user_assembler_name (builtin, asmspec);
+ switch (DECL_FUNCTION_CODE (decl))
+ {
+ case BUILT_IN_MEMCPY:
+ init_block_move_fn (asmspec);
+ memcpy_libfunc = set_user_assembler_libfunc ("memcpy", asmspec);
+ break;
+ case BUILT_IN_MEMSET:
+ init_block_clear_fn (asmspec);
+ memset_libfunc = set_user_assembler_libfunc ("memset", asmspec);
+ break;
+ case BUILT_IN_MEMMOVE:
+ memmove_libfunc = set_user_assembler_libfunc ("memmove", asmspec);
+ break;
+ case BUILT_IN_MEMCMP:
+ memcmp_libfunc = set_user_assembler_libfunc ("memcmp", asmspec);
+ break;
+ case BUILT_IN_ABORT:
+ abort_libfunc = set_user_assembler_libfunc ("abort", asmspec);
+ break;
+ default:
+ break;
+ }
+}