+2014-08-25 David Malcolm <dmalcolm@redhat.com>
+
+ * config/mep/mep-protos.h (mep_mulr_source): Strengthen first
+ param from rtx to rtx_insn *.
+ (mep_reuse_lo): Likewise for third param.
+ (mep_use_post_modify_p): Likewise for first param.
+ (mep_core_address_length): Likewise.
+ (mep_cop_address_length): Likewise.
+ (mep_final_prescan_insn): Likewise.
+ (mep_store_data_bypass_p): Likewise for both params.
+ (mep_mul_hilo_bypass_p): Likewise.
+ (mep_ipipe_ldc_p): Likewise for param.
+
+ * config/mep/mep.c (mep_mulr_source): Likewise for param "insn".
+ (mep_rewrite_mult): Likewise.
+ (mep_rewrite_mulsi3): Likewise.
+ (mep_rewrite_maddsi3): Likewise.
+ (mep_reuse_lo_p_1): Likewise.
+ (mep_reuse_lo_p): Likewise.
+ (mep_frame_expr): Likewise.
+ (mep_make_parallel): Likewise for both params.
+ (mep_use_post_modify_p_1): Likewise for param "set_insn" and
+ local "insn".
+ (mep_use_post_modify_p): Likewise for param "insn".
+ (mep_core_address_length): Likewise.
+ (mep_cop_address_length): Likewise.
+ (mep_reg_set_in_function): Likewise for local "insn".
+ (mep_asm_without_operands_p): Likewise.
+ (F): Likewise for return type and param "x".
+ (add_constant): Likewise for local "insn".
+ (maybe_dead_move): Likewise for return type and local "insn".
+ (mep_expand_prologue): Likewise for local "insn".
+ (mep_final_prescan_insn): Likewise for param "insn".
+ (mep_reorg_regmove): Likewise for param "insns" and locals "insn",
+ "next", "follow", "x".
+ (mep_insert_repeat_label_last): Likewise for return type, param
+ "last_insn", and locals "next", "prev". Strengthen param "label"
+ from rtx to rtx_code_label *.
+ (struct mep_doloop_begin): Strengthen field "insn" from rtx to
+ rtx_insn *.
+ (struct mep_doloop_end): Likewise for fields "insn" and
+ "fallthrough".
+ (mep_reorg_repeat): Likewise for param "insns" and local "insn".
+ Strengthen local "repeat_label" from rtx to rtx_code_label *.
+ (mep_invertable_branch_p): Strengthen param "insn" from rtx to
+ rtx_insn *.
+ (mep_invert_branch): Likewise for params "insn" and "after".
+ (mep_reorg_erepeat): Likewise for param "insns" and locals
+ "insn", "prev", "new_last", "barrier", "user". Strengthen local
+ "l" from rtx to rtx_code_label *.
+ (mep_jmp_return_reorg): Strengthen param "insns" and local "insn"
+ from rtx to rtx_insn *.
+ (mep_reorg_addcombine): Likewise for param "insns" and locals
+ "i", "n".
+ (add_sp_insn_p): Likewise for param "insn".
+ (mep_reorg_noframe): Likewise for param "insns" and locals
+ "start_frame_insn", "end_frame_insn", "next".
+ (mep_reorg): Likewise for local "insns".
+ (mep_store_data_bypass_1): Likewise for param "prev". Add checked
+ cast.
+ (mep_store_data_bypass_p): Likewise for params "prev", "insn".
+ (mep_mul_hilo_bypass_p): Likewise.
+ (mep_ipipe_ldc_p): Likewise for param "insn".
+ (mep_make_bundle): Likewise for return type, param "cop" and local
+ "insn", splitting out the latter into a new local "seq" for when it
+ is a SEQUENCE rather than an insn.
+ (core_insn_p): Likewise for param "insn".
+ (mep_bundle_insns): Likewise for param "insns" and locals "insn",
+ "last", "first", "note", "prev", "core_insn".
+
2014-08-25 David Malcolm <dmalcolm@redhat.com>
* config/m68k/m68k-protos.h (output_btst): Strengthen param 4 from
static void encode_pattern_1 (rtx);
static void encode_pattern (rtx);
static bool const_in_range (rtx, int, int);
-static void mep_rewrite_mult (rtx, rtx);
-static void mep_rewrite_mulsi3 (rtx, rtx, rtx, rtx);
-static void mep_rewrite_maddsi3 (rtx, rtx, rtx, rtx, rtx);
-static bool mep_reuse_lo_p_1 (rtx, rtx, rtx, bool);
+static void mep_rewrite_mult (rtx_insn *, rtx);
+static void mep_rewrite_mulsi3 (rtx_insn *, rtx, rtx, rtx);
+static void mep_rewrite_maddsi3 (rtx_insn *, rtx, rtx, rtx, rtx);
+static bool mep_reuse_lo_p_1 (rtx, rtx, rtx_insn *, bool);
static bool move_needs_splitting (rtx, rtx, enum machine_mode);
static bool mep_expand_setcc_1 (enum rtx_code, rtx, rtx, rtx);
static bool mep_nongeneral_reg (rtx);
static bool mep_reg_set_in_function (int);
static bool mep_interrupt_saved_reg (int);
static bool mep_call_saves_register (int);
-static rtx F (rtx);
+static rtx_insn *F (rtx_insn *);
static void add_constant (int, int, int, int);
-static rtx maybe_dead_move (rtx, rtx, bool);
+static rtx_insn *maybe_dead_move (rtx, rtx, bool);
static void mep_reload_pointer (int, const char *);
static void mep_start_function (FILE *, HOST_WIDE_INT);
static bool mep_function_ok_for_sibcall (tree, tree);
static unsigned int mep_section_type_flags (tree, const char *, int);
static void mep_asm_named_section (const char *, unsigned int, tree);
static bool mep_mentioned_p (rtx, rtx, int);
-static void mep_reorg_regmove (rtx);
-static rtx mep_insert_repeat_label_last (rtx, rtx, bool, bool);
-static void mep_reorg_repeat (rtx);
-static bool mep_invertable_branch_p (rtx);
-static void mep_invert_branch (rtx, rtx);
-static void mep_reorg_erepeat (rtx);
-static void mep_jmp_return_reorg (rtx);
-static void mep_reorg_addcombine (rtx);
+static void mep_reorg_regmove (rtx_insn *);
+static rtx_insn *mep_insert_repeat_label_last (rtx_insn *, rtx_code_label *,
+ bool, bool);
+static void mep_reorg_repeat (rtx_insn *);
+static bool mep_invertable_branch_p (rtx_insn *);
+static void mep_invert_branch (rtx_insn *, rtx_insn *);
+static void mep_reorg_erepeat (rtx_insn *);
+static void mep_jmp_return_reorg (rtx_insn *);
+static void mep_reorg_addcombine (rtx_insn *);
static void mep_reorg (void);
static void mep_init_intrinsics (void);
static void mep_init_builtins (void);
static rtx mep_find_ready_insn (rtx *, int, enum attr_slot, int);
static void mep_move_ready_insn (rtx *, int, rtx);
static int mep_sched_reorder (FILE *, int, rtx *, int *, int);
-static rtx mep_make_bundle (rtx, rtx);
-static void mep_bundle_insns (rtx);
+static rtx_insn *mep_make_bundle (rtx, rtx_insn *);
+static void mep_bundle_insns (rtx_insn *);
static bool mep_rtx_cost (rtx, int, int, int, int *, bool);
static int mep_address_cost (rtx, enum machine_mode, addr_space_t, bool);
static void mep_setup_incoming_varargs (cumulative_args_t, enum machine_mode,
at the end of the insn stream. */
rtx
-mep_mulr_source (rtx insn, rtx dest, rtx src1, rtx src2)
+mep_mulr_source (rtx_insn *insn, rtx dest, rtx src1, rtx src2)
{
if (rtx_equal_p (dest, src1))
return src2;
to (clobber (reg:SI HI_REGNO)). */
static void
-mep_rewrite_mult (rtx insn, rtx pattern)
+mep_rewrite_mult (rtx_insn *insn, rtx pattern)
{
rtx hi_clobber;
store the result in DEST if nonnull. */
static void
-mep_rewrite_mulsi3 (rtx insn, rtx dest, rtx src1, rtx src2)
+mep_rewrite_mulsi3 (rtx_insn *insn, rtx dest, rtx src1, rtx src2)
{
rtx lo, pattern;
be deleted by a peephole2 if SRC3 is already in $lo. */
static void
-mep_rewrite_maddsi3 (rtx insn, rtx dest, rtx src1, rtx src2, rtx src3)
+mep_rewrite_maddsi3 (rtx_insn *insn, rtx dest, rtx src1, rtx src2, rtx src3)
{
rtx lo, pattern;
if GPR is no longer used. */
static bool
-mep_reuse_lo_p_1 (rtx lo, rtx gpr, rtx insn, bool gpr_dead_p)
+mep_reuse_lo_p_1 (rtx lo, rtx gpr, rtx_insn *insn, bool gpr_dead_p)
{
do
{
/* A wrapper around mep_reuse_lo_p_1 that preserves recog_data. */
bool
-mep_reuse_lo_p (rtx lo, rtx gpr, rtx insn, bool gpr_dead_p)
+mep_reuse_lo_p (rtx lo, rtx gpr, rtx_insn *insn, bool gpr_dead_p)
{
bool result = mep_reuse_lo_p_1 (lo, gpr, insn, gpr_dead_p);
extract_insn (insn);
/* Return the effect of frame-related instruction INSN. */
static rtx
-mep_frame_expr (rtx insn)
+mep_frame_expr (rtx_insn *insn)
{
rtx note, expr;
new pattern in INSN1; INSN2 will be deleted by the caller. */
static void
-mep_make_parallel (rtx insn1, rtx insn2)
+mep_make_parallel (rtx_insn *insn1, rtx_insn *insn2)
{
rtx expr;
be persuaded to do SET_INSN as a side-effect. Return true if so. */
static bool
-mep_use_post_modify_p_1 (rtx set_insn, rtx reg, rtx offset)
+mep_use_post_modify_p_1 (rtx_insn *set_insn, rtx reg, rtx offset)
{
- rtx insn;
+ rtx_insn *insn;
insn = set_insn;
do
/* A wrapper around mep_use_post_modify_p_1 that preserves recog_data. */
bool
-mep_use_post_modify_p (rtx insn, rtx reg, rtx offset)
+mep_use_post_modify_p (rtx_insn *insn, rtx reg, rtx offset)
{
bool result = mep_use_post_modify_p_1 (insn, reg, offset);
extract_insn (insn);
}
int
-mep_core_address_length (rtx insn, int opn)
+mep_core_address_length (rtx_insn *insn, int opn)
{
rtx set = single_set (insn);
rtx mem = XEXP (set, opn);
}
int
-mep_cop_address_length (rtx insn, int opn)
+mep_cop_address_length (rtx_insn *insn, int opn)
{
rtx set = single_set (insn);
rtx mem = XEXP (set, opn);
static bool
mep_reg_set_in_function (int regno)
{
- rtx reg, insn;
+ rtx reg;
+ rtx_insn *insn;
if (mep_interrupt_p () && df_regs_ever_live_p(regno))
return true;
{
if (cfun->machine->asms_without_operands == 0)
{
- rtx insn;
+ rtx_insn *insn;
push_topmost_sequence ();
insn = get_insns ();
gcc_unreachable ();
}
-static rtx
-F (rtx x)
+static rtx_insn *
+F (rtx_insn *x)
{
RTX_FRAME_RELATED_P (x) = 1;
return x;
static void
add_constant (int dest, int src, int value, int mark_frame)
{
- rtx insn;
+ rtx_insn *insn;
int hi, lo;
if (src == dest && value == 0)
/* Move SRC to DEST. Mark the move as being potentially dead if
MAYBE_DEAD_P. */
-static rtx
+static rtx_insn *
maybe_dead_move (rtx dest, rtx src, bool ATTRIBUTE_UNUSED maybe_dead_p)
{
- rtx insn = emit_move_insn (dest, src);
+ rtx_insn *insn = emit_move_insn (dest, src);
#if 0
if (maybe_dead_p)
REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD, const0_rtx, NULL);
F(maybe_dead_move (mem, gen_rtx_REG (rmode, i), maybe_dead_p));
else if (rmode == DImode)
{
- rtx insn;
+ rtx_insn *insn;
int be = TARGET_BIG_ENDIAN ? 4 : 0;
mem = gen_rtx_MEM (SImode,
}
else
{
- rtx insn;
+ rtx_insn *insn;
maybe_dead_move (gen_rtx_REG (rmode, REGSAVE_CONTROL_TEMP),
gen_rtx_REG (rmode, i),
maybe_dead_p);
}
void
-mep_final_prescan_insn (rtx insn, rtx *operands ATTRIBUTE_UNUSED,
+mep_final_prescan_insn (rtx_insn *insn, rtx *operands ATTRIBUTE_UNUSED,
int noperands ATTRIBUTE_UNUSED)
{
/* Despite the fact that MeP is perfectly capable of branching and
}
static void
-mep_reorg_regmove (rtx insns)
+mep_reorg_regmove (rtx_insn *insns)
{
- rtx insn, next, pat, follow, *where;
+ rtx_insn *insn, *next, *follow;
+ rtx pat, *where;
int count = 0, done = 0, replace, before = 0;
if (dump_file)
{
if (dump_file)
{
- rtx x;
+ rtx_insn *x;
fprintf (dump_file, "----- Candidate for superfluous move deletion:\n\n");
for (x = insn; x ;x = NEXT_INSN (x))
Return the last instruction in the adjusted loop. */
-static rtx
-mep_insert_repeat_label_last (rtx last_insn, rtx label, bool including,
- bool shared)
+static rtx_insn *
+mep_insert_repeat_label_last (rtx_insn *last_insn, rtx_code_label *label,
+ bool including, bool shared)
{
- rtx next, prev;
+ rtx_insn *next, *prev;
int count = 0, code, icode;
if (dump_file)
if (INSN_P (prev))
{
if (GET_CODE (PATTERN (prev)) == SEQUENCE)
- prev = XVECEXP (PATTERN (prev), 0, 1);
+ prev = as_a <rtx_insn *> (XVECEXP (PATTERN (prev), 0, 1));
/* Other insns that should not be in the last two opcodes. */
icode = recog_memoized (prev);
struct mep_doloop_begin *next;
/* The instruction itself. */
- rtx insn;
+ rtx_insn *insn;
/* The initial counter value. This is known to be a general register. */
rtx counter;
struct mep_doloop_end *next;
/* The instruction itself. */
- rtx insn;
+ rtx_insn *insn;
/* The first instruction after INSN when the branch isn't taken. */
- rtx fallthrough;
+ rtx_insn *fallthrough;
/* The location of the counter value. Since doloop_end_internal is a
jump instruction, it has to allow the counter to be stored anywhere
/* The main repeat reorg function. See comment above for details. */
static void
-mep_reorg_repeat (rtx insns)
+mep_reorg_repeat (rtx_insn *insns)
{
- rtx insn;
+ rtx_insn *insn;
struct mep_doloop *loops, *loop;
struct mep_doloop_begin *begin;
struct mep_doloop_end *end;
if (mep_repeat_loop_p (loop))
{
/* Case (1) or (2). */
- rtx repeat_label, label_ref;
+ rtx_code_label *repeat_label;
+ rtx label_ref;
/* Create a new label for the repeat insn. */
repeat_label = gen_label_rtx ();
static bool
-mep_invertable_branch_p (rtx insn)
+mep_invertable_branch_p (rtx_insn *insn)
{
rtx cond, set;
enum rtx_code old_code;
}
static void
-mep_invert_branch (rtx insn, rtx after)
+mep_invert_branch (rtx_insn *insn, rtx_insn *after)
{
rtx cond, set, label;
int i;
}
static void
-mep_reorg_erepeat (rtx insns)
+mep_reorg_erepeat (rtx_insn *insns)
{
- rtx insn, prev, l, x;
+ rtx_insn *insn, *prev;
+ rtx_code_label *l;
+ rtx x;
int count;
for (insn = insns; insn; insn = NEXT_INSN (insn))
if (prev == JUMP_LABEL (insn))
{
- rtx newlast;
+ rtx_insn *newlast;
if (dump_file)
fprintf (dump_file, "found loop top, %d insns\n", count);
so, we know nobody inside the loop uses it.
But we must be careful to put the erepeat
*after* the label. */
- rtx barrier;
+ rtx_insn *barrier;
for (barrier = PREV_INSN (prev);
barrier && NOTE_P (barrier);
barrier = PREV_INSN (barrier))
{
/* A label is OK if there is exactly one user, and we
can find that user before the next label. */
- rtx user = 0;
+ rtx_insn *user = 0;
int safe = 0;
if (LABEL_NUSES (prev) == 1)
{
always do this on its own. */
static void
-mep_jmp_return_reorg (rtx insns)
+mep_jmp_return_reorg (rtx_insn *insns)
{
- rtx insn, label, ret;
+ rtx_insn *insn;
+ rtx label, ret;
int ret_code;
for (insn = insns; insn; insn = NEXT_INSN (insn))
static void
-mep_reorg_addcombine (rtx insns)
+mep_reorg_addcombine (rtx_insn *insns)
{
- rtx i, n;
+ rtx_insn *i, *n;
for (i = insns; i; i = NEXT_INSN (i))
if (INSN_P (i)
/* If this insn adjusts the stack, return the adjustment, else return
zero. */
static int
-add_sp_insn_p (rtx insn)
+add_sp_insn_p (rtx_insn *insn)
{
rtx pat;
/* Check for trivial functions that set up an unneeded stack
frame. */
static void
-mep_reorg_noframe (rtx insns)
+mep_reorg_noframe (rtx_insn *insns)
{
- rtx start_frame_insn;
- rtx end_frame_insn = 0;
+ rtx_insn *start_frame_insn;
+ rtx_insn *end_frame_insn = 0;
int sp_adjust, sp2;
rtx sp;
while (insns)
{
- rtx next = next_real_insn (insns);
+ rtx_insn *next = next_real_insn (insns);
if (!next)
break;
static void
mep_reorg (void)
{
- rtx insns = get_insns ();
+ rtx_insn *insns = get_insns ();
/* We require accurate REG_DEAD notes. */
compute_bb_for_insn ();
not the containing insn. */
static bool
-mep_store_data_bypass_1 (rtx prev, rtx pat)
+mep_store_data_bypass_1 (rtx_insn *prev, rtx pat)
{
/* Cope with intrinsics like swcpa. */
if (GET_CODE (pat) == PARALLEL)
int i;
for (i = 0; i < XVECLEN (pat, 0); i++)
- if (mep_store_data_bypass_p (prev, XVECEXP (pat, 0, i)))
+ if (mep_store_data_bypass_p (prev,
+ as_a <rtx_insn *> (XVECEXP (pat, 0, i))))
return true;
return false;
has no true dependence on PREV. */
bool
-mep_store_data_bypass_p (rtx prev, rtx insn)
+mep_store_data_bypass_p (rtx_insn *prev, rtx_insn *insn)
{
return INSN_P (insn) ? mep_store_data_bypass_1 (prev, PATTERN (insn)) : false;
}
between multiplication instructions PREV and INSN. */
bool
-mep_mul_hilo_bypass_p (rtx prev, rtx insn)
+mep_mul_hilo_bypass_p (rtx_insn *prev, rtx_insn *insn)
{
rtx pat;
read from PSW, LP, SAR, HI and LO. */
bool
-mep_ipipe_ldc_p (rtx insn)
+mep_ipipe_ldc_p (rtx_insn *insn)
{
rtx pat, src;
Emit the bundle in place of COP and return it. */
-static rtx
-mep_make_bundle (rtx core, rtx cop)
+static rtx_insn *
+mep_make_bundle (rtx core, rtx_insn *cop)
{
- rtx insn;
+ rtx seq;
+ rtx_insn *insn;
/* If CORE is an existing instruction, remove it, otherwise put
the new pattern in an INSN harness. */
core = make_insn_raw (core);
/* Generate the bundle sequence and replace COP with it. */
- insn = gen_rtx_SEQUENCE (VOIDmode, gen_rtvec (2, core, cop));
- insn = emit_insn_after (insn, cop);
+ seq = gen_rtx_SEQUENCE (VOIDmode, gen_rtvec (2, core, cop));
+ insn = emit_insn_after (seq, cop);
remove_insn (cop);
/* Set up the links of the insns inside the SEQUENCE. */
}
static int
-core_insn_p (rtx insn)
+core_insn_p (rtx_insn *insn)
{
if (GET_CODE (PATTERN (insn)) == USE)
return 0;
Called from mep_insn_reorg. */
static void
-mep_bundle_insns (rtx insns)
+mep_bundle_insns (rtx_insn *insns)
{
- rtx insn, last = NULL_RTX, first = NULL_RTX;
+ rtx_insn *insn, *last = NULL, *first = NULL;
int saw_scheduling = 0;
/* Only do bundling if we're in vliw mode. */
else if (NONJUMP_INSN_P (insn) && GET_MODE (insn) == VOIDmode && first)
{
- rtx note, prev;
+ rtx_insn *note, *prev;
/* INSN is part of a bundle; FIRST is the first insn in that
bundle. Move all intervening notes out of the bundle.
if (TARGET_IVC2)
{
- rtx core_insn = NULL_RTX;
+ rtx_insn *core_insn = NULL;
/* IVC2 slots are scheduled by DFA, so we just accept
whatever the scheduler gives us. However, we must make