+2014-09-09 David Malcolm <dmalcolm@redhat.com>
+
+ * rtl.h (INSN_LOCATION): Strengthen param from const_rtx to
+ const rtx_insn *, and from rtx to rtx_insn * for the other
+ overloaded variant.
+ (RTL_LOCATION): Add a checked cast to rtx_insn * when invoking
+ INSN_LOCATION, since we know INSN_P holds.
+ (insn_line): Strengthen param from const_rtx to const rtx_insn *.
+ (insn_file): Likewise.
+ (insn_scope): Likewise.
+ (insn_location): Likewise.
+
+ * config/mips/mips.c (mips16_gp_pseudo_reg): Strengthen local
+ "insn" from rtx to rtx_insn *, introducing a new local rtx "set"
+ for the result of gen_load_const_gp.
+ * config/rs6000/rs6000-protos.h (output_call): Strengthen first
+ param from rtx to rtx_insn *.
+ * config/rs6000/rs6000.c (output_call): Likewise.
+ * dwarf2out.c (dwarf2out_var_location): Likewise for local "prev",
+ introducing a checked cast to rtx_sequence * and use of the insn
+ method.
+ * emit-rtl.c (emit_copy_of_insn_after): Strengthen both params
+ from rtx to rtx_insn *.
+ (insn_scope): Strengthen param from const_rtx to const rtx_insn *.
+ (insn_line): Likewise.
+ (insn_file): Likewise.
+ (insn_location): Likewise.
+ * emit-rtl.h (emit_copy_of_insn_after): Strengthen both params
+ from rtx to rtx_insn *.
+ * print-rtl.c (print_rtx): Introduce local "in_insn" via a checked
+ cast, using it for calls to INSN_HAS_LOCATION and insn_location.
+ * recog.c (peep2_attempt): Introduce local rtx_insn * "peepinsn"
+ via a checked cast.
+ * reorg.c (relax_delay_slots): Strengthen locals named "after"
+ from rtx to rtx_insn *; use methods of "pat" for type-safety.
+
2014-09-09 David Malcolm <dmalcolm@redhat.com>
* combine.c (try_combine): Eliminate checked cast on result of
{
if (cfun->machine->mips16_gp_pseudo_rtx == NULL_RTX)
{
- rtx insn;
rtx_insn *scan;
cfun->machine->mips16_gp_pseudo_rtx = gen_reg_rtx (Pmode);
while (NEXT_INSN (scan) && !INSN_P (NEXT_INSN (scan)))
scan = NEXT_INSN (scan);
- insn = gen_load_const_gp (cfun->machine->mips16_gp_pseudo_rtx);
- insn = emit_insn_after (insn, scan);
+ rtx set = gen_load_const_gp (cfun->machine->mips16_gp_pseudo_rtx);
+ rtx_insn *insn = emit_insn_after (set, scan);
INSN_LOCATION (insn) = 0;
pop_topmost_sequence ();
HOST_WIDE_INT);
#if TARGET_MACHO
-char *output_call (rtx, rtx *, int, int);
+char *output_call (rtx_insn *, rtx *, int, int);
#endif
#ifdef NO_DOLLAR_IN_LABEL
CALL_DEST is the routine we are calling. */
char *
-output_call (rtx insn, rtx *operands, int dest_operand_number,
+output_call (rtx_insn *insn, rtx *operands, int dest_operand_number,
int cookie_operand_number)
{
static char buf[256];
{
struct call_arg_loc_node *ca_loc
= ggc_cleared_alloc<call_arg_loc_node> ();
- rtx prev = prev_real_insn (loc_note), x;
+ rtx_insn *prev = prev_real_insn (loc_note);
+ rtx x;
ca_loc->call_arg_loc_note = loc_note;
ca_loc->next = NULL;
ca_loc->label = last_label;
&& GET_CODE (PATTERN (prev)) == SEQUENCE
&& CALL_P (XVECEXP (PATTERN (prev), 0, 0)))));
if (!CALL_P (prev))
- prev = XVECEXP (PATTERN (prev), 0, 0);
+ prev = as_a <rtx_sequence *> (PATTERN (prev))->insn (0);
ca_loc->tail_call_p = SIBLING_CALL_P (prev);
x = get_call_rtx_from (PATTERN (prev));
if (x)
Care updating of libcall regions if present. */
rtx_insn *
-emit_copy_of_insn_after (rtx insn, rtx after)
+emit_copy_of_insn_after (rtx_insn *insn, rtx_insn *after)
{
rtx_insn *new_rtx;
rtx link;
/* Return lexical scope block insn belongs to. */
tree
-insn_scope (const_rtx insn)
+insn_scope (const rtx_insn *insn)
{
return LOCATION_BLOCK (INSN_LOCATION (insn));
}
/* Return line number of the statement that produced this insn. */
int
-insn_line (const_rtx insn)
+insn_line (const rtx_insn *insn)
{
return LOCATION_LINE (INSN_LOCATION (insn));
}
/* Return source file of the statement that produced this insn. */
const char *
-insn_file (const_rtx insn)
+insn_file (const rtx_insn *insn)
{
return LOCATION_FILE (INSN_LOCATION (insn));
}
/* Return expanded location of the statement that produced this insn. */
expanded_location
-insn_location (const_rtx insn)
+insn_location (const rtx_insn *insn)
{
return expand_location (INSN_LOCATION (insn));
}
extern rtx copy_insn (rtx);
extern rtx_insn *copy_delay_slot_insn (rtx_insn *);
extern rtx gen_int_mode (HOST_WIDE_INT, enum machine_mode);
-extern rtx_insn *emit_copy_of_insn_after (rtx, rtx);
+extern rtx_insn *emit_copy_of_insn_after (rtx_insn *, rtx_insn *);
extern void set_reg_attrs_from_value (rtx, rtx);
extern void set_reg_attrs_for_parm (rtx, rtx);
extern void set_reg_attrs_for_decl_rtl (tree t, rtx x);
if (i == 4 && INSN_P (in_rtx))
{
#ifndef GENERATOR_FILE
+ const rtx_insn *in_insn = as_a <const rtx_insn *> (in_rtx);
+
/* Pretty-print insn locations. Ignore scoping as it is mostly
redundant with line number information and do not print anything
when there is no location information available. */
- if (INSN_HAS_LOCATION (as_a <const rtx_insn *> (in_rtx)))
+ if (INSN_HAS_LOCATION (in_insn))
{
- expanded_location xloc = insn_location (in_rtx);
+ expanded_location xloc = insn_location (in_insn);
fprintf (outfile, " %s:%i", xloc.file, xloc.line);
}
#endif
eh_note = find_reg_note (peep2_insn_data[i].insn, REG_EH_REGION, NULL_RTX);
/* Replace the old sequence with the new. */
+ rtx_insn *peepinsn = as_a <rtx_insn *> (peep2_insn_data[i].insn);
last = emit_insn_after_setloc (attempt,
peep2_insn_data[i].insn,
- INSN_LOCATION (peep2_insn_data[i].insn));
+ INSN_LOCATION (peepinsn));
before_try = PREV_INSN (insn);
delete_insn_chain (insn, peep2_insn_data[i].insn, false);
&& JUMP_P (next)
&& PATTERN (next) == PATTERN (delay_insn))
{
- rtx after;
+ rtx_insn *after;
int i;
/* Delete the RETURN and just execute the delay list insns.
gcc_assert (GET_CODE (pat) == SEQUENCE);
add_insn_after (delay_insn, trial, NULL);
after = delay_insn;
- for (i = 1; i < XVECLEN (pat, 0); i++)
- after = emit_copy_of_insn_after (XVECEXP (pat, 0, i), after);
+ for (i = 1; i < pat->len (); i++)
+ after = emit_copy_of_insn_after (pat->insn (i), after);
delete_scheduled_jump (delay_insn);
continue;
}
#endif
)
{
- rtx after;
+ rtx_insn *after;
int i;
/* All this insn does is execute its delay list and jump to the
gcc_assert (GET_CODE (pat) == SEQUENCE);
add_insn_after (delay_insn, trial, NULL);
after = delay_insn;
- for (i = 1; i < XVECLEN (pat, 0); i++)
- after = emit_copy_of_insn_after (XVECEXP (pat, 0, i), after);
+ for (i = 1; i < pat->len (); i++)
+ after = emit_copy_of_insn_after (pat->insn (i), after);
delete_scheduled_jump (delay_insn);
continue;
}
return XEXP (insn, 3);
}
-inline unsigned int INSN_LOCATION (const_rtx insn)
+inline unsigned int INSN_LOCATION (const rtx_insn *insn)
{
return XUINT (insn, 4);
}
-inline unsigned int& INSN_LOCATION (rtx insn)
+inline unsigned int& INSN_LOCATION (rtx_insn *insn)
{
return XUINT (insn, 4);
}
/* LOCATION of an RTX if relevant. */
#define RTL_LOCATION(X) (INSN_P (X) ? \
- INSN_LOCATION (X) : UNKNOWN_LOCATION)
+ INSN_LOCATION (as_a <rtx_insn *> (X)) \
+ : UNKNOWN_LOCATION)
/* Code number of instruction, from when it was recognized.
-1 means this instruction has not been recognized yet. */
extern rtx_insn *prev_cc0_setter (rtx);
/* In emit-rtl.c */
-extern int insn_line (const_rtx);
-extern const char * insn_file (const_rtx);
-extern tree insn_scope (const_rtx);
-extern expanded_location insn_location (const_rtx);
+extern int insn_line (const rtx_insn *);
+extern const char * insn_file (const rtx_insn *);
+extern tree insn_scope (const rtx_insn *);
+extern expanded_location insn_location (const rtx_insn *);
extern location_t prologue_location, epilogue_location;
/* In jump.c */