summaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-29 15:47:54 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-29 15:47:54 +0000
commit81bdf64f2035b8979549fc533915ea17d429dc9f (patch)
tree69e2b47b22500339535d6f5f37e3fca2350d4f3a /gcc/function.c
parent7f1c23c2e7981438c251121d85cf5d807b9a4f5d (diff)
downloadgcc-81bdf64f2035b8979549fc533915ea17d429dc9f.tar.gz
2008-07-29 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r138226 [after tuple merge into trunk] some compiler probe stuff are missing * gcc/compiler-probe.h: more gimple, less tree * gcc/compiler-probe.c: incomplete merge. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@138247 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 8e8b907f917..532a94f34c4 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -59,7 +59,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "target.h"
#include "cfglayout.h"
-#include "tree-gimple.h"
+#include "gimple.h"
#include "tree-pass.h"
#include "predict.h"
#include "df.h"
@@ -1547,7 +1547,7 @@ static tree
instantiate_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
{
tree t = *tp;
- if (! EXPR_P (t) && ! GIMPLE_STMT_P (t))
+ if (! EXPR_P (t))
{
*walk_subtrees = 0;
if (DECL_P (t) && DECL_RTL_SET_P (t))
@@ -3092,7 +3092,7 @@ gimplify_parm_type (tree *tp, int *walk_subtrees, void *data)
else if (TYPE_SIZE (t) && !TREE_CONSTANT (TYPE_SIZE (t))
&& !TYPE_SIZES_GIMPLIFIED (t))
{
- gimplify_type_sizes (t, (tree *) data);
+ gimplify_type_sizes (t, (gimple_seq *) data);
*walk_subtrees = 1;
}
}
@@ -3102,15 +3102,15 @@ gimplify_parm_type (tree *tp, int *walk_subtrees, void *data)
/* Gimplify the parameter list for current_function_decl. This involves
evaluating SAVE_EXPRs of variable sized parameters and generating code
- to implement callee-copies reference parameters. Returns a list of
- statements to add to the beginning of the function, or NULL if nothing
- to do. */
+ to implement callee-copies reference parameters. Returns a sequence of
+ statements to add to the beginning of the function. */
-tree
+gimple_seq
gimplify_parameters (void)
{
struct assign_parm_data_all all;
- tree fnargs, parm, stmts = NULL;
+ tree fnargs, parm;
+ gimple_seq stmts = NULL;
assign_parms_initialize_all (&all);
fnargs = assign_parms_augmented_arg_list (&all);
@@ -3170,12 +3170,11 @@ gimplify_parameters (void)
t = built_in_decls[BUILT_IN_ALLOCA];
t = build_call_expr (t, 1, DECL_SIZE_UNIT (parm));
t = fold_convert (ptr_type, t);
- t = build_gimple_modify_stmt (addr, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (addr), addr, t);
gimplify_and_add (t, &stmts);
}
- t = build_gimple_modify_stmt (local, parm);
- gimplify_and_add (t, &stmts);
+ gimplify_assign (local, parm, &stmts);
SET_DECL_VALUE_EXPR (parm, local);
DECL_HAS_VALUE_EXPR_P (parm) = 1;
@@ -3731,13 +3730,30 @@ debug_find_var_in_block_tree (tree var, tree block)
static bool in_dummy_function;
-/* Invoke the target hook when setting cfun. */
+/* Invoke the target hook when setting cfun. Update the optimization options
+ if the function uses different options than the default. */
static void
invoke_set_current_function_hook (tree fndecl)
{
if (!in_dummy_function)
- targetm.set_current_function (fndecl);
+ {
+ tree opts = ((fndecl)
+ ? DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl)
+ : optimization_default_node);
+
+ if (!opts)
+ opts = optimization_default_node;
+
+ /* Change optimization options if needed. */
+ if (optimization_current_node != opts)
+ {
+ optimization_current_node = opts;
+ cl_optimization_restore (TREE_OPTIMIZATION (opts));
+ }
+
+ targetm.set_current_function (fndecl);
+ }
}
/* cfun should never be set directly; use this function. */