summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-24 20:19:13 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-24 20:19:13 +0000
commitd2024a0d4bf5213b6b53d77335feb52954bd7a1b (patch)
tree929883b632ad4304f0f6c62c4f887885e3a41afc /gcc
parent7e6077637c9f5bedb073c6ce4346f82cfd80cb32 (diff)
downloadgcc-d2024a0d4bf5213b6b53d77335feb52954bd7a1b.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100110 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/tree-nested.c36
-rw-r--r--gcc/tree-profile.c6
-rw-r--r--gcc/tree-ssa-loop-ivopts.c2
-rw-r--r--gcc/tree.h2
5 files changed, 44 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 71ae0c62c67..665911fc925 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+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.
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index b1ab217340b..124bbf98cfb 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -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];
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index 2c91fc3859f..d611168635e 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -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,
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index f60082ab31a..5cb623b871e 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -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;
}
diff --git a/gcc/tree.h b/gcc/tree.h
index 8dc989435bb..b7764d81882 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -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);