This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] expand from SSA form (1/2)


On Wed, Apr 22, 2009 at 6:42 PM, Michael Matz <matz@suse.de> wrote:
> On Wed, 22 Apr 2009, Michael Matz wrote:
>
>> I'll soon send a new version of the patch that fixes all problems and
>> testcases I encountered.
>
> Like so. ?This is the full patch, i.e. including the cleanups, but
> excluding the testsuite changes. ?It should incorporate all feedback.
> Compared to the last version it adds comments for new functions, fixes
> muflap2, and generally some other minor problems showing when I started
> testing Ada and a bug reported by Andrey.
>
> This patch (plus testsuite changes) was bootstrapped with Ada on
> x86_64-linux. ?There are no testsuite regressions:
> FAIL: gcc.dg/tree-prof/bb-reorg.c compilation, ?-fprofile-use -D_PROFILE_USE
> FAIL: gcc.dg/tree-prof/pr34999.c compilation, ?-fprofile-use -D_PROFILE_USE
> FAIL: gcc.target/i386/avx-vmovntdq-256-1.c (test for excess errors)
> FAIL: gcc.target/i386/avx-vmovntpd-256-1.c (test for excess errors)
> FAIL: gcc.target/i386/avx-vmovntps-256-1.c (test for excess errors)
> FAIL: libmudflap.c++/pass41-frag.cxx execution test
> FAIL: libmudflap.c++/pass41-frag.cxx (-static) execution test
> FAIL: libmudflap.c++/pass41-frag.cxx (-O2) execution test
> FAIL: libmudflap.c++/pass41-frag.cxx (-O3) execution test
>
> All of these happen without the patch too (known bugs, old binutils, and
> pass41-frag never seems to work anyway).
>
> I'd like to ask for approval for the series.
>
>
> Ciao,
> Michael.
> --
> ? ? ? ?* builtins.c (fold_builtin_next_arg): Handle SSA names.
> ? ? ? ?* tree-ssa-copyrename.c (rename_ssa_copies): Don't iterate
> ? ? ? ?beyond num_ssa_names, use ssa_name() directly.
> ? ? ? ?* tree-ssa-ter.c (free_temp_expr_table): Likewise.
> ? ? ? ?* tree-ssa-coalesce.c (create_outofssa_var_map): Likewise,
> ? ? ? ?mark only useful SSA names.
> ? ? ? ?(compare_pairs): Swap cost comparison.
> ? ? ? ?(coalesce_ssa_name): Don't use change_partition_var.
> ? ? ? ?* tree-nrv.c (struct nrv_data): Add modified member.
> ? ? ? ?(finalize_nrv_r): Set it.
> ? ? ? ?(tree_nrv): Use it to update statements.
> ? ? ? ?(pass_nrv): Require PROP_ssa.
> ? ? ? ?* tree-mudflap.c (create_referenced_var): New static helper.
> ? ? ? ?(mf_decl_cache_locals, mf_build_check_statement_for): Use it.
> ? ? ? ?(pass_mudflap_2): Require PROP_ssa, run ssa update at finish.
> ? ? ? ?* alias.c (find_base_decl): Handle SSA names.
> ? ? ? ?* emit-rtl (set_reg_attrs_for_parm): Make non-static.
> ? ? ? ?(component_ref_for_mem_expr): Don't leak SSA names into RTL.
> ? ? ? ?* rtl.h (set_reg_attrs_for_parm): Declare.
> ? ? ? ?* tree-optimize.c (pass_cleanup_cfg_post_optimizing): Rename
> ? ? ? ?to "optimized", remove unused locals at finish.
> ? ? ? ?(execute_free_datastructures): Make global, call
> ? ? ? ?delete_tree_cfg_annotations.
> ? ? ? ?(execute_free_cfg_annotations): Don't call
> ? ? ? ?delete_tree_cfg_annotations.
>
> ? ? ? ?* ssaexpand.h: New file.
> ? ? ? ?* expr.c (toplevel): Include ssaexpand.h.
> ? ? ? ?(expand_assignment): Handle SSA names the same as register
> ? ? ? ?variables.
> ? ? ? ?(expand_expr_real_1): Expand SSA names.
> ? ? ? ?* cfgexpand.c (toplevel): Include ssaexpand.h.
> ? ? ? ?(SA): New global variable.
> ? ? ? ?(gimple_cond_pred_to_tree): Fold TERed comparisons into predicates.
> ? ? ? ?(SSAVAR): New macro.
> ? ? ? ?(set_rtl): New helper function.
> ? ? ? ?(add_stack_var): Deal with SSA names, use set_rtl.
> ? ? ? ?(expand_one_stack_var_at): Likewise.
> ? ? ? ?(expand_one_stack_var): Deal with SSA names.
> ? ? ? ?(stack_var_size_cmp): Use code (SSA_NAME / DECL) as tie breaker
> ? ? ? ?before unique numbers.
> ? ? ? ?(expand_stack_vars): Use set_rtl.
> ? ? ? ?(expand_one_var): Accept SSA names, add asserts for them, feed them
> ? ? ? ?to above subroutines.
> ? ? ? ?(expand_used_vars): Expand all partitions (without default defs),
> ? ? ? ?then only the local decls (ignoring those expanded already).
> ? ? ? ?(expand_gimple_cond): Remove edges when jumpif() expands an
> ? ? ? ?unconditional jump.
> ? ? ? ?(expand_gimple_basic_block): Don't clear EDGE_EXECUTABLE here,
> ? ? ? ?or remove abnormal edges. ?Ignore insns setting the LHS of a TERed
> ? ? ? ?SSA name.
> ? ? ? ?(gimple_expand_cfg): Call into rewrite_out_of_ssa, initialize
> ? ? ? ?members of SA; deal with PARM_DECL partitions here; expand
> ? ? ? ?all PHI nodes, free tree datastructures and SA. ?Commit instructions
> ? ? ? ?on edges, clear EDGE_EXECUTABLE and remove abnormal edges here.
> ? ? ? ?(pass_expand): Require and destroy PROP_ssa, verify SSA form, flow
> ? ? ? ?info and statements at start, collect garbage at finish.
> ? ? ? ?* tree-ssa-live.h (struct _var_map): Remove partition_to_var member.
> ? ? ? ?(VAR_ANN_PARTITION) Remove.
> ? ? ? ?(change_partition_var): Don't declare.
> ? ? ? ?(partition_to_var): Always return SSA names.
> ? ? ? ?(var_to_partition): Only accept SSA names.
> ? ? ? ?(register_ssa_partition): Only check argument.
> ? ? ? ?* tree-ssa-live.c (init_var_map): Don't allocate partition_to_var
> ? ? ? ?member.
> ? ? ? ?(delete_var_map): Don't free it.
> ? ? ? ?(var_union): Only accept SSA names, simplify.
> ? ? ? ?(partition_view_init): Mark only useful SSA names as used.
> ? ? ? ?(partition_view_fini): Only deal with SSA names.
> ? ? ? ?(change_partition_var): Remove.
> ? ? ? ?(dump_var_map): Use ssa_name instead of partition_to_var member.
> ? ? ? ?* tree-ssa.c (delete_tree_ssa): Don't remove PHI nodes on RTL
> ? ? ? ?basic blocks.
> ? ? ? ?* tree-outof-ssa.c (toplevel): Include ssaexpand.h and expr.h.
> ? ? ? ?(struct _elim_graph): New member const_dests; nodes member vector of
> ? ? ? ?ints.
> ? ? ? ?(set_location_for_edge): New static helper.
> ? ? ? ?(create_temp): Remove.
> ? ? ? ?(insert_partition_copy_on_edge, insert_part_to_rtx_on_edge,
> ? ? ? ?insert_value_copy_on_edge, insert_rtx_to_part_on_edge): New
> ? ? ? ?functions.
> ? ? ? ?(new_elim_graph): Allocate const_dests member.
> ? ? ? ?(clean_elim_graph): Truncate const_dests member.
> ? ? ? ?(delete_elim_graph): Free const_dests member.
> ? ? ? ?(elim_graph_size): Adapt to new type of nodes member.
> ? ? ? ?(elim_graph_add_node): Likewise.
> ? ? ? ?(eliminate_name): Likewise.
> ? ? ? ?(eliminate_build): Don't take basic block argument, deal only with
> ? ? ? ?partition numbers, not variables.
> ? ? ? ?(get_temp_reg): New static helper.
> ? ? ? ?(elim_create): Use it, deal with RTL temporaries instead of trees.
> ? ? ? ?(eliminate_phi): Adjust all calls to new signature.
> ? ? ? ?(assign_vars, replace_use_variable, replace_def_variable): Remove.
> ? ? ? ?(rewrite_trees): Only do checking.
> ? ? ? ?(edge_leader, stmt_list, leader_has_match, leader_match): Remove.
> ? ? ? ?(same_stmt_list_p, identical_copies_p, identical_stmt_lists_p,
> ? ? ? ?init_analyze_edges_for_bb, fini_analyze_edges_for_bb,
> ? ? ? ?contains_tree_r, MAX_STMTS_IN_LATCH,
> ? ? ? ?process_single_block_loop_latch, analyze_edges_for_bb,
> ? ? ? ?perform_edge_inserts): Remove.
> ? ? ? ?(expand_phi_nodes): New global function.
> ? ? ? ?(remove_ssa_form): Take ssaexpand parameter. ?Don't call removed
> ? ? ? ?functions, initialize new parameter, remember partitions having a
> ? ? ? ?default def.
> ? ? ? ?(finish_out_of_ssa): New global function.
> ? ? ? ?(rewrite_out_of_ssa): Make global. ?Adjust call to remove_ssa_form,
> ? ? ? ?don't reset in_ssa_p here.
> ? ? ? ?(pass_del_ssa): Remove.
> ? ? ? ?* tree-flow.h (struct var_ann_d): Remove out_of_ssa_tag and
> ? ? ? ?partition members.
> ? ? ? ?(execute_free_datastructures): Declare.
> ? ? ? ?* Makefile.in (SSAEXPAND_H): New variable.
> ? ? ? ?(tree-outof-ssa.o, expr.o, cfgexpand.o): Depend on SSAEXPAND_H.
> ? ? ? ?* basic-block.h (commit_one_edge_insertion): Declare.
> ? ? ? ?* passes.c (init_optimization_passes): Move pass_nrv and
> ? ? ? ?pass_mudflap2 before pass_cleanup_cfg_post_optimizing, remove
> ? ? ? ?pass_del_ssa, pass_free_datastructures, pass_free_cfg_annotations.
> ? ? ? ?* cfgrtl.c (commit_one_edge_insertion): Make global, don't declare.
> ? ? ? ?(redirect_branch_edge): Deal with super block when expanding, split
> ? ? ? ?out jump patching itself into ...
> ? ? ? ?(patch_jump_insn): ... here, new static helper.

Some comments inline...

> Index: tree-ssa-copyrename.c
> ===================================================================
> *** tree-ssa-copyrename.c ? ? ? (revision 146576)
> --- tree-ssa-copyrename.c ? ? ? (working copy)
> *************** rename_ssa_copies (void)
> *** 291,297 ****
> ? ?else
> ? ? ?debug = NULL;
>
> ! ? map = init_var_map (num_ssa_names + 1);
>
> ? ?FOR_EACH_BB (bb)
> ? ? ?{
> --- 291,297 ----
> ? ?else
> ? ? ?debug = NULL;
>
> ! ? map = init_var_map (num_ssa_names);
>
> ? ?FOR_EACH_BB (bb)
> ? ? ?{
> *************** rename_ssa_copies (void)
> *** 339,350 ****
> ? ?/* Now one more pass to make all elements of a partition share the same
> ? ? ? root variable. ?*/
>
> ! ? for (x = 1; x <= num_ssa_names; x++)
> ? ? ?{
> ? ? ? ?part_var = partition_to_var (map, x);
> ? ? ? ?if (!part_var)
> ? ? ? ? ?continue;
> ! ? ? ? var = map->partition_to_var[x];
> ? ? ? ?if (debug)
> ? ? ? ? ?{
> ? ? ? ? ?if (SSA_NAME_VAR (var) != SSA_NAME_VAR (part_var))
> --- 339,350 ----
> ? ?/* Now one more pass to make all elements of a partition share the same
> ? ? ? root variable. ?*/
>
> ! ? for (x = 1; x < num_ssa_names; x++)
> ? ? ?{
> ? ? ? ?part_var = partition_to_var (map, x);
> ? ? ? ?if (!part_var)
> ? ? ? ? ?continue;
> ! ? ? ? var = ssa_name (x);
> ? ? ? ?if (debug)
> ? ? ? ? ?{
> ? ? ? ? ?if (SSA_NAME_VAR (var) != SSA_NAME_VAR (part_var))

This piece is ok as obvious.  Please commit it separately.


> Index: cfgexpand.c
> ===================================================================
> *** cfgexpand.c (revision 146576)
> --- cfgexpand.c (working copy)
> *************** along with GCC; see the file COPYING3.
> *** 42,49 ****
> --- 42,54 ----
> ?#include "tree-inline.h"
> ?#include "value-prof.h"
> ?#include "target.h"
> + #include "ssaexpand.h"
>
>
> + /* This variable holds information helping the rewriting of SSA trees
> + ? ?into RTL. ?*/
> + struct ssaexpand SA;
> +
> ?/* Return an expression tree corresponding to the RHS of GIMPLE
> ? ? statement STMT. ?*/
>
> *************** gimple_assign_rhs_to_tree (gimple stmt)
> *** 78,85 ****
> ?static tree
> ?gimple_cond_pred_to_tree (gimple stmt)
> ?{
> ? ?return build2 (gimple_cond_code (stmt), boolean_type_node,
> ! ? ? ? ? ? ? ? ?gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
> ?}
>
> ?/* Helper for gimple_to_tree. ?Set EXPR_LOCATION for every expression
> --- 83,104 ----
> ?static tree
> ?gimple_cond_pred_to_tree (gimple stmt)
> ?{
> + ? /* We're sometimes presented with such code:
> + ? ? ? ?D.123_1 = x < y;
> + ? ? ? ?if (D.123_1 != 0)
> + ? ? ? ? ?...
> + ? ? ?This would expand to two comparisons which then later might
> + ? ? ?be cleaned up by combine. ?But some pattern matchers like if-conversion
> + ? ? ?work better when there's only one compare, so make up for this
> + ? ? ?here as special exception if TER would have made the same change. ?*/
> + ? tree lhs = gimple_cond_lhs (stmt);
> + ? if (SA.values
> + ? ? ? && TREE_CODE (lhs) == SSA_NAME
> + ? ? ? && SA.values[SSA_NAME_VERSION (lhs)])
> + ? ? lhs = gimple_assign_rhs_to_tree (SA.values[SSA_NAME_VERSION (lhs)]);

Do we really need the SA.values array here?  It seems that
a bitmap would be enough, as the definition should be still
reachable via SSA_NAME_DEF_STMT (lhs).  (Thanks Paolo
for noticing this)

> +
> ? ?return build2 (gimple_cond_code (stmt), boolean_type_node,
> ! ? ? ? ? ? ? ? ?lhs, gimple_cond_rhs (stmt));
> ?}
>
> ?/* Helper for gimple_to_tree. ?Set EXPR_LOCATION for every expression
> *************** failed:
> *** 423,428 ****
> --- 442,464 ----
> ?#define STACK_ALIGNMENT_NEEDED 1
> ?#endif
>
> + #define SSAVAR(x) (TREE_CODE (x) == SSA_NAME ? SSA_NAME_VAR (x) : x)

This should be in some public place, ideally with a more
sound name.  Any ideas?

> + /* Associate declaration T with storage space X. ?If T is no
> + ? ?SSA name this is exactly SET_DECL_RTL, otherwise make the
> + ? ?partition of T associated with X. ?*/
> + static inline void
> + set_rtl (tree t, rtx x)
> + {
> + ? if (TREE_CODE (t) == SSA_NAME)
> + ? ? {
> + ? ? ? SA.partition_to_pseudo[var_to_partition (SA.map, t)] = x;
> + ? ? ? if (x && !MEM_P (x))
> + ? ? ? set_reg_attrs_for_decl_rtl (SSA_NAME_VAR (t), x);
> + ? ? }
> + ? else
> + ? ? SET_DECL_RTL (t, x);
> + }
>
> ?/* This structure holds data relevant to one variable that will be
> ? ? placed in a stack slot. ?*/
> *************** add_stack_var (tree decl)
> *** 561,575 ****
> ? ? ?}
> ? ?stack_vars[stack_vars_num].decl = decl;
> ? ?stack_vars[stack_vars_num].offset = 0;
> ! ? stack_vars[stack_vars_num].size = tree_low_cst (DECL_SIZE_UNIT (decl), 1);
> ! ? stack_vars[stack_vars_num].alignb = get_decl_align_unit (decl);
>
> ? ?/* All variables are initially in their own partition. ?*/
> ? ?stack_vars[stack_vars_num].representative = stack_vars_num;
> ? ?stack_vars[stack_vars_num].next = EOC;
>
> ? ?/* Ensure that this decl doesn't get put onto the list twice. ?*/
> ! ? SET_DECL_RTL (decl, pc_rtx);
>
> ? ?stack_vars_num++;
> ?}
> --- 597,611 ----
> ? ? ?}
> ? ?stack_vars[stack_vars_num].decl = decl;
> ? ?stack_vars[stack_vars_num].offset = 0;
> ! ? stack_vars[stack_vars_num].size = tree_low_cst (DECL_SIZE_UNIT (SSAVAR (decl)), 1);
> ! ? stack_vars[stack_vars_num].alignb = get_decl_align_unit (SSAVAR (decl));
>
> ? ?/* All variables are initially in their own partition. ?*/
> ? ?stack_vars[stack_vars_num].representative = stack_vars_num;
> ? ?stack_vars[stack_vars_num].next = EOC;
>
> ? ?/* Ensure that this decl doesn't get put onto the list twice. ?*/
> ! ? set_rtl (decl, pc_rtx);
>
> ? ?stack_vars_num++;
> ?}
> *************** add_alias_set_conflicts (void)
> *** 688,709 ****
> ?}
>
> ?/* A subroutine of partition_stack_vars. ?A comparison function for qsort,
> ! ? ?sorting an array of indices by the size of the object. ?*/
>
> ?static int
> ?stack_var_size_cmp (const void *a, const void *b)
> ?{
> ? ?HOST_WIDE_INT sa = stack_vars[*(const size_t *)a].size;
> ? ?HOST_WIDE_INT sb = stack_vars[*(const size_t *)b].size;
> ! ? unsigned int uida = DECL_UID (stack_vars[*(const size_t *)a].decl);
> ! ? unsigned int uidb = DECL_UID (stack_vars[*(const size_t *)b].decl);
>
> ? ?if (sa < sb)
> ? ? ?return -1;
> ? ?if (sa > sb)
> ? ? ?return 1;
> ! ? /* For stack variables of the same size use the uid of the decl
> ! ? ? ?to make the sort stable. ?*/
> ? ?if (uida < uidb)
> ? ? ?return -1;
> ? ?if (uida > uidb)
> --- 724,760 ----
> ?}
>
> ?/* A subroutine of partition_stack_vars. ?A comparison function for qsort,
> ! ? ?sorting an array of indices by the size and type of the object. ?*/
>
> ?static int
> ?stack_var_size_cmp (const void *a, const void *b)
> ?{
> ? ?HOST_WIDE_INT sa = stack_vars[*(const size_t *)a].size;
> ? ?HOST_WIDE_INT sb = stack_vars[*(const size_t *)b].size;
> ! ? tree decla, declb;
> ! ? unsigned int uida, uidb;
>
> ? ?if (sa < sb)
> ? ? ?return -1;
> ? ?if (sa > sb)
> ? ? ?return 1;
> ! ? decla = stack_vars[*(const size_t *)a].decl;
> ! ? declb = stack_vars[*(const size_t *)b].decl;
> ! ? /* For stack variables of the same size use and id of the decls
> ! ? ? ?to make the sort stable. ?Two SSA names are compared by their
> ! ? ? ?version, SSA names come before non-SSA names, and two normal
> ! ? ? ?decls are compared by their DECL_UID. ?*/
> ! ? if (TREE_CODE (decla) == SSA_NAME)
> ! ? ? {
> ! ? ? ? if (TREE_CODE (declb) == SSA_NAME)
> ! ? ? ? uida = SSA_NAME_VERSION (decla), uidb = SSA_NAME_VERSION (declb);
> ! ? ? ? else
> ! ? ? ? return -1;
> ! ? ? }
> ! ? else if (TREE_CODE (declb) == SSA_NAME)
> ! ? ? return 1;
> ! ? else
> ! ? ? uida = DECL_UID (decla), uidb = DECL_UID (declb);
> ? ?if (uida < uidb)
> ? ? ?return -1;
> ? ?if (uida > uidb)
> *************** expand_one_stack_var_at (tree decl, HOST
> *** 874,894 ****
> ? ?gcc_assert (offset == trunc_int_for_mode (offset, Pmode));
>
> ? ?x = plus_constant (virtual_stack_vars_rtx, offset);
> ! ? x = gen_rtx_MEM (DECL_MODE (decl), x);
>
> ! ? /* Set alignment we actually gave this decl. ?*/
> ! ? offset -= frame_phase;
> ! ? align = offset & -offset;
> ! ? align *= BITS_PER_UNIT;
> ! ? if (align == 0)
> ! ? ? align = STACK_BOUNDARY;
> ! ? else if (align > MAX_SUPPORTED_STACK_ALIGNMENT)
> ! ? ? align = MAX_SUPPORTED_STACK_ALIGNMENT;
> ! ? DECL_ALIGN (decl) = align;
> ! ? DECL_USER_ALIGN (decl) = 0;
>
> ! ? set_mem_attributes (x, decl, true);
> ! ? SET_DECL_RTL (decl, x);
> ?}
>
> ?/* A subroutine of expand_used_vars. ?Give each partition representative
> --- 925,951 ----
> ? ?gcc_assert (offset == trunc_int_for_mode (offset, Pmode));
>
> ? ?x = plus_constant (virtual_stack_vars_rtx, offset);
> ! ? x = gen_rtx_MEM (DECL_MODE (SSAVAR (decl)), x);
>
> ! ? if (TREE_CODE (decl) != SSA_NAME)
> ! ? ? {
> ! ? ? ? /* Set alignment we actually gave this decl if it isn't an SSA name.
> ! ? ? ? ? ?If it is we generate stack slots only accidentally so it isn't as
> ! ? ? ? ?important, we'll simply use the alignment that is already set. ?*/
> ! ? ? ? offset -= frame_phase;
> ! ? ? ? align = offset & -offset;
> ! ? ? ? align *= BITS_PER_UNIT;
> ! ? ? ? if (align == 0)
> ! ? ? ? align = STACK_BOUNDARY;
> ! ? ? ? else if (align > MAX_SUPPORTED_STACK_ALIGNMENT)
> ! ? ? ? align = MAX_SUPPORTED_STACK_ALIGNMENT;
>
> ! ? ? ? DECL_ALIGN (decl) = align;
> ! ? ? ? DECL_USER_ALIGN (decl) = 0;
> ! ? ? }
> !
> ! ? set_mem_attributes (x, SSAVAR (decl), true);
> ! ? set_rtl (decl, x);
> ?}
>
> ?/* A subroutine of expand_used_vars. ?Give each partition representative
> *************** expand_stack_vars (bool (*pred) (tree))
> *** 912,918 ****
>
> ? ? ? ?/* Skip variables that have already had rtl assigned. ?See also
> ? ? ? ? add_stack_var where we perpetrate this pc_rtx hack. ?*/
> ! ? ? ? if (DECL_RTL (stack_vars[i].decl) != pc_rtx)
> ? ? ? ?continue;
>
> ? ? ? ?/* Check the predicate to see whether this variable should be
> --- 969,977 ----
>
> ? ? ? ?/* Skip variables that have already had rtl assigned. ?See also
> ? ? ? ? add_stack_var where we perpetrate this pc_rtx hack. ?*/
> ! ? ? ? if ((TREE_CODE (stack_vars[i].decl) == SSA_NAME
> ! ? ? ? ? ?? SA.partition_to_pseudo[var_to_partition (SA.map, stack_vars[i].decl)]
> ! ? ? ? ? ?: DECL_RTL (stack_vars[i].decl)) != pc_rtx)
> ? ? ? ?continue;
>
> ? ? ? ?/* Check the predicate to see whether this variable should be
> *************** account_stack_vars (void)
> *** 951,957 ****
>
> ? ? ? ?size += stack_vars[i].size;
> ? ? ? ?for (j = i; j != EOC; j = stack_vars[j].next)
> ! ? ? ? SET_DECL_RTL (stack_vars[j].decl, NULL);
> ? ? ?}
> ? ?return size;
> ?}
> --- 1010,1016 ----
>
> ? ? ? ?size += stack_vars[i].size;
> ? ? ? ?for (j = i; j != EOC; j = stack_vars[j].next)
> ! ? ? ? set_rtl (stack_vars[j].decl, NULL);
> ? ? ?}
> ? ?return size;
> ?}
> *************** expand_one_stack_var (tree var)
> *** 964,971 ****
> ?{
> ? ?HOST_WIDE_INT size, offset, align;
>
> ! ? size = tree_low_cst (DECL_SIZE_UNIT (var), 1);
> ! ? align = get_decl_align_unit (var);
> ? ?offset = alloc_stack_frame_space (size, align);
>
> ? ?expand_one_stack_var_at (var, offset);
> --- 1023,1030 ----
> ?{
> ? ?HOST_WIDE_INT size, offset, align;
>
> ! ? size = tree_low_cst (DECL_SIZE_UNIT (SSAVAR (var)), 1);
> ! ? align = get_decl_align_unit (SSAVAR (var));
> ? ?offset = alloc_stack_frame_space (size, align);
>
> ? ?expand_one_stack_var_at (var, offset);
> *************** expand_one_hard_reg_var (tree var)
> *** 986,1005 ****
> ?static void
> ?expand_one_register_var (tree var)
> ?{
> ! ? tree type = TREE_TYPE (var);
> ? ?int unsignedp = TYPE_UNSIGNED (type);
> ? ?enum machine_mode reg_mode
> ! ? ? = promote_mode (type, DECL_MODE (var), &unsignedp, 0);
> ? ?rtx x = gen_reg_rtx (reg_mode);
>
> ! ? SET_DECL_RTL (var, x);
>
> ? ?/* Note if the object is a user variable. ?*/
> ! ? if (!DECL_ARTIFICIAL (var))
> ! ? ? ? mark_user_reg (x);
>
> ? ?if (POINTER_TYPE_P (type))
> ! ? ? mark_reg_pointer (x, TYPE_ALIGN (TREE_TYPE (TREE_TYPE (var))));
> ?}
>
> ?/* A subroutine of expand_one_var. ?Called to assign rtl to a VAR_DECL that
> --- 1045,1065 ----
> ?static void
> ?expand_one_register_var (tree var)
> ?{


> *************** struct rtl_opt_pass pass_expand =
> *** 2471,2480 ****
> ? ?0, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* static_pass_number */
> ? ?TV_EXPAND, ? ? ? ? ? ? ? ? ? ? ? ? ?/* tv_id */
> ? ?/* ??? If TER is enabled, we actually receive GENERIC. ?*/
> ! ? PROP_gimple_leh | PROP_cfg, ? ? ? ? ? /* properties_required */
> ? ?PROP_rtl, ? ? ? ? ? ? ? ? ? ? ? ? ? ? /* properties_provided */
> ! ? PROP_trees, ? ? ? ? ? ? ? ? ? ? ? ? /* properties_destroyed */
> ! ? 0, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* todo_flags_start */
> ! ? TODO_dump_func, ? ? ? ? ? ? ? ? ? ? ? /* todo_flags_finish */
> ? }
> ?};
> --- 2644,2655 ----
> ? ?0, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* static_pass_number */
> ? ?TV_EXPAND, ? ? ? ? ? ? ? ? ? ? ? ? ?/* tv_id */
> ? ?/* ??? If TER is enabled, we actually receive GENERIC. ?*/

This is no longer true ;)

> ! ? PROP_ssa | PROP_gimple_leh | PROP_cfg, ? ? ? ? ? /* properties_required */
> ? ?PROP_rtl, ? ? ? ? ? ? ? ? ? ? ? ? ? ? /* properties_provided */
> ! ? PROP_ssa | PROP_trees, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* properties_destroyed */
> ! ? TODO_verify_ssa | TODO_verify_flow
> ! ? ? | TODO_verify_stmts, ? ? ? ? ? ? ?/* todo_flags_start */
> ! ? TODO_dump_func
> ! ? | TODO_ggc_collect ? ? ? ? ? ? ? ? ?/* todo_flags_finish */
> ? }
> ?};


> Index: tree-mudflap.c
> ===================================================================
> *** tree-mudflap.c ? ? ?(revision 146576)
> --- tree-mudflap.c ? ? ?(working copy)
> *************** execute_mudflap_function_ops (void)
> *** 447,452 ****
> --- 447,465 ----
> ? ?return 0;
> ?}
>
> + /* Construct a new temporary variable with TYPE
> + ? ?as type and PREFIX as name prefix, add it to referenced vars
> + ? ?and mark it for renaming. ?*/
> +
> + static tree
> + create_referenced_var (tree type, const char *prefix)
> + {
> + ? tree var = create_tmp_var (type, prefix);
> + ? add_referenced_var (var);
> + ? mark_sym_for_renaming (var);
> + ? return var;
> + }

This is exactly the same as make_rename_temp () from tree-dfa.c,
so use that.

> ?/* Create and initialize local shadow variables for the lookup cache
> ? ? globals. ?Put their decls in the *_l globals for use by
> ? ? mf_build_check_statement_for. ?*/
> *************** mf_decl_cache_locals (void)
> *** 459,469 ****
>
> ? ?/* Build the cache vars. ?*/
> ? ?mf_cache_shift_decl_l
> ! ? ? = mf_mark (create_tmp_var (TREE_TYPE (mf_cache_shift_decl),
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "__mf_lookup_shift_l"));
>
> ? ?mf_cache_mask_decl_l
> ! ? ? = mf_mark (create_tmp_var (TREE_TYPE (mf_cache_mask_decl),
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "__mf_lookup_mask_l"));
>
> ? ?/* Build initialization nodes for the cache vars. ?We just load the
> --- 472,482 ----
>
> ? ?/* Build the cache vars. ?*/
> ? ?mf_cache_shift_decl_l
> ! ? ? = mf_mark (create_referenced_var (TREE_TYPE (mf_cache_shift_decl),
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "__mf_lookup_shift_l"));
>
> ? ?mf_cache_mask_decl_l
> ! ? ? = mf_mark (create_referenced_var (TREE_TYPE (mf_cache_mask_decl),
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "__mf_lookup_mask_l"));
>
> ? ?/* Build initialization nodes for the cache vars. ?We just load the
> *************** mf_build_check_statement_for (tree base,
> *** 546,554 ****
> ? ? ?}
>
> ? ?/* Build our local variables. ?*/
> ! ? mf_elem = create_tmp_var (mf_cache_structptr_type, "__mf_elem");
> ! ? mf_base = create_tmp_var (mf_uintptr_type, "__mf_base");
> ! ? mf_limit = create_tmp_var (mf_uintptr_type, "__mf_limit");
>
> ? ?/* Build: __mf_base = (uintptr_t) <base address expression>. ?*/
> ? ?seq = gimple_seq_alloc ();
> --- 559,567 ----
> ? ? ?}
>
> ? ?/* Build our local variables. ?*/
> ! ? mf_elem = create_referenced_var (mf_cache_structptr_type, "__mf_elem");
> ! ? mf_base = create_referenced_var (mf_uintptr_type, "__mf_base");
> ! ? mf_limit = create_referenced_var (mf_uintptr_type, "__mf_limit");
>
> ? ?/* Build: __mf_base = (uintptr_t) <base address expression>. ?*/
> ? ?seq = gimple_seq_alloc ();
> *************** mf_build_check_statement_for (tree base,
> *** 627,633 ****
> ? ?t = build2 (TRUTH_OR_EXPR, boolean_type_node, t, u);
> ? ?t = force_gimple_operand (t, &stmts, false, NULL_TREE);
> ? ?gimple_seq_add_seq (&seq, stmts);
> ! ? cond = create_tmp_var (boolean_type_node, "__mf_unlikely_cond");
> ? ?g = gimple_build_assign ?(cond, t);
> ? ?gimple_set_location (g, location);
> ? ?gimple_seq_add_stmt (&seq, g);
> --- 640,646 ----
> ? ?t = build2 (TRUTH_OR_EXPR, boolean_type_node, t, u);
> ? ?t = force_gimple_operand (t, &stmts, false, NULL_TREE);
> ? ?gimple_seq_add_seq (&seq, stmts);
> ! ? cond = create_referenced_var (boolean_type_node, "__mf_unlikely_cond");
> ? ?g = gimple_build_assign ?(cond, t);
> ? ?gimple_set_location (g, location);
> ? ?gimple_seq_add_stmt (&seq, g);
> *************** struct gimple_opt_pass pass_mudflap_2 =
> *** 1366,1377 ****
> ? ?NULL, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? /* next */
> ? ?0, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* static_pass_number */
> ? ?TV_NONE, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* tv_id */
> ! ? PROP_gimple_leh, ? ? ? ? ? ? ? ? ? ? ?/* properties_required */
> ? ?0, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* properties_provided */
> ? ?0, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* properties_destroyed */
> ? ?0, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* todo_flags_start */
> ? ?TODO_verify_flow | TODO_verify_stmts
> ! ? | TODO_dump_func ? ? ? ? ? ? ? ? ? ? ?/* todo_flags_finish */
> ? }
> ?};
>
> --- 1379,1390 ----
> ? ?NULL, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? /* next */
> ? ?0, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* static_pass_number */
> ? ?TV_NONE, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* tv_id */
> ! ? PROP_ssa | PROP_cfg | PROP_gimple_leh,/* properties_required */
> ? ?0, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* properties_provided */
> ? ?0, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* properties_destroyed */
> ? ?0, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* todo_flags_start */
> ? ?TODO_verify_flow | TODO_verify_stmts
> ! ? | TODO_dump_func | TODO_update_ssa ? ?/* todo_flags_finish */
> ? }
> ?};
>
> Index: tree-ssa-ter.c
> ===================================================================
> *** tree-ssa-ter.c ? ? ?(revision 146576)
> --- tree-ssa-ter.c ? ? ?(working copy)
> *************** free_temp_expr_table (temp_expr_table_p
> *** 225,231 ****
> ? ?unsigned x;
> ? ?for (x = 0; x <= num_var_partitions (t->map); x++)
> ? ? ?gcc_assert (!t->kill_list[x]);
> ! ? for (x = 0; x < num_ssa_names + 1; x++)
> ? ? ?{
> ? ? ? ?gcc_assert (t->expr_decl_uids[x] == NULL);
> ? ? ? ?gcc_assert (t->partition_dependencies[x] == NULL);
> --- 225,231 ----
> ? ?unsigned x;
> ? ?for (x = 0; x <= num_var_partitions (t->map); x++)
> ? ? ?gcc_assert (!t->kill_list[x]);
> ! ? for (x = 0; x < num_ssa_names; x++)
> ? ? ?{
> ? ? ? ?gcc_assert (t->expr_decl_uids[x] == NULL);
> ? ? ? ?gcc_assert (t->partition_dependencies[x] == NULL);

Obvious, commit with the other similar piece separately.


> Index: tree-ssa.c
> ===================================================================
> *** tree-ssa.c ?(revision 146576)
> --- tree-ssa.c ?(working copy)
> *************** delete_tree_ssa (void)
> *** 844,850 ****
>
> ? ? ? ? ?gimple_set_modified (stmt, true);
> ? ? ? ?}
> ! ? ? ? set_phi_nodes (bb, NULL);
> ? ? ?}
>
> ? ?/* Remove annotations from every referenced local variable. ?*/
> --- 844,851 ----
>
> ? ? ? ? ?gimple_set_modified (stmt, true);
> ? ? ? ?}
> ! ? ? ? if (!(bb->flags & BB_RTL))
> ! ? ? ? set_phi_nodes (bb, NULL);
> ? ? ?}
>
> ? ?/* Remove annotations from every referenced local variable. ?*/
> Index: rtl.h
> ===================================================================
> *** rtl.h ? ? ? (revision 146576)
> --- rtl.h ? ? ? (working copy)
> *************** extern rtx gen_int_mode (HOST_WIDE_INT,
> *** 1494,1499 ****
> --- 1494,1500 ----
> ?extern rtx emit_copy_of_insn_after (rtx, rtx);
> ?extern void set_reg_attrs_from_value (rtx, rtx);
> ?extern void set_reg_attrs_for_parm (rtx, rtx);
> + extern void set_reg_attrs_for_decl_rtl (tree t, rtx x);
> ?extern void adjust_reg_mode (rtx, enum machine_mode);
> ?extern int mem_expr_equal_p (const_tree, const_tree);
>
> Index: tree-optimize.c
> ===================================================================
> *** tree-optimize.c ? ? (revision 146576)
> --- tree-optimize.c ? ? (working copy)
> *************** struct gimple_opt_pass pass_cleanup_cfg_
> *** 201,207 ****
> ?{
> ? {
> ? ?GIMPLE_PASS,
> ! ? "final_cleanup", ? ? ? ? ? ? ? ? ? ?/* name */
> ? ?NULL, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? /* gate */
> ? ?execute_cleanup_cfg_post_optimizing, ? ? ? ?/* execute */
> ? ?NULL, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? /* sub */
> --- 201,207 ----
> ?{
> ? {
> ? ?GIMPLE_PASS,
> ! ? "optimized", ? ? ? ? ? ? ? ? ? ? ? ?/* name */
> ? ?NULL, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? /* gate */
> ? ?execute_cleanup_cfg_post_optimizing, ? ? ? ?/* execute */
> ? ?NULL, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? /* sub */
> *************** struct gimple_opt_pass pass_cleanup_cfg_
> *** 213,225 ****
> ? ?0, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* properties_destroyed */
> ? ?0, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* todo_flags_start */
> ? ?TODO_dump_func ? ? ? ? ? ? ? ? ? ? ?/* todo_flags_finish */
> ? }
> ?};
>
> ?/* Pass: do the actions required to finish with tree-ssa optimization
> ? ? passes. ?*/
>
> ! static unsigned int
> ?execute_free_datastructures (void)
> ?{
> ? ?free_dominance_info (CDI_DOMINATORS);
> --- 213,226 ----
> ? ?0, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* properties_destroyed */
> ? ?0, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* todo_flags_start */
> ? ?TODO_dump_func ? ? ? ? ? ? ? ? ? ? ?/* todo_flags_finish */
> + ? ? | TODO_remove_unused_locals
> ? }
> ?};
>
> ?/* Pass: do the actions required to finish with tree-ssa optimization
> ? ? passes. ?*/
>
> ! unsigned int
> ?execute_free_datastructures (void)
> ?{
> ? ?free_dominance_info (CDI_DOMINATORS);
> *************** execute_free_datastructures (void)
> *** 228,233 ****
> --- 229,238 ----
> ? ?/* Remove the ssa structures. ?*/
> ? ?if (cfun->gimple_df)
> ? ? ?delete_tree_ssa ();
> +
> + ? /* And get rid of annotations we no longer need. ?*/
> + ? delete_tree_cfg_annotations ();
> +
> ? ?return 0;
> ?}
>
> *************** struct gimple_opt_pass pass_free_datastr
> *** 254,262 ****
> ?static unsigned int
> ?execute_free_cfg_annotations (void)
> ?{
> - ? /* And get rid of annotations we no longer need. ?*/
> - ? delete_tree_cfg_annotations ();
> -
> ? ?return 0;
> ?}

It looks like the pass referencing this is now dead.  Please remove
this function and the pass structure.

> [Message clipped]

bah ... ;)  Other half in next mail.

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]