* 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.
From-SVN: r137666
+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
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;
/* 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;
}
else
record_vars (c->temps);
- if (optimize)
+ if (c->temp_htab)
htab_delete (c->temp_htab);
- free (c);
}
static void
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)
{
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);
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;
&& 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,
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));
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));
{
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
tree t;
enum gimplify_status ret;
gimple_predicate gimple_test_f;
+ struct gimplify_ctx gctx;
*stmts = NULL_TREE;
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;
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;
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);
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);
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);
{
tree bind, block, stmt = *stmt_p;
tree t, lock, unlock, name;
+ struct gimplify_ctx gctx;
name = OMP_CRITICAL_NAME (stmt);
if (name)
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);
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);
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);
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);
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;
if (ctx->srecord_type)
create_task_copyfn (stmt, ctx);
- push_gimplify_context ();
+ push_gimplify_context (&gctx);
par_olist = NULL_TREE;
par_ilist = NULL_TREE;
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);
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 *);
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 *);
|| !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)
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. */
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);
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)
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));
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);
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 ();