Commit bde6c65d by Jeff Law Committed by Jeff Law

tree-nested.c (build_addr): New "context" argument.

        * tree-nested.c (build_addr): New "context" argument.  Temporarily
        set current_function_decl around the call to build the ADDR_EXPR.
        (get_static_chain): Pass proper context to build_addr.
        (convert_nl_goto_reference): Likewise.
        (convert_tramp_reference): Likewise.
        (final_nesting_tree_1): Likewise.
        * tree-profile.c (tree_gen_interval_profiler): Likewise.
        (tree_gen_pow2_profiler): Likewise.
        (tree_gen_one_value_profiler): Likewise.
        * tree-ssa-loop-ivopts.c (build_addr_strip_iref): Likewise.
        * tree.h (build_addr): Update prototype.

From-SVN: r100110
parent 04d0d750
2005-05-24 Jeff Law <law@redhat.com>
* tree-nested.c (build_addr): New "context" argument. Temporarily
set current_function_decl around the call to build the ADDR_EXPR.
(get_static_chain): Pass proper context to build_addr.
(convert_nl_goto_reference): Likewise.
(convert_tramp_reference): Likewise.
(final_nesting_tree_1): Likewise.
* tree-profile.c (tree_gen_interval_profiler): Likewise.
(tree_gen_pow2_profiler): Likewise.
(tree_gen_one_value_profiler): Likewise.
* tree-ssa-loop-ivopts.c (build_addr_strip_iref): Likewise.
* tree.h (build_addr): Update prototype.
2005-05-24 Kazu Hirata <kazu@cs.umass.edu>
* tree-flow.h (bb_ann_d): Remove has_escape_site.
......
......@@ -148,12 +148,15 @@ create_tmp_var_for (struct nesting_info *info, tree type, const char *prefix)
return tmp_var;
}
/* Take the address of EXP. Mark it for addressability as necessary. */
/* Take the address of EXP to be used within function CONTEXT.
Mark it for addressability as necessary. */
tree
build_addr (tree exp)
build_addr (tree exp, tree context)
{
tree base = exp;
tree save_context;
tree retval;
while (handled_component_p (base))
base = TREE_OPERAND (base, 0);
......@@ -161,7 +164,18 @@ build_addr (tree exp)
if (DECL_P (base))
TREE_ADDRESSABLE (base) = 1;
return build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (exp)), exp);
/* Building the ADDR_EXPR will compute a set of properties for
that ADDR_EXPR. Those properties are unfortunately context
specific. ie, they are dependent on CURRENT_FUNCTION_DECL.
Temporarily set CURRENT_FUNCTION_DECL to the desired context,
build the ADDR_EXPR, then restore CURRENT_FUNCTION_DECL. That
way the properties are for the ADDR_EXPR are computed properly. */
save_context = current_function_decl;
current_function_decl = context;
retval = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (exp)), exp);
current_function_decl = save_context;;
return retval;
}
/* Insert FIELD into TYPE, sorted by alignment requirements. */
......@@ -716,7 +730,7 @@ get_static_chain (struct nesting_info *info, tree target_context,
if (info->context == target_context)
{
x = build_addr (info->frame_decl);
x = build_addr (info->frame_decl, target_context);
}
else
{
......@@ -1092,10 +1106,10 @@ convert_nl_goto_reference (tree *tp, int *walk_subtrees, void *data)
/* 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->tsi);
x = build_addr (x);
x = build_addr (x, target_context);
x = tsi_gimplify_val (info, x, &wi->tsi);
arg = tree_cons (NULL, x, NULL);
x = build_addr (new_label);
x = build_addr (new_label, target_context);
arg = tree_cons (NULL, x, arg);
x = implicit_built_in_decls[BUILT_IN_NONLOCAL_GOTO];
x = build_function_call_expr (x, arg);
......@@ -1190,7 +1204,7 @@ convert_tramp_reference (tree *tp, int *walk_subtrees, void *data)
/* Compute the address of the field holding the trampoline. */
x = get_frame_field (info, target_context, x, &wi->tsi);
x = build_addr (x);
x = build_addr (x, target_context);
x = tsi_gimplify_val (info, x, &wi->tsi);
arg = tree_cons (NULL, x, NULL);
......@@ -1322,7 +1336,7 @@ finalize_nesting_tree_1 (struct nesting_info *root)
continue;
if (use_pointer_in_frame (p))
x = build_addr (p);
x = build_addr (p, context);
else
x = p;
......@@ -1358,15 +1372,15 @@ finalize_nesting_tree_1 (struct nesting_info *root)
if (DECL_NO_STATIC_CHAIN (i->context))
x = null_pointer_node;
else
x = build_addr (root->frame_decl);
x = build_addr (root->frame_decl, context);
arg = tree_cons (NULL, x, NULL);
x = build_addr (i->context);
x = build_addr (i->context, context);
arg = tree_cons (NULL, x, arg);
x = build (COMPONENT_REF, TREE_TYPE (field),
root->frame_decl, field, NULL_TREE);
x = build_addr (x);
x = build_addr (x, context);
arg = tree_cons (NULL, x, arg);
x = implicit_built_in_decls[BUILT_IN_INIT_TRAMPOLINE];
......
......@@ -143,7 +143,7 @@ tree_gen_interval_profiler (histogram_value value, unsigned tag, unsigned base)
tree steps = build_int_cst_type (unsigned_type_node, value->hdata.intvl.steps);
ref_ptr = force_gimple_operand_bsi (&bsi,
build_addr (ref),
build_addr (ref, current_function_decl),
true, NULL_TREE);
val = prepare_instrumented_value (&bsi, value);
args = tree_cons (NULL_TREE, ref_ptr,
......@@ -168,7 +168,7 @@ tree_gen_pow2_profiler (histogram_value value, unsigned tag, unsigned base)
tree args, call, val;
ref_ptr = force_gimple_operand_bsi (&bsi,
build_addr (ref),
build_addr (ref, current_function_decl),
true, NULL_TREE);
val = prepare_instrumented_value (&bsi, value);
args = tree_cons (NULL_TREE, ref_ptr,
......@@ -191,7 +191,7 @@ tree_gen_one_value_profiler (histogram_value value, unsigned tag, unsigned base)
tree args, call, val;
ref_ptr = force_gimple_operand_bsi (&bsi,
build_addr (ref),
build_addr (ref, current_function_decl),
true, NULL_TREE);
val = prepare_instrumented_value (&bsi, value);
args = tree_cons (NULL_TREE, ref_ptr,
......
......@@ -1527,7 +1527,7 @@ build_addr_strip_iref (tree obj)
obj = fold_convert (type, TREE_OPERAND (obj, 0));
}
else
obj = build_addr (obj);
obj = build_addr (obj, current_function_decl);
return obj;
}
......
......@@ -3651,7 +3651,7 @@ extern tree build_nonstandard_integer_type (unsigned HOST_WIDE_INT, int);
extern tree build_range_type (tree, tree, tree);
extern HOST_WIDE_INT int_cst_value (tree);
extern tree tree_fold_gcd (tree, tree);
extern tree build_addr (tree);
extern tree build_addr (tree, tree);
extern bool fields_compatible_p (tree, tree);
extern tree find_compatible_field (tree, tree);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment