diff options
author | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-05 09:25:37 +0000 |
---|---|---|
committer | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-05 09:25:37 +0000 |
commit | dec41e985c71854a2c59159966a63a2c3455b079 (patch) | |
tree | 5fe97f05e5fc6b7356f52252207207aa904b781f /gcc/cfgloopanal.c | |
parent | f7405bb8498bf3795c0caf032fdd247b33dddc5c (diff) | |
download | gcc-dec41e985c71854a2c59159966a63a2c3455b079.tar.gz |
* tree-ssa-loop-ivopts.c: New file.
* Makefile.in (tree-ssa-loop-ivopts.c): Add.
* cfgloop.h (target_avail_regs, target_res_regs, target_small_cost,
target_pres_cost, target_spill_cost): Declare.
* cfgloopanal.c (avail_regs, res_regs, small_cost, pres_cost,
spill_cost): Renamed to ...
(target_avail_regs, target_res_regs, target_small_cost,
target_pres_cost, target_spill_cost): ... and exported.
(init_set_costs, global_cost_for_size): Work with renamed variables.
* common.opt (flag_ivopts): New flag.
* expr.c (expand_expr_real_1): Handle SSA_NAME case. Handle
REF_ORIGINAL.
* gimplify.c (struct gimplify_ctx): Add into_ssa field.
(internal_get_tmp_var, gimplify_modify_expr, gimplify_expr): Support
generating SSA form.
(force_gimple_operand): New function.
* timevar.def (TV_TREE_LOOP_IVOPTS): New timevar.
* tree-cfg.c (stmt_bsi): New function.
* params.def (PARAM_IV_CONSIDER_ALL_CANDIDATES_BOUND,
PARAM_IV_MAX_CONSIDERED_USES): New.
* tree-flow.h (stmt_bsi, tree_ssa_iv_optimize, split_loop_exit_edge,
bsi_insert_on_edge_immediate_loop. standard_iv_increment_position,
ip_end_pos, ip_normal_pos, force_gimple_operand): Declare.
* tree-gimple.c (is_gimple_formal_tmp_var): Accept ssa names.
* tree-nested.c (build_addr): Export.
* tree-optimize.c (init_tree_optimization_passes): Add
pass_iv_optimize.
* tree-pass.h (pass_iv_optimize): Declare.
* tree-ssa-loop-im.c (for_each_index): Handle REALPART_EXPR and
IMAGPART_EXPR.
* tree-ssa-loop-manip.c (create_iv): Force the base to be acceptable
as a phi node argument.
(split_loop_exit_edge, bsi_insert_on_edge_immediate_loop,
ip_end_pos, ip_normal_pos, standard_iv_increment_position): New
functions.
* tree-ssa-loop-niter.c (zero_p, unsigned_type_for): Export.
* tree-ssa-loop.c (tree_ssa_loop_ivopts, gate_tree_ssa_loop_ivopts,
pass_iv_optimize): New pass.
* tree-ssa-operands.c (get_indirect_ref_operands): Handle REF_ORIGINAL.
* tree-ssanames.c (release_ssa_name): Allow calling with var = NULL.
* tree.c (build_int_cst_type, cst_and_fits_in_hwi): New functions.
* tree.h (REF_ORIGINAL): New macro.
(build_int_cst_type, unsigned_type_for, zero_p,
cst_and_fits_in_hwi, build_addr): Declare.
* doc/invoke.texi (-fivopts): Document.
(PARAM_IV_CONSIDER_ALL_CANDIDATES_BOUND,
PARAM_IV_MAX_CONSIDERED_USES): Document.
* doc/passes.texi: Document induction variable optimizations pass.
* gcc.dg/tree-ssa/loop-2.c: New test.
* gcc.dg/tree-ssa/loop-3.c: New test.
* gcc.dg/tree-ssa/loop-4.c: New test.
* gcc.dg/tree-ssa/loop-5.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87100 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgloopanal.c')
-rw-r--r-- | gcc/cfgloopanal.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c index 074574fc029..0a5179ea976 100644 --- a/gcc/cfgloopanal.c +++ b/gcc/cfgloopanal.c @@ -497,12 +497,12 @@ seq_cost (rtx seq) /* The properties of the target. */ -static unsigned avail_regs; /* Number of available registers. */ -static unsigned res_regs; /* Number of reserved registers. */ -static unsigned small_cost; /* The cost for register when there is a free one. */ -static unsigned pres_cost; /* The cost for register when there are not too many +unsigned target_avail_regs; /* Number of available registers. */ +unsigned target_res_regs; /* Number of reserved registers. */ +unsigned target_small_cost; /* The cost for register when there is a free one. */ +unsigned target_pres_cost; /* The cost for register when there are not too many free ones. */ -static unsigned spill_cost; /* The cost for register when we need to spill. */ +unsigned target_spill_cost; /* The cost for register when we need to spill. */ /* Initialize the constants for computing set costs. */ @@ -519,9 +519,9 @@ init_set_costs (void) for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) if (TEST_HARD_REG_BIT (reg_class_contents[GENERAL_REGS], i) && !fixed_regs[i]) - avail_regs++; + target_avail_regs++; - res_regs = 3; + target_res_regs = 3; /* These are really just heuristic values. */ @@ -529,15 +529,15 @@ init_set_costs (void) emit_move_insn (reg1, reg2); seq = get_insns (); end_sequence (); - small_cost = seq_cost (seq); - pres_cost = 2 * small_cost; + target_small_cost = seq_cost (seq); + target_pres_cost = 2 * target_small_cost; start_sequence (); emit_move_insn (mem, reg1); emit_move_insn (reg2, mem); seq = get_insns (); end_sequence (); - spill_cost = seq_cost (seq); + target_spill_cost = seq_cost (seq); } /* Calculates cost for having SIZE new loop global variables. REGS_USED is the @@ -550,14 +550,14 @@ global_cost_for_size (unsigned size, unsigned regs_used, unsigned n_uses) unsigned regs_needed = regs_used + size; unsigned cost = 0; - if (regs_needed + res_regs <= avail_regs) - cost += small_cost * size; - else if (regs_needed <= avail_regs) - cost += pres_cost * size; + if (regs_needed + target_res_regs <= target_avail_regs) + cost += target_small_cost * size; + else if (regs_needed <= target_avail_regs) + cost += target_pres_cost * size; else { - cost += pres_cost * size; - cost += spill_cost * n_uses * (regs_needed - avail_regs) / regs_needed; + cost += target_pres_cost * size; + cost += target_spill_cost * n_uses * (regs_needed - target_avail_regs) / regs_needed; } return cost; |