This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[TCB] Fix alias initialization of call-clobbered vars
- From: Diego Novillo <dnovillo at redhat dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 11 Dec 2004 00:20:17 -0500
- Subject: [TCB] Fix alias initialization of call-clobbered vars
- Organization: Red Hat Canada
When we clear the call-clobbered bit from a variable, we should also
invalidate the call-clobbered cache in the operand scanner. This patch
adds a helper function to do that.
It also changes the loop to go over the call-clobbered variables. We
already traverse all the symbols in init_alias_info, so there's no need
to do another loop just for the call-clobbered vars.
Bootstrapped and tested x86, ia64, ppc and x86-64.
Diego.
2004-12-10 Diego Novillo <dnovillo@redhat.com>
* tree-flow-inline.h (clear_call_clobbered): New function.
* tree-ssa-alias.c (init_alias_info): Call it.
Index: tree-flow-inline.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-flow-inline.h,v
retrieving revision 2.23.2.4
diff -d -c -p -u -r2.23.2.4 tree-flow-inline.h
--- tree-flow-inline.h 6 Dec 2004 01:03:47 -0000 2.23.2.4
+++ tree-flow-inline.h 11 Dec 2004 03:28:36 -0000
@@ -625,6 +625,19 @@ mark_call_clobbered (tree var)
ssa_ro_call_cache_valid = false;
}
+/* Clear the call-clobbered attribute from variable VAR. */
+static inline void
+clear_call_clobbered (tree var)
+{
+ var_ann_t ann = var_ann (var);
+ if (ann->mem_tag_kind != NOT_A_TAG)
+ DECL_EXTERNAL (var) = 0;
+ bitmap_clear_bit (call_clobbered_vars, ann->uid);
+ ssa_call_clobbered_cache_valid = false;
+ ssa_ro_call_cache_valid = false;
+}
+
+
/* Mark variable VAR as being non-addressable. */
static inline void
mark_non_addressable (tree var)
Index: tree-ssa-alias.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-alias.c,v
retrieving revision 2.39.2.9
diff -d -c -p -u -r2.39.2.9 tree-ssa-alias.c
--- tree-ssa-alias.c 11 Dec 2004 01:52:51 -0000 2.39.2.9
+++ tree-ssa-alias.c 11 Dec 2004 03:28:36 -0000
@@ -437,7 +437,6 @@ init_alias_info (void)
if (aliases_computed_p)
{
unsigned i;
- bitmap_iterator bi;
basic_block bb;
/* Make sure that every statement has a valid set of operands.
@@ -453,19 +452,6 @@ init_alias_info (void)
get_stmt_operands (bsi_stmt (si));
}
- /* Clear the call-clobbered set. We are going to re-discover
- call-clobbered variables. */
- EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, bi)
- {
- tree var = referenced_var (i);
-
- /* Variables that are intrinsically call-clobbered (globals,
- local statics, etc) will not be marked by the aliasing
- code, so we can't remove them from CALL_CLOBBERED_VARS. */
- if (!is_call_clobbered (var))
- bitmap_clear_bit (call_clobbered_vars, var_ann (var)->uid);
- }
-
/* Similarly, clear the set of addressable variables. In this
case, we can just clear the set because addressability is
only computed here. */
@@ -474,9 +460,19 @@ init_alias_info (void)
/* Clear flow-insensitive alias information from each symbol. */
for (i = 0; i < num_referenced_vars; i++)
{
- var_ann_t ann = var_ann (referenced_var (i));
+ tree var = referenced_var (i);
+ var_ann_t ann = var_ann (var);
+
ann->is_alias_tag = 0;
ann->may_aliases = NULL;
+
+ /* Since we are about to re-discover call-clobbered
+ variables, clear the call-clobbered flag. Variables that
+ are intrinsically call-clobbered (globals, local statics,
+ etc) will not be marked by the aliasing code, so we can't
+ remove them from CALL_CLOBBERED_VARS. */
+ if (ann->mem_tag_kind != NOT_A_TAG || !is_global_var (var))
+ clear_call_clobbered (var);
}
/* Clear flow-sensitive points-to information from each SSA name. */