+2014-08-22 David Malcolm <dmalcolm@redhat.com>
+
+ * output.h (final_scan_insn): Strengthen return type from rtx to
+ rtx_insn *.
+ (final_forward_branch_p): Likewise for param.
+ (current_output_insn): Likewise for this global.
+
+ * final.c (rtx debug_insn): Likewise for this variable.
+ (current_output_insn): Likewise.
+ (get_attr_length_1): Rename param "insn" to "uncast_insn",
+ adding "insn" back in as an rtx_insn * with a checked cast, so
+ that macro ADJUST_INSN_LENGTH can be passed an rtx_insn * as the
+ first param.
+ (compute_alignments): Strengthen local "label" from rtx to
+ rtx_insn *.
+ (shorten_branches): Rename param from "first" to "uncast_first",
+ introducing a new local rtx_insn * "first" using a checked cast to
+ effectively strengthen "first" from rtx to rtx_insn * without
+ affecting the type signature. Strengthen locals "insn", "seq",
+ "next", "label" from rtx to rtx_insn *.
+ (change_scope): Strengthen param "orig_insn" and local "insn" from
+ rtx to rtx_insn *.
+ (final_start_function): Rename param from "first" to "uncast_first",
+ introducing a new local rtx_insn * "first" using a checked cast to
+ effectively strengthen "first" from rtx to rtx_insn * without
+ affecting the type signature. Strengthen local "insn" from rtx to
+ rtx_insn *.
+ (dump_basic_block_info): Strengthen param "insn" from rtx to
+ rtx_insn *.
+ (final): Rename param from "first" to "uncast_first",
+ introducing a new local rtx_insn * "first" using a checked cast to
+ effectively strengthen "first" from rtx to rtx_insn * without
+ affecting the type signature. Strengthen locals "insn", "next"
+ from rtx to rtx_insn *.
+ (output_alternate_entry_point): Strengthen param "insn" from rtx to
+ rtx_insn *.
+ (call_from_call_insn): Strengthen param "insn" from rtx to
+ rtx_call_insn *.
+ (final_scan_insn): Rename param from "insn" to "uncast_insn",
+ introducing a new local rtx_insn * "insn" using a checked cast to
+ effectively strengthen "insn" from rtx to rtx_insn * without
+ affecting the type signature. Strengthen return type and locals
+ "next", "note", "prev", "new_rtx" from rtx to rtx_insn *. Remove
+ now-redundant checked cast to rtx_insn * from both invocations of
+ debug_hooks->var_location. Convert CALL_P into a dyn_cast,
+ introducing a local "call_insn" for use when invoking
+ call_from_call_insn.
+ (notice_source_line): Strengthen param "insn" from rtx to
+ rtx_insn *.
+ (leaf_function_p): Likewise for local "insn".
+ (final_forward_branch_p): Likewise.
+ (leaf_renumber_regs): Likewise for param "first".
+ (rest_of_clean_state): Likewise for locals "insn" and "next".
+ (self_recursive_call_p): Likewise for param "insn".
+ (collect_fn_hard_reg_usage): Likewise for local "insn".
+ (get_call_fndecl): Likewise for param "insn".
+ (get_call_cgraph_rtl_info): Likewise.
+ (get_call_reg_set_usage): Rename param from "insn" to "uncast_insn",
+ introducing a new local rtx_insn * "insn" using a checked cast to
+ effectively strengthen "insn" from rtx to rtx_insn * without
+ affecting the type signature.
+
+ * config/arc/arc.c (arc_final_prescan_insn): For now, add checked
+ cast when assigning from param "insn" to current_output_insn.
+ (arc_pad_return): Strengthen local "insn" from rtx to rtx_insn *
+ so that we can assign it back to current_output_insn.
+
2014-08-20 Pitchumani Sivanupandi <pitchumani.s@atmel.com>
* config/avr/avr-mcus.def: Remove atmega26hvg, atmega64rfa2,
#define SEEN_EMITTED 2
/* Last insn processed by final_scan_insn. */
-static rtx debug_insn;
-rtx current_output_insn;
+static rtx_insn *debug_insn;
+rtx_insn *current_output_insn;
/* Line number of last NOTE. */
static int last_linenum;
static int asm_insn_count (rtx);
static void profile_function (FILE *);
static void profile_after_prologue (FILE *);
-static bool notice_source_line (rtx, bool *);
+static bool notice_source_line (rtx_insn *, bool *);
static rtx walk_alter_subreg (rtx *, bool *);
static void output_asm_name (void);
-static void output_alternate_entry_point (FILE *, rtx);
+static void output_alternate_entry_point (FILE *, rtx_insn *);
static tree get_mem_expr_from_op (rtx, int *);
static void output_asm_operand_names (rtx *, int *, int);
#ifdef LEAF_REGISTERS
-static void leaf_renumber_regs (rtx);
+static void leaf_renumber_regs (rtx_insn *);
#endif
#ifdef HAVE_cc0
static int alter_cond (rtx);
#endif
static int align_fuzz (rtx, rtx, int, unsigned);
static void collect_fn_hard_reg_usage (void);
-static tree get_call_fndecl (rtx);
+static tree get_call_fndecl (rtx_insn *);
\f
/* Initialize data in final at the beginning of a compilation. */
get its actual length. Otherwise, use FALLBACK_FN to calculate the
length. */
static int
-get_attr_length_1 (rtx insn, int (*fallback_fn) (rtx))
+get_attr_length_1 (rtx uncast_insn, int (*fallback_fn) (rtx))
{
+ rtx_insn *insn = as_a <rtx_insn *> (uncast_insn);
rtx body;
int i;
int length = 0;
fprintf (dump_file, "freq_max: %i\n",freq_max);
FOR_EACH_BB_FN (bb, cfun)
{
- rtx label = BB_HEAD (bb);
+ rtx_insn *label = BB_HEAD (bb);
int fallthru_frequency = 0, branch_frequency = 0, has_fallthru = 0;
edge e;
edge_iterator ei;
slots. */
void
-shorten_branches (rtx first)
+shorten_branches (rtx uncast_first)
{
- rtx insn;
+ rtx_insn *first = safe_as_a <rtx_insn *> (uncast_first);
+ rtx_insn *insn;
int max_uid;
int i;
int max_log;
int max_skip;
#define MAX_CODE_ALIGN 16
- rtx seq;
+ rtx_insn *seq;
int something_changed = 1;
char *varying_length;
rtx body;
if (LABEL_P (insn))
{
- rtx next;
+ rtx_insn *next;
bool next_is_jumptable;
/* Merge in alignments computed by compute_alignments. */
}
else if (BARRIER_P (insn))
{
- rtx label;
+ rtx_insn *label;
for (label = insn; label && ! INSN_P (label);
label = NEXT_INSN (label))
#ifdef CASE_VECTOR_SHORTEN_MODE
/* If the mode of a following jump table was changed, we
may need to update the alignment of this label. */
- rtx next;
+ rtx_insn *next;
bool next_is_jumptable;
next = next_nonnote_insn (insn);
/* Emit lexical block notes needed to change scope from S1 to S2. */
static void
-change_scope (rtx orig_insn, tree s1, tree s2)
+change_scope (rtx_insn *orig_insn, tree s1, tree s2)
{
- rtx insn = orig_insn;
+ rtx_insn *insn = orig_insn;
tree com = NULL_TREE;
tree ts1 = s1, ts2 = s2;
tree s;
test and compare insns. */
void
-final_start_function (rtx first, FILE *file,
+final_start_function (rtx uncast_first, FILE *file,
int optimize_p ATTRIBUTE_UNUSED)
{
+ rtx_insn *first = safe_as_a <rtx_insn *> (uncast_first);
block_depth = 0;
this_is_asm_operands = 0;
#endif
)
{
- rtx insn;
+ rtx_insn *insn;
for (insn = first; insn; insn = NEXT_INSN (insn))
if (!NOTE_P (insn))
{
- insn = NULL_RTX;
+ insn = NULL;
break;
}
else if (NOTE_KIND (insn) == NOTE_INSN_BASIC_BLOCK
continue;
else
{
- insn = NULL_RTX;
+ insn = NULL;
break;
}
output file, and INSN is the instruction being emitted. */
static void
-dump_basic_block_info (FILE *file, rtx insn, basic_block *start_to_bb,
+dump_basic_block_info (FILE *file, rtx_insn *insn, basic_block *start_to_bb,
basic_block *end_to_bb, int bb_map_size, int *bb_seqn)
{
basic_block bb;
For description of args, see `final_start_function', above. */
void
-final (rtx first, FILE *file, int optimize_p)
+final (rtx uncast_first, FILE *file, int optimize_p)
{
- rtx insn, next;
+ rtx_insn *first = safe_as_a <rtx_insn *> (uncast_first);
+ rtx_insn *insn, *next;
int seen = 0;
/* Used for -dA dump. */
The case fall-through in this function is intentional. */
static void
-output_alternate_entry_point (FILE *file, rtx insn)
+output_alternate_entry_point (FILE *file, rtx_insn *insn)
{
const char *name = LABEL_NAME (insn);
/* Given a CALL_INSN, find and return the nested CALL. */
static rtx
-call_from_call_insn (rtx insn)
+call_from_call_insn (rtx_call_insn *insn)
{
rtx x;
gcc_assert (CALL_P (insn));
debug information. We force the emission of a line note after
both NOTE_INSN_PROLOGUE_END and NOTE_INSN_FUNCTION_BEG. */
-rtx
-final_scan_insn (rtx insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
+rtx_insn *
+final_scan_insn (rtx uncast_insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
int nopeepholes ATTRIBUTE_UNUSED, int *seen)
{
#ifdef HAVE_cc0
rtx set;
#endif
- rtx next;
+ rtx_insn *next;
+
+ rtx_insn *insn = as_a <rtx_insn *> (uncast_insn);
insn_counter++;
case NOTE_INSN_VAR_LOCATION:
case NOTE_INSN_CALL_ARG_LOCATION:
if (!DECL_IGNORED_P (current_function_decl))
- debug_hooks->var_location (as_a <rtx_insn *> (insn));
+ debug_hooks->var_location (insn);
break;
default:
for (i = 1; i < XVECLEN (body, 0); i++)
{
rtx insn = XVECEXP (body, 0, i);
- rtx next = NEXT_INSN (insn);
+ rtx_insn *next = NEXT_INSN (insn);
/* We loop in case any instruction in a delay slot gets
split. */
do
if (optimize_p && !flag_no_peephole && !nopeepholes)
{
- rtx next = peephole (insn);
+ rtx_insn *next = peephole (insn);
/* When peepholing, if there were notes within the peephole,
emit them before the peephole. */
if (next != 0 && next != NEXT_INSN (insn))
{
- rtx note, prev = PREV_INSN (insn);
+ rtx_insn *note, *prev = PREV_INSN (insn);
for (note = NEXT_INSN (insn); note != next;
note = NEXT_INSN (note))
needs to be reinserted. */
if (templ == 0)
{
- rtx prev;
+ rtx_insn *prev;
gcc_assert (prev_nonnote_insn (insn) == last_ignored_compare);
be split. */
if (templ[0] == '#' && templ[1] == '\0')
{
- rtx new_rtx = try_split (body, insn, 0);
+ rtx_insn *new_rtx = try_split (body, insn, 0);
/* If we didn't split the insn, go away. */
if (new_rtx == insn && PATTERN (new_rtx) == body)
&& targetm.asm_out.unwind_emit)
targetm.asm_out.unwind_emit (asm_out_file, insn);
- if (CALL_P (insn))
+ if (rtx_call_insn *call_insn = dyn_cast <rtx_call_insn *> (insn))
{
- rtx x = call_from_call_insn (insn);
+ rtx x = call_from_call_insn (call_insn);
x = XEXP (x, 0);
if (x && MEM_P (x) && GET_CODE (XEXP (x, 0)) == SYMBOL_REF)
{
assemble_external (t);
}
if (!DECL_IGNORED_P (current_function_decl))
- debug_hooks->var_location (as_a <rtx_insn *> (insn));
+ debug_hooks->var_location (insn);
}
/* Output assembler code from the template. */
breakpoint location. */
static bool
-notice_source_line (rtx insn, bool *is_stmt)
+notice_source_line (rtx_insn *insn, bool *is_stmt)
{
const char *filename;
int linenum;
int
leaf_function_p (void)
{
- rtx insn;
+ rtx_insn *insn;
/* Some back-ends (e.g. s390) want leaf functions to stay leaf
functions even if they call mcount. */
output templates to customary add branch prediction hints.
*/
int
-final_forward_branch_p (rtx insn)
+final_forward_branch_p (rtx_insn *insn)
{
int insn_id, label_id;
available in leaf functions. */
static void
-leaf_renumber_regs (rtx first)
+leaf_renumber_regs (rtx_insn *first)
{
- rtx insn;
+ rtx_insn *insn;
/* Renumber only the actual patterns.
The reg-notes can contain frame pointer refs,
static unsigned int
rest_of_clean_state (void)
{
- rtx insn, next;
+ rtx_insn *insn, *next;
FILE *final_output = NULL;
int save_unnumbered = flag_dump_unnumbered;
int save_noaddr = flag_dump_noaddr;
/* Return true if INSN is a call to the the current function. */
static bool
-self_recursive_call_p (rtx insn)
+self_recursive_call_p (rtx_insn *insn)
{
tree fndecl = get_call_fndecl (insn);
return (fndecl == current_function_decl
static void
collect_fn_hard_reg_usage (void)
{
- rtx insn;
+ rtx_insn *insn;
#ifdef STACK_REGS
int i;
#endif
/* Get the declaration of the function called by INSN. */
static tree
-get_call_fndecl (rtx insn)
+get_call_fndecl (rtx_insn *insn)
{
rtx note, datum;
call targets that can be overwritten. */
static struct cgraph_rtl_info *
-get_call_cgraph_rtl_info (rtx insn)
+get_call_cgraph_rtl_info (rtx_insn *insn)
{
tree fndecl;
in REG_SET. Return DEFAULT_SET in REG_SET if not found. */
bool
-get_call_reg_set_usage (rtx insn, HARD_REG_SET *reg_set,
+get_call_reg_set_usage (rtx uncast_insn, HARD_REG_SET *reg_set,
HARD_REG_SET default_set)
{
+ rtx_insn *insn = safe_as_a <rtx_insn *> (uncast_insn);
if (flag_use_caller_save)
{
struct cgraph_rtl_info *node = get_call_cgraph_rtl_info (insn);