[tuples] Convert prefetching and related passes
Diego Novillo
dnovillo@google.com
Tue Mar 11 14:47:00 GMT 2008
On 03/09/08 15:43, Zdenek Dvorak wrote:
> Prefetching marks some assignment statements as nontemporal stores, I used one of
> the unused flags in gimple_statement_base for it, as just now there does
> not seem to be any other way how to add a flag to GIMPLE_ASSIGN
> statements.
There are three ways of adding flags:
- For pass-local flags (PLF) you can use one of the two PLFs bits, but
this is for markers that are generated and consumed by the one pass.
- If the marker needs to survive across optimizations or into RTL, then
what you did is correct. Grab an unused bitfield in
gimple_statement_base and add accessors to it.
- For statements that do not need the subcode field, you can add to the
GF_* masks like GIMPLE_CALL and GIMPLE_ASM do.
When we run out of flags in gimple_statement_base, there's two things we
can do:
- Take advantage of the 32bit hole we have in gimple_statement_base on
64 bit hosts. This would make the structure one word bigger on 32bit
hosts, though.
- Leave only the 6 most used markers in bitflags and move the rest to
pointer-sets or arrays indexed by SSA name (if possible).
> 1) allocate_phi_node failed if the vector in free_phinodes was empty,
> but not NULL.
This should be fixed now that we free the free_phinodes location when we
allocate. Does it still happen?
> 2) I have added two new functions (gimple_assign_rhs_code that returns
> the tree code of the rhs of an assignment -- it may differ from
> gimple_assign_subcode for SINGLE_RHS objects),
Actually, there is no reason to have gimple_assign_subcode now that you
added gimple_assign_rhs_code. For an assignment, the only correct
answer is what you implemented in gimple_assign_rhs_code, so
gimple_assign_subcode needs to disappear.
> gimple_assign_rhs2_or_null (that returns NULL for non-binary
> right-hand sides), that simplify the code on a few places a bit.
OK. For gimple_assign_rhs2_or_null, how about we make
gimple_assign_rhs2 behave like that by default?
If the caller blindly tries to get rhs2 and it's NULL, they're going to
find out one way or another, anyway. So, adding another accessor in
this case may not be worth the name pollution.
The same would apply for the other RHS accessors (when we add them).
> 3) I also went over all calls of gimple_assign_subcode and converted
> some of them to gimple_assign_rhs_code (there was one place where
> I am sure that it is necessary, and two or three where I was not
> sure, but it cannot harm). The uses of gimple_assign_subcode
> in tree-ssa-coalesce.c were just wrong and are replaced with
> gimple_assign_copy_p calls.
> 4) gimplification forgets to set the ssa name in the lhs of newly created
> assignment.
Thanks.
> * tree-ssa-loop-niter.c (chain_of_csts_start): Exclude memory loads.
> (get_val_for): Assert that the statement is an assignment.
> (derive_constant_upper_bound_assign): Use gimple_assign_rhs_code
> and gimple_assign_rhs2_or_null.
> * tree-ssa-loop-manip.c (create_iv, ip_normal_pos,
> standard_iv_increment_position, determine_exit_conditions,
> tree_transform_and_unroll_loop): Tuplify.
> * tree-scalar-evolution.c (interpret_expr): Fail for chrecs.
> (interpret_gimple_assign): Use gimple_assign_rhs_code and
> gimple_assign_rhs2_or_null.
> * tree-phinodes.c (allocate_phi_node): Test whether the queue
> is free using VEC_empty.
> * tree-gimple.c (gimple_assign_rhs_code): New function.
> * tree-gimple.h (gimple_assign_rhs_code): Declare.
> * tree-ssa-loop-ivopts.c (single_dom_exit): Enable.
> * gimple-dummy.c (compute_data_dependences_for_loop, dump_ddrs,
> free_data_refs, free_dependence_relations,
> gimple_duplicate_loop_to_header_edge, tree_ssa_prefetch_arrays,
> estimated_loop_iterations_int): Removed.
> * tree-ssa-loop-ivcanon.c (tree_num_loop_insns): Tuplify.
> * predict.c, tree-data-ref.c, tree-ssa-loop-prefetch.c: Tuplify.
> * tree-data-ref.h (struct data_reference, struct rdg_vertex): Change
> the type of stmt to gimple.
> (get_references_in_stmt, create_data_ref, rdg_vertex_for_stmt,
> stores_from_loop, remove_similar_memory_refs,
> have_similar_memory_accesses): Declaration changed.
> * gimple-iterator.c (gsi_insert_seq_on_edge_immediate): New.
> * gimple-pretty-print.c (dump_gimple_assign): Dump nontemporal
> move.
> * gimplify.c (gimplify_modify_expr): Set lhs of the assignment to
> the new SSA name.
> * tree-ssa-coalesce.c (build_ssa_conflict_graph,
> create_outofssa_var_map): Use gimple_assign_copy_p.
> * tree-predcom.c (mark_virtual_ops_for_renaming): Enable.
> * tree-inline.c (estimate_num_insns): Use gimple_assign_rhs_code.
> * tree-flow.h (mark_virtual_ops_for_renaming): Declaration changed.
> * gimple.h (struct gimple_statement_base): Change unused_4 flag
> to nontemporal_move flag.
> (gimple_assign_rhs2_or_null, gimple_assign_nontemporal_move_p,
> gimple_assign_set_nontemporal_move): New functions.
> (gsi_insert_seq_on_edge_immediate): Declare.
> * tree-cfg.c (verify_types_in_gimple_assign): Use
> gimple_assign_rhs_code.
> (gimple_lv_adjust_loop_header_phi, gimple_lv_add_condition_to_bb):
> Tuplify.
> (gimple_cfg_hooks): Enable lv_add_condition_to_bb and
> lv_adjust_loop_header_phi hooks.
> * passes.c (init_optimization_passes): Enable pass_profile,
> pass_check_data_deps and pass_loop_prefetch.
OK with the above changes. Could you update the wiki with the passes
that you've converted?
Thanks. Diego.
More information about the Gcc-patches
mailing list