Doing so means strengthening the types of the make_raw callbacks within emit-rtl.c from rtx to rtx_insn * as used by the emit_pattern_* internal functions. There's more that could be done in terms of the params to these functions, but we'll save that for later.
gcc/ * rtl.h (make_insn_raw): Strengthen return type from rtx to rtx_insn *. * emit-rtl.c (make_insn_raw): Strengthen return type and local "insn" from rtx to rtx_insn *. (make_debug_insn_raw): Strengthen return type from rtx to rtx_insn *; strengthen local "insn" from rtx to rtx_debug_insn *. (make_jump_insn_raw): Strengthen return type from rtx to rtx_insn *; strengthen local "insn" from rtx to rtx_jump_insn *. (make_call_insn_raw): Strengthen return type from rtx to rtx_insn *; strengthen local "insn" from rtx to rtx_call_insn *. (emit_pattern_before_noloc): Strengthen return type of "make_raw" callback from rtx to rtx_insn *; likewise for local "insn" and "next", adding a checked cast to rtx_insn in the relevant cases of the switch statement. (emit_pattern_after_noloc): Strengthen return type of "make_raw" callback from rtx to rtx_insn *. (emit_pattern_after_setloc): Likewise. (emit_pattern_after): Likewise. (emit_pattern_before_setloc): Likewise. (emit_pattern_before): Likewise. --- gcc/emit-rtl.c | 42 +++++++++++++++++++++--------------------- gcc/rtl.h | 2 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 39e73a2..bbc7fb7 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -3747,12 +3747,12 @@ try_split (rtx pat, rtx trial, int last) /* Make and return an INSN rtx, initializing all its slots. Store PATTERN in the pattern slots. */ -rtx +rtx_insn * make_insn_raw (rtx pattern) { - rtx insn; + rtx_insn *insn; - insn = rtx_alloc (INSN); + insn = as_a <rtx_insn *> (rtx_alloc (INSN)); INSN_UID (insn) = cur_insn_uid++; PATTERN (insn) = pattern; @@ -3778,12 +3778,12 @@ make_insn_raw (rtx pattern) /* Like `make_insn_raw' but make a DEBUG_INSN instead of an insn. */ -static rtx +static rtx_insn * make_debug_insn_raw (rtx pattern) { - rtx insn; + rtx_debug_insn *insn; - insn = rtx_alloc (DEBUG_INSN); + insn = as_a <rtx_debug_insn *> (rtx_alloc (DEBUG_INSN)); INSN_UID (insn) = cur_debug_insn_uid++; if (cur_debug_insn_uid > MIN_NONDEBUG_INSN_UID) INSN_UID (insn) = cur_insn_uid++; @@ -3799,12 +3799,12 @@ make_debug_insn_raw (rtx pattern) /* Like `make_insn_raw' but make a JUMP_INSN instead of an insn. */ -static rtx +static rtx_insn * make_jump_insn_raw (rtx pattern) { - rtx insn; + rtx_jump_insn *insn; - insn = rtx_alloc (JUMP_INSN); + insn = as_a <rtx_jump_insn *> (rtx_alloc (JUMP_INSN)); INSN_UID (insn) = cur_insn_uid++; PATTERN (insn) = pattern; @@ -3819,12 +3819,12 @@ make_jump_insn_raw (rtx pattern) /* Like `make_insn_raw' but make a CALL_INSN instead of an insn. */ -static rtx +static rtx_insn * make_call_insn_raw (rtx pattern) { - rtx insn; + rtx_call_insn *insn; - insn = rtx_alloc (CALL_INSN); + insn = as_a <rtx_call_insn *> (rtx_alloc (CALL_INSN)); INSN_UID (insn) = cur_insn_uid++; PATTERN (insn) = pattern; @@ -4258,9 +4258,9 @@ reorder_insns (rtx from, rtx to, rtx after) static rtx emit_pattern_before_noloc (rtx x, rtx before, rtx last, basic_block bb, - rtx (*make_raw) (rtx)) + rtx_insn *(*make_raw) (rtx)) { - rtx insn; + rtx_insn *insn; gcc_assert (before); @@ -4276,10 +4276,10 @@ emit_pattern_before_noloc (rtx x, rtx before, rtx last, basic_block bb, case CODE_LABEL: case BARRIER: case NOTE: - insn = x; + insn = as_a <rtx_insn *> (x); while (insn) { - rtx next = NEXT_INSN (insn); + rtx_insn *next = NEXT_INSN (insn); add_insn_before (insn, before, bb); last = insn; insn = next; @@ -4412,7 +4412,7 @@ emit_insn_after_1 (rtx first, rtx after, basic_block bb) static rtx emit_pattern_after_noloc (rtx x, rtx after, basic_block bb, - rtx (*make_raw)(rtx)) + rtx_insn *(*make_raw)(rtx)) { rtx last = after; @@ -4579,7 +4579,7 @@ emit_note_before (enum insn_note subtype, rtx before) static rtx emit_pattern_after_setloc (rtx pattern, rtx after, int loc, - rtx (*make_raw) (rtx)) + rtx_insn *(*make_raw) (rtx)) { rtx last = emit_pattern_after_noloc (pattern, after, NULL, make_raw); @@ -4604,7 +4604,7 @@ emit_pattern_after_setloc (rtx pattern, rtx after, int loc, static rtx emit_pattern_after (rtx pattern, rtx after, bool skip_debug_insns, - rtx (*make_raw) (rtx)) + rtx_insn *(*make_raw) (rtx)) { rtx prev = after; @@ -4682,7 +4682,7 @@ emit_debug_insn_after (rtx pattern, rtx after) static rtx emit_pattern_before_setloc (rtx pattern, rtx before, int loc, bool insnp, - rtx (*make_raw) (rtx)) + rtx_insn *(*make_raw) (rtx)) { rtx first = PREV_INSN (before); rtx last = emit_pattern_before_noloc (pattern, before, @@ -4714,7 +4714,7 @@ emit_pattern_before_setloc (rtx pattern, rtx before, int loc, bool insnp, static rtx emit_pattern_before (rtx pattern, rtx before, bool skip_debug_insns, - bool insnp, rtx (*make_raw) (rtx)) + bool insnp, rtx_insn *(*make_raw) (rtx)) { rtx next = before; diff --git a/gcc/rtl.h b/gcc/rtl.h index 85b725a..51e8a45 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -2400,7 +2400,7 @@ extern rtx gen_clobber (rtx); extern rtx emit_clobber (rtx); extern rtx gen_use (rtx); extern rtx emit_use (rtx); -extern rtx make_insn_raw (rtx); +extern rtx_insn *make_insn_raw (rtx); extern void add_function_usage_to (rtx, rtx); extern rtx_call_insn *last_call_insn (void); extern rtx_insn *previous_insn (rtx); -- 1.8.5.3