On Wed, 2014-08-13 at 11:52 -0600, Jeff Law wrote:
> On 08/06/14 11:20, David Malcolm wrote:
> > 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.
> OK.  This will require the obvious updates for the nullable change.

Thanks.

Fixed up and committed to trunk as r214194, having having
bootstrapped&regrtested on x86_64-unknown-linux-gnu (Fedora 20) albeit
in combination with patches 30-39, and verified that it builds
standalone both for that target, and for sh-elf, to give additional
coverage for the sh.c change.

Am attaching what I committed.

Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog	(revision 214193)
+++ gcc/ChangeLog	(revision 214194)
@@ -1,5 +1,126 @@
 2014-08-19  David Malcolm  <dmalc...@redhat.com>
 
+	* 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.
+
+2014-08-19  David Malcolm  <dmalc...@redhat.com>
+
 	* emit-rtl.c (emit_jump_table_data): Strengthen return type from
 	rtx to rtx_jump_table_data *.  Also for local.
 	* rtl.h (emit_jump_table_data): Likewise.
Index: gcc/emit-rtl.c
===================================================================
--- gcc/emit-rtl.c	(revision 214193)
+++ gcc/emit-rtl.c	(revision 214194)
@@ -4269,7 +4269,7 @@
    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))
 {
@@ -4278,7 +4278,7 @@
   gcc_assert (before);
 
   if (x == NULL_RTX)
-    return last;
+    return safe_as_a <rtx_insn *> (last);
 
   switch (GET_CODE (x))
     {
@@ -4311,12 +4311,12 @@
       break;
     }
 
-  return last;
+  return safe_as_a <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);
@@ -4325,7 +4325,7 @@
 /* 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,
@@ -4335,7 +4335,7 @@
 /* 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,
@@ -4345,7 +4345,7 @@
 /* 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,
@@ -4355,10 +4355,10 @@
 /* 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++;
 
@@ -4368,13 +4368,13 @@
 
 /* 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
@@ -4423,7 +4423,7 @@
   return last;
 }
 
-static rtx
+static rtx_insn *
 emit_pattern_after_noloc (rtx x, rtx after, basic_block bb,
 			  rtx_insn *(*make_raw)(rtx))
 {
@@ -4432,7 +4432,7 @@
   gcc_assert (after);
 
   if (x == NULL_RTX)
-    return last;
+    return safe_as_a <rtx_insn *> (last);
 
   switch (GET_CODE (x))
     {
@@ -4458,13 +4458,13 @@
       break;
     }
 
-  return last;
+  return safe_as_a <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);
@@ -4474,7 +4474,7 @@
 /* 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);
@@ -4483,7 +4483,7 @@
 /* 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);
@@ -4492,7 +4492,7 @@
 /* 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);
@@ -4501,10 +4501,10 @@
 /* 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++;
 
@@ -4514,13 +4514,13 @@
 
 /* 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
@@ -4590,7 +4590,7 @@
 /* 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))
 {
@@ -4597,7 +4597,7 @@
   rtx last = emit_pattern_after_noloc (pattern, after, NULL, make_raw);
 
   if (pattern == NULL_RTX || !loc)
-    return last;
+    return safe_as_a <rtx_insn *> (last);
 
   after = NEXT_INSN (after);
   while (1)
@@ -4608,7 +4608,7 @@
 	break;
       after = NEXT_INSN (after);
     }
-  return last;
+  return safe_as_a <rtx_insn *> (last);
 }
 
 /* Insert PATTERN after AFTER.  MAKE_RAW indicates how to turn PATTERN
@@ -4615,7 +4615,7 @@
    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))
 {
@@ -4633,7 +4633,7 @@
 }
 
 /* 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);
@@ -4640,7 +4640,7 @@
 }
 
 /* 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);
@@ -4647,7 +4647,7 @@
 }
 
 /* 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);
@@ -4654,7 +4654,7 @@
 }
 
 /* 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);
@@ -4661,7 +4661,7 @@
 }
 
 /* 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);
@@ -4668,7 +4668,7 @@
 }
 
 /* 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);
@@ -4675,7 +4675,7 @@
 }
 
 /* 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);
@@ -4682,7 +4682,7 @@
 }
 
 /* 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);
@@ -4693,7 +4693,7 @@
    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))
 {
@@ -4703,7 +4703,7 @@
                                         NULL, make_raw);
 
   if (pattern == NULL_RTX || !loc)
-    return last;
+    return safe_as_a <rtx_insn *> (last);
 
   if (!first)
     first = get_insns ();
@@ -4717,7 +4717,7 @@
 	break;
       first = NEXT_INSN (first);
     }
-  return last;
+  return safe_as_a <rtx_insn *> (last);
 }
 
 /* Insert PATTERN before BEFORE.  MAKE_RAW indicates how to turn PATTERN
@@ -4725,7 +4725,7 @@
    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))
 {
@@ -4745,7 +4745,7 @@
 }
 
 /* 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,
@@ -4753,7 +4753,7 @@
 }
 
 /* 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);
@@ -4760,7 +4760,7 @@
 }
 
 /* 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,
@@ -4768,7 +4768,7 @@
 }
 
 /* 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,
@@ -4776,7 +4776,7 @@
 }
 
 /* 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,
@@ -4785,7 +4785,7 @@
 
 /* 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,
@@ -4793,7 +4793,7 @@
 }
 
 /* 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,
@@ -4802,7 +4802,7 @@
 
 /* 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,
@@ -4814,11 +4814,11 @@
 
    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;
@@ -4832,10 +4832,10 @@
     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;
@@ -4861,11 +4861,11 @@
 /* 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;
@@ -4879,10 +4879,10 @@
     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;
@@ -4908,10 +4908,11 @@
 /* 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))
     {
@@ -4922,10 +4923,10 @@
     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;
@@ -4951,10 +4952,10 @@
 /* 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))
     {
@@ -4986,13 +4987,13 @@
 
 /* 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
@@ -5013,10 +5014,10 @@
 /* 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;
@@ -5047,7 +5048,7 @@
 
 /* Emit a clobber of lvalue X.  */
 
-rtx
+rtx_insn *
 emit_clobber (rtx x)
 {
   /* CONCATs should not appear in the insn stream.  */
@@ -5061,10 +5062,10 @@
 
 /* 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);
@@ -5075,7 +5076,7 @@
 
 /* Emit a use of rvalue X.  */
 
-rtx
+rtx_insn *
 emit_use (rtx x)
 {
   /* CONCATs should not appear in the insn stream.  */
@@ -5089,10 +5090,10 @@
 
 /* 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);
@@ -5237,7 +5238,7 @@
 /* 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);
@@ -5250,7 +5251,7 @@
       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;
@@ -6055,10 +6056,11 @@
 /* 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))
     {
Index: gcc/emit-rtl.h
===================================================================
--- gcc/emit-rtl.h	(revision 214193)
+++ gcc/emit-rtl.h	(revision 214194)
@@ -66,7 +66,7 @@
 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);
Index: gcc/rtl.h
===================================================================
--- gcc/rtl.h	(revision 214193)
+++ gcc/rtl.h	(revision 214194)
@@ -2379,49 +2379,49 @@
 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);
@@ -3094,7 +3094,7 @@
 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);
Index: gcc/config/sh/sh.c
===================================================================
--- gcc/config/sh/sh.c	(revision 214193)
+++ gcc/config/sh/sh.c	(revision 214194)
@@ -195,7 +195,7 @@
 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);
@@ -6784,7 +6784,7 @@
 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;
@@ -6944,12 +6944,12 @@
 
 /* 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.  */
Index: gcc/cfgrtl.c
===================================================================
--- gcc/cfgrtl.c	(revision 214193)
+++ gcc/cfgrtl.c	(revision 214194)
@@ -1446,7 +1446,7 @@
 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)

Reply via email to