diff options
author | Rafael Espindola <espindola@google.com> | 2009-03-19 15:50:59 +0000 |
---|---|---|
committer | Rafael Espindola <espindola@google.com> | 2009-03-19 15:50:59 +0000 |
commit | 9ed52cf654d024349344fd4d2e6c5341d3598179 (patch) | |
tree | b5d84a721489b5d40761ca889d81e3dbf818d6dd /gcc | |
parent | 1810b488e267fa4c1333cb9a28bc3c281d14720c (diff) |
2009-03-19 Rafael Avila de Espindola <espindola@google.com>
* builtins.c (is_builtin_name): New.
(called_as_built_in): Use is_builtin_name. Make it static.
* tree.h (is_builtin_name): New.
(called_as_built_in): Remove.
* varasm.c (incorporeal_function_p):
Use is_builtin_name.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/lto@144966 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog.lto | 9 | ||||
-rw-r--r-- | gcc/builtins.c | 21 | ||||
-rw-r--r-- | gcc/tree.h | 2 | ||||
-rw-r--r-- | gcc/varasm.c | 7 |
4 files changed, 31 insertions, 8 deletions
diff --git a/gcc/ChangeLog.lto b/gcc/ChangeLog.lto index d814e1349c7..60b329891d5 100644 --- a/gcc/ChangeLog.lto +++ b/gcc/ChangeLog.lto @@ -1,3 +1,12 @@ +2009-03-19 Rafael Avila de Espindola <espindola@google.com> + + * builtins.c (is_builtin_name): New. + (called_as_built_in): Use is_builtin_name. Make it static. + * tree.h (is_builtin_name): New. + (called_as_built_in): Remove. + * varasm.c (incorporeal_function_p): + Use is_builtin_name. + 2009-03-18 Simon Baldwin <simonb@google.com> Revert: diff --git a/gcc/builtins.c b/gcc/builtins.c index a29e8e85693..ededccc2f26 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -241,14 +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". */ - bool -called_as_built_in (tree node) +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) @@ -256,6 +251,20 @@ 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 e241fa9e175..4276b5b1aa0 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4924,7 +4924,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 called_as_built_in (tree); +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 153635573eb..6d9d018f28b 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -2249,11 +2249,16 @@ incorporeal_function_p (tree decl) { if (TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl)) { + const char *name; + if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL && DECL_FUNCTION_CODE (decl) == BUILT_IN_ALLOCA) return true; - if (called_as_built_in (decl)) + gcc_assert (DECL_ASSEMBLER_NAME_SET_P (decl)); + name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); + + if (is_builtin_name (name)) return true; } return false; |