This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[IPA] Localize SSA datastructures
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, dnovillo at redhat dot com
- Date: Thu, 18 Aug 2005 15:42:16 +0200
- Subject: [IPA] Localize SSA datastructures
Hi,
this patch makes SSA local so we can turn multiple functions into SSA
form at a time. There is one important FIXME in the patch about
annotations of global variables being shared across function bodies that
fortunately doesn't hurt because there is nothing useful stored in the
intraprocedurally. But it also shows that we should re-think this and
make them function local if possible.
Honza
Bootstrapped/regtested i686-linux, will commit it after bit of more
testing.
2005-08-18 Jan Hubicka <jh@suse.cz>
* Makefile.in (tree-ssanames, tree-eh, tree-ssa-operands): Kill GGC
file.
* function.h (struct function): Add struct ssa.
* tree-cfgcleanup (modified_noreturn_calls): Kill.
(cleanup_control_flow): Set modified_noreturn_calls only when in SSA.
* tree-dfa.c (referenced_vars): Kill.
(make_rename_temp): Touch referenced_vars only when in SSA.
(default_def_fn, default_def, set_default_def): New.
* tree-flow-inline.h (mark_stmt_modified): Only touch noreturn calls
when in SSA.
(default_def, set_default_def): Kill.
(is_call_clobbered, mark_call_clobbered, clear_call_clobbered,
mark_non_addressable): Update call_clobbered_vars and operand caches.
* tree-flow.h (in_ssa_p): Kill variable.
(struct opbuild_list_d): Declare here.
(struct ssa): New struct.
(referenced_vars, ssa_names, modified_noreturn_calls, global_var,
aliases_computed_p, in_ssa_p, free_ssanames, build_defs, build_uses,
build_v_may_defs, build_vuses, build_v_must_defs, operand_memory,
operand_memory_index, free_defs, free_uses, free_vuses, free_maydefs,
free_mustdefs): New macros.
(var_ann_d): Kill default_def.
(modified_noreturn_calls, referenced_vars, ssa_names, global_var,
call_clobbered_vars, addressable_vars, aliases_computed_p): Kill global
variable.
(set_default_def, default_def): No longer inline.
* tree-intossa.c (in_ssa_p): Kill.
(rewrite_into_ssa): Set in_ssa_p using x_ field.
* tree-optimize.c (execute_free_datastructures): Only kill SSA when
present.
* tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p using x_ field.
* tree-ssa-alias.c (aliases_computed_p, call_clobbered_vars,
addressable_vars, global_var): Kill.
(init_alias_info, setup_pointers_and_addressables,
maybe_create_global_var): Update name of call clobbered bitmaps.
* tree-ssa-operands.c (opbuild_list_d): Kill structure definition.
(build_defs, build_uses, build_v_may_defs, build_vuses,
build_v_must_defs, ssa_call_clobbered_cache_valid,
ssa_ro_call_cache_valid): Kill.
(ssa_call_clobbered_cache_valid_for, ssa_ro_call_cache_valid_for): New.
(ops_active, operand_memory, operand_memory_index): Kill.
(free_defs, free_uses, free_vuses, free_maydefs, free_mustdefs): Kill.
(ssa_operands_active): Use cfun->ssa.
(init_ssa_operands): Likewise.
(fini_ssa_operands): Update clobbered cache.
(get_asm_expr_operands, get_call_expr_operands, add_call_clobber_ops,
debug_immediate_uses_for): Update.
* tree-ssa-operands.h (ssa_call_clobbered_cache_valid,
ssa_ro_call_cache_valid): Rename to...
(ssa_call_clobbered_cache_valid_for, ssa_ro_call_cache_valid_for): ...
this one.
* tree-ssa-opfinalize.h (FINALIZE_FUNC): Check datastructure sanity.
* tree-ssa-structalias (update_alias_info): Update.
* tree-ssa.c (init_tree_ssa): Allocate SSA structure; update for new
names.
(delete_tree_ssa): Similarly.
* tree-ssanames.c (ssa_names, free_ssanames): Kill; do not include
gt-tree-ssanames.h
* tree-vect-generic.c (expand_vector_operations): Do not update stmt
when not in SSA form.
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1533.2.1
diff -c -3 -p -r1.1533.2.1 Makefile.in
*** Makefile.in 9 Aug 2005 11:25:29 -0000 1.1533.2.1
--- Makefile.in 17 Aug 2005 09:34:11 -0000
*************** tree-ssa-threadupdate.o : tree-ssa-threa
*** 1788,1794 ****
$(DIAGNOSTIC_H) function.h $(TM_H) coretypes.h $(TREE_DUMP_H) \
$(BASIC_BLOCK_H) $(FLAGS_H) tree-pass.h $(CFGLOOP_H)
tree-ssanames.o : tree-ssanames.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
! $(TM_H) $(TREE_H) $(VARRAY_H) $(GGC_H) gt-tree-ssanames.h $(TREE_FLOW_H)
tree-phinodes.o : tree-phinodes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(TREE_H) $(VARRAY_H) $(GGC_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) \
gt-tree-phinodes.h $(RTL_H) toplev.h
--- 1788,1794 ----
$(DIAGNOSTIC_H) function.h $(TM_H) coretypes.h $(TREE_DUMP_H) \
$(BASIC_BLOCK_H) $(FLAGS_H) tree-pass.h $(CFGLOOP_H)
tree-ssanames.o : tree-ssanames.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
! $(TM_H) $(TREE_H) $(VARRAY_H) $(GGC_H) $(TREE_FLOW_H)
tree-phinodes.o : tree-phinodes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(TREE_H) $(VARRAY_H) $(GGC_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) \
gt-tree-phinodes.h $(RTL_H) toplev.h
*************** GTFILES = $(srcdir)/input.h $(srcdir)/co
*** 2737,2748 ****
$(srcdir)/stringpool.c $(srcdir)/tree.c $(srcdir)/varasm.c \
$(srcdir)/tree-mudflap.c $(srcdir)/tree-flow.h \
$(srcdir)/c-objc-common.c $(srcdir)/c-common.c $(srcdir)/c-parser.c \
! $(srcdir)/tree-ssanames.c $(srcdir)/tree-eh.c $(srcdir)/tree-ssa-address.c \
$(srcdir)/tree-phinodes.c $(srcdir)/tree-cfg.c \
$(srcdir)/tree-dfa.c $(srcdir)/tree-ssa-propagate.c \
$(srcdir)/tree-iterator.c $(srcdir)/gimplify.c \
$(srcdir)/tree-chrec.h $(srcdir)/tree-vect-generic.c \
! $(srcdir)/tree-ssa-operands.h $(srcdir)/tree-ssa-operands.c \
$(srcdir)/tree-profile.c $(srcdir)/tree-nested.c \
$(srcdir)/ipa-reference.c \
$(srcdir)/targhooks.c $(out_file) \
--- 2737,2748 ----
$(srcdir)/stringpool.c $(srcdir)/tree.c $(srcdir)/varasm.c \
$(srcdir)/tree-mudflap.c $(srcdir)/tree-flow.h \
$(srcdir)/c-objc-common.c $(srcdir)/c-common.c $(srcdir)/c-parser.c \
! $(srcdir)/tree-eh.c $(srcdir)/tree-ssa-address.c \
$(srcdir)/tree-phinodes.c $(srcdir)/tree-cfg.c \
$(srcdir)/tree-dfa.c $(srcdir)/tree-ssa-propagate.c \
$(srcdir)/tree-iterator.c $(srcdir)/gimplify.c \
$(srcdir)/tree-chrec.h $(srcdir)/tree-vect-generic.c \
! $(srcdir)/tree-ssa-operands.h \
$(srcdir)/tree-profile.c $(srcdir)/tree-nested.c \
$(srcdir)/ipa-reference.c \
$(srcdir)/targhooks.c $(out_file) \
*************** gt-dbxout.h gt-c-common.h gt-c-decl.h gt
*** 2763,2769 ****
gt-c-pragma.h gtype-c.h gt-cfglayout.h \
gt-tree-mudflap.h gt-tree-vect-generic.h \
gt-tree-profile.h gt-tree-ssa-address.h \
! gt-tree-ssanames.h gt-tree-iterator.h gt-gimplify.h \
gt-tree-phinodes.h gt-tree-nested.h \
gt-tree-ssa-operands.h gt-tree-ssa-propagate.h \
gt-stringpool.h gt-targhooks.h : s-gtype ; @true
--- 2763,2769 ----
gt-c-pragma.h gtype-c.h gt-cfglayout.h \
gt-tree-mudflap.h gt-tree-vect-generic.h \
gt-tree-profile.h gt-tree-ssa-address.h \
! gt-tree-iterator.h gt-gimplify.h \
gt-tree-phinodes.h gt-tree-nested.h \
gt-tree-ssa-operands.h gt-tree-ssa-propagate.h \
gt-stringpool.h gt-targhooks.h : s-gtype ; @true
Index: function.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.h,v
retrieving revision 1.156.4.1
diff -c -3 -p -r1.156.4.1 function.h
*** function.h 13 Aug 2005 10:51:40 -0000 1.156.4.1
--- function.h 17 Aug 2005 09:34:11 -0000
*************** struct expr_status GTY(())
*** 155,160 ****
--- 155,161 ----
#define apply_args_value (cfun->expr->x_apply_args_value)
#define forced_labels (cfun->expr->x_forced_labels)
#define stack_pointer_delta (cfun->expr->x_stack_pointer_delta)
+ struct ssa;
/* This structure can save all the important global and static variables
describing the status of the current function. */
*************** struct function GTY(())
*** 169,174 ****
--- 170,176 ----
/* The control flow graph for this function. */
struct control_flow_graph *cfg;
bool after_inlining;
+ struct ssa *ssa;
/* For function.c. */
Index: tree-cfgcleanup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfgcleanup.c,v
retrieving revision 2.5
diff -c -3 -p -r2.5 tree-cfgcleanup.c
*** tree-cfgcleanup.c 2 Aug 2005 19:12:41 -0000 2.5
--- tree-cfgcleanup.c 17 Aug 2005 09:34:12 -0000
*************** cleanup_control_expr_graph (basic_block
*** 126,139 ****
return retval;
}
- /* A list of all the noreturn calls passed to modify_stmt.
- cleanup_control_flow uses it to detect cases where a mid-block
- indirect call has been turned into a noreturn call. When this
- happens, all the instructions after the call are no longer
- reachable and must be deleted as dead. */
-
- VEC(tree,gc) *modified_noreturn_calls;
-
/* Try to remove superfluous control structures. */
static bool
--- 126,131 ----
*************** cleanup_control_flow (void)
*** 145,157 ****
tree stmt;
/* Detect cases where a mid-block call is now known not to return. */
! while (VEC_length (tree, modified_noreturn_calls))
! {
! stmt = VEC_pop (tree, modified_noreturn_calls);
! bb = bb_for_stmt (stmt);
! if (bb != NULL && last_stmt (bb) != stmt && noreturn_call_p (stmt))
! split_block (bb, stmt);
! }
FOR_EACH_BB (bb)
{
--- 137,150 ----
tree stmt;
/* Detect cases where a mid-block call is now known not to return. */
! if (cfun->ssa)
! while (VEC_length (tree, modified_noreturn_calls))
! {
! stmt = VEC_pop (tree, modified_noreturn_calls);
! bb = bb_for_stmt (stmt);
! if (bb != NULL && last_stmt (bb) != stmt && noreturn_call_p (stmt))
! split_block (bb, stmt);
! }
FOR_EACH_BB (bb)
{
Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-dfa.c,v
retrieving revision 2.63
diff -c -3 -p -r2.63 tree-dfa.c
*** tree-dfa.c 28 Jul 2005 16:29:52 -0000 2.63
--- tree-dfa.c 17 Aug 2005 09:34:12 -0000
*************** static void add_referenced_var (tree, st
*** 82,90 ****
/* Global declarations. */
- /* Array of all variables referenced in the function. */
- htab_t referenced_vars;
-
/*---------------------------------------------------------------------------
Dataflow analysis (DFA) routines
--- 82,87 ----
*************** tree
*** 210,216 ****
make_rename_temp (tree type, const char *prefix)
{
tree t = create_tmp_var (type, prefix);
! if (referenced_vars)
{
add_referenced_tmp_var (t);
mark_sym_for_renaming (t);
--- 207,213 ----
make_rename_temp (tree type, const char *prefix)
{
tree t = create_tmp_var (type, prefix);
! if (cfun->ssa && referenced_vars)
{
add_referenced_tmp_var (t);
mark_sym_for_renaming (t);
*************** referenced_var_insert (unsigned int uid,
*** 609,614 ****
--- 606,668 ----
*(struct int_tree_map **) loc = h;
}
+ /* Lookup UID in the default_defs hashtable and return the associated
+ variable. */
+
+ tree
+ default_def_fn (struct function *fn, tree var)
+ {
+ struct int_tree_map *h, in;
+ gcc_assert (TREE_CODE (var) == VAR_DECL || TREE_CODE (var) == PARM_DECL
+ || TREE_CODE (var) == RESULT_DECL);
+ in.uid = DECL_UID (var);
+ h = htab_find_with_hash (fn->ssa->default_defs, &in, DECL_UID (var));
+ if (h)
+ return h->to;
+ return NULL_TREE;
+ }
+
+ tree
+ default_def (tree var)
+ {
+ return default_def_fn (cfun, var);
+ }
+
+ /* Insert the pair UID, TO into the default_defs hashtable. */
+
+ void
+ set_default_def (tree var, tree def)
+ {
+ struct int_tree_map in;
+ struct int_tree_map *h;
+ void **loc;
+
+ gcc_assert (TREE_CODE (var) == VAR_DECL || TREE_CODE (var) == PARM_DECL
+ || TREE_CODE (var) == RESULT_DECL);
+ in.uid = DECL_UID (var);
+ if (!def && default_def (var))
+ {
+ loc = htab_find_slot_with_hash (cfun->ssa->default_defs, &in, DECL_UID (var), INSERT);
+ htab_remove_elt (cfun->ssa->default_defs, *loc);
+ return;
+ }
+ gcc_assert (TREE_CODE (def) == SSA_NAME);
+ loc = htab_find_slot_with_hash (cfun->ssa->default_defs, &in, DECL_UID (var), INSERT);
+ /* Defalt definition might be changed by tail call optimization. */
+ if (!*loc)
+ {
+ h = ggc_alloc (sizeof (struct int_tree_map));
+ h->uid = DECL_UID (var);
+ h->to = def;
+ *(struct int_tree_map **) loc = h;
+ }
+ else
+ {
+ h = *loc;
+ h->to = def;
+ }
+ }
+
/* Add VAR to the list of dereferenced variables.
WALK_STATE contains a hash table used to avoid adding the same
Index: tree-flow-inline.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-flow-inline.h,v
retrieving revision 2.55
diff -c -3 -p -r2.55 tree-flow-inline.h
*** tree-flow-inline.h 28 Jul 2005 16:29:52 -0000 2.55
--- tree-flow-inline.h 17 Aug 2005 09:34:12 -0000
*************** mark_stmt_modified (tree t)
*** 242,248 ****
ann = stmt_ann (t);
if (ann == NULL)
ann = create_stmt_ann (t);
! else if (noreturn_call_p (t))
VEC_safe_push (tree, gc, modified_noreturn_calls, t);
ann->modified = 1;
}
--- 242,248 ----
ann = stmt_ann (t);
if (ann == NULL)
ann = create_stmt_ann (t);
! else if (noreturn_call_p (t) && cfun->ssa)
VEC_safe_push (tree, gc, modified_noreturn_calls, t);
ann->modified = 1;
}
*************** is_label_stmt (tree t)
*** 675,697 ****
return false;
}
- /* Set the default definition for VAR to DEF. */
- static inline void
- set_default_def (tree var, tree def)
- {
- var_ann_t ann = get_var_ann (var);
- ann->default_def = def;
- }
-
- /* Return the default definition for variable VAR, or NULL if none
- exists. */
- static inline tree
- default_def (tree var)
- {
- var_ann_t ann = var_ann (var);
- return ann ? ann->default_def : NULL_TREE;
- }
-
/* PHI nodes should contain only ssa_names and invariants. A test
for ssa_name is definitely simpler; don't let invalid contents
slip in in the meantime. */
--- 675,680 ----
*************** static inline bool
*** 845,851 ****
is_call_clobbered (tree var)
{
return is_global_var (var)
! || bitmap_bit_p (call_clobbered_vars, DECL_UID (var));
}
/* Mark variable VAR as being clobbered by function calls. */
--- 828,834 ----
is_call_clobbered (tree var)
{
return is_global_var (var)
! || bitmap_bit_p (cfun->ssa->call_clobbered_vars, DECL_UID (var));
}
/* Mark variable VAR as being clobbered by function calls. */
*************** mark_call_clobbered (tree var)
*** 859,867 ****
location in global memory. */
if (ann->mem_tag_kind != NOT_A_TAG && ann->mem_tag_kind != STRUCT_FIELD)
DECL_EXTERNAL (var) = 1;
! bitmap_set_bit (call_clobbered_vars, DECL_UID (var));
! ssa_call_clobbered_cache_valid = false;
! ssa_ro_call_cache_valid = false;
}
/* Clear the call-clobbered attribute from variable VAR. */
--- 842,850 ----
location in global memory. */
if (ann->mem_tag_kind != NOT_A_TAG && ann->mem_tag_kind != STRUCT_FIELD)
DECL_EXTERNAL (var) = 1;
! bitmap_set_bit (cfun->ssa->call_clobbered_vars, DECL_UID (var));
! ssa_call_clobbered_cache_valid_for = NULL;
! ssa_ro_call_cache_valid_for = NULL;
}
/* Clear the call-clobbered attribute from variable VAR. */
*************** clear_call_clobbered (tree var)
*** 871,889 ****
var_ann_t ann = var_ann (var);
if (ann->mem_tag_kind != NOT_A_TAG && ann->mem_tag_kind != STRUCT_FIELD)
DECL_EXTERNAL (var) = 0;
! bitmap_clear_bit (call_clobbered_vars, DECL_UID (var));
! 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)
{
! bitmap_clear_bit (call_clobbered_vars, DECL_UID (var));
TREE_ADDRESSABLE (var) = 0;
! ssa_call_clobbered_cache_valid = false;
! ssa_ro_call_cache_valid = false;
}
/* Return the common annotation for T. Return NULL if the annotation
--- 854,872 ----
var_ann_t ann = var_ann (var);
if (ann->mem_tag_kind != NOT_A_TAG && ann->mem_tag_kind != STRUCT_FIELD)
DECL_EXTERNAL (var) = 0;
! bitmap_clear_bit (cfun->ssa->call_clobbered_vars, DECL_UID (var));
! ssa_call_clobbered_cache_valid_for = NULL;
! ssa_ro_call_cache_valid_for = NULL;
}
/* Mark variable VAR as being non-addressable. */
static inline void
mark_non_addressable (tree var)
{
! bitmap_clear_bit (cfun->ssa->call_clobbered_vars, DECL_UID (var));
TREE_ADDRESSABLE (var) = 0;
! ssa_call_clobbered_cache_valid_for = NULL;
! ssa_ro_call_cache_valid_for = NULL;
}
/* Return the common annotation for T. Return NULL if the annotation
Index: tree-flow.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-flow.h,v
retrieving revision 2.131.2.1
diff -c -3 -p -r2.131.2.1 tree-flow.h
*** tree-flow.h 9 Aug 2005 11:25:35 -0000 2.131.2.1
--- tree-flow.h 17 Aug 2005 09:34:12 -0000
*************** struct basic_block_def;
*** 40,47 ****
typedef struct basic_block_def *basic_block;
#endif
! /* True if the code is in ssa form. */
! extern bool in_ssa_p;
typedef struct
{
--- 40,144 ----
typedef struct basic_block_def *basic_block;
#endif
! /* This structure maintain a sorted list of operands which is created by
! parse_ssa_operand. */
! struct opbuild_list_d GTY (())
! {
! varray_type vars; /* The VAR_DECLS tree. */
! varray_type uid; /* The sort value for virtual symbols. */
! varray_type next; /* The next index in the sorted list. */
! int first; /* First element in list. */
! unsigned num; /* Number of elements. */
! };
!
! struct ssa GTY(()) {
! /* Array of all variables referenced in the function. */
! htab_t GTY((param_is (struct int_tree_map))) x_referenced_vars;
! /* A list of all the noreturn calls passed to modify_stmt.
! cleanup_control_flow uses it to detect cases where a mid-block
! indirect call has been turned into a noreturn call. When this
! happens, all the instructions after the call are no longer
! reachable and must be deleted as dead. */
! VEC(tree,gc) *x_modified_noreturn_calls;
! /* Array of all SSA_NAMEs used in the function. */
! VEC(tree,gc) *x_ssa_names;
!
! /* Artificial variable used to model the effects of function calls. */
! tree x_global_var;
!
! /* Call clobbered variables in the function. If bit I is set, then
! REFERENCED_VARS (I) is call-clobbered. */
! bitmap call_clobbered_vars;
!
! /* Addressable variables in the function. If bit I is set, then
! REFERENCED_VARS (I) has had its address taken. Note that
! CALL_CLOBBERED_VARS and ADDRESSABLE_VARS are not related. An
! addressable variable is not necessarily call-clobbered (e.g., a
! local addressable whose address does not escape) and not all
! call-clobbered variables are addressable (e.g., a local static
! variable). */
! bitmap addressable_vars;
!
! /* 'true' after aliases have been computed (see compute_may_aliases). */
! bool x_aliases_computed_p;
!
! bool x_in_ssa_p;
!
! /* Free list of SSA_NAMEs. */
! tree x_free_ssanames;
!
! /* Array for building all the def operands. */
! struct opbuild_list_d x_build_defs;
!
! /* Array for building all the use operands. */
! struct opbuild_list_d x_build_uses;
!
! /* Array for building all the v_may_def operands. */
! struct opbuild_list_d x_build_v_may_defs;
!
! /* Array for building all the vuse operands. */
! struct opbuild_list_d x_build_vuses;
!
! /* Array for building all the v_must_def operands. */
! struct opbuild_list_d x_build_v_must_defs;
!
! struct ssa_operand_memory_d *x_operand_memory;
! unsigned x_operand_memory_index;
!
! bool ops_active;
!
! struct def_optype_d * GTY((skip)) x_free_defs;
! struct use_optype_d * GTY((skip)) x_free_uses;
! struct vuse_optype_d * GTY((skip)) x_free_vuses;
! struct maydef_optype_d * GTY((skip)) x_free_maydefs;
! struct mustdef_optype_d * GTY((skip)) x_free_mustdefs;
!
! /* Hashtable holding definition for symbol. If this field is not NULL, it
! means that the first reference to this variable in the function is a
! USE or a VUSE. In those cases, the SSA renamer creates an SSA name
! for this variable with an empty defining statement. */
! htab_t GTY((param_is (struct int_tree_map))) default_defs;
! };
! #define referenced_vars cfun->ssa->x_referenced_vars
! #define ssa_names cfun->ssa->x_ssa_names
! #define modified_noreturn_calls cfun->ssa->x_modified_noreturn_calls
! #define global_var cfun->ssa->x_global_var
! #define aliases_computed_p cfun->ssa->x_aliases_computed_p
! #define in_ssa_p (cfun->ssa && cfun->ssa->x_in_ssa_p)
! #define free_ssanames (cfun->ssa->x_free_ssanames)
!
! #define build_defs (cfun->ssa->x_build_defs)
! #define build_uses (cfun->ssa->x_build_uses)
! #define build_v_may_defs (cfun->ssa->x_build_v_may_defs)
! #define build_vuses (cfun->ssa->x_build_vuses)
! #define build_v_must_defs (cfun->ssa->x_build_v_must_defs)
! #define operand_memory (cfun->ssa->x_operand_memory)
! #define operand_memory_index (cfun->ssa->x_operand_memory_index)
! #define free_defs (cfun->ssa->x_free_defs)
! #define free_uses (cfun->ssa->x_free_uses)
! #define free_vuses (cfun->ssa->x_free_vuses)
! #define free_maydefs (cfun->ssa->x_free_maydefs)
! #define free_mustdefs (cfun->ssa->x_free_mustdefs)
typedef struct
{
*************** struct var_ann_d GTY(())
*** 231,242 ****
/* Used by the root-var object in tree-ssa-live.[ch]. */
unsigned root_index;
- /* Default definition for this symbol. If this field is not NULL, it
- means that the first reference to this variable in the function is a
- USE or a VUSE. In those cases, the SSA renamer creates an SSA name
- for this variable with an empty defining statement. */
- tree default_def;
-
/* During into-ssa and the dominator optimizer, this field holds the
current version of this variable (an SSA_NAME). */
tree current_def;
--- 328,333 ----
*************** union tree_ann_d GTY((desc ("ann_type ((
*** 334,341 ****
struct stmt_ann_d GTY((tag ("STMT_ANN"))) stmt;
};
- extern GTY(()) VEC(tree,gc) *modified_noreturn_calls;
-
typedef union tree_ann_d *tree_ann_t;
typedef struct var_ann_d *var_ann_t;
typedef struct stmt_ann_d *stmt_ann_t;
--- 425,430 ----
*************** static inline const char *get_filename (
*** 358,365 ****
static inline bool is_exec_stmt (tree);
static inline bool is_label_stmt (tree);
static inline bitmap addresses_taken (tree);
- static inline void set_default_def (tree, tree);
- static inline tree default_def (tree);
/*---------------------------------------------------------------------------
Structure representing predictions in tree level.
--- 447,452 ----
*************** typedef struct
*** 424,457 ****
VEC_iterate (tree, (VEC), (ITER).i, (VAR)); \
(ITER).i++)
- /* Array of all variables referenced in the function. */
- extern GTY((param_is (struct int_tree_map))) htab_t referenced_vars;
-
extern tree referenced_var_lookup (unsigned int);
extern tree referenced_var_lookup_if_exists (unsigned int);
#define num_referenced_vars htab_elements (referenced_vars)
#define referenced_var(i) referenced_var_lookup (i)
- /* Array of all SSA_NAMEs used in the function. */
- extern GTY(()) VEC(tree,gc) *ssa_names;
-
#define num_ssa_names (VEC_length (tree, ssa_names))
#define ssa_name(i) (VEC_index (tree, ssa_names, (i)))
- /* Artificial variable used to model the effects of function calls. */
- extern GTY(()) tree global_var;
-
- /* Call clobbered variables in the function. If bit I is set, then
- REFERENCED_VARS (I) is call-clobbered. */
- extern bitmap call_clobbered_vars;
-
- /* Addressable variables in the function. If bit I is set, then
- REFERENCED_VARS (I) has had its address taken. */
- extern bitmap addressable_vars;
-
- /* 'true' after aliases have been computed (see compute_may_aliases). */
- extern bool aliases_computed_p;
-
/* Macros for showing usage statistics. */
#define SCALE(x) ((unsigned long) ((x) < 1024*10 \
? (x) \
--- 511,524 ----
*************** extern void mark_new_vars_to_rename (tre
*** 597,602 ****
--- 664,672 ----
extern void find_new_referenced_vars (tree *);
extern tree make_rename_temp (tree, const char *);
+ extern void set_default_def (tree, tree);
+ extern tree default_def (tree);
+ extern tree default_def_fn (struct function *, tree);
/* In gimple-low.c */
extern void record_vars (tree);
Index: tree-into-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-into-ssa.c,v
retrieving revision 2.64
diff -c -3 -p -r2.64 tree-into-ssa.c
*** tree-into-ssa.c 28 Jul 2005 16:29:52 -0000 2.64
--- tree-into-ssa.c 17 Aug 2005 09:34:12 -0000
*************** Boston, MA 02110-1301, USA. */
*** 54,62 ****
Graph. ACM Transactions on Programming Languages and Systems,
13(4):451-490, October 1991. */
- /* True if the code is in ssa form. */
- bool in_ssa_p;
-
/* Structure to map a variable VAR to the set of blocks that contain
definitions for VAR. */
struct def_blocks_d
--- 54,59 ----
*************** rewrite_into_ssa (void)
*** 1773,1779 ****
sbitmap_free (interesting_blocks);
timevar_pop (TV_TREE_SSA_OTHER);
! in_ssa_p = true;
}
--- 1770,1776 ----
sbitmap_free (interesting_blocks);
timevar_pop (TV_TREE_SSA_OTHER);
! cfun->ssa->x_in_ssa_p = true;
}
Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 2.121.2.2
diff -c -3 -p -r2.121.2.2 tree-optimize.c
*** tree-optimize.c 14 Aug 2005 13:52:37 -0000 2.121.2.2
--- tree-optimize.c 17 Aug 2005 09:34:12 -0000
*************** execute_free_datastructures (void)
*** 168,174 ****
/* Remove the ssa structures. Do it here since this includes statement
annotations that need to be intact during disband_implicit_edges. */
! delete_tree_ssa ();
}
struct tree_opt_pass pass_free_datastructures =
--- 199,206 ----
/* Remove the ssa structures. Do it here since this includes statement
annotations that need to be intact during disband_implicit_edges. */
! if (cfun->ssa)
! delete_tree_ssa ();
}
struct tree_opt_pass pass_free_datastructures =
Index: tree-outof-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-outof-ssa.c,v
retrieving revision 2.65
diff -c -3 -p -r2.65 tree-outof-ssa.c
*** tree-outof-ssa.c 30 Jul 2005 22:14:16 -0000 2.65
--- tree-outof-ssa.c 17 Aug 2005 09:34:12 -0000
*************** rewrite_out_of_ssa (void)
*** 2524,2530 ****
/* Mark arrays indexed with non-constant indices with TREE_ADDRESSABLE. */
discover_nonconstant_array_refs ();
! in_ssa_p = false;
}
--- 2524,2530 ----
/* Mark arrays indexed with non-constant indices with TREE_ADDRESSABLE. */
discover_nonconstant_array_refs ();
! cfun->ssa->x_in_ssa_p = false;
}
Index: tree-ssa-alias.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-alias.c,v
retrieving revision 2.109.2.1
diff -c -3 -p -r2.109.2.1 tree-ssa-alias.c
*** tree-ssa-alias.c 9 Aug 2005 11:25:36 -0000 2.109.2.1
--- tree-ssa-alias.c 17 Aug 2005 09:34:13 -0000
*************** Boston, MA 02110-1301, USA. */
*** 52,60 ****
aliasing */
static bitmap_obstack alias_obstack;
- /* 'true' after aliases have been computed (see compute_may_aliases). */
- bool aliases_computed_p;
-
/* Structure to map a variable to its alias set and keep track of the
virtual operands that will be needed to represent it. */
struct alias_map_d
--- 52,57 ----
*************** static void set_pt_anything (tree ptr);
*** 116,142 ****
/* Global declarations. */
- /* Call clobbered variables in the function. If bit I is set, then
- REFERENCED_VARS (I) is call-clobbered. */
- bitmap call_clobbered_vars;
-
- /* Addressable variables in the function. If bit I is set, then
- REFERENCED_VARS (I) has had its address taken. Note that
- CALL_CLOBBERED_VARS and ADDRESSABLE_VARS are not related. An
- addressable variable is not necessarily call-clobbered (e.g., a
- local addressable whose address does not escape) and not all
- call-clobbered variables are addressable (e.g., a local static
- variable). */
- bitmap addressable_vars;
-
- /* When the program has too many call-clobbered variables and call-sites,
- this variable is used to represent the clobbering effects of function
- calls. In these cases, all the call clobbered variables in the program
- are forced to alias this variable. This reduces compile times by not
- having to keep track of too many V_MAY_DEF expressions at call sites. */
- tree global_var;
-
-
/* Compute may-alias information for every variable referenced in function
FNDECL.
--- 113,118 ----
*************** init_alias_info (void)
*** 472,478 ****
/* Similarly, clear the set of addressable variables. In this
case, we can just clear the set because addressability is
only computed here. */
! bitmap_clear (addressable_vars);
/* Clear flow-insensitive alias information from each symbol. */
FOR_EACH_REFERENCED_VAR (var, rvi)
--- 448,454 ----
/* Similarly, clear the set of addressable variables. In this
case, we can just clear the set because addressability is
only computed here. */
! bitmap_clear (cfun->ssa->addressable_vars);
/* Clear flow-insensitive alias information from each symbol. */
FOR_EACH_REFERENCED_VAR (var, rvi)
*************** setup_pointers_and_addressables (struct
*** 1240,1246 ****
cleanup passes. */
if (TREE_ADDRESSABLE (var))
{
! if (!bitmap_bit_p (addressable_vars, DECL_UID (var))
&& TREE_CODE (var) != RESULT_DECL
&& !is_global_var (var))
{
--- 1216,1222 ----
cleanup passes. */
if (TREE_ADDRESSABLE (var))
{
! if (!bitmap_bit_p (cfun->ssa->addressable_vars, DECL_UID (var))
&& TREE_CODE (var) != RESULT_DECL
&& !is_global_var (var))
{
*************** setup_pointers_and_addressables (struct
*** 1260,1266 ****
for (sv = svars; sv; sv = sv->next)
{
! if (bitmap_bit_p (addressable_vars, DECL_UID (sv->var)))
okay_to_mark = false;
mark_sym_for_renaming (sv->var);
}
--- 1236,1242 ----
for (sv = svars; sv; sv = sv->next)
{
! if (bitmap_bit_p (cfun->ssa->addressable_vars, DECL_UID (sv->var)))
okay_to_mark = false;
mark_sym_for_renaming (sv->var);
}
*************** maybe_create_global_var (struct alias_in
*** 1389,1395 ****
{
/* Count all the call-clobbered variables. */
n_clobbered = 0;
! EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, bi)
{
n_clobbered++;
}
--- 1365,1371 ----
{
/* Count all the call-clobbered variables. */
n_clobbered = 0;
! EXECUTE_IF_SET_IN_BITMAP (cfun->ssa->call_clobbered_vars, 0, i, bi)
{
n_clobbered++;
}
*************** maybe_create_global_var (struct alias_in
*** 1432,1438 ****
/* Mark all call-clobbered symbols for renaming. Since the initial
rewrite into SSA ignored all call sites, we may need to rename
.GLOBAL_VAR and the call-clobbered variables. */
! EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, bi)
{
tree var = referenced_var (i);
--- 1408,1414 ----
/* Mark all call-clobbered symbols for renaming. Since the initial
rewrite into SSA ignored all call sites, we may need to rename
.GLOBAL_VAR and the call-clobbered variables. */
! EXECUTE_IF_SET_IN_BITMAP (cfun->ssa->call_clobbered_vars, 0, i, bi)
{
tree var = referenced_var (i);
Index: tree-ssa-operands.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-operands.c,v
retrieving revision 2.100
diff -c -3 -p -r2.100 tree-ssa-operands.c
*** tree-ssa-operands.c 2 Aug 2005 11:46:44 -0000 2.100
--- tree-ssa-operands.c 17 Aug 2005 09:34:13 -0000
*************** Boston, MA 02110-1301, USA. */
*** 103,140 ****
to distinguish "reset the world" events from explicit MODIFY_EXPRs. */
#define opf_non_specific (1 << 3)
- /* This structure maintain a sorted list of operands which is created by
- parse_ssa_operand. */
- struct opbuild_list_d GTY (())
- {
- varray_type vars; /* The VAR_DECLS tree. */
- varray_type uid; /* The sort value for virtual symbols. */
- varray_type next; /* The next index in the sorted list. */
- int first; /* First element in list. */
- unsigned num; /* Number of elements. */
- };
#define OPBUILD_LAST -1
!
! /* Array for building all the def operands. */
! static GTY (()) struct opbuild_list_d build_defs;
!
! /* Array for building all the use operands. */
! static GTY (()) struct opbuild_list_d build_uses;
!
! /* Array for building all the v_may_def operands. */
! static GTY (()) struct opbuild_list_d build_v_may_defs;
!
! /* Array for building all the vuse operands. */
! static GTY (()) struct opbuild_list_d build_vuses;
!
! /* Array for building all the v_must_def operands. */
! static GTY (()) struct opbuild_list_d build_v_must_defs;
!
! /* True if the operands for call clobbered vars are cached and valid. */
! bool ssa_call_clobbered_cache_valid;
! bool ssa_ro_call_cache_valid;
/* These arrays are the cached operand vectors for call clobbered calls. */
static VEC(tree,heap) *clobbered_v_may_defs;
--- 103,115 ----
to distinguish "reset the world" events from explicit MODIFY_EXPRs. */
#define opf_non_specific (1 << 3)
#define OPBUILD_LAST -1
! /* Points to the function declaration of function cache is valid for
! (if any) */
! tree ssa_call_clobbered_cache_valid_for;
! tree ssa_ro_call_cache_valid_for;
/* These arrays are the cached operand vectors for call clobbered calls. */
static VEC(tree,heap) *clobbered_v_may_defs;
*************** static VEC(tree,heap) *ro_call_vuses;
*** 143,152 ****
static bool clobbered_aliased_loads;
static bool clobbered_aliased_stores;
static bool ro_call_aliased_loads;
- static bool ops_active = false;
-
- static GTY (()) struct ssa_operand_memory_d *operand_memory = NULL;
- static unsigned operand_memory_index;
static void get_expr_operands (tree, tree *, int);
static void get_asm_expr_operands (tree);
--- 118,123 ----
*************** static void add_call_read_ops (tree);
*** 162,173 ****
static void add_stmt_operand (tree *, stmt_ann_t, int);
static void build_ssa_operands (tree stmt);
- static def_optype_p free_defs = NULL;
- static use_optype_p free_uses = NULL;
- static vuse_optype_p free_vuses = NULL;
- static maydef_optype_p free_maydefs = NULL;
- static mustdef_optype_p free_mustdefs = NULL;
-
/* Initialize a virtual operand build LIST called NAME with NUM elements. */
static inline void
--- 133,138 ----
*************** opbuild_remove_elem (struct opbuild_list
*** 390,396 ****
bool
ssa_operands_active (void)
{
! return ops_active;
}
--- 355,361 ----
bool
ssa_operands_active (void)
{
! return cfun->ssa && cfun->ssa->ops_active;
}
*************** init_ssa_operands (void)
*** 406,412 ****
opbuild_initialize_virtual (&build_v_must_defs, 25, "build_v_must_defs");
gcc_assert (operand_memory == NULL);
operand_memory_index = SSA_OPERAND_MEMORY_SIZE;
! ops_active = true;
}
--- 371,377 ----
opbuild_initialize_virtual (&build_v_must_defs, 25, "build_v_must_defs");
gcc_assert (operand_memory == NULL);
operand_memory_index = SSA_OPERAND_MEMORY_SIZE;
! cfun->ssa->ops_active = true;
}
*************** fini_ssa_operands (void)
*** 426,431 ****
--- 391,398 ----
free_vuses = NULL;
free_maydefs = NULL;
free_mustdefs = NULL;
+ ssa_call_clobbered_cache_valid_for = NULL;
+ ssa_ro_call_cache_valid_for = NULL;
while ((ptr = operand_memory) != NULL)
{
operand_memory = operand_memory->next;
*************** fini_ssa_operands (void)
*** 435,441 ****
VEC_free (tree, heap, clobbered_v_may_defs);
VEC_free (tree, heap, clobbered_vuses);
VEC_free (tree, heap, ro_call_vuses);
! ops_active = false;
}
--- 402,408 ----
VEC_free (tree, heap, clobbered_v_may_defs);
VEC_free (tree, heap, clobbered_vuses);
VEC_free (tree, heap, ro_call_vuses);
! cfun->ssa->ops_active = false;
}
*************** get_asm_expr_operands (tree stmt)
*** 1558,1571 ****
if (global_var)
add_stmt_operand (&global_var, s_ann, opf_is_def);
else
! EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, bi)
{
tree var = referenced_var (i);
add_stmt_operand (&var, s_ann, opf_is_def | opf_non_specific);
}
/* Now clobber all addressables. */
! EXECUTE_IF_SET_IN_BITMAP (addressable_vars, 0, i, bi)
{
tree var = referenced_var (i);
--- 1525,1538 ----
if (global_var)
add_stmt_operand (&global_var, s_ann, opf_is_def);
else
! EXECUTE_IF_SET_IN_BITMAP (cfun->ssa->call_clobbered_vars, 0, i, bi)
{
tree var = referenced_var (i);
add_stmt_operand (&var, s_ann, opf_is_def | opf_non_specific);
}
/* Now clobber all addressables. */
! EXECUTE_IF_SET_IN_BITMAP (cfun->ssa->addressable_vars, 0, i, bi)
{
tree var = referenced_var (i);
*************** get_call_expr_operands (tree stmt, tree
*** 1723,1729 ****
we avoid adding superfluous virtual operands, which can be a
significant compile time sink (See PR 15855). */
if (aliases_computed_p
! && !bitmap_empty_p (call_clobbered_vars)
&& !(call_flags & ECF_NOVOPS))
{
/* A 'pure' or a 'const' function never call-clobbers anything.
--- 1690,1696 ----
we avoid adding superfluous virtual operands, which can be a
significant compile time sink (See PR 15855). */
if (aliases_computed_p
! && !bitmap_empty_p (cfun->ssa->call_clobbered_vars)
&& !(call_flags & ECF_NOVOPS))
{
/* A 'pure' or a 'const' function never call-clobbers anything.
*************** add_call_clobber_ops (tree stmt, tree ca
*** 1984,1990 ****
not_written_b = callee ? ipa_reference_get_not_written_global (callee) : NULL;
/* If cache is valid, copy the elements into the build vectors. */
! if (ssa_call_clobbered_cache_valid
&& (!not_read_b || bitmap_empty_p (not_read_b))
&& (!not_written_b || bitmap_empty_p (not_written_b)))
{
--- 1951,1957 ----
not_written_b = callee ? ipa_reference_get_not_written_global (callee) : NULL;
/* If cache is valid, copy the elements into the build vectors. */
! if (ssa_call_clobbered_cache_valid_for == current_function_decl
&& (!not_read_b || bitmap_empty_p (not_read_b))
&& (!not_written_b || bitmap_empty_p (not_written_b)))
{
*************** add_call_clobber_ops (tree stmt, tree ca
*** 2015,2021 ****
memset (&empty_ann, 0, sizeof (struct stmt_ann_d));
/* Add a V_MAY_DEF operand for every call clobbered variable. */
! EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, u, bi)
{
tree var = referenced_var (u);
if (unmodifiable_var_p (var))
--- 1982,1988 ----
memset (&empty_ann, 0, sizeof (struct stmt_ann_d));
/* Add a V_MAY_DEF operand for every call clobbered variable. */
! EXECUTE_IF_SET_IN_BITMAP (cfun->ssa->call_clobbered_vars, 0, u, bi)
{
tree var = referenced_var (u);
if (unmodifiable_var_p (var))
*************** add_call_clobber_ops (tree stmt, tree ca
*** 2075,2081 ****
gcc_assert (opbuild_num_elems (&build_v_may_defs)
== VEC_length (tree, clobbered_v_may_defs));
! ssa_call_clobbered_cache_valid = true;
}
}
--- 2042,2048 ----
gcc_assert (opbuild_num_elems (&build_v_may_defs)
== VEC_length (tree, clobbered_v_may_defs));
! ssa_call_clobbered_cache_valid_for = current_function_decl;
}
}
*************** add_call_read_ops (tree stmt)
*** 2103,2109 ****
}
/* If cache is valid, copy the elements into the build vector. */
! if (ssa_ro_call_cache_valid)
{
for (i = VEC_length (tree, ro_call_vuses) - 1; i >=0 ; i--)
{
--- 2070,2076 ----
}
/* If cache is valid, copy the elements into the build vector. */
! if (ssa_ro_call_cache_valid_for == current_function_decl)
{
for (i = VEC_length (tree, ro_call_vuses) - 1; i >=0 ; i--)
{
*************** add_call_read_ops (tree stmt)
*** 2122,2128 ****
memset (&empty_ann, 0, sizeof (struct stmt_ann_d));
/* Add a VUSE for each call-clobbered variable. */
! EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, u, bi)
{
tree var = referenced_var (u);
add_stmt_operand (&var, &empty_ann, opf_none | opf_non_specific);
--- 2089,2095 ----
memset (&empty_ann, 0, sizeof (struct stmt_ann_d));
/* Add a VUSE for each call-clobbered variable. */
! EXECUTE_IF_SET_IN_BITMAP (cfun->ssa->call_clobbered_vars, 0, u, bi)
{
tree var = referenced_var (u);
add_stmt_operand (&var, &empty_ann, opf_none | opf_non_specific);
*************** add_call_read_ops (tree stmt)
*** 2145,2151 ****
gcc_assert (opbuild_num_elems (&build_vuses)
== VEC_length (tree, ro_call_vuses));
! ssa_ro_call_cache_valid = true;
}
--- 2112,2118 ----
gcc_assert (opbuild_num_elems (&build_vuses)
== VEC_length (tree, ro_call_vuses));
! ssa_ro_call_cache_valid_for = current_function_decl;
}
*************** debug_immediate_uses_for (tree var)
*** 2283,2286 ****
{
dump_immediate_uses_for (stderr, var);
}
- #include "gt-tree-ssa-operands.h"
--- 2250,2252 ----
Index: tree-ssa-operands.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-operands.h,v
retrieving revision 2.20
diff -c -3 -p -r2.20 tree-ssa-operands.h
*** tree-ssa-operands.h 10 Jul 2005 00:27:51 -0000 2.20
--- tree-ssa-operands.h 17 Aug 2005 09:34:13 -0000
*************** extern void dump_immediate_uses_for (FIL
*** 165,172 ****
extern void debug_immediate_uses (void);
extern void debug_immediate_uses_for (tree var);
! extern bool ssa_call_clobbered_cache_valid;
! extern bool ssa_ro_call_cache_valid;
extern bool ssa_operands_active (void);
--- 165,172 ----
extern void debug_immediate_uses (void);
extern void debug_immediate_uses_for (tree var);
! extern tree ssa_call_clobbered_cache_valid_for;
! extern tree ssa_ro_call_cache_valid_for;
extern bool ssa_operands_active (void);
Index: tree-ssa-opfinalize.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-opfinalize.h,v
retrieving revision 2.3
diff -c -3 -p -r2.3 tree-ssa-opfinalize.h
*** tree-ssa-opfinalize.h 25 Jun 2005 02:01:44 -0000 2.3
--- tree-ssa-opfinalize.h 17 Aug 2005 09:34:13 -0000
*************** FINALIZE_FUNC (tree stmt)
*** 68,73 ****
--- 68,79 ----
FINALIZE_BASE_TYPE old_base;
FINALIZE_TYPE new_list;
+ #ifdef ENABLE_CHECKING
+ /* Quick check that function contextes are sane or we get memory corruption. */
+ gcc_assert (!stmt_ann (stmt)->bb
+ || BASIC_BLOCK (stmt_ann (stmt)->bb->index) == stmt_ann (stmt)->bb);
+ #endif
+
new_list.next = NULL;
last = &new_list;
Index: tree-ssa-structalias.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-structalias.c,v
retrieving revision 2.25
diff -c -3 -p -r2.25 tree-ssa-structalias.c
*** tree-ssa-structalias.c 27 Jul 2005 11:15:24 -0000 2.25
--- tree-ssa-structalias.c 17 Aug 2005 09:34:13 -0000
*************** update_alias_info (tree stmt, struct ali
*** 2532,2538 ****
addr_taken = addresses_taken (stmt);
if (addr_taken)
{
! bitmap_ior_into (addressable_vars, addr_taken);
/* If STMT is an escape point, all the addresses taken by it are
call-clobbered. */
--- 2532,2538 ----
addr_taken = addresses_taken (stmt);
if (addr_taken)
{
! bitmap_ior_into (cfun->ssa->addressable_vars, addr_taken);
/* If STMT is an escape point, all the addresses taken by it are
call-clobbered. */
*************** update_alias_info (tree stmt, struct ali
*** 2573,2579 ****
so that they can be treated like regular statements?
Currently, they are treated as second-class
statements. */
! add_to_addressable_set (TREE_OPERAND (op, 0), &addressable_vars);
continue;
}
--- 2573,2579 ----
so that they can be treated like regular statements?
Currently, they are treated as second-class
statements. */
! add_to_addressable_set (TREE_OPERAND (op, 0), &cfun->ssa->addressable_vars);
continue;
}
Index: tree-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa.c,v
retrieving revision 2.106
diff -c -3 -p -r2.106 tree-ssa.c
*** tree-ssa.c 19 Jul 2005 20:20:40 -0000 2.106
--- tree-ssa.c 17 Aug 2005 09:34:13 -0000
*************** int_tree_map_hash (const void *item)
*** 799,808 ****
void
init_tree_ssa (void)
{
referenced_vars = htab_create_ggc (20, int_tree_map_hash,
int_tree_map_eq, NULL);
! call_clobbered_vars = BITMAP_ALLOC (NULL);
! addressable_vars = BITMAP_ALLOC (NULL);
init_ssanames ();
init_phinodes ();
global_var = NULL_TREE;
--- 799,811 ----
void
init_tree_ssa (void)
{
+ cfun->ssa = ggc_alloc_cleared (sizeof (struct ssa));
referenced_vars = htab_create_ggc (20, int_tree_map_hash,
int_tree_map_eq, NULL);
! cfun->ssa->default_defs = htab_create_ggc (20, int_tree_map_hash,
! int_tree_map_eq, NULL);
! cfun->ssa->call_clobbered_vars = BITMAP_GGC_ALLOC ();
! cfun->ssa->addressable_vars = BITMAP_GGC_ALLOC ();
init_ssanames ();
init_phinodes ();
global_var = NULL_TREE;
*************** delete_tree_ssa (void)
*** 851,873 ****
/* Remove annotations from every referenced variable. */
FOR_EACH_REFERENCED_VAR (var, rvi)
{
! ggc_free (var->common.ann);
! var->common.ann = NULL;
}
htab_delete (referenced_vars);
referenced_vars = NULL;
fini_ssanames ();
fini_phinodes ();
global_var = NULL_TREE;
! BITMAP_FREE (call_clobbered_vars);
! call_clobbered_vars = NULL;
! BITMAP_FREE (addressable_vars);
! addressable_vars = NULL;
modified_noreturn_calls = NULL;
aliases_computed_p = false;
gcc_assert (!need_ssa_update_p ());
}
--- 854,893 ----
/* Remove annotations from every referenced variable. */
FOR_EACH_REFERENCED_VAR (var, rvi)
{
! /* Annotations for static variables are shared across functions.
! FIXME: Probably this needs to be cleaned up somehow - most of stuff in
! annotations is currently local. We need to separate out the global
! info and probably kill annotations after early passes and rebuild
! before late so they don't consume memory during IPA. */
! if (!TREE_STATIC (var) && !DECL_EXTERNAL (var))
! {
! ggc_free (var->common.ann);
! var->common.ann = NULL;
! }
! else
! {
! var_ann_t ann = var_ann (var);
! memset ((void *)ann, 0, sizeof (*ann));
! ann->common.type = VAR_ANN;
! }
}
htab_delete (referenced_vars);
referenced_vars = NULL;
+ htab_delete (cfun->ssa->default_defs);
+ cfun->ssa->default_defs = NULL;
fini_ssanames ();
fini_phinodes ();
global_var = NULL_TREE;
!
! cfun->ssa->call_clobbered_vars = NULL;
!
! cfun->ssa->addressable_vars = NULL;
modified_noreturn_calls = NULL;
aliases_computed_p = false;
gcc_assert (!need_ssa_update_p ());
+ cfun->ssa = NULL;
}
Index: tree-ssanames.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssanames.c,v
retrieving revision 2.29
diff -c -3 -p -r2.29 tree-ssanames.c
*** tree-ssanames.c 13 Jul 2005 22:35:28 -0000 2.29
--- tree-ssanames.c 17 Aug 2005 09:34:13 -0000
*************** Boston, MA 02110-1301, USA. */
*** 57,69 ****
We could also use a zone allocator for these objects since they have
a very well defined lifetime. If someone wants to experiment with that
this is the place to try it. */
-
- /* Array of all SSA_NAMEs used in the function. */
- VEC(tree,gc) *ssa_names;
-
- /* Free list of SSA_NAMEs. This list is wiped at the end of each function
- after we leave SSA form. */
- static GTY (()) tree free_ssanames;
/* Version numbers with special meanings. We start allocating new version
numbers after the special ones. */
--- 57,62 ----
*************** replace_ssa_name_symbol (tree ssa_name,
*** 307,311 ****
SSA_NAME_VAR (ssa_name) = sym;
TREE_TYPE (ssa_name) = TREE_TYPE (sym);
}
-
- #include "gt-tree-ssanames.h"
--- 300,302 ----
Index: tree-vect-generic.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vect-generic.c,v
retrieving revision 2.4
diff -c -3 -p -r2.4 tree-vect-generic.c
*** tree-vect-generic.c 20 Jul 2005 01:18:28 -0000 2.4
--- tree-vect-generic.c 17 Aug 2005 09:34:13 -0000
*************** expand_vector_operations (void)
*** 489,495 ****
for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
{
expand_vector_operations_1 (&bsi);
! update_stmt_if_modified (bsi_stmt (bsi));
}
}
}
--- 489,496 ----
for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
{
expand_vector_operations_1 (&bsi);
! if (in_ssa_p)
! update_stmt_if_modified (bsi_stmt (bsi));
}
}
}