/* Nested function decomposition for GIMPLE.
- Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
- Free Software Foundation, Inc.
+ Copyright (C) 2004-2013 Free Software Foundation, Inc.
This file is part of GCC.
info->frame_type = type;
info->frame_decl = create_tmp_var_for (info, type, "FRAME");
+ DECL_NONLOCAL_FRAME (info->frame_decl) = 1;
/* ??? Always make it addressable for now, since it is meant to
be pointed to by the static chain pointer. This pessimizes
return field;
}
-/* Invoke CALLBACK on all statements of GIMPLE sequence SEQ. */
+/* Invoke CALLBACK on all statements of GIMPLE sequence *PSEQ. */
static void
walk_body (walk_stmt_fn callback_stmt, walk_tree_fn callback_op,
- struct nesting_info *info, gimple_seq seq)
+ struct nesting_info *info, gimple_seq *pseq)
{
struct walk_stmt_info wi;
memset (&wi, 0, sizeof (wi));
wi.info = info;
wi.val_only = true;
- walk_gimple_seq (seq, callback_stmt, callback_op, &wi);
+ walk_gimple_seq_mod (pseq, callback_stmt, callback_op, &wi);
}
walk_function (walk_stmt_fn callback_stmt, walk_tree_fn callback_op,
struct nesting_info *info)
{
- walk_body (callback_stmt, callback_op, info, gimple_body (info->context));
+ gimple_seq body = gimple_body (info->context);
+ walk_body (callback_stmt, callback_op, info, &body);
+ gimple_set_body (info->context, body);
}
/* Invoke CALLBACK on a GIMPLE_OMP_FOR's init, cond, incr and pre-body. */
tree t;
size_t i;
- walk_body (callback_stmt, callback_op, info, gimple_omp_for_pre_body (for_stmt));
+ walk_body (callback_stmt, callback_op, info, gimple_omp_for_pre_body_ptr (for_stmt));
- seq = gimple_seq_alloc ();
+ seq = NULL;
memset (&wi, 0, sizeof (wi));
wi.info = info;
wi.gsi = gsi_last (seq);
walk_tree (&TREE_OPERAND (t, 1), callback_op, &wi, NULL);
}
- if (gimple_seq_empty_p (seq))
- gimple_seq_free (seq);
- else
+ seq = gsi_seq (wi.gsi);
+ if (!gimple_seq_empty_p (seq))
{
gimple_seq pre_body = gimple_omp_for_pre_body (for_stmt);
annotate_all_with_location (seq, gimple_location (for_stmt));
for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested)
{
- for (arg = DECL_ARGUMENTS (cgn->decl); arg; arg = DECL_CHAIN (arg))
+ for (arg = DECL_ARGUMENTS (cgn->symbol.decl); arg; arg = DECL_CHAIN (arg))
if (variably_modified_type_p (TREE_TYPE (arg), orig_fndecl))
return true;
- if (check_for_nested_with_variably_modified (cgn->decl, orig_fndecl))
+ if (check_for_nested_with_variably_modified (cgn->symbol.decl,
+ orig_fndecl))
return true;
}
info->var_map = pointer_map_create ();
info->mem_refs = pointer_set_create ();
info->suppress_expansion = BITMAP_ALLOC (&nesting_info_bitmap_obstack);
- info->context = cgn->decl;
+ info->context = cgn->symbol.decl;
for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested)
{
walk_tree (&TREE_OPERAND (t, 3), convert_nonlocal_reference_op,
wi, NULL);
}
- else if (TREE_CODE (t) == BIT_FIELD_REF)
- {
- walk_tree (&TREE_OPERAND (t, 1), convert_nonlocal_reference_op,
- wi, NULL);
- walk_tree (&TREE_OPERAND (t, 2), convert_nonlocal_reference_op,
- wi, NULL);
- }
}
wi->val_only = false;
walk_tree (tp, convert_nonlocal_reference_op, wi, NULL);
= info->context;
walk_body (convert_nonlocal_reference_stmt,
convert_nonlocal_reference_op, info,
- OMP_CLAUSE_REDUCTION_GIMPLE_INIT (clause));
+ &OMP_CLAUSE_REDUCTION_GIMPLE_INIT (clause));
walk_body (convert_nonlocal_reference_stmt,
convert_nonlocal_reference_op, info,
- OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (clause));
+ &OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (clause));
DECL_CONTEXT (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause))
= old_context;
}
case OMP_CLAUSE_LASTPRIVATE:
walk_body (convert_nonlocal_reference_stmt,
convert_nonlocal_reference_op, info,
- OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (clause));
+ &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (clause));
break;
default:
info->new_local_var_chain = NULL;
walk_body (convert_nonlocal_reference_stmt, convert_nonlocal_reference_op,
- info, gimple_omp_body (stmt));
+ info, gimple_omp_body_ptr (stmt));
if (info->new_local_var_chain)
declare_vars (info->new_local_var_chain,
walk_gimple_omp_for (stmt, convert_nonlocal_reference_stmt,
convert_nonlocal_reference_op, info);
walk_body (convert_nonlocal_reference_stmt,
- convert_nonlocal_reference_op, info, gimple_omp_body (stmt));
+ convert_nonlocal_reference_op, info, gimple_omp_body_ptr (stmt));
info->suppress_expansion = save_suppress;
break;
save_suppress = info->suppress_expansion;
convert_nonlocal_omp_clauses (gimple_omp_sections_clauses_ptr (stmt), wi);
walk_body (convert_nonlocal_reference_stmt, convert_nonlocal_reference_op,
- info, gimple_omp_body (stmt));
+ info, gimple_omp_body_ptr (stmt));
info->suppress_expansion = save_suppress;
break;
save_suppress = info->suppress_expansion;
convert_nonlocal_omp_clauses (gimple_omp_single_clauses_ptr (stmt), wi);
walk_body (convert_nonlocal_reference_stmt, convert_nonlocal_reference_op,
- info, gimple_omp_body (stmt));
+ info, gimple_omp_body_ptr (stmt));
info->suppress_expansion = save_suppress;
break;
case GIMPLE_OMP_MASTER:
case GIMPLE_OMP_ORDERED:
walk_body (convert_nonlocal_reference_stmt, convert_nonlocal_reference_op,
- info, gimple_omp_body (stmt));
+ info, gimple_omp_body_ptr (stmt));
break;
case GIMPLE_BIND:
walk_tree (&TREE_OPERAND (t, 3), convert_local_reference_op, wi,
NULL);
}
- else if (TREE_CODE (t) == BIT_FIELD_REF)
- {
- walk_tree (&TREE_OPERAND (t, 1), convert_local_reference_op, wi,
- NULL);
- walk_tree (&TREE_OPERAND (t, 2), convert_local_reference_op, wi,
- NULL);
- }
}
wi->val_only = false;
walk_tree (tp, convert_local_reference_op, wi, NULL);
= info->context;
walk_body (convert_local_reference_stmt,
convert_local_reference_op, info,
- OMP_CLAUSE_REDUCTION_GIMPLE_INIT (clause));
+ &OMP_CLAUSE_REDUCTION_GIMPLE_INIT (clause));
walk_body (convert_local_reference_stmt,
convert_local_reference_op, info,
- OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (clause));
+ &OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (clause));
DECL_CONTEXT (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause))
= old_context;
}
case OMP_CLAUSE_LASTPRIVATE:
walk_body (convert_local_reference_stmt,
convert_local_reference_op, info,
- OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (clause));
+ &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (clause));
break;
default:
info->new_local_var_chain = NULL;
walk_body (convert_local_reference_stmt, convert_local_reference_op, info,
- gimple_omp_body (stmt));
+ gimple_omp_body_ptr (stmt));
if (info->new_local_var_chain)
declare_vars (info->new_local_var_chain,
walk_gimple_omp_for (stmt, convert_local_reference_stmt,
convert_local_reference_op, info);
walk_body (convert_local_reference_stmt, convert_local_reference_op,
- info, gimple_omp_body (stmt));
+ info, gimple_omp_body_ptr (stmt));
info->suppress_expansion = save_suppress;
break;
save_suppress = info->suppress_expansion;
convert_local_omp_clauses (gimple_omp_sections_clauses_ptr (stmt), wi);
walk_body (convert_local_reference_stmt, convert_local_reference_op,
- info, gimple_omp_body (stmt));
+ info, gimple_omp_body_ptr (stmt));
info->suppress_expansion = save_suppress;
break;
save_suppress = info->suppress_expansion;
convert_local_omp_clauses (gimple_omp_single_clauses_ptr (stmt), wi);
walk_body (convert_local_reference_stmt, convert_local_reference_op,
- info, gimple_omp_body (stmt));
+ info, gimple_omp_body_ptr (stmt));
info->suppress_expansion = save_suppress;
break;
case GIMPLE_OMP_MASTER:
case GIMPLE_OMP_ORDERED:
walk_body (convert_local_reference_stmt, convert_local_reference_op,
- info, gimple_omp_body (stmt));
+ info, gimple_omp_body_ptr (stmt));
break;
case GIMPLE_COND:
*handled_ops_p = false;
return NULL_TREE;
+ case GIMPLE_ASSIGN:
+ if (gimple_clobber_p (stmt))
+ {
+ tree lhs = gimple_assign_lhs (stmt);
+ if (!use_pointer_in_frame (lhs)
+ && lookup_field_for_decl (info, lhs, NO_INSERT))
+ {
+ gsi_replace (gsi, gimple_build_nop (), true);
+ break;
+ }
+ }
+ *handled_ops_p = false;
+ return NULL_TREE;
+
default:
/* For every other statement that we are not interested in
handling here, let the walker traverse the operands. */
/* Build: __builtin_nl_goto(new_label, &chain->nl_goto_field). */
field = get_nl_goto_field (i);
- x = get_frame_field (info, target_context, field, &wi->gsi);
+ x = get_frame_field (info, target_context, field, gsi);
x = build_addr (x, target_context);
- x = gsi_gimplify_val (info, x, &wi->gsi);
+ x = gsi_gimplify_val (info, x, gsi);
call = gimple_build_call (builtin_decl_implicit (BUILT_IN_NONLOCAL_GOTO),
2, build_addr (new_label, target_context), x);
- gsi_replace (&wi->gsi, call, false);
+ gsi_replace (gsi, call, false);
/* We have handled all of STMT's operands, no need to keep going. */
*handled_ops_p = true;
save_local_var_chain = info->new_local_var_chain;
info->new_local_var_chain = NULL;
walk_body (convert_tramp_reference_stmt, convert_tramp_reference_op,
- info, gimple_omp_body (stmt));
+ info, gimple_omp_body_ptr (stmt));
if (info->new_local_var_chain)
declare_vars (info->new_local_var_chain,
gimple_seq_first_stmt (gimple_omp_body (stmt)),
case GIMPLE_OMP_TASK:
save_static_chain_added = info->static_chain_added;
info->static_chain_added = 0;
- walk_body (convert_gimple_call, NULL, info, gimple_omp_body (stmt));
+ walk_body (convert_gimple_call, NULL, info, gimple_omp_body_ptr (stmt));
for (i = 0; i < 2; i++)
{
tree c, decl;
case GIMPLE_OMP_FOR:
walk_body (convert_gimple_call, NULL, info,
- gimple_omp_for_pre_body (stmt));
+ gimple_omp_for_pre_body_ptr (stmt));
/* FALLTHRU */
case GIMPLE_OMP_SECTIONS:
case GIMPLE_OMP_SECTION:
case GIMPLE_OMP_MASTER:
case GIMPLE_OMP_ORDERED:
case GIMPLE_OMP_CRITICAL:
- walk_body (convert_gimple_call, NULL, info, gimple_omp_body (stmt));
+ walk_body (convert_gimple_call, NULL, info, gimple_omp_body_ptr (stmt));
break;
default:
gimplify_all_functions (struct cgraph_node *root)
{
struct cgraph_node *iter;
- if (!gimple_body (root->decl))
- gimplify_function_tree (root->decl);
+ if (!gimple_body (root->symbol.decl))
+ gimplify_function_tree (root->symbol.decl);
for (iter = root->nested; iter; iter = iter->next_nested)
gimplify_all_functions (iter);
}