summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorbonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4>2009-02-25 18:12:29 +0000
committerbonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4>2009-02-25 18:12:29 +0000
commit1e176869cd26ef28c4a51cb6fea1b2bdf4efb12f (patch)
treec11ea245aed067520c5c29a56b9929cdd2cb3bae /gcc
parent28efe441f0e1c06790f306c158ccc2c0e0c2f1bd (diff)
downloadgcc-1e176869cd26ef28c4a51cb6fea1b2bdf4efb12f.tar.gz
2009-02-25 Paolo Bonzini <bonzini@gnu.org>
* regmove.c (regmove_optimize): Conform to struct rtl_opt_pass execute function prototype. Get f and nregs from max_reg_num and get_insns. Remove the first backward pass as it's dead, guard the forward pass by flag_expensive_optimizations. (rest_of_handle_regmove): Delete. (pass_regmove): Replace it with regmove_optimize. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@144429 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/regmove.c51
2 files changed, 24 insertions, 36 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2aa1030c022..2b02471d1bd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2009-02-25 Paolo Bonzini <bonzini@gnu.org>
+
+ * regmove.c (regmove_optimize): Conform to struct rtl_opt_pass
+ execute function prototype. Get f and nregs from max_reg_num
+ and get_insns. Remove the first backward pass as it's dead,
+ guard the forward pass by flag_expensive_optimizations.
+ (rest_of_handle_regmove): Delete.
+ (pass_regmove): Replace it with regmove_optimize.
+
2009-02-25 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/39259
diff --git a/gcc/regmove.c b/gcc/regmove.c
index 9342cade624..8ce0ea00da7 100644
--- a/gcc/regmove.c
+++ b/gcc/regmove.c
@@ -882,25 +882,21 @@ fixup_match_2 (rtx insn, rtx dst, rtx src, rtx offset)
return 0;
}
-/* Main entry for the register move optimization.
- F is the first instruction.
- NREGS is one plus the highest pseudo-reg number used in the instruction.
- REGMOVE_DUMP_FILE is a stream for output of a trace of actions taken
- (or 0 if none should be output). */
+/* Main entry for the register move optimization. */
-static void
-regmove_optimize (rtx f, int nregs)
+static unsigned int
+regmove_optimize (void)
{
rtx insn;
struct match match;
- int pass;
int i;
rtx copy_src, copy_dst;
+ int nregs = max_reg_num ();
/* ??? Hack. Regmove doesn't examine the CFG, and gets mightily
confused by non-call exceptions ending blocks. */
if (flag_non_call_exceptions)
- return;
+ return 0;
df_note_add_problem ();
df_analyze ();
@@ -912,35 +908,26 @@ regmove_optimize (rtx f, int nregs)
for (i = nregs; --i >= 0; )
regno_src_regno[i] = -1;
- /* A forward/backward pass. Replace output operands with input operands. */
+ /* A forward pass. Replace output operands with input operands. */
- for (pass = 0; pass <= 2; pass++)
+ if (flag_expensive_optimizations)
{
- if (! flag_regmove && pass >= flag_expensive_optimizations)
- goto done;
-
if (dump_file)
- fprintf (dump_file, "Starting %s pass...\n",
- pass ? "backward" : "forward");
+ fprintf (dump_file, "Starting forward pass...\n");
- for (insn = pass ? get_last_insn () : f; insn;
- insn = pass ? PREV_INSN (insn) : NEXT_INSN (insn))
+ for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
{
- rtx set;
-
- set = single_set (insn);
+ rtx set = single_set (insn);
if (! set)
continue;
- if (flag_expensive_optimizations && ! pass
- && (GET_CODE (SET_SRC (set)) == SIGN_EXTEND
- || GET_CODE (SET_SRC (set)) == ZERO_EXTEND)
+ if ((GET_CODE (SET_SRC (set)) == SIGN_EXTEND
+ || GET_CODE (SET_SRC (set)) == ZERO_EXTEND)
&& REG_P (XEXP (SET_SRC (set), 0))
&& REG_P (SET_DEST (set)))
optimize_reg_copy_3 (insn, SET_DEST (set), SET_SRC (set));
- if (flag_expensive_optimizations && ! pass
- && REG_P (SET_SRC (set))
+ if (REG_P (SET_SRC (set))
&& REG_P (SET_DEST (set)))
{
/* If this is a register-register copy where SRC is not dead,
@@ -1245,7 +1232,6 @@ regmove_optimize (rtx f, int nregs)
}
}
- done:
/* Clean up. */
free (regno_src_regno);
if (reg_set_in_bb)
@@ -1255,6 +1241,7 @@ regmove_optimize (rtx f, int nregs)
}
regstat_free_n_sets_and_refs ();
regstat_free_ri ();
+ return 0;
}
/* Returns nonzero if INSN's pattern has matching constraints for any operand.
@@ -1356,14 +1343,6 @@ gate_handle_regmove (void)
return (optimize > 0 && flag_regmove);
}
-/* Register allocation pre-pass, to reduce number of moves necessary
- for two-address machines. */
-static unsigned int
-rest_of_handle_regmove (void)
-{
- regmove_optimize (get_insns (), max_reg_num ());
- return 0;
-}
struct rtl_opt_pass pass_regmove =
{
@@ -1371,7 +1350,7 @@ struct rtl_opt_pass pass_regmove =
RTL_PASS,
"regmove", /* name */
gate_handle_regmove, /* gate */
- rest_of_handle_regmove, /* execute */
+ regmove_optimize, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */