diff options
author | David Malcolm <dmalcolm@redhat.com> | 2014-08-28 18:59:13 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2014-08-28 18:59:13 +0000 |
commit | e6eda746185997c7c42ee8691761cb7c3c7d0ce1 (patch) | |
tree | 505bd8408677649e55caaf6edf746f1bd1cfe859 /gcc/emit-rtl.c | |
parent | f8f0516ef64cf62bdbba30cee5055685c6f9b68a (diff) | |
download | gcc-e6eda746185997c7c42ee8691761cb7c3c7d0ce1.zip gcc-e6eda746185997c7c42ee8691761cb7c3c7d0ce1.tar.gz gcc-e6eda746185997c7c42ee8691761cb7c3c7d0ce1.tar.bz2 |
Make SET_NEXT_INSN/SET_PREV_INSN require an rtx_insn
gcc/
2014-08-28 David Malcolm <dmalcolm@redhat.com>
* rtl.h (SET_PREV_INSN): Strengthen param from rtx to rtx_insn *.
(SET_NEXT_INSN): Likewise.
(gen_rtvec_v): Add an overload for param types (int, rtx_insn **).
* config/c6x/c6x.c (gen_one_bundle): Strengthen param "slot" from
rtx * to rtx_insn **. Introduce a new local rtx "seq", using it
to split out the SEQUENCE from local "bundle", strengthening the
latter from rtx to rtx_insn * to hold the insn holding the SEQUENCE.
Strengthen locals "t" and "insn" from rtx to rtx_insn *.
(c6x_gen_bundles): Strengthen locals "insn", "next", "last_call"
and the type of the elements of the "slot" array from rtx to
rtx_insn *.
(reorg_split_calls): Likewise for locals "insn" and "next", and
the type of the elements of the "slot" array.
* config/frv/frv.c (frv_nops): Likewise for the elements of this
array.
(frv_function_prologue): Likewise for locals "insn", "next",
"last_call".
(frv_register_nop): Introduce a local "nop_insn" to be the
rtx_insn * containing rtx "nop".
* config/mep/mep.c (mep_make_bundle): Param "core" is sometimes
used as an insn and sometimes as a pattern, so rename it to
"core_insn_or_pat", and introduce local rtx_insn * "core_insn",
using it where dealing with the core insn.
* config/picochip/picochip.c (reorder_var_tracking_notes):
Strengthen locals "insn", "next", "last_insn", "queue",
"next_queue", "prev" from rtx to rtx_insn *.
* emit-rtl.c (gen_rtvec_v): Add overloaded implementation for when
the second param is an rtx_insn ** rather than an rtx **.
(link_insn_into_chain): Strengthen locals "seq" and "sequence"
from rtx to rtx_sequence *, and introduce local named "sequence",
using methods of rtx_sequence to clarify the code.
(remove_insn): Introduce local rtx_sequence * named "sequence" and
use its methods.
(emit_insn_after_1): Strengthen return type from rtx to rtx_insn *.
Rename param "after" to "uncast_after", reintroducing "after" as a
local rtx_insn * with a checked cast.
(emit_pattern_after_noloc): Rename param "after" to "uncast_after",
reintroducing "after" as a local rtx_insn * with a checked cast.
Strengthen local "last" from rtx to rtx_insn * and remove the
now-redundant checked casts.
(copy_delay_slot_insn): Strengthen return type and param from rtx
to rtx_insn *.
* haifa-sched.c (reemit_notes): Strengthen params "insn" and
"last" from rtx to rtx_insn *.
From-SVN: r214685
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r-- | gcc/emit-rtl.c | 57 |
1 files changed, 42 insertions, 15 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 2365dc2..8ec78a9 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -933,6 +933,25 @@ gen_rtvec_v (int n, rtx *argp) return rt_val; } + +rtvec +gen_rtvec_v (int n, rtx_insn **argp) +{ + int i; + rtvec rt_val; + + /* Don't allocate an empty rtvec... */ + if (n == 0) + return NULL_RTVEC; + + rt_val = rtvec_alloc (n); + + for (i = 0; i < n; i++) + rt_val->elem[i] = *argp++; + + return rt_val; +} + /* Return the number of bytes between the start of an OUTER_MODE in-memory value and the start of an INNER_MODE in-memory value, @@ -3885,22 +3904,25 @@ link_insn_into_chain (rtx_insn *insn, rtx_insn *prev, rtx_insn *next) SET_NEXT_INSN (prev) = insn; if (NONJUMP_INSN_P (prev) && GET_CODE (PATTERN (prev)) == SEQUENCE) { - rtx sequence = PATTERN (prev); - SET_NEXT_INSN (XVECEXP (sequence, 0, XVECLEN (sequence, 0) - 1)) = insn; + rtx_sequence *sequence = as_a <rtx_sequence *> (PATTERN (prev)); + SET_NEXT_INSN (sequence->insn (sequence->len () - 1)) = insn; } } if (next != NULL) { SET_PREV_INSN (next) = insn; if (NONJUMP_INSN_P (next) && GET_CODE (PATTERN (next)) == SEQUENCE) - SET_PREV_INSN (XVECEXP (PATTERN (next), 0, 0)) = insn; + { + rtx_sequence *sequence = as_a <rtx_sequence *> (PATTERN (next)); + SET_PREV_INSN (sequence->insn (0)) = insn; + } } if (NONJUMP_INSN_P (insn) && GET_CODE (PATTERN (insn)) == SEQUENCE) { - rtx sequence = PATTERN (insn); - SET_PREV_INSN (XVECEXP (sequence, 0, 0)) = prev; - SET_NEXT_INSN (XVECEXP (sequence, 0, XVECLEN (sequence, 0) - 1)) = next; + rtx_sequence *sequence = as_a <rtx_sequence *> (PATTERN (insn)); + SET_PREV_INSN (sequence->insn (0)) = prev; + SET_NEXT_INSN (sequence->insn (sequence->len () - 1)) = next; } } @@ -4079,8 +4101,8 @@ remove_insn (rtx insn) SET_NEXT_INSN (prev) = next; if (NONJUMP_INSN_P (prev) && GET_CODE (PATTERN (prev)) == SEQUENCE) { - rtx sequence = PATTERN (prev); - SET_NEXT_INSN (XVECEXP (sequence, 0, XVECLEN (sequence, 0) - 1)) = next; + rtx_sequence *sequence = as_a <rtx_sequence *> (PATTERN (prev)); + SET_NEXT_INSN (sequence->insn (sequence->len () - 1)) = next; } } else if (get_insns () == insn) @@ -4107,7 +4129,10 @@ remove_insn (rtx insn) { SET_PREV_INSN (next) = prev; if (NONJUMP_INSN_P (next) && GET_CODE (PATTERN (next)) == SEQUENCE) - SET_PREV_INSN (XVECEXP (PATTERN (next), 0, 0)) = prev; + { + rtx_sequence *sequence = as_a <rtx_sequence *> (PATTERN (next)); + SET_PREV_INSN (sequence->insn (0)) = prev; + } } else if (get_last_insn () == insn) set_last_insn (prev); @@ -4387,9 +4412,10 @@ emit_label_before (rtx label, rtx before) /* Helper for emit_insn_after, handles lists of instructions efficiently. */ -static rtx -emit_insn_after_1 (rtx_insn *first, rtx after, basic_block bb) +static rtx_insn * +emit_insn_after_1 (rtx_insn *first, rtx uncast_after, basic_block bb) { + rtx_insn *after = safe_as_a <rtx_insn *> (uncast_after); rtx_insn *last; rtx_insn *after_after; if (!bb && !BARRIER_P (after)) @@ -4431,15 +4457,16 @@ emit_insn_after_1 (rtx_insn *first, rtx after, basic_block bb) } static rtx_insn * -emit_pattern_after_noloc (rtx x, rtx after, basic_block bb, +emit_pattern_after_noloc (rtx x, rtx uncast_after, basic_block bb, rtx_insn *(*make_raw)(rtx)) { - rtx last = after; + rtx_insn *after = safe_as_a <rtx_insn *> (uncast_after); + rtx_insn *last = after; gcc_assert (after); if (x == NULL_RTX) - return safe_as_a <rtx_insn *> (last); + return last; switch (GET_CODE (x)) { @@ -4465,7 +4492,7 @@ emit_pattern_after_noloc (rtx x, rtx after, basic_block bb, break; } - return safe_as_a <rtx_insn *> (last); + return last; } /* Make X be output after the insn AFTER and set the BB of insn. If |