+2014-08-21 David Malcolm <dmalcolm@redhat.com>
+
+ * auto-inc-dec.c (struct inc_insn): Strengthen field "insn" from
+ rtx to rtx_insn *.
+ (struct mem_insn): Likewise for field "insn".
+ (reg_next_use): Strengthen from rtx * to rtx_insn **.
+ (reg_next_inc_use): Likewise.
+ (reg_next_def): Likewise.
+ (move_dead_notes): Strengthen params "to_insn" and "from_insn"
+ from rtx to rtx_insn *.
+ (move_insn_before): Likewise for param "next_insn" and local "insns".
+ (attempt_change): Likewise for local "mov_insn".
+ (try_merge): Likewise for param "last_insn".
+ (get_next_ref): Likewise for return type and local "insn".
+ Strengthen param "next_array" from rtx * to rtx_insn **.
+ (parse_add_or_inc): Strengthen param "insn" from rtx to
+ rtx_insn *.
+ (find_inc): Likewise for locals "insn" and "other_insn" (three of
+ the latter).
+ (merge_in_block): Likewise for locals "insn", "curr",
+ "other_insn".
+ (pass_inc_dec::execute): Update allocations of the arrays to
+ reflect the stronger types.
+
2014-08-21 David Malcolm <dmalcolm@redhat.com>
* asan.c (asan_clear_shadow): Strengthen locals "insn", "insns"
static struct inc_insn
{
- rtx insn; /* The insn being parsed. */
+ rtx_insn *insn; /* The insn being parsed. */
rtx pat; /* The pattern of the insn. */
bool reg1_is_const; /* True if reg1 is const, false if reg1 is a reg. */
enum form form;
static struct mem_insn
{
- rtx insn; /* The insn being parsed. */
+ rtx_insn *insn; /* The insn being parsed. */
rtx pat; /* The pattern of the insn. */
rtx *mem_loc; /* The address of the field that holds the mem */
/* that is to be replaced. */
must be compared with the current block.
*/
-static rtx *reg_next_use = NULL;
-static rtx *reg_next_inc_use = NULL;
-static rtx *reg_next_def = NULL;
+static rtx_insn **reg_next_use = NULL;
+static rtx_insn **reg_next_inc_use = NULL;
+static rtx_insn **reg_next_def = NULL;
/* Move dead note that match PATTERN to TO_INSN from FROM_INSN. We do
does not appear that there are any other kinds of relevant notes. */
static void
-move_dead_notes (rtx to_insn, rtx from_insn, rtx pattern)
+move_dead_notes (rtx_insn *to_insn, rtx_insn *from_insn, rtx pattern)
{
rtx note;
rtx next_note;
/* Create a mov insn DEST_REG <- SRC_REG and insert it before
NEXT_INSN. */
-static rtx
-insert_move_insn_before (rtx next_insn, rtx dest_reg, rtx src_reg)
+static rtx_insn *
+insert_move_insn_before (rtx_insn *next_insn, rtx dest_reg, rtx src_reg)
{
- rtx insns;
+ rtx_insn *insns;
start_sequence ();
emit_move_insn (dest_reg, src_reg);
handled mov free. */
basic_block bb = BLOCK_FOR_INSN (mem_insn.insn);
- rtx mov_insn = NULL;
+ rtx_insn *mov_insn = NULL;
int regno;
rtx mem = *mem_insn.mem_loc;
enum machine_mode mode = GET_MODE (mem);
/* The width of the mem being accessed. */
int size = GET_MODE_SIZE (GET_MODE (mem));
- rtx last_insn = NULL;
+ rtx_insn *last_insn = NULL;
enum machine_mode reg_mode = GET_MODE (inc_reg);
switch (inc_insn.form)
NEXT_ARRAY) or defines (if reg_next_def is passed in NEXT_ARRAY)
REGNO in BB. */
-static rtx
-get_next_ref (int regno, basic_block bb, rtx *next_array)
+static rtx_insn *
+get_next_ref (int regno, basic_block bb, rtx_insn **next_array)
{
- rtx insn = next_array[regno];
+ rtx_insn *insn = next_array[regno];
/* Lazy about cleaning out the next_arrays. */
if (insn && BLOCK_FOR_INSN (insn) != bb)
processed. */
static bool
-parse_add_or_inc (rtx insn, bool before_mem)
+parse_add_or_inc (rtx_insn *insn, bool before_mem)
{
rtx pat = single_set (insn);
if (!pat)
static bool
find_inc (bool first_try)
{
- rtx insn;
+ rtx_insn *insn;
basic_block bb = BLOCK_FOR_INSN (mem_insn.insn);
- rtx other_insn;
+ rtx_insn *other_insn;
df_ref def;
/* Make sure this reg appears only once in this insn. */
{
/* Make sure that there is no insn that assigns to inc_insn.res
between the mem_insn and the inc_insn. */
- rtx other_insn = get_next_ref (REGNO (inc_insn.reg_res),
- BLOCK_FOR_INSN (mem_insn.insn),
- reg_next_def);
+ rtx_insn *other_insn = get_next_ref (REGNO (inc_insn.reg_res),
+ BLOCK_FOR_INSN (mem_insn.insn),
+ reg_next_def);
if (other_insn != inc_insn.insn)
{
if (dump_file)
then we just abandon this. */
int luid = DF_INSN_LUID (inc_insn.insn);
- rtx other_insn;
+ rtx_insn *other_insn;
/* Make sure this reg appears only once in this insn. */
if (count_occurrences (PATTERN (mem_insn.insn), mem_insn.reg1, 1) != 1)
static void
merge_in_block (int max_reg, basic_block bb)
{
- rtx insn;
- rtx curr;
+ rtx_insn *insn;
+ rtx_insn *curr;
int success_in_block = 0;
if (dump_file)
clear of c because the inc insn is going to move
into the mem_insn.insn. */
int luid = DF_INSN_LUID (mem_insn.insn);
- rtx other_insn
+ rtx_insn *other_insn
= get_next_ref (REGNO (inc_insn.reg1), bb, reg_next_use);
if (other_insn && luid > DF_INSN_LUID (other_insn))
df_note_add_problem ();
df_analyze ();
- reg_next_use = XCNEWVEC (rtx, max_reg);
- reg_next_inc_use = XCNEWVEC (rtx, max_reg);
- reg_next_def = XCNEWVEC (rtx, max_reg);
+ reg_next_use = XCNEWVEC (rtx_insn *, max_reg);
+ reg_next_inc_use = XCNEWVEC (rtx_insn *, max_reg);
+ reg_next_def = XCNEWVEC (rtx_insn *, max_reg);
FOR_EACH_BB_FN (bb, fun)
merge_in_block (max_reg, bb);