summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-09 19:32:54 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-09 19:32:54 +0000
commitdac18d1a16fa87cb35d78ff4b7e41c85db4c11d4 (patch)
tree36739d69af4b92f19e771bb69a776ef920375013
parent6a61fe704133c856b4eb1fa673406e56577a8324 (diff)
downloadppe42-gcc-dac18d1a16fa87cb35d78ff4b7e41c85db4c11d4.tar.gz
ppe42-gcc-dac18d1a16fa87cb35d78ff4b7e41c85db4c11d4.zip
* gimplify.c (struct gimplify_ctx): Move to tree-gimple.h.
(push_gimplify_context): Don't allocate temp_htab nor c itself here. Add c argument. (pop_gimplify_context): Check c->temp_htab instead of optimize whether htab_delete should be called. Don't free c. (lookup_tmp_var): Create temp_htab lazily. (gimplify_scan_omp_clauses, gimplify_omp_parallel, gimplify_omp_task, gimplify_body, force_gimple_operand): Adjust push_gimplify_context callers. * omp-low.c (lower_omp_sections, lower_omp_single, lower_omp_master, lower_omp_ordered, lower_omp_critical, lower_omp_for, create_task_copyfn, lower_omp_taskreg, execute_lower_omp): * tree-ssa-ccp.c (convert_to_gimple_builtin): Likewise. * tree-sra.c (generate_element_init): Likewise. * tree-mudflap.c (execute_mudflap_function_ops, execute_mudflap_function_decls): Likewise. * tree-inline.c (setup_one_parameter, optimize_inline_calls): Likewise. * tree-gimple.h (struct gimplify_ctx): New type. (push_gimplify_context): Adjust prototype. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137666 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog22
-rw-r--r--gcc/gimplify.c54
-rw-r--r--gcc/omp-low.c28
-rw-r--r--gcc/tree-gimple.h22
-rw-r--r--gcc/tree-inline.c7
-rw-r--r--gcc/tree-mudflap.c8
-rw-r--r--gcc/tree-sra.c3
-rw-r--r--gcc/tree-ssa-ccp.c3
8 files changed, 95 insertions, 52 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1f8e3a99ef6..4cb2caea99f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,25 @@
+2008-07-09 Jakub Jelinek <jakub@redhat.com>
+
+ * gimplify.c (struct gimplify_ctx): Move to tree-gimple.h.
+ (push_gimplify_context): Don't allocate temp_htab nor c itself here.
+ Add c argument.
+ (pop_gimplify_context): Check c->temp_htab instead of optimize whether
+ htab_delete should be called. Don't free c.
+ (lookup_tmp_var): Create temp_htab lazily.
+ (gimplify_scan_omp_clauses, gimplify_omp_parallel, gimplify_omp_task,
+ gimplify_body, force_gimple_operand): Adjust push_gimplify_context
+ callers.
+ * omp-low.c (lower_omp_sections, lower_omp_single, lower_omp_master,
+ lower_omp_ordered, lower_omp_critical, lower_omp_for,
+ create_task_copyfn, lower_omp_taskreg, execute_lower_omp):
+ * tree-ssa-ccp.c (convert_to_gimple_builtin): Likewise.
+ * tree-sra.c (generate_element_init): Likewise.
+ * tree-mudflap.c (execute_mudflap_function_ops,
+ execute_mudflap_function_decls): Likewise.
+ * tree-inline.c (setup_one_parameter, optimize_inline_calls): Likewise.
+ * tree-gimple.h (struct gimplify_ctx): New type.
+ (push_gimplify_context): Adjust prototype.
+
2008-07-09 Daniel Berlin <dberlin@dberlin.org>
* tree-ssa-pre.c (phi_translate_1): Update placement of
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index c3af34bf27e..b6bc9ca79a5 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -85,26 +85,6 @@ struct gimplify_omp_ctx
enum omp_region_type region_type;
};
-struct gimplify_ctx
-{
- struct gimplify_ctx *prev_context;
-
- tree current_bind_expr;
- tree temps;
- tree conditional_cleanups;
- tree exit_label;
- tree return_temp;
-
- VEC(tree,heap) *case_labels;
- /* The formal temporary table. Should this be persistent? */
- htab_t temp_htab;
-
- int conditions;
- bool save_stack;
- bool into_ssa;
- bool allow_rhs_cond_expr;
-};
-
static struct gimplify_ctx *gimplify_ctxp;
static struct gimplify_omp_ctx *gimplify_omp_ctxp;
@@ -169,15 +149,10 @@ gimple_tree_eq (const void *p1, const void *p2)
/* Set up a context for the gimplifier. */
void
-push_gimplify_context (void)
+push_gimplify_context (struct gimplify_ctx *c)
{
- struct gimplify_ctx *c;
-
- c = (struct gimplify_ctx *) xcalloc (1, sizeof (struct gimplify_ctx));
+ memset (c, '\0', sizeof (*c));
c->prev_context = gimplify_ctxp;
- if (optimize)
- c->temp_htab = htab_create (1000, gimple_tree_hash, gimple_tree_eq, free);
-
gimplify_ctxp = c;
}
@@ -202,9 +177,8 @@ pop_gimplify_context (tree body)
else
record_vars (c->temps);
- if (optimize)
+ if (c->temp_htab)
htab_delete (c->temp_htab);
- free (c);
}
static void
@@ -575,6 +549,9 @@ lookup_tmp_var (tree val, bool is_formal)
void **slot;
elt.val = val;
+ if (gimplify_ctxp->temp_htab == NULL)
+ gimplify_ctxp->temp_htab
+ = htab_create (1000, gimple_tree_hash, gimple_tree_eq, free);
slot = htab_find_slot (gimplify_ctxp->temp_htab, (void *)&elt, INSERT);
if (*slot == NULL)
{
@@ -5105,6 +5082,7 @@ gimplify_scan_omp_clauses (tree *list_p, tree *pre_p,
enum omp_region_type region_type)
{
struct gimplify_omp_ctx *ctx, *outer_ctx;
+ struct gimplify_ctx gctx;
tree c;
ctx = new_omp_context (region_type);
@@ -5161,10 +5139,10 @@ gimplify_scan_omp_clauses (tree *list_p, tree *pre_p,
omp_add_variable (ctx, OMP_CLAUSE_REDUCTION_PLACEHOLDER (c),
GOVD_LOCAL | GOVD_SEEN);
gimplify_omp_ctxp = ctx;
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
gimplify_stmt (&OMP_CLAUSE_REDUCTION_INIT (c));
pop_gimplify_context (OMP_CLAUSE_REDUCTION_INIT (c));
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
gimplify_stmt (&OMP_CLAUSE_REDUCTION_MERGE (c));
pop_gimplify_context (OMP_CLAUSE_REDUCTION_MERGE (c));
gimplify_omp_ctxp = outer_ctx;
@@ -5173,7 +5151,7 @@ gimplify_scan_omp_clauses (tree *list_p, tree *pre_p,
&& OMP_CLAUSE_LASTPRIVATE_STMT (c))
{
gimplify_omp_ctxp = ctx;
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
if (TREE_CODE (OMP_CLAUSE_LASTPRIVATE_STMT (c)) != BIND_EXPR)
{
tree bind = build3 (BIND_EXPR, void_type_node, NULL,
@@ -5396,13 +5374,14 @@ static enum gimplify_status
gimplify_omp_parallel (tree *expr_p, tree *pre_p)
{
tree expr = *expr_p;
+ struct gimplify_ctx gctx;
gimplify_scan_omp_clauses (&OMP_PARALLEL_CLAUSES (expr), pre_p,
OMP_PARALLEL_COMBINED (expr)
? ORT_COMBINED_PARALLEL
: ORT_PARALLEL);
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
gimplify_stmt (&OMP_PARALLEL_BODY (expr));
@@ -5425,10 +5404,11 @@ static enum gimplify_status
gimplify_omp_task (tree *expr_p, tree *pre_p)
{
tree expr = *expr_p;
+ struct gimplify_ctx gctx;
gimplify_scan_omp_clauses (&OMP_TASK_CLAUSES (expr), pre_p, ORT_TASK);
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
gimplify_stmt (&OMP_TASK_BODY (expr));
@@ -6653,11 +6633,12 @@ gimplify_body (tree *body_p, tree fndecl, bool do_parms)
{
location_t saved_location = input_location;
tree body, parm_stmts;
+ struct gimplify_ctx gctx;
timevar_push (TV_TREE_GIMPLIFY);
gcc_assert (gimplify_ctxp == NULL);
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
/* Unshare most shared trees in the body and in that of any nested functions.
It would seem we don't have to do this for nested functions because
@@ -6799,6 +6780,7 @@ force_gimple_operand (tree expr, tree *stmts, bool simple, tree var)
tree t;
enum gimplify_status ret;
gimple_predicate gimple_test_f;
+ struct gimplify_ctx gctx;
*stmts = NULL_TREE;
@@ -6807,7 +6789,7 @@ force_gimple_operand (tree expr, tree *stmts, bool simple, tree var)
gimple_test_f = simple ? is_gimple_val : is_gimple_reg_rhs;
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
gimplify_ctxp->into_ssa = gimple_in_ssa_p (cfun);
gimplify_ctxp->allow_rhs_cond_expr = true;
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index e5680077bd0..4378c43d402 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -5281,10 +5281,11 @@ lower_omp_sections (tree *stmt_p, omp_context *ctx)
tree t, dlist;
tree_stmt_iterator tsi;
unsigned i, len;
+ struct gimplify_ctx gctx;
stmt = *stmt_p;
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
dlist = NULL;
ilist = NULL;
@@ -5482,8 +5483,9 @@ static void
lower_omp_single (tree *stmt_p, omp_context *ctx)
{
tree t, bind, block, single_stmt = *stmt_p, dlist;
+ struct gimplify_ctx gctx;
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
block = make_node (BLOCK);
*stmt_p = bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, block);
@@ -5526,8 +5528,9 @@ static void
lower_omp_master (tree *stmt_p, omp_context *ctx)
{
tree bind, block, stmt = *stmt_p, lab = NULL, x;
+ struct gimplify_ctx gctx;
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
block = make_node (BLOCK);
*stmt_p = bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, block);
@@ -5565,8 +5568,9 @@ static void
lower_omp_ordered (tree *stmt_p, omp_context *ctx)
{
tree bind, block, stmt = *stmt_p, x;
+ struct gimplify_ctx gctx;
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
block = make_node (BLOCK);
*stmt_p = bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, block);
@@ -5609,6 +5613,7 @@ lower_omp_critical (tree *stmt_p, omp_context *ctx)
{
tree bind, block, stmt = *stmt_p;
tree t, lock, unlock, name;
+ struct gimplify_ctx gctx;
name = OMP_CRITICAL_NAME (stmt);
if (name)
@@ -5658,7 +5663,7 @@ lower_omp_critical (tree *stmt_p, omp_context *ctx)
unlock = build_call_expr (unlock, 0);
}
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
block = make_node (BLOCK);
*stmt_p = bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, block);
@@ -5743,10 +5748,11 @@ lower_omp_for (tree *stmt_p, omp_context *ctx)
tree t, stmt, ilist, dlist, new_stmt, block, *body_p, *rhs_p;
struct omp_for_data fd;
int i;
+ struct gimplify_ctx gctx;
stmt = *stmt_p;
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
lower_omp (&OMP_FOR_PRE_BODY (stmt), ctx);
lower_omp (&OMP_FOR_BODY (stmt), ctx);
@@ -5909,6 +5915,7 @@ create_task_copyfn (tree task_stmt, omp_context *ctx)
bool record_needs_remap = false, srecord_needs_remap = false;
splay_tree_node n;
struct omp_taskcopy_context tcctx;
+ struct gimplify_ctx gctx;
child_fn = OMP_TASK_COPYFN (task_stmt);
child_cfun = DECL_STRUCT_FUNCTION (child_fn);
@@ -5921,7 +5928,7 @@ create_task_copyfn (tree task_stmt, omp_context *ctx)
DECL_CONTEXT (t) = child_fn;
/* Populate the function. */
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
current_function_decl = child_fn;
bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, NULL);
@@ -6138,6 +6145,7 @@ lower_omp_taskreg (tree *stmt_p, omp_context *ctx)
tree clauses, par_bind, par_body, new_body, bind;
tree olist, ilist, par_olist, par_ilist;
tree stmt, child_fn, t;
+ struct gimplify_ctx gctx;
stmt = *stmt_p;
@@ -6161,7 +6169,7 @@ lower_omp_taskreg (tree *stmt_p, omp_context *ctx)
if (ctx->srecord_type)
create_task_copyfn (stmt, ctx);
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
par_olist = NULL_TREE;
par_ilist = NULL_TREE;
@@ -6422,8 +6430,10 @@ execute_lower_omp (void)
if (all_contexts->root)
{
+ struct gimplify_ctx gctx;
+
if (task_shared_vars)
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
lower_omp (&DECL_SAVED_TREE (current_function_decl), NULL);
if (task_shared_vars)
pop_gimplify_context (NULL);
diff --git a/gcc/tree-gimple.h b/gcc/tree-gimple.h
index 3864d5d9d3e..3691cbc5631 100644
--- a/gcc/tree-gimple.h
+++ b/gcc/tree-gimple.h
@@ -118,6 +118,26 @@ enum gimplify_status {
GS_ALL_DONE = 1 /* The expression is fully gimplified. */
};
+struct gimplify_ctx
+{
+ struct gimplify_ctx *prev_context;
+
+ tree current_bind_expr;
+ tree temps;
+ tree conditional_cleanups;
+ tree exit_label;
+ tree return_temp;
+
+ VEC(tree,heap) *case_labels;
+ /* The formal temporary table. Should this be persistent? */
+ htab_t temp_htab;
+
+ int conditions;
+ bool save_stack;
+ bool into_ssa;
+ bool allow_rhs_cond_expr;
+};
+
extern enum gimplify_status gimplify_expr (tree *, tree *, tree *,
bool (*) (tree), fallback_t);
extern void gimplify_type_sizes (tree, tree *);
@@ -125,7 +145,7 @@ extern void gimplify_one_sizepos (tree *, tree *);
extern void gimplify_stmt (tree *);
extern void gimplify_to_stmt_list (tree *);
extern void gimplify_body (tree *, tree, bool);
-extern void push_gimplify_context (void);
+extern void push_gimplify_context (struct gimplify_ctx *);
extern void pop_gimplify_context (tree);
extern void gimplify_and_add (tree, tree *);
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 0f1a8bd1720..c0f4c880f7f 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1590,8 +1590,9 @@ setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn,
|| !is_gimple_reg (var))
{
tree_stmt_iterator i;
+ struct gimplify_ctx gctx;
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
gimplify_stmt (&init_stmt);
if (gimple_in_ssa_p (cfun)
&& init_stmt && TREE_CODE (init_stmt) == STATEMENT_LIST)
@@ -2986,6 +2987,8 @@ optimize_inline_calls (tree fn)
tree prev_fn;
basic_block bb;
int last = n_basic_blocks;
+ struct gimplify_ctx gctx;
+
/* There is no point in performing inlining if errors have already
occurred -- and we might crash if we try to inline invalid
code. */
@@ -3012,7 +3015,7 @@ optimize_inline_calls (tree fn)
id.transform_lang_insert_block = NULL;
id.statements_to_fold = pointer_set_create ();
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
/* We make no attempts to keep dominance info up-to-date. */
free_dominance_info (CDI_DOMINATORS);
diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c
index b5e8984a4df..46650b37dd4 100644
--- a/gcc/tree-mudflap.c
+++ b/gcc/tree-mudflap.c
@@ -421,13 +421,15 @@ mudflap_init (void)
static unsigned int
execute_mudflap_function_ops (void)
{
+ struct gimplify_ctx gctx;
+
/* Don't instrument functions such as the synthetic constructor
built during mudflap_finish_file. */
if (mf_marked_p (current_function_decl) ||
DECL_ARTIFICIAL (current_function_decl))
return 0;
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
/* In multithreaded mode, don't cache the lookup cache parameters. */
if (! flag_mudflap_threads)
@@ -958,13 +960,15 @@ mf_xform_derefs (void)
static unsigned int
execute_mudflap_function_decls (void)
{
+ struct gimplify_ctx gctx;
+
/* Don't instrument functions such as the synthetic constructor
built during mudflap_finish_file. */
if (mf_marked_p (current_function_decl) ||
DECL_ARTIFICIAL (current_function_decl))
return 0;
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
mf_xform_decls (DECL_SAVED_TREE (current_function_decl),
DECL_ARGUMENTS (current_function_decl));
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 16f719e5ecb..21cf367b23a 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -2832,8 +2832,9 @@ static bool
generate_element_init (struct sra_elt *elt, tree init, tree *list_p)
{
bool ret;
+ struct gimplify_ctx gctx;
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
ret = generate_element_init_1 (elt, init, list_p);
pop_gimplify_context (NULL);
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index da6b7855a81..3b90da4ddc8 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -2825,8 +2825,9 @@ convert_to_gimple_builtin (block_stmt_iterator *si_p, tree expr, bool ignore)
tree_stmt_iterator ti;
tree stmt = bsi_stmt (*si_p);
tree tmp, stmts = NULL;
+ struct gimplify_ctx gctx;
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
if (ignore)
{
tmp = build_empty_stmt ();
OpenPOWER on IntegriCloud