+2015-07-08 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
+
+ * auto-inc-dec.c (pass_inc_dec::execute): Don't check the value
+ of AUTO_INC_DEC with the preprocessor.
+ * combine.c (combine_instructions): Likewise.
+ (can_combine_p): Likewise.
+ (try_combine): Likewise.
+ * emit-rtl.c (try_split): Likewise.
+ * loop-invariant.c (calculate_loop_reg_pressure): Likewise.
+ * lower-subreg.c (resolve_simple_move): Likewise.
+ * lra.c (update_inc_notes): Likewise.
+ * recog.c (asm_operand_ok): Likewise.
+ (constrain_operands): Likewise.
+ * regrename.c (scan_rtx_address): Likewise.
+ * reload.c (update_auto_inc_notes): Likewise.
+ (reg_inc_found_and_valid_p): Likewise.
+ * reload1.c (reload): Likewise.
+ (emit_input_reload_insns): Likewise.
+ (delete_output_reload): Likewise.
+ * sched-deps.c (init_insn_reg_pressure_info): Likewise.
+ * valtrack.c (cleanup_auto_inc_dec): Likewise.
+
2015-07-08 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
* rtl.h: Always define AUTO_INC_DEC.
before the ref or +c if the increment was after the ref, then if we
can do the combination but switch the pre/post bit. */
-#if AUTO_INC_DEC
enum form
{
}
}
-#endif
-
/* Discover auto-inc auto-dec instructions. */
namespace {
/* opt_pass methods: */
virtual bool gate (function *)
{
-#if AUTO_INC_DEC
+ if (!AUTO_INC_DEC)
+ return false;
+
return (optimize > 0 && flag_auto_inc_dec);
-#else
- return false;
-#endif
}
unsigned int
pass_inc_dec::execute (function *fun ATTRIBUTE_UNUSED)
{
-#if AUTO_INC_DEC
+ if (!AUTO_INC_DEC)
+ return 0;
+
basic_block bb;
int max_reg = max_reg_num ();
free (reg_next_def);
mem_tmp = NULL;
-#endif
+
return 0;
}
FOR_BB_INSNS (this_basic_block, insn)
if (INSN_P (insn) && BLOCK_FOR_INSN (insn))
{
-#if AUTO_INC_DEC
rtx links;
-#endif
subst_low_luid = DF_INSN_LUID (insn);
subst_insn = insn;
insn);
record_dead_and_set_regs (insn);
-#if AUTO_INC_DEC
- for (links = REG_NOTES (insn); links; links = XEXP (links, 1))
- if (REG_NOTE_KIND (links) == REG_INC)
- set_nonzero_bits_and_sign_copies (XEXP (links, 0), NULL_RTX,
- insn);
-#endif
+ if (AUTO_INC_DEC)
+ for (links = REG_NOTES (insn); links; links = XEXP (links, 1))
+ if (REG_NOTE_KIND (links) == REG_INC)
+ set_nonzero_bits_and_sign_copies (XEXP (links, 0), NULL_RTX,
+ insn);
/* Record the current insn_rtx_cost of this instruction. */
if (NONJUMP_INSN_P (insn))
const_rtx set = 0;
rtx src, dest;
rtx_insn *p;
-#if AUTO_INC_DEC
rtx link;
-#endif
bool all_adjacent = true;
int (*is_volatile_p) (const_rtx);
Also insist that I3 not be a jump; if it were one
and the incremented register were spilled, we would lose. */
-#if AUTO_INC_DEC
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_INC
- && (JUMP_P (i3)
- || reg_used_between_p (XEXP (link, 0), insn, i3)
- || (pred != NULL_RTX
- && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (pred)))
- || (pred2 != NULL_RTX
- && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (pred2)))
- || (succ != NULL_RTX
- && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (succ)))
- || (succ2 != NULL_RTX
- && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (succ2)))
- || reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i3))))
- return 0;
-#endif
+ if (AUTO_INC_DEC)
+ for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
+ if (REG_NOTE_KIND (link) == REG_INC
+ && (JUMP_P (i3)
+ || reg_used_between_p (XEXP (link, 0), insn, i3)
+ || (pred != NULL_RTX
+ && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (pred)))
+ || (pred2 != NULL_RTX
+ && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (pred2)))
+ || (succ != NULL_RTX
+ && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (succ)))
+ || (succ2 != NULL_RTX
+ && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (succ2)))
+ || reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i3))))
+ return 0;
/* Don't combine an insn that follows a CC0-setting insn.
An insn that uses CC0 must not be separated from the one that sets it.
|| GET_CODE (XEXP (SET_DEST (PATTERN (i3)), 0)) == POST_DEC)))
/* It's not the exception. */
#endif
-#if AUTO_INC_DEC
- {
- rtx link;
- for (link = REG_NOTES (i3); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_INC
- && (reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i2))
- || (i1 != 0
- && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i1)))))
- {
- undo_all ();
- return 0;
- }
- }
-#endif
+ if (AUTO_INC_DEC)
+ {
+ rtx link;
+ for (link = REG_NOTES (i3); link; link = XEXP (link, 1))
+ if (REG_NOTE_KIND (link) == REG_INC
+ && (reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i2))
+ || (i1 != 0
+ && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i1)))))
+ {
+ undo_all ();
+ return 0;
+ }
+ }
/* See if the SETs in I1 or I2 need to be kept around in the merged
instruction: whenever the value set there is still needed past I3.
return insn;
}
-#if AUTO_INC_DEC
/* Find a RTX_AUTOINC class rtx which matches DATA. */
static int
}
return false;
}
-#endif
/* Increment the label uses for all labels present in rtx. */
}
break;
-#if AUTO_INC_DEC
case REG_INC:
+ if (!AUTO_INC_DEC)
+ break;
+
for (insn = insn_last; insn != NULL_RTX; insn = PREV_INSN (insn))
{
rtx reg = XEXP (note, 0);
add_reg_note (insn, REG_INC, reg);
}
break;
-#endif
case REG_ARGS_SIZE:
fixup_args_size_notes (NULL, insn_last, INTVAL (XEXP (note, 0)));
note_stores (PATTERN (insn), mark_reg_store, NULL);
-#if AUTO_INC_DEC
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_INC)
- mark_reg_store (XEXP (link, 0), NULL_RTX, NULL);
-#endif
+ if (AUTO_INC_DEC)
+ for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
+ if (REG_NOTE_KIND (link) == REG_INC)
+ mark_reg_store (XEXP (link, 0), NULL_RTX, NULL);
+
while (n_regs_set-- > 0)
{
rtx note = find_regno_note (insn, REG_UNUSED,
reg = gen_reg_rtx (orig_mode);
-#if AUTO_INC_DEC
- {
- rtx move = emit_move_insn (reg, src);
- if (MEM_P (src))
- {
- rtx note = find_reg_note (insn, REG_INC, NULL_RTX);
- if (note)
- add_reg_note (move, REG_INC, XEXP (note, 0));
- }
- }
-#else
- emit_move_insn (reg, src);
-#endif
+ if (AUTO_INC_DEC)
+ {
+ rtx move = emit_move_insn (reg, src);
+ if (MEM_P (src))
+ {
+ rtx note = find_reg_note (insn, REG_INC, NULL_RTX);
+ if (note)
+ add_reg_note (move, REG_INC, XEXP (note, 0));
+ }
+ }
+ else
+ emit_move_insn (reg, src);
+
src = reg;
}
mdest = simplify_gen_subreg (orig_mode, dest, GET_MODE (dest), 0);
minsn = emit_move_insn (real_dest, mdest);
-#if AUTO_INC_DEC
- if (MEM_P (real_dest)
+ if (AUTO_INC_DEC && MEM_P (real_dest)
&& !(resolve_reg_p (real_dest) || resolve_subreg_p (real_dest)))
{
rtx note = find_reg_note (insn, REG_INC, NULL_RTX);
if (note)
add_reg_note (minsn, REG_INC, XEXP (note, 0));
}
-#endif
smove = single_set (minsn);
gcc_assert (smove != NULL_RTX);
return false;
}
-#if AUTO_INC_DEC
/* Process recursively X of INSN and add REG_INC notes if necessary. */
static void
}
}
-#endif
/* Remove all REG_DEAD and REG_UNUSED notes and regenerate REG_INC.
We change pseudos by hard registers without notification of DF and
else
pnote = &XEXP (*pnote, 1);
}
-#if AUTO_INC_DEC
- add_auto_inc_notes (insn, PATTERN (insn));
-#endif
+
+ if (AUTO_INC_DEC)
+ add_auto_inc_notes (insn, PATTERN (insn));
}
}
asm_operand_ok (rtx op, const char *constraint, const char **constraints)
{
int result = 0;
-#if AUTO_INC_DEC
bool incdec_ok = false;
-#endif
/* Use constrain_operands after reload. */
gcc_assert (!reload_completed);
result = 1;
break;
-#if AUTO_INC_DEC
case '<':
case '>':
/* ??? Before auto-inc-dec, auto inc/dec insns are not supposed
Match any memory and hope things are resolved after reload. */
incdec_ok = true;
-#endif
default:
cn = lookup_constraint (constraint);
switch (get_constraint_type (cn))
return 0;
}
-#if AUTO_INC_DEC
/* For operands without < or > constraints reject side-effects. */
- if (!incdec_ok && result && MEM_P (op))
+ if (AUTO_INC_DEC && !incdec_ok && result && MEM_P (op))
switch (GET_CODE (XEXP (op, 0)))
{
case PRE_INC:
default:
break;
}
-#endif
return result;
}
= recog_data.operand[funny_match[funny_match_index].this_op];
}
-#if AUTO_INC_DEC
/* For operands without < or > constraints reject side-effects. */
- if (recog_data.is_asm)
+ if (AUTO_INC_DEC && recog_data.is_asm)
{
for (opno = 0; opno < recog_data.n_operands; opno++)
if (MEM_P (recog_data.operand[opno]))
break;
}
}
-#endif
+
return 1;
}
}
case PRE_INC:
case PRE_DEC:
case PRE_MODIFY:
-#if !AUTO_INC_DEC
/* If the target doesn't claim to handle autoinc, this must be
something special, like a stack push. Kill this chain. */
+ if (!AUTO_INC_DEC)
action = mark_all_read;
-#endif
+
break;
case MEM:
update_auto_inc_notes (rtx_insn *insn ATTRIBUTE_UNUSED, int regno ATTRIBUTE_UNUSED,
int reloadnum ATTRIBUTE_UNUSED)
{
-#if AUTO_INC_DEC
- rtx link;
+ if (!AUTO_INC_DEC)
+ return;
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
+ for (rtx link = REG_NOTES (insn); link; link = XEXP (link, 1))
if (REG_NOTE_KIND (link) == REG_INC
&& (int) REGNO (XEXP (link, 0)) == regno)
push_replacement (&XEXP (link, 0), reloadnum, VOIDmode);
-#endif
}
\f
/* Record the pseudo registers we must reload into hard registers in a
/* Return 1 if registers from REGNO to ENDREGNO are the subjects of a
REG_INC note in insn INSN. REGNO must refer to a hard register. */
-#if AUTO_INC_DEC
static int
reg_inc_found_and_valid_p (unsigned int regno, unsigned int endregno,
rtx insn)
{
rtx link;
+ if (!AUTO_INC_DEC)
+ return 0;
+
gcc_assert (insn);
if (! INSN_P (insn))
}
return 0;
}
-#else
-
-#define reg_inc_found_and_valid_p(regno,endregno,insn) 0
-
-#endif
/* Return 1 if register REGNO is the subject of a clobber in insn INSN.
If SETS is 1, also consider SETs. If SETS is 2, enable checking
static void delete_address_reloads (rtx_insn *, rtx_insn *);
static void delete_address_reloads_1 (rtx_insn *, rtx, rtx_insn *);
static void inc_for_reload (rtx, rtx, rtx, int);
-#if AUTO_INC_DEC
static void add_auto_inc_notes (rtx_insn *, rtx);
-#endif
static void substitute (rtx *, const_rtx, rtx);
static bool gen_reload_chain_without_interm_reg_p (int, int);
static int reloads_conflict (int, int);
pnote = &XEXP (*pnote, 1);
}
-#if AUTO_INC_DEC
- add_auto_inc_notes (insn, PATTERN (insn));
-#endif
+ if (AUTO_INC_DEC)
+ add_auto_inc_notes (insn, PATTERN (insn));
/* Simplify (subreg (reg)) if it appears as an operand. */
cleanup_subreg_operands (insn);
is ill-formed and we must reject this optimization. */
extract_insn (temp);
if (constrain_operands (1, get_enabled_alternatives (temp))
-#if AUTO_INC_DEC
- && ! find_reg_note (temp, REG_INC, reloadreg)
-#endif
- )
+ && (!AUTO_INC_DEC || ! find_reg_note (temp, REG_INC, reloadreg)))
{
/* If the previous insn is an output reload, the source is
a reload register, and its spill_reg_store entry will
continue;
if (MEM_P (reg2) || reload_override_in[k])
reg2 = rld[k].in_reg;
-#if AUTO_INC_DEC
- if (rld[k].out && ! rld[k].out_reg)
+
+ if (AUTO_INC_DEC && rld[k].out && ! rld[k].out_reg)
reg2 = XEXP (rld[k].in_reg, 0);
-#endif
+
while (GET_CODE (reg2) == SUBREG)
reg2 = SUBREG_REG (reg2);
if (rtx_equal_p (reg2, reg))
}
}
\f
-#if AUTO_INC_DEC
static void
add_auto_inc_notes (rtx_insn *insn, rtx x)
{
add_auto_inc_notes (insn, XVECEXP (x, i, j));
}
}
-#endif
note_stores (PATTERN (insn), mark_insn_reg_store, insn);
-#if AUTO_INC_DEC
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_INC)
- mark_insn_reg_store (XEXP (link, 0), NULL_RTX, insn);
-#endif
+ if (AUTO_INC_DEC)
+ for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
+ if (REG_NOTE_KIND (link) == REG_INC)
+ mark_insn_reg_store (XEXP (link, 0), NULL_RTX, insn);
for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
if (REG_NOTE_KIND (link) == REG_DEAD)
cleanup_auto_inc_dec (rtx src, machine_mode mem_mode ATTRIBUTE_UNUSED)
{
rtx x = src;
-#if AUTO_INC_DEC
+ if (!AUTO_INC_DEC)
+ return copy_rtx (x);
+
const RTX_CODE code = GET_CODE (x);
int i;
const char *fmt;
= cleanup_auto_inc_dec (XVECEXP (src, i, j), mem_mode);
}
-#else /* !AUTO_INC_DEC */
- x = copy_rtx (x);
-#endif /* !AUTO_INC_DEC */
-
return x;
}