From 2c57d586684ea096c8d8f57bf0eb301ad30e10d8 Mon Sep 17 00:00:00 2001 From: dmalcolm Date: Tue, 19 Aug 2014 19:38:12 +0000 Subject: [PATCH] make_insn_raw returns an rtx_insn 2014-08-19 David Malcolm * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214187 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 24 ++++++++++++++++++++++++ gcc/emit-rtl.c | 42 +++++++++++++++++++++--------------------- gcc/rtl.h | 2 +- 3 files changed, 46 insertions(+), 22 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d6c75e5..3b92fbf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,29 @@ 2014-08-19 David Malcolm + * 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. + +2014-08-19 David Malcolm + * emit-rtl.c (last_call_insn): Strengthen return type from rtx to rtx_call_insn *. * rtl.h (is_a_helper ::test): New overload, diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 5b68b1e..218ddc4 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -3760,12 +3760,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_alloc (INSN)); INSN_UID (insn) = cur_insn_uid++; PATTERN (insn) = pattern; @@ -3791,12 +3791,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_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++; @@ -3812,12 +3812,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_alloc (JUMP_INSN)); INSN_UID (insn) = cur_insn_uid++; PATTERN (insn) = pattern; @@ -3832,12 +3832,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_alloc (CALL_INSN)); INSN_UID (insn) = cur_insn_uid++; PATTERN (insn) = pattern; @@ -4271,9 +4271,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); @@ -4289,10 +4289,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 (x); while (insn) { - rtx next = NEXT_INSN (insn); + rtx_insn *next = NEXT_INSN (insn); add_insn_before (insn, before, bb); last = insn; insn = next; @@ -4425,7 +4425,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; @@ -4592,7 +4592,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); @@ -4617,7 +4617,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; @@ -4695,7 +4695,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, @@ -4727,7 +4727,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 fea6637..8426b91 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -2422,7 +2422,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); -- 2.7.4