More scaffolding: strengthen the return types from the various emit_
functions from rtx to rtx_insn * (or to the rtx_barrier * subclass in a
few cases).

These will ultimately have their params strengthened also, but we
postpone that until much later in the patch series.  So for now there
are also various checked casts to ensure we really got an insn when
returning such params back.

Doing so requires a minor tweak to config/sh/sh.c

gcc/
        * emit-rtl.h (emit_copy_of_insn_after): Strengthen return type
        from rtx to rtx_insn *.

        * rtl.h (emit_insn_before): Likewise.
        (emit_insn_before_noloc): Likewise.
        (emit_insn_before_setloc): Likewise.
        (emit_jump_insn_before): Likewise.
        (emit_jump_insn_before_noloc): Likewise.
        (emit_jump_insn_before_setloc): Likewise.
        (emit_call_insn_before): Likewise.
        (emit_call_insn_before_noloc): Likewise.
        (emit_call_insn_before_setloc): Likewise.
        (emit_debug_insn_before): Likewise.
        (emit_debug_insn_before_noloc): Likewise.
        (emit_debug_insn_before_setloc): Likewise.
        (emit_label_before): Likewise.
        (emit_insn_after): Likewise.
        (emit_insn_after_noloc): Likewise.
        (emit_insn_after_setloc): Likewise.
        (emit_jump_insn_after): Likewise.
        (emit_jump_insn_after_noloc): Likewise.
        (emit_jump_insn_after_setloc): Likewise.
        (emit_call_insn_after): Likewise.
        (emit_call_insn_after_noloc): Likewise.
        (emit_call_insn_after_setloc): Likewise.
        (emit_debug_insn_after): Likewise.
        (emit_debug_insn_after_noloc): Likewise.
        (emit_debug_insn_after_setloc): Likewise.
        (emit_label_after): Likewise.
        (emit_insn): Likewise.
        (emit_debug_insn): Likewise.
        (emit_jump_insn): Likewise.
        (emit_call_insn): Likewise.
        (emit_label): Likewise.
        (gen_clobber): Likewise.
        (emit_clobber): Likewise.
        (gen_use): Likewise.
        (emit_use): Likewise.
        (emit): Likewise.

        (emit_barrier_before): Strengthen return type from rtx to
        rtx_barrier *.
        (emit_barrier_after): Likewise.
        (emit_barrier): Likewise.

        * emit-rtl.c (emit_pattern_before_noloc):  Strengthen return type
        from rtx to rtx_insn *.  Add checked casts for now when converting
        "last" from rtx to rtx_insn *.
        (emit_insn_before_noloc): Likewise for return type.
        (emit_jump_insn_before_noloc): Likewise.
        (emit_call_insn_before_noloc): Likewise.
        (emit_debug_insn_before_noloc): Likewise.
        (emit_barrier_before): Strengthen return type and local "insn"
        from rtx to rtx_barrier *.
        (emit_label_before): Strengthen return type from rtx to
        rtx_insn *.  Add checked cast for now when returning param
        (emit_pattern_after_noloc): Strengthen return type from rtx to
        rtx_insn *.  Add checked casts for now when converting "last" from
        rtx to rtx_insn *.
        (emit_insn_after_noloc): Strengthen return type from rtx to
        rtx_insn *.
        (emit_jump_insn_after_noloc): Likewise.
        (emit_call_insn_after_noloc): Likewise.
        (emit_debug_insn_after_noloc): Likewise.
        (emit_barrier_after): Strengthen return type from rtx to
        rtx_barrier *.
        (emit_label_after): Strengthen return type from rtx to rtx_insn *.
        Add checked cast for now when converting "label" from rtx to
        rtx_insn *.
        (emit_pattern_after_setloc): Strengthen return type from rtx to
        rtx_insn *.  Add checked casts for now when converting "last" from
        rtx to rtx_insn *.
        (emit_pattern_after): Strengthen return type from rtx to
        rtx_insn *.
        (emit_insn_after_setloc): Likewise.
        (emit_insn_after): Likewise.
        (emit_jump_insn_after_setloc): Likewise.
        (emit_jump_insn_after): Likewise.
        (emit_call_insn_after_setloc): Likewise.
        (emit_call_insn_after): Likewise.
        (emit_debug_insn_after_setloc): Likewise.
        (emit_debug_insn_after): Likewise.
        (emit_pattern_before_setloc): Likewise.  Add checked casts for now
        when converting "last" from rtx to rtx_insn *.
        (emit_pattern_before): Strengthen return type from rtx to
        rtx_insn *.
        (emit_insn_before_setloc): Likewise.
        (emit_insn_before): Likewise.
        (emit_jump_insn_before_setloc): Likewise.
        (emit_jump_insn_before): Likewise.
        (emit_call_insn_before_setloc): Likewise.
        (emit_call_insn_before): Likewise.
        (emit_debug_insn_before_setloc): Likewise.
        (emit_debug_insn_before): Likewise.
        (emit_insn): Strengthen return type and locals "last", "insn",
        "next" from rtx to rtx_insn *.  Add checked cast to rtx_insn
        within cases where we know we have an insn.
        (emit_debug_insn): Likewise.
        (emit_jump_insn): Likewise.
        (emit_call_insn): Strengthen return type and local "insn" from rtx
        to rtx_insn *.
        (emit_label): Strengthen return type from rtx to rtx_insn *.  Add
        a checked cast to rtx_insn * for now on "label".
        (emit_barrier): Strengthen return type from rtx to rtx_barrier *.
        (emit_clobber): Strengthen return type from rtx to rtx_insn *.
        (emit_use): Likewise.
        (gen_use): Likewise, also for local "seq".
        (emit): Likewise for return type and local "insn".
        (rtx_insn): Likewise for return type and local "new_rtx".

        * cfgrtl.c (emit_barrier_after_bb): Strengthen local "barrier"
        from rtx to rtx_barrier *.

        * config/sh/sh.c (output_stack_adjust): Since emit_insn has
        changed return type from rtx to rtx_insn *, we must update
        "emit_fn" type, and this in turn means updating...
        (frame_insn): ...this.  Strengthen return type from rtx to
        rtx_insn *.  Introduce a new local "insn" of the appropriate type.
---
 gcc/cfgrtl.c       |   2 +-
 gcc/config/sh/sh.c |  12 ++---
 gcc/emit-rtl.c     | 154 +++++++++++++++++++++++++++--------------------------
 gcc/emit-rtl.h     |   2 +-
 gcc/rtl.h          |  78 +++++++++++++--------------
 5 files changed, 125 insertions(+), 123 deletions(-)

diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 2a490f9..9f15a7d 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1447,7 +1447,7 @@ rtl_redirect_edge_and_branch (edge e, basic_block target)
 void
 emit_barrier_after_bb (basic_block bb)
 {
-  rtx barrier = emit_barrier_after (BB_END (bb));
+  rtx_barrier *barrier = emit_barrier_after (BB_END (bb));
   gcc_assert (current_ir_type () == IR_RTL_CFGRTL
               || current_ir_type () == IR_RTL_CFGLAYOUT);
   if (current_ir_type () == IR_RTL_CFGLAYOUT)
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index a21625f..df6a5bb 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -195,7 +195,7 @@ static rtx gen_block_redirect (rtx, int, int);
 static void sh_reorg (void);
 static void sh_option_override (void);
 static void output_stack_adjust (int, rtx, int, HARD_REG_SET *, bool);
-static rtx frame_insn (rtx);
+static rtx_insn *frame_insn (rtx);
 static rtx push (int);
 static void pop (int);
 static void push_regs (HARD_REG_SET *, int);
@@ -6783,7 +6783,7 @@ static void
 output_stack_adjust (int size, rtx reg, int epilogue_p,
                     HARD_REG_SET *live_regs_mask, bool frame_p)
 {
-  rtx (*emit_fn) (rtx) = frame_p ? &frame_insn : &emit_insn;
+  rtx_insn *(*emit_fn) (rtx) = frame_p ? &frame_insn : &emit_insn;
   if (size)
     {
       HOST_WIDE_INT align = STACK_BOUNDARY / BITS_PER_UNIT;
@@ -6943,12 +6943,12 @@ output_stack_adjust (int size, rtx reg, int epilogue_p,
 
 /* Emit the specified insn and mark it as frame related.
    FIXME: Rename this to emit_frame_insn.  */
-static rtx
+static rtx_insn *
 frame_insn (rtx x)
 {
-  x = emit_insn (x);
-  RTX_FRAME_RELATED_P (x) = 1;
-  return x;
+  rtx_insn *insn = emit_insn (x);
+  RTX_FRAME_RELATED_P (insn) = 1;
+  return insn;
 }
 
 /* Output RTL to push register RN onto the stack.  */
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 2614937..042694a 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -4256,7 +4256,7 @@ reorder_insns (rtx from, rtx to, rtx after)
    SEQUENCE rtl results in much fragmented RTL memory since the SEQUENCE
    generated would almost certainly die right after it was created.  */
 
-static rtx
+static rtx_insn *
 emit_pattern_before_noloc (rtx x, rtx before, rtx last, basic_block bb,
                            rtx_insn *(*make_raw) (rtx))
 {
@@ -4265,7 +4265,7 @@ emit_pattern_before_noloc (rtx x, rtx before, rtx last, 
basic_block bb,
   gcc_assert (before);
 
   if (x == NULL_RTX)
-    return last;
+    return as_a_nullable <rtx_insn *> (last);
 
   switch (GET_CODE (x))
     {
@@ -4298,12 +4298,12 @@ emit_pattern_before_noloc (rtx x, rtx before, rtx last, 
basic_block bb,
       break;
     }
 
-  return last;
+  return as_a_nullable <rtx_insn *> (last);
 }
 
 /* Make X be output before the instruction BEFORE.  */
 
-rtx
+rtx_insn *
 emit_insn_before_noloc (rtx x, rtx before, basic_block bb)
 {
   return emit_pattern_before_noloc (x, before, before, bb, make_insn_raw);
@@ -4312,7 +4312,7 @@ emit_insn_before_noloc (rtx x, rtx before, basic_block bb)
 /* Make an instruction with body X and code JUMP_INSN
    and output it before the instruction BEFORE.  */
 
-rtx
+rtx_insn *
 emit_jump_insn_before_noloc (rtx x, rtx before)
 {
   return emit_pattern_before_noloc (x, before, NULL_RTX, NULL,
@@ -4322,7 +4322,7 @@ emit_jump_insn_before_noloc (rtx x, rtx before)
 /* Make an instruction with body X and code CALL_INSN
    and output it before the instruction BEFORE.  */
 
-rtx
+rtx_insn *
 emit_call_insn_before_noloc (rtx x, rtx before)
 {
   return emit_pattern_before_noloc (x, before, NULL_RTX, NULL,
@@ -4332,7 +4332,7 @@ emit_call_insn_before_noloc (rtx x, rtx before)
 /* Make an instruction with body X and code DEBUG_INSN
    and output it before the instruction BEFORE.  */
 
-rtx
+rtx_insn *
 emit_debug_insn_before_noloc (rtx x, rtx before)
 {
   return emit_pattern_before_noloc (x, before, NULL_RTX, NULL,
@@ -4342,10 +4342,10 @@ emit_debug_insn_before_noloc (rtx x, rtx before)
 /* Make an insn of code BARRIER
    and output it before the insn BEFORE.  */
 
-rtx
+rtx_barrier *
 emit_barrier_before (rtx before)
 {
-  rtx insn = rtx_alloc (BARRIER);
+  rtx_barrier *insn = as_a <rtx_barrier *> (rtx_alloc (BARRIER));
 
   INSN_UID (insn) = cur_insn_uid++;
 
@@ -4355,13 +4355,13 @@ emit_barrier_before (rtx before)
 
 /* Emit the label LABEL before the insn BEFORE.  */
 
-rtx
+rtx_insn *
 emit_label_before (rtx label, rtx before)
 {
   gcc_checking_assert (INSN_UID (label) == 0);
   INSN_UID (label) = cur_insn_uid++;
   add_insn_before (label, before, NULL);
-  return label;
+  return as_a <rtx_insn *> (label);
 }
 
 /* Helper for emit_insn_after, handles lists of instructions
@@ -4410,7 +4410,7 @@ emit_insn_after_1 (rtx first, rtx after, basic_block bb)
   return last;
 }
 
-static rtx
+static rtx_insn *
 emit_pattern_after_noloc (rtx x, rtx after, basic_block bb,
                          rtx_insn *(*make_raw)(rtx))
 {
@@ -4419,7 +4419,7 @@ emit_pattern_after_noloc (rtx x, rtx after, basic_block 
bb,
   gcc_assert (after);
 
   if (x == NULL_RTX)
-    return last;
+    return as_a_nullable <rtx_insn *> (last);
 
   switch (GET_CODE (x))
     {
@@ -4445,13 +4445,13 @@ emit_pattern_after_noloc (rtx x, rtx after, basic_block 
bb,
       break;
     }
 
-  return last;
+  return as_a_nullable <rtx_insn *> (last);
 }
 
 /* Make X be output after the insn AFTER and set the BB of insn.  If
    BB is NULL, an attempt is made to infer the BB from AFTER.  */
 
-rtx
+rtx_insn *
 emit_insn_after_noloc (rtx x, rtx after, basic_block bb)
 {
   return emit_pattern_after_noloc (x, after, bb, make_insn_raw);
@@ -4461,7 +4461,7 @@ emit_insn_after_noloc (rtx x, rtx after, basic_block bb)
 /* Make an insn of code JUMP_INSN with body X
    and output it after the insn AFTER.  */
 
-rtx
+rtx_insn *
 emit_jump_insn_after_noloc (rtx x, rtx after)
 {
   return emit_pattern_after_noloc (x, after, NULL, make_jump_insn_raw);
@@ -4470,7 +4470,7 @@ emit_jump_insn_after_noloc (rtx x, rtx after)
 /* Make an instruction with body X and code CALL_INSN
    and output it after the instruction AFTER.  */
 
-rtx
+rtx_insn *
 emit_call_insn_after_noloc (rtx x, rtx after)
 {
   return emit_pattern_after_noloc (x, after, NULL, make_call_insn_raw);
@@ -4479,7 +4479,7 @@ emit_call_insn_after_noloc (rtx x, rtx after)
 /* Make an instruction with body X and code CALL_INSN
    and output it after the instruction AFTER.  */
 
-rtx
+rtx_insn *
 emit_debug_insn_after_noloc (rtx x, rtx after)
 {
   return emit_pattern_after_noloc (x, after, NULL, make_debug_insn_raw);
@@ -4488,10 +4488,10 @@ emit_debug_insn_after_noloc (rtx x, rtx after)
 /* Make an insn of code BARRIER
    and output it after the insn AFTER.  */
 
-rtx
+rtx_barrier *
 emit_barrier_after (rtx after)
 {
-  rtx insn = rtx_alloc (BARRIER);
+  rtx_barrier *insn = as_a <rtx_barrier *> (rtx_alloc (BARRIER));
 
   INSN_UID (insn) = cur_insn_uid++;
 
@@ -4501,13 +4501,13 @@ emit_barrier_after (rtx after)
 
 /* Emit the label LABEL after the insn AFTER.  */
 
-rtx
+rtx_insn *
 emit_label_after (rtx label, rtx after)
 {
   gcc_checking_assert (INSN_UID (label) == 0);
   INSN_UID (label) = cur_insn_uid++;
   add_insn_after (label, after, NULL);
-  return label;
+  return as_a <rtx_insn *> (label);
 }
 
 /* Notes require a bit of special handling: Some notes need to have their
@@ -4577,14 +4577,14 @@ emit_note_before (enum insn_note subtype, rtx before)
 /* Insert PATTERN after AFTER, setting its INSN_LOCATION to LOC.
    MAKE_RAW indicates how to turn PATTERN into a real insn.  */
 
-static rtx
+static rtx_insn *
 emit_pattern_after_setloc (rtx pattern, rtx after, int loc,
                           rtx_insn *(*make_raw) (rtx))
 {
   rtx last = emit_pattern_after_noloc (pattern, after, NULL, make_raw);
 
   if (pattern == NULL_RTX || !loc)
-    return last;
+    return as_a_nullable <rtx_insn *> (last);
 
   after = NEXT_INSN (after);
   while (1)
@@ -4595,14 +4595,14 @@ emit_pattern_after_setloc (rtx pattern, rtx after, int 
loc,
        break;
       after = NEXT_INSN (after);
     }
-  return last;
+  return as_a_nullable <rtx_insn *> (last);
 }
 
 /* Insert PATTERN after AFTER.  MAKE_RAW indicates how to turn PATTERN
    into a real insn.  SKIP_DEBUG_INSNS indicates whether to insert after
    any DEBUG_INSNs.  */
 
-static rtx
+static rtx_insn *
 emit_pattern_after (rtx pattern, rtx after, bool skip_debug_insns,
                    rtx_insn *(*make_raw) (rtx))
 {
@@ -4620,56 +4620,56 @@ emit_pattern_after (rtx pattern, rtx after, bool 
skip_debug_insns,
 }
 
 /* Like emit_insn_after_noloc, but set INSN_LOCATION according to LOC.  */
-rtx
+rtx_insn *
 emit_insn_after_setloc (rtx pattern, rtx after, int loc)
 {
   return emit_pattern_after_setloc (pattern, after, loc, make_insn_raw);
 }
 
 /* Like emit_insn_after_noloc, but set INSN_LOCATION according to AFTER.  */
-rtx
+rtx_insn *
 emit_insn_after (rtx pattern, rtx after)
 {
   return emit_pattern_after (pattern, after, true, make_insn_raw);
 }
 
 /* Like emit_jump_insn_after_noloc, but set INSN_LOCATION according to LOC.  */
-rtx
+rtx_insn *
 emit_jump_insn_after_setloc (rtx pattern, rtx after, int loc)
 {
   return emit_pattern_after_setloc (pattern, after, loc, make_jump_insn_raw);
 }
 
 /* Like emit_jump_insn_after_noloc, but set INSN_LOCATION according to AFTER.  
*/
-rtx
+rtx_insn *
 emit_jump_insn_after (rtx pattern, rtx after)
 {
   return emit_pattern_after (pattern, after, true, make_jump_insn_raw);
 }
 
 /* Like emit_call_insn_after_noloc, but set INSN_LOCATION according to LOC.  */
-rtx
+rtx_insn *
 emit_call_insn_after_setloc (rtx pattern, rtx after, int loc)
 {
   return emit_pattern_after_setloc (pattern, after, loc, make_call_insn_raw);
 }
 
 /* Like emit_call_insn_after_noloc, but set INSN_LOCATION according to AFTER.  
*/
-rtx
+rtx_insn *
 emit_call_insn_after (rtx pattern, rtx after)
 {
   return emit_pattern_after (pattern, after, true, make_call_insn_raw);
 }
 
 /* Like emit_debug_insn_after_noloc, but set INSN_LOCATION according to LOC.  
*/
-rtx
+rtx_insn *
 emit_debug_insn_after_setloc (rtx pattern, rtx after, int loc)
 {
   return emit_pattern_after_setloc (pattern, after, loc, make_debug_insn_raw);
 }
 
 /* Like emit_debug_insn_after_noloc, but set INSN_LOCATION according to AFTER. 
 */
-rtx
+rtx_insn *
 emit_debug_insn_after (rtx pattern, rtx after)
 {
   return emit_pattern_after (pattern, after, false, make_debug_insn_raw);
@@ -4680,7 +4680,7 @@ emit_debug_insn_after (rtx pattern, rtx after)
    indicates if PATTERN is meant for an INSN as opposed to a JUMP_INSN,
    CALL_INSN, etc.  */
 
-static rtx
+static rtx_insn *
 emit_pattern_before_setloc (rtx pattern, rtx before, int loc, bool insnp,
                            rtx_insn *(*make_raw) (rtx))
 {
@@ -4690,7 +4690,7 @@ emit_pattern_before_setloc (rtx pattern, rtx before, int 
loc, bool insnp,
                                         NULL, make_raw);
 
   if (pattern == NULL_RTX || !loc)
-    return last;
+    return as_a_nullable <rtx_insn *> (last);
 
   if (!first)
     first = get_insns ();
@@ -4704,7 +4704,7 @@ emit_pattern_before_setloc (rtx pattern, rtx before, int 
loc, bool insnp,
        break;
       first = NEXT_INSN (first);
     }
-  return last;
+  return as_a_nullable <rtx_insn *> (last);
 }
 
 /* Insert PATTERN before BEFORE.  MAKE_RAW indicates how to turn PATTERN
@@ -4712,7 +4712,7 @@ emit_pattern_before_setloc (rtx pattern, rtx before, int 
loc, bool insnp,
    before any DEBUG_INSNs.  INSNP indicates if PATTERN is meant for an
    INSN as opposed to a JUMP_INSN, CALL_INSN, etc.  */
 
-static rtx
+static rtx_insn *
 emit_pattern_before (rtx pattern, rtx before, bool skip_debug_insns,
                     bool insnp, rtx_insn *(*make_raw) (rtx))
 {
@@ -4732,7 +4732,7 @@ emit_pattern_before (rtx pattern, rtx before, bool 
skip_debug_insns,
 }
 
 /* Like emit_insn_before_noloc, but set INSN_LOCATION according to LOC.  */
-rtx
+rtx_insn *
 emit_insn_before_setloc (rtx pattern, rtx before, int loc)
 {
   return emit_pattern_before_setloc (pattern, before, loc, true,
@@ -4740,14 +4740,14 @@ emit_insn_before_setloc (rtx pattern, rtx before, int 
loc)
 }
 
 /* Like emit_insn_before_noloc, but set INSN_LOCATION according to BEFORE.  */
-rtx
+rtx_insn *
 emit_insn_before (rtx pattern, rtx before)
 {
   return emit_pattern_before (pattern, before, true, true, make_insn_raw);
 }
 
 /* like emit_insn_before_noloc, but set INSN_LOCATION according to LOC.  */
-rtx
+rtx_insn *
 emit_jump_insn_before_setloc (rtx pattern, rtx before, int loc)
 {
   return emit_pattern_before_setloc (pattern, before, loc, false,
@@ -4755,7 +4755,7 @@ emit_jump_insn_before_setloc (rtx pattern, rtx before, 
int loc)
 }
 
 /* Like emit_jump_insn_before_noloc, but set INSN_LOCATION according to 
BEFORE.  */
-rtx
+rtx_insn *
 emit_jump_insn_before (rtx pattern, rtx before)
 {
   return emit_pattern_before (pattern, before, true, false,
@@ -4763,7 +4763,7 @@ emit_jump_insn_before (rtx pattern, rtx before)
 }
 
 /* Like emit_insn_before_noloc, but set INSN_LOCATION according to LOC.  */
-rtx
+rtx_insn *
 emit_call_insn_before_setloc (rtx pattern, rtx before, int loc)
 {
   return emit_pattern_before_setloc (pattern, before, loc, false,
@@ -4772,7 +4772,7 @@ emit_call_insn_before_setloc (rtx pattern, rtx before, 
int loc)
 
 /* Like emit_call_insn_before_noloc,
    but set insn_location according to BEFORE.  */
-rtx
+rtx_insn *
 emit_call_insn_before (rtx pattern, rtx before)
 {
   return emit_pattern_before (pattern, before, true, false,
@@ -4780,7 +4780,7 @@ emit_call_insn_before (rtx pattern, rtx before)
 }
 
 /* Like emit_insn_before_noloc, but set INSN_LOCATION according to LOC.  */
-rtx
+rtx_insn *
 emit_debug_insn_before_setloc (rtx pattern, rtx before, int loc)
 {
   return emit_pattern_before_setloc (pattern, before, loc, false,
@@ -4789,7 +4789,7 @@ emit_debug_insn_before_setloc (rtx pattern, rtx before, 
int loc)
 
 /* Like emit_debug_insn_before_noloc,
    but set insn_location according to BEFORE.  */
-rtx
+rtx_insn *
 emit_debug_insn_before (rtx pattern, rtx before)
 {
   return emit_pattern_before (pattern, before, false, false,
@@ -4801,11 +4801,11 @@ emit_debug_insn_before (rtx pattern, rtx before)
 
    Returns the last insn emitted.  */
 
-rtx
+rtx_insn *
 emit_insn (rtx x)
 {
-  rtx last = get_last_insn ();
-  rtx insn;
+  rtx_insn *last = get_last_insn ();
+  rtx_insn *insn;
 
   if (x == NULL_RTX)
     return last;
@@ -4819,10 +4819,10 @@ emit_insn (rtx x)
     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 (insn);
          last = insn;
          insn = next;
@@ -4848,11 +4848,11 @@ emit_insn (rtx x)
 /* Make an insn of code DEBUG_INSN with pattern X
    and add it to the end of the doubly-linked list.  */
 
-rtx
+rtx_insn *
 emit_debug_insn (rtx x)
 {
-  rtx last = get_last_insn ();
-  rtx insn;
+  rtx_insn *last = get_last_insn ();
+  rtx_insn *insn;
 
   if (x == NULL_RTX)
     return last;
@@ -4866,10 +4866,10 @@ emit_debug_insn (rtx x)
     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 (insn);
          last = insn;
          insn = next;
@@ -4895,10 +4895,11 @@ emit_debug_insn (rtx x)
 /* Make an insn of code JUMP_INSN with pattern X
    and add it to the end of the doubly-linked list.  */
 
-rtx
+rtx_insn *
 emit_jump_insn (rtx x)
 {
-  rtx last = NULL_RTX, insn;
+  rtx_insn *last = NULL;
+  rtx_insn *insn;
 
   switch (GET_CODE (x))
     {
@@ -4909,10 +4910,10 @@ emit_jump_insn (rtx x)
     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 (insn);
          last = insn;
          insn = next;
@@ -4938,10 +4939,10 @@ emit_jump_insn (rtx x)
 /* Make an insn of code CALL_INSN with pattern X
    and add it to the end of the doubly-linked list.  */
 
-rtx
+rtx_insn *
 emit_call_insn (rtx x)
 {
-  rtx insn;
+  rtx_insn *insn;
 
   switch (GET_CODE (x))
     {
@@ -4973,13 +4974,13 @@ emit_call_insn (rtx x)
 
 /* Add the label LABEL to the end of the doubly-linked list.  */
 
-rtx
+rtx_insn *
 emit_label (rtx label)
 {
   gcc_checking_assert (INSN_UID (label) == 0);
   INSN_UID (label) = cur_insn_uid++;
   add_insn (label);
-  return label;
+  return as_a <rtx_insn *> (label);
 }
 
 /* Make an insn of code JUMP_TABLE_DATA
@@ -5000,10 +5001,10 @@ emit_jump_table_data (rtx table)
 /* Make an insn of code BARRIER
    and add it to the end of the doubly-linked list.  */
 
-rtx
+rtx_barrier *
 emit_barrier (void)
 {
-  rtx barrier = rtx_alloc (BARRIER);
+  rtx_barrier *barrier = as_a <rtx_barrier *> (rtx_alloc (BARRIER));
   INSN_UID (barrier) = cur_insn_uid++;
   add_insn (barrier);
   return barrier;
@@ -5034,7 +5035,7 @@ emit_note (enum insn_note kind)
 
 /* Emit a clobber of lvalue X.  */
 
-rtx
+rtx_insn *
 emit_clobber (rtx x)
 {
   /* CONCATs should not appear in the insn stream.  */
@@ -5048,10 +5049,10 @@ emit_clobber (rtx x)
 
 /* Return a sequence of insns to clobber lvalue X.  */
 
-rtx
+rtx_insn *
 gen_clobber (rtx x)
 {
-  rtx seq;
+  rtx_insn *seq;
 
   start_sequence ();
   emit_clobber (x);
@@ -5062,7 +5063,7 @@ gen_clobber (rtx x)
 
 /* Emit a use of rvalue X.  */
 
-rtx
+rtx_insn *
 emit_use (rtx x)
 {
   /* CONCATs should not appear in the insn stream.  */
@@ -5076,10 +5077,10 @@ emit_use (rtx x)
 
 /* Return a sequence of insns to use rvalue X.  */
 
-rtx
+rtx_insn *
 gen_use (rtx x)
 {
-  rtx seq;
+  rtx_insn *seq;
 
   start_sequence ();
   emit_use (x);
@@ -5224,7 +5225,7 @@ classify_insn (rtx x)
 /* Emit the rtl pattern X as an appropriate kind of insn.
    If X is a label, it is simply added into the insn chain.  */
 
-rtx
+rtx_insn *
 emit (rtx x)
 {
   enum rtx_code code = classify_insn (x);
@@ -5237,7 +5238,7 @@ emit (rtx x)
       return emit_insn (x);
     case  JUMP_INSN:
       {
-       rtx insn = emit_jump_insn (x);
+       rtx_insn *insn = emit_jump_insn (x);
        if (any_uncondjump_p (insn) || GET_CODE (x) == RETURN)
          return emit_barrier ();
        return insn;
@@ -6042,10 +6043,11 @@ init_emit_once (void)
 /* Produce exact duplicate of insn INSN after AFTER.
    Care updating of libcall regions if present.  */
 
-rtx
+rtx_insn *
 emit_copy_of_insn_after (rtx insn, rtx after)
 {
-  rtx new_rtx, link;
+  rtx_insn *new_rtx;
+  rtx link;
 
   switch (GET_CODE (insn))
     {
diff --git a/gcc/emit-rtl.h b/gcc/emit-rtl.h
index f97ac49..30425c2 100644
--- a/gcc/emit-rtl.h
+++ b/gcc/emit-rtl.h
@@ -63,7 +63,7 @@ extern rtx copy_insn_1 (rtx);
 extern rtx copy_insn (rtx);
 extern rtx copy_delay_slot_insn (rtx);
 extern rtx gen_int_mode (HOST_WIDE_INT, enum machine_mode);
-extern rtx emit_copy_of_insn_after (rtx, rtx);
+extern rtx_insn *emit_copy_of_insn_after (rtx, rtx);
 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);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index ed65d1e..d519908 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2357,49 +2357,49 @@ extern rtx assign_stack_temp_for_type (enum 
machine_mode, HOST_WIDE_INT, tree);
 extern rtx assign_temp (tree, int, int);
 
 /* In emit-rtl.c */
-extern rtx emit_insn_before (rtx, rtx);
-extern rtx emit_insn_before_noloc (rtx, rtx, basic_block);
-extern rtx emit_insn_before_setloc (rtx, rtx, int);
-extern rtx emit_jump_insn_before (rtx, rtx);
-extern rtx emit_jump_insn_before_noloc (rtx, rtx);
-extern rtx emit_jump_insn_before_setloc (rtx, rtx, int);
-extern rtx emit_call_insn_before (rtx, rtx);
-extern rtx emit_call_insn_before_noloc (rtx, rtx);
-extern rtx emit_call_insn_before_setloc (rtx, rtx, int);
-extern rtx emit_debug_insn_before (rtx, rtx);
-extern rtx emit_debug_insn_before_noloc (rtx, rtx);
-extern rtx emit_debug_insn_before_setloc (rtx, rtx, int);
-extern rtx emit_barrier_before (rtx);
-extern rtx emit_label_before (rtx, rtx);
+extern rtx_insn *emit_insn_before (rtx, rtx);
+extern rtx_insn *emit_insn_before_noloc (rtx, rtx, basic_block);
+extern rtx_insn *emit_insn_before_setloc (rtx, rtx, int);
+extern rtx_insn *emit_jump_insn_before (rtx, rtx);
+extern rtx_insn *emit_jump_insn_before_noloc (rtx, rtx);
+extern rtx_insn *emit_jump_insn_before_setloc (rtx, rtx, int);
+extern rtx_insn *emit_call_insn_before (rtx, rtx);
+extern rtx_insn *emit_call_insn_before_noloc (rtx, rtx);
+extern rtx_insn *emit_call_insn_before_setloc (rtx, rtx, int);
+extern rtx_insn *emit_debug_insn_before (rtx, rtx);
+extern rtx_insn *emit_debug_insn_before_noloc (rtx, rtx);
+extern rtx_insn *emit_debug_insn_before_setloc (rtx, rtx, int);
+extern rtx_barrier *emit_barrier_before (rtx);
+extern rtx_insn *emit_label_before (rtx, rtx);
 extern rtx_note *emit_note_before (enum insn_note, rtx);
-extern rtx emit_insn_after (rtx, rtx);
-extern rtx emit_insn_after_noloc (rtx, rtx, basic_block);
-extern rtx emit_insn_after_setloc (rtx, rtx, int);
-extern rtx emit_jump_insn_after (rtx, rtx);
-extern rtx emit_jump_insn_after_noloc (rtx, rtx);
-extern rtx emit_jump_insn_after_setloc (rtx, rtx, int);
-extern rtx emit_call_insn_after (rtx, rtx);
-extern rtx emit_call_insn_after_noloc (rtx, rtx);
-extern rtx emit_call_insn_after_setloc (rtx, rtx, int);
-extern rtx emit_debug_insn_after (rtx, rtx);
-extern rtx emit_debug_insn_after_noloc (rtx, rtx);
-extern rtx emit_debug_insn_after_setloc (rtx, rtx, int);
-extern rtx emit_barrier_after (rtx);
-extern rtx emit_label_after (rtx, rtx);
+extern rtx_insn *emit_insn_after (rtx, rtx);
+extern rtx_insn *emit_insn_after_noloc (rtx, rtx, basic_block);
+extern rtx_insn *emit_insn_after_setloc (rtx, rtx, int);
+extern rtx_insn *emit_jump_insn_after (rtx, rtx);
+extern rtx_insn *emit_jump_insn_after_noloc (rtx, rtx);
+extern rtx_insn *emit_jump_insn_after_setloc (rtx, rtx, int);
+extern rtx_insn *emit_call_insn_after (rtx, rtx);
+extern rtx_insn *emit_call_insn_after_noloc (rtx, rtx);
+extern rtx_insn *emit_call_insn_after_setloc (rtx, rtx, int);
+extern rtx_insn *emit_debug_insn_after (rtx, rtx);
+extern rtx_insn *emit_debug_insn_after_noloc (rtx, rtx);
+extern rtx_insn *emit_debug_insn_after_setloc (rtx, rtx, int);
+extern rtx_barrier *emit_barrier_after (rtx);
+extern rtx_insn *emit_label_after (rtx, rtx);
 extern rtx_note *emit_note_after (enum insn_note, rtx);
-extern rtx emit_insn (rtx);
-extern rtx emit_debug_insn (rtx);
-extern rtx emit_jump_insn (rtx);
-extern rtx emit_call_insn (rtx);
-extern rtx emit_label (rtx);
+extern rtx_insn *emit_insn (rtx);
+extern rtx_insn *emit_debug_insn (rtx);
+extern rtx_insn *emit_jump_insn (rtx);
+extern rtx_insn *emit_call_insn (rtx);
+extern rtx_insn *emit_label (rtx);
 extern rtx_jump_table_data *emit_jump_table_data (rtx);
-extern rtx emit_barrier (void);
+extern rtx_barrier *emit_barrier (void);
 extern rtx_note *emit_note (enum insn_note);
 extern rtx_note *emit_note_copy (rtx_note *);
-extern rtx gen_clobber (rtx);
-extern rtx emit_clobber (rtx);
-extern rtx gen_use (rtx);
-extern rtx emit_use (rtx);
+extern rtx_insn *gen_clobber (rtx);
+extern rtx_insn *emit_clobber (rtx);
+extern rtx_insn *gen_use (rtx);
+extern rtx_insn *emit_use (rtx);
 extern rtx_insn *make_insn_raw (rtx);
 extern void add_function_usage_to (rtx, rtx);
 extern rtx_call_insn *last_call_insn (void);
@@ -3067,7 +3067,7 @@ extern void add_insn (rtx);
 extern void add_insn_before (rtx, rtx, basic_block);
 extern void add_insn_after (rtx, rtx, basic_block);
 extern void remove_insn (rtx);
-extern rtx emit (rtx);
+extern rtx_insn *emit (rtx);
 extern void delete_insn (rtx);
 extern rtx_insn *entry_of_function (void);
 extern void emit_insn_at_entry (rtx);
-- 
1.8.5.3

Reply via email to