aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlatunji Ruwase <tjruwase@google.com>2009-06-26 18:10:03 +0000
committerRichard Henderson <rth@redhat.com>2009-06-26 18:10:03 +0000
commiteeeb71cee53c9b004df05c1640a77e906462575d (patch)
treec678b61dfc527900843787a7f2b7ab998a25fa29
parent36ae15719adedf1a69b60aa695b8016cc95a2cc8 (diff)
* builtins.c (expand_builtin_alloca): Handle builtin alloca
that is marked not to be inlined. Remove flag_mudflap use. * tree-mudflap.c: Rename mf_xform_derefs to mf_xfrom_statements. (mf_xform_statements): Mark builtin alloca calls as un-inlineable. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@148980 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/builtins.c6
-rw-r--r--gcc/tree-mudflap.c35
3 files changed, 35 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9c7bbd67756..744aaf7ce0e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2009-06-26 Olatunji Ruwase <tjruwase@google.com>
+
+ * builtins.c (expand_builtin_alloca): Handle builtin alloca
+ that is marked not to be inlined. Remove flag_mudflap use.
+ * tree-mudflap.c: Rename mf_xform_derefs to mf_xfrom_statements.
+ (mf_xform_statements): Mark builtin alloca calls as un-inlineable.
+
2009-06-26 Steve Ellcey <sje@cup.hp.com>
PR bootstrap/40338
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 8476f00e422..7fdb4f03428 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -5182,10 +5182,8 @@ expand_builtin_alloca (tree exp, rtx target)
rtx op0;
rtx result;
- /* In -fmudflap-instrumented code, alloca() and __builtin_alloca()
- should always expand to function calls. These can be intercepted
- in libmudflap. */
- if (flag_mudflap)
+ /* Emit normal call if marked not-inlineable. */
+ if (CALL_CANNOT_INLINE_P (exp))
return NULL_RTX;
if (!validate_arglist (exp, INTEGER_TYPE, VOID_TYPE))
diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c
index cfba33d9c66..8fcafca4b8f 100644
--- a/gcc/tree-mudflap.c
+++ b/gcc/tree-mudflap.c
@@ -62,7 +62,7 @@ static tree mf_file_function_line_tree (location_t);
/* Indirection-related instrumentation. */
static void mf_decl_cache_locals (void);
static void mf_decl_clear_locals (void);
-static void mf_xform_derefs (void);
+static void mf_xform_statements (void);
static unsigned int execute_mudflap_function_ops (void);
/* Addressable variables instrumentation. */
@@ -416,13 +416,19 @@ mudflap_init (void)
/* ------------------------------------------------------------------------ */
-/* Memory reference transforms. Perform the mudflap indirection-related
- tree transforms on the current function.
-
- This is the second part of the mudflap instrumentation. It works on
+/* This is the second part of the mudflap instrumentation. It works on
low-level GIMPLE using the CFG, because we want to run this pass after
tree optimizations have been performed, but we have to preserve the CFG
- for expansion from trees to RTL. */
+ for expansion from trees to RTL.
+ Below is the list of transformations performed on statements in the
+ current function.
+
+ 1) Memory reference transforms: Perform the mudflap indirection-related
+ tree transforms on memory references.
+
+ 2) Mark BUILTIN_ALLOCA calls not inlineable.
+
+ */
static unsigned int
execute_mudflap_function_ops (void)
@@ -441,7 +447,7 @@ execute_mudflap_function_ops (void)
if (! flag_mudflap_threads)
mf_decl_cache_locals ();
- mf_xform_derefs ();
+ mf_xform_statements ();
if (! flag_mudflap_threads)
mf_decl_clear_locals ();
@@ -934,9 +940,12 @@ mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp,
mf_build_check_statement_for (base, limit, iter, location, dirflag);
}
-
+/* Transform
+ 1) Memory references.
+ 2) BUILTIN_ALLOCA calls.
+*/
static void
-mf_xform_derefs (void)
+mf_xform_statements (void)
{
basic_block bb, next;
gimple_stmt_iterator i;
@@ -974,6 +983,14 @@ mf_xform_derefs (void)
}
break;
+ case GIMPLE_CALL:
+ {
+ tree fndecl = gimple_call_fndecl (s);
+ if (fndecl && (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_ALLOCA))
+ gimple_call_set_cannot_inline (s, true);
+ }
+ break;
+
default:
;
}