static void optimize_reg_copy_2 PROTO((rtx, rtx, rtx));
static void optimize_reg_copy_3 PROTO((rtx, rtx, rtx));
static rtx gen_add3_insn PROTO((rtx, rtx, rtx));
-static void copy_src_to_dest PROTO((rtx, rtx, rtx, int, int));
+static void copy_src_to_dest PROTO((rtx, rtx, rtx, int));
static int *regmove_bb_head;
struct match {
static int regclass_compatible_p PROTO((int, int));
static int replacement_quality PROTO((rtx));
static int fixup_match_2 PROTO((rtx, rtx, rtx, rtx, FILE *));
-static int loop_depth;
/* Return non-zero if registers with CLASS1 and CLASS2 can be merged without
causing too much register allocation problems. */
&& (sregno >= FIRST_PSEUDO_REGISTER
|| ! reg_overlap_mentioned_p (src,
PATTERN (q))))
- {
- /* We assume that a register is used exactly once per
- insn in the REG_N_REFS updates below. If this is not
- correct, no great harm is done.
-
- Since we do not know if we will change the lifetime of
- SREGNO or DREGNO, we must not update REG_LIVE_LENGTH
- or REG_N_CALLS_CROSSED at this time. */
- if (sregno >= FIRST_PSEUDO_REGISTER)
- REG_N_REFS (sregno) -= loop_depth;
-
- if (dregno >= FIRST_PSEUDO_REGISTER)
- REG_N_REFS (dregno) += loop_depth;
- }
+ ;
else
{
validate_replace_rtx (dest, src, q);
if (GET_RTX_CLASS (GET_CODE (q)) == 'i')
{
if (reg_mentioned_p (dest, PATTERN (q)))
- {
- PATTERN (q) = replace_rtx (PATTERN (q), dest, src);
-
- /* We assume that a register is used exactly once per
- insn in the updates below. If this is not correct,
- no great harm is done. */
- REG_N_REFS (dregno) -= loop_depth;
- REG_N_REFS (sregno) += loop_depth;
- }
+ PATTERN (q) = replace_rtx (PATTERN (q), dest, src);
if (GET_CODE (q) == CALL_INSN)
instead moving the value to dest directly before the operation. */
static void
-copy_src_to_dest (insn, src, dest, loop_depth, old_max_uid)
+copy_src_to_dest (insn, src, dest, old_max_uid)
rtx insn;
rtx src;
rtx dest;
- int loop_depth;
int old_max_uid;
{
rtx seq;
/* Update the various register tables. */
dest_regno = REGNO (dest);
- REG_N_SETS (dest_regno) += loop_depth;
- REG_N_REFS (dest_regno) += loop_depth;
+ REG_N_SETS (dest_regno) ++;
REG_LIVE_LENGTH (dest_regno)++;
if (REGNO_FIRST_UID (dest_regno) == insn_uid)
REGNO_FIRST_UID (dest_regno) = move_uid;
REG_N_CALLS_CROSSED (REGNO (dst)) += num_calls;
}
- REG_N_REFS (REGNO (dst)) += loop_depth;
- REG_N_REFS (REGNO (src)) -= loop_depth;
-
if (regmove_dump_file)
fprintf (regmove_dump_file,
"Fixed operand of insn %d.\n",
/* A forward/backward pass. Replace output operands with input operands. */
- loop_depth = 1;
-
for (pass = 0; pass <= 2; pass++)
{
if (! flag_regmove && pass >= flag_expensive_optimizations)
rtx set;
int op_no, match_no;
- if (GET_CODE (insn) == NOTE)
- {
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
- loop_depth++;
- else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END)
- loop_depth--;
- }
-
set = single_set (insn);
if (! set)
continue;
if (regmove_dump_file)
fprintf (regmove_dump_file, "Starting backward pass...\n");
- loop_depth = 1;
-
for (insn = get_last_insn (); insn; insn = PREV_INSN (insn))
{
- if (GET_CODE (insn) == NOTE)
- {
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END)
- loop_depth++;
- else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
- loop_depth--;
- }
if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
{
int op_no, match_no;
REG_LIVE_LENGTH (srcno) = 2;
}
- /* We assume that a register is used exactly once per
- insn in the updates above. If this is not correct,
- no great harm is done. */
-
- REG_N_REFS (dstno) += 2 * loop_depth;
- REG_N_REFS (srcno) -= 2 * loop_depth;
-
- /* If that was the only time src was set,
- and src was not live at the start of the
- function, we know that we have no more
- references to src; clear REG_N_REFS so it
- won't make reload do any work. */
- if (REG_N_SETS (REGNO (src)) == 0
- && ! regno_uninitialized (REGNO (src)))
- REG_N_REFS (REGNO (src)) = 0;
-
if (regmove_dump_file)
fprintf (regmove_dump_file,
"Fixed operand %d of insn %d matching operand %d.\n",
/* If we weren't able to replace any of the alternatives, try an
alternative appoach of copying the source to the destination. */
if (!success && copy_src != NULL_RTX)
- copy_src_to_dest (insn, copy_src, copy_dst, loop_depth,
- old_max_uid);
+ copy_src_to_dest (insn, copy_src, copy_dst, old_max_uid);
}
}
HOST_WIDE_INT insn_const, newconst;
rtx overlap = 0; /* need to move insn ? */
rtx src_note = find_reg_note (insn, REG_DEAD, src), dst_note;
- int length, s_length, true_loop_depth;
+ int length, s_length;
/* If SRC is marked as unchanging, we may not change it.
??? Maybe we could get better code by removing the unchanging bit
if (! success)
return 0;
- true_loop_depth = backward ? 2 - loop_depth : loop_depth;
-
/* Remove the death note for DST from P. */
remove_note (p, dst_note);
if (code == MINUS)
post_inc = 0;
validate_change (insn, &XEXP (SET_SRC (set), 1), GEN_INT (insn_const), 0);
REG_N_SETS (REGNO (src))++;
- REG_N_REFS (REGNO (src)) += true_loop_depth;
REG_LIVE_LENGTH (REGNO (src))++;
}
if (overlap)
NOTE_SOURCE_FILE (q) = 0;
REG_N_SETS (REGNO (src))--;
REG_N_CALLS_CROSSED (REGNO (src)) -= num_calls2;
- REG_N_REFS (REGNO (src)) -= true_loop_depth;
REG_LIVE_LENGTH (REGNO (src)) -= s_length2;
insn_const = 0;
}
if (REG_LIVE_LENGTH (REGNO (dst)) < 2)
REG_LIVE_LENGTH (REGNO (dst)) = 2;
}
-
- /* We assume that a register is used exactly once per
- insn in the updates above. If this is not correct,
- no great harm is done. */
-
- REG_N_REFS (REGNO (src)) += 2 * true_loop_depth;
- REG_N_REFS (REGNO (dst)) -= 2 * true_loop_depth;
-
- /* If that was the only time dst was set,
- and dst was not live at the start of the
- function, we know that we have no more
- references to dst; clear REG_N_REFS so it
- won't make reload do any work. */
- if (REG_N_SETS (REGNO (dst)) == 0
- && ! regno_uninitialized (REGNO (dst)))
- REG_N_REFS (REGNO (dst)) = 0;
-
if (regmove_dump_file)
fprintf (regmove_dump_file,
"Fixed operand %d of insn %d matching operand %d.\n",