diff options
author | Diego Novillo <dnovillo@gcc.gnu.org> | 2009-10-03 17:10:11 -0400 |
---|---|---|
committer | Diego Novillo <dnovillo@gcc.gnu.org> | 2009-10-03 17:10:11 -0400 |
commit | d7f09764d7bc66b9997c811c22e11efc87b44792 (patch) | |
tree | 3a9882bd235e5026410e5397a5e46a97ece50b48 /gcc/builtins.c | |
parent | b06e51a0c9852e7fb7c6f589b46f6906ce48febd (diff) | |
download | gcc-d7f09764d7bc66b9997c811c22e11efc87b44792.tar.gz |
Merge lto branch into trunk.
From-SVN: r152434
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 50 |
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; + } +} |