This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 030/236] Convert various rtx to rtx_note *


On Wed, 2014-08-06 at 13:20 -0400, David Malcolm wrote:
> gcc/
> 	* basic-block.h (create_basic_block_structure): Strengthen third
> 	param "bb_note" from rtx to rtx_note *.
> 	* rtl.h (emit_note_before): Strengthen return type from rtx to
> 	rtx_note *.
> 	(emit_note_after): Likewise.
> 	(emit_note): Likewise.
> 	(emit_note_copy): Likewise.  Also, strengthen param similarly.
> 	* function.h (struct rtl_data): Strengthen field
> 	"x_stack_check_probe_note" from rtx to rtx_note *.
> 
> 	* cfgexpand.c (expand_gimple_basic_block): Strengthen local "note"
> 	from rtx to rtx_note *.
> 	* cfgrtl.c (create_basic_block_structure): Strengthen third param
> 	"bb_note" from rtx to rtx_note *.
> 	(duplicate_insn_chain): Likewise for local "last".  Add a checked cast
> 	when calling emit_note_copy.
> 	* emit-rtl.c (make_note_raw): Strengthen return type from rtx to
> 	rtx_note *.
> 	(emit_note_after): Likewise.
> 	(emit_note_before): Likewise.
> 	(emit_note_copy): Likewise.  Also, strengthen param similarly.
> 	(emit_note): Likewise.
> 	* except.c (convert_to_eh_region_ranges): Strengthen local "note"
> 	from rtx to rtx_note *.
> 	* final.c (change_scope): Likewise.
> 	(reemit_insn_block_notes): Likewise, for both locals named "note".
> 	Also, strengthen local "insn" from rtx to rtx_insn *.
> 	* haifa-sched.c (sched_extend_bb): Strengthen local "note" from
> 	rtx to rtx_note *.
> 	* reg-stack.c (compensate_edge): Likewise for local "after". Also,
> 	strengthen local "seq" from rtx to rtx_insn *.
> 	* reload1.c (reload_as_needed): Strengthen local "marker" from rtx
> 	to rtx_note *.
> 	* sel-sched-ir.c (bb_note_pool): Strengthen from rtx_vec_t to
> 	vec<rtx_note *>.
> 	(get_bb_note_from_pool): Strengthen return type from rtx to
> 	rtx_note *.
> 	(sel_create_basic_block): Strengthen local "new_bb_note" from
> 	insn_t to rtx_note *.
> 	* var-tracking.c (emit_note_insn_var_location): Strengthen local
> 	"note" from rtx to rtx_note *.
> 	(emit_notes_in_bb): Likewise.

I believe this is covered by Jeff's blanket approval here:
https://gcc.gnu.org/ml/gcc-patches/2014-08/msg01337.html

Successfully bootstrapped&regrtested on x86_64-unknown-linux-gnu
(Fedora 20) albeit in combination with patches 31-39, and verified that
it builds standalone for 7 targets. 

Committed to trunk as r214192.

This required some additional changes relative to what I originally
posted, specifically to emit_note_eh_region_end (since
emit_note_eh_region_end was added in r212171).  I'm attaching what I
actually committed.


Index: gcc/final.c
===================================================================
--- gcc/final.c	(revision 214191)
+++ gcc/final.c	(revision 214192)
@@ -1631,7 +1631,7 @@
   s = s1;
   while (s != com)
     {
-      rtx note = emit_note_before (NOTE_INSN_BLOCK_END, insn);
+      rtx_note *note = emit_note_before (NOTE_INSN_BLOCK_END, insn);
       NOTE_BLOCK (note) = s;
       s = BLOCK_SUPERCONTEXT (s);
     }
@@ -1653,7 +1653,8 @@
 reemit_insn_block_notes (void)
 {
   tree cur_block = DECL_INITIAL (cfun->decl);
-  rtx insn, note;
+  rtx_insn *insn;
+  rtx_note *note;
 
   insn = get_insns ();
   for (; insn; insn = NEXT_INSN (insn))
@@ -1666,7 +1667,7 @@
           for (tree s = cur_block; s != DECL_INITIAL (cfun->decl);
                s = BLOCK_SUPERCONTEXT (s))
             {
-              rtx note = emit_note_before (NOTE_INSN_BLOCK_END, insn);
+              rtx_note *note = emit_note_before (NOTE_INSN_BLOCK_END, insn);
               NOTE_BLOCK (note) = s;
               note = emit_note_after (NOTE_INSN_BLOCK_BEG, insn);
               NOTE_BLOCK (note) = s;
Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog	(revision 214191)
+++ gcc/ChangeLog	(revision 214192)
@@ -1,6 +1,53 @@
 2014-08-19  David Malcolm  <dmalcolm@redhat.com>
 
+	* basic-block.h (create_basic_block_structure): Strengthen third
+	param "bb_note" from rtx to rtx_note *.
+	* rtl.h (emit_note_before): Strengthen return type from rtx to
+	rtx_note *.
+	(emit_note_after): Likewise.
+	(emit_note): Likewise.
+	(emit_note_copy): Likewise.  Also, strengthen param similarly.
 	* function.h (struct rtl_data): Strengthen field
+	"x_stack_check_probe_note" from rtx to rtx_note *.
+
+	* cfgexpand.c (expand_gimple_basic_block): Strengthen local "note"
+	from rtx to rtx_note *.
+	* cfgrtl.c (create_basic_block_structure): Strengthen third param
+	"bb_note" from rtx to rtx_note *.
+	(duplicate_insn_chain): Likewise for local "last".  Add a checked cast
+	when calling emit_note_copy.
+	* emit-rtl.c (make_note_raw): Strengthen return type from rtx to
+	rtx_note *.
+	(emit_note_after): Likewise.
+	(emit_note_before): Likewise.
+	(emit_note_copy): Likewise.  Also, strengthen param similarly.
+	(emit_note): Likewise.
+	* except.c (emit_note_eh_region_end): Likewise for return type.
+	Strengthen local "next" from rtx to rtx_insn *.
+	(convert_to_eh_region_ranges): Strengthen local "note"
+	from rtx to rtx_note *.
+	* final.c (change_scope): Likewise.
+	(reemit_insn_block_notes): Likewise, for both locals named "note".
+	Also, strengthen local "insn" from rtx to rtx_insn *.
+	* haifa-sched.c (sched_extend_bb): Strengthen local "note" from
+	rtx to rtx_note *.
+	* reg-stack.c (compensate_edge): Likewise for local "after". Also,
+	strengthen local "seq" from rtx to rtx_insn *.
+	* reload1.c (reload_as_needed): Strengthen local "marker" from rtx
+	to rtx_note *.
+	* sel-sched-ir.c (bb_note_pool): Strengthen from rtx_vec_t to
+	vec<rtx_note *>.
+	(get_bb_note_from_pool): Strengthen return type from rtx to
+	rtx_note *.
+	(sel_create_basic_block): Strengthen local "new_bb_note" from
+	insn_t to rtx_note *.
+	* var-tracking.c (emit_note_insn_var_location): Strengthen local
+	"note" from rtx to rtx_note *.
+	(emit_notes_in_bb): Likewise.
+
+2014-08-19  David Malcolm  <dmalcolm@redhat.com>
+
+	* function.h (struct rtl_data): Strengthen field
 	"x_parm_birth_insn" from rtx to rtx_insn *.
 	* function.c (struct assign_parm_data_all): Strengthen fields
 	"first_conversion_insn" and "last_conversion_insn" from rtx to
Index: gcc/haifa-sched.c
===================================================================
--- gcc/haifa-sched.c	(revision 214191)
+++ gcc/haifa-sched.c	(revision 214192)
@@ -7610,7 +7610,7 @@
 	  /* Don't emit a NOTE if it would end up before a BARRIER.  */
 	  && !BARRIER_P (NEXT_INSN (end))))
     {
-      rtx note = emit_note_after (NOTE_INSN_DELETED, end);
+      rtx_note *note = emit_note_after (NOTE_INSN_DELETED, end);
       /* Make note appear outside BB.  */
       set_block_for_insn (note, NULL);
       SET_BB_END (EXIT_BLOCK_PTR_FOR_FN (cfun)->prev_bb) = end;
Index: gcc/sel-sched-ir.c
===================================================================
--- gcc/sel-sched-ir.c	(revision 214191)
+++ gcc/sel-sched-ir.c	(revision 214192)
@@ -126,7 +126,7 @@
 } nop_pool = { NULL, 0, 0 };
 
 /* The pool for basic block notes.  */
-static rtx_vec_t bb_note_pool;
+static vec<rtx_note *> bb_note_pool;
 
 /* A NOP pattern used to emit placeholder insns.  */
 rtx nop_pattern = NULL_RTX;
@@ -4976,14 +4976,14 @@
 }
 
 /* Get a bb_note from pool or return NULL_RTX if pool is empty.  */
-static rtx
+static rtx_note *
 get_bb_note_from_pool (void)
 {
   if (bb_note_pool.is_empty ())
-    return NULL_RTX;
+    return NULL;
   else
     {
-      rtx note = bb_note_pool.pop ();
+      rtx_note *note = bb_note_pool.pop ();
 
       SET_PREV_INSN (note) = NULL_RTX;
       SET_NEXT_INSN (note) = NULL_RTX;
@@ -5341,7 +5341,7 @@
 sel_create_basic_block (void *headp, void *endp, basic_block after)
 {
   basic_block new_bb;
-  insn_t new_bb_note;
+  rtx_note *new_bb_note;
 
   gcc_assert (flag_sel_sched_pipelining_outer_loops
               || !last_added_blocks.exists ());
Index: gcc/function.h
===================================================================
--- gcc/function.h	(revision 214191)
+++ gcc/function.h	(revision 214192)
@@ -286,7 +286,7 @@
   struct frame_space *frame_space_list;
 
   /* Place after which to insert the tail_recursion_label if we need one.  */
-  rtx x_stack_check_probe_note;
+  rtx_note *x_stack_check_probe_note;
 
   /* Location at which to save the argument pointer if it will need to be
      referenced.  There are two cases where this is done: if nonlocal gotos
Index: gcc/except.c
===================================================================
--- gcc/except.c	(revision 214191)
+++ gcc/except.c	(revision 214192)
@@ -2458,10 +2458,10 @@
   return call_site_base + crtl->eh.call_site_record_v[section]->length () - 1;
 }
 
-static rtx
+static rtx_note *
 emit_note_eh_region_end (rtx insn)
 {
-  rtx next = NEXT_INSN (insn);
+  rtx_insn *next = NEXT_INSN (insn);
 
   /* Make sure we do not split a call and its corresponding
      CALL_ARG_LOCATION note.  */
@@ -2479,7 +2479,8 @@
 static unsigned int
 convert_to_eh_region_ranges (void)
 {
-  rtx insn, iter, note;
+  rtx insn, iter;
+  rtx_note *note;
   action_hash_type ar_hash (31);
   int last_action = -3;
   rtx last_action_insn = NULL_RTX;
Index: gcc/emit-rtl.c
===================================================================
--- gcc/emit-rtl.c	(revision 214191)
+++ gcc/emit-rtl.c	(revision 214192)
@@ -3852,7 +3852,7 @@
 
 /* Like `make_insn_raw' but make a NOTE instead of an insn.  */
 
-static rtx
+static rtx_note *
 make_note_raw (enum insn_note subtype)
 {
   /* Some notes are never created this way at all.  These notes are
@@ -3860,7 +3860,7 @@
   gcc_assert (subtype != NOTE_INSN_DELETED_LABEL
 	      && subtype != NOTE_INSN_DELETED_DEBUG_LABEL);
 
-  rtx note = rtx_alloc (NOTE);
+  rtx_note *note = as_a <rtx_note *> (rtx_alloc (NOTE));
   INSN_UID (note) = cur_insn_uid++;
   NOTE_KIND (note) = subtype;
   BLOCK_FOR_INSN (note) = NULL;
@@ -4557,10 +4557,10 @@
 
 /* Emit a note of subtype SUBTYPE after the insn AFTER.  */
 
-rtx
+rtx_note *
 emit_note_after (enum insn_note subtype, rtx after)
 {
-  rtx note = make_note_raw (subtype);
+  rtx_note *note = make_note_raw (subtype);
   basic_block bb = BARRIER_P (after) ? NULL : BLOCK_FOR_INSN (after);
   bool on_bb_boundary_p = (bb != NULL && BB_END (bb) == after);
 
@@ -4573,10 +4573,10 @@
 
 /* Emit a note of subtype SUBTYPE before the insn BEFORE.  */
 
-rtx
+rtx_note *
 emit_note_before (enum insn_note subtype, rtx before)
 {
-  rtx note = make_note_raw (subtype);
+  rtx_note *note = make_note_raw (subtype);
   basic_block bb = BARRIER_P (before) ? NULL : BLOCK_FOR_INSN (before);
   bool on_bb_boundary_p = (bb != NULL && BB_HEAD (bb) == before);
 
@@ -5023,11 +5023,11 @@
 
 /* Emit a copy of note ORIG.  */
 
-rtx
-emit_note_copy (rtx orig)
+rtx_note *
+emit_note_copy (rtx_note *orig)
 {
   enum insn_note kind = (enum insn_note) NOTE_KIND (orig);
-  rtx note = make_note_raw (kind);
+  rtx_note *note = make_note_raw (kind);
   NOTE_DATA (note) = NOTE_DATA (orig);
   add_insn (note);
   return note;
@@ -5036,10 +5036,10 @@
 /* Make an insn of code NOTE or type NOTE_NO
    and add it to the end of the doubly-linked list.  */
 
-rtx
+rtx_note *
 emit_note (enum insn_note kind)
 {
-  rtx note = make_note_raw (kind);
+  rtx_note *note = make_note_raw (kind);
   add_insn (note);
   return note;
 }
Index: gcc/cfgexpand.c
===================================================================
--- gcc/cfgexpand.c	(revision 214191)
+++ gcc/cfgexpand.c	(revision 214192)
@@ -4893,7 +4893,7 @@
   gimple_stmt_iterator gsi;
   gimple_seq stmts;
   gimple stmt = NULL;
-  rtx note;
+  rtx_note *note;
   rtx_insn *last;
   edge e;
   edge_iterator ei;
@@ -4965,7 +4965,7 @@
       maybe_dump_rtl_for_gimple_stmt (stmt, last);
     }
   else
-    note = SET_BB_HEAD (bb) = emit_note (NOTE_INSN_BASIC_BLOCK);
+    SET_BB_HEAD (bb) = note = emit_note (NOTE_INSN_BASIC_BLOCK);
 
   NOTE_BASIC_BLOCK (note) = bb;
 
Index: gcc/rtl.h
===================================================================
--- gcc/rtl.h	(revision 214191)
+++ gcc/rtl.h	(revision 214192)
@@ -2393,7 +2393,7 @@
 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 emit_note_before (enum insn_note, 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);
@@ -2408,7 +2408,7 @@
 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 emit_note_after (enum insn_note, 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);
@@ -2416,8 +2416,8 @@
 extern rtx emit_label (rtx);
 extern rtx emit_jump_table_data (rtx);
 extern rtx emit_barrier (void);
-extern rtx emit_note (enum insn_note);
-extern rtx emit_note_copy (rtx);
+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);
Index: gcc/var-tracking.c
===================================================================
--- gcc/var-tracking.c	(revision 214191)
+++ gcc/var-tracking.c	(revision 214192)
@@ -8589,7 +8589,8 @@
   rtx insn = data->insn;
   enum emit_note_where where = data->where;
   variable_table_type *vars = data->vars;
-  rtx note, note_vl;
+  rtx_note *note;
+  rtx note_vl;
   int i, j, n_var_parts;
   bool complete;
   enum var_init_status initialized = VAR_INIT_STATUS_UNINITIALIZED;
@@ -9135,7 +9136,8 @@
 	    dataflow_set_clear_at_call (set);
 	    emit_notes_for_changes (insn, EMIT_NOTE_AFTER_CALL_INSN, set->vars);
 	    {
-	      rtx arguments = mo->u.loc, *p = &arguments, note;
+	      rtx arguments = mo->u.loc, *p = &arguments;
+	      rtx_note *note;
 	      while (*p)
 		{
 		  XEXP (XEXP (*p, 0), 1)
Index: gcc/reg-stack.c
===================================================================
--- gcc/reg-stack.c	(revision 214191)
+++ gcc/reg-stack.c	(revision 214192)
@@ -2810,7 +2810,8 @@
     }
   else
     {
-      rtx seq, after;
+      rtx_insn *seq;
+      rtx_note *after;
 
       current_block = NULL;
       start_sequence ();
Index: gcc/basic-block.h
===================================================================
--- gcc/basic-block.h	(revision 214191)
+++ gcc/basic-block.h	(revision 214192)
@@ -412,7 +412,8 @@
 extern void redirect_edge_succ (edge, basic_block);
 extern edge redirect_edge_succ_nodup (edge, basic_block);
 extern void redirect_edge_pred (edge, basic_block);
-extern basic_block create_basic_block_structure (rtx, rtx, rtx, basic_block);
+extern basic_block create_basic_block_structure (rtx, rtx, rtx_note *,
+						 basic_block);
 extern void clear_bb_flags (void);
 extern void dump_bb_info (FILE *, basic_block, int, int, bool, bool);
 extern void dump_edge_info (FILE *, edge, int, int);
Index: gcc/cfgrtl.c
===================================================================
--- gcc/cfgrtl.c	(revision 214191)
+++ gcc/cfgrtl.c	(revision 214192)
@@ -272,7 +272,8 @@
    AFTER is the basic block we should be put after.  */
 
 basic_block
-create_basic_block_structure (rtx head, rtx end, rtx bb_note, basic_block after)
+create_basic_block_structure (rtx head, rtx end, rtx_note *bb_note,
+			      basic_block after)
 {
   basic_block bb;
 
@@ -4082,7 +4083,8 @@
 rtx
 duplicate_insn_chain (rtx from, rtx to)
 {
-  rtx insn, next, last, copy;
+  rtx insn, next, copy;
+  rtx_note *last;
 
   /* Avoid updating of boundaries of previous basic block.  The
      note will get removed from insn stream in fixup.  */
@@ -4150,7 +4152,7 @@
 	      break;
 
 	    case NOTE_INSN_EPILOGUE_BEG:
-	      emit_note_copy (insn);
+	      emit_note_copy (as_a <rtx_note *> (insn));
 	      break;
 
 	    default:
Index: gcc/reload1.c
===================================================================
--- gcc/reload1.c	(revision 214191)
+++ gcc/reload1.c	(revision 214192)
@@ -4573,7 +4573,8 @@
 #if defined (AUTO_INC_DEC)
   int i;
 #endif
-  rtx x, marker;
+  rtx x;
+  rtx_note *marker;
 
   memset (spill_reg_rtx, 0, sizeof spill_reg_rtx);
   memset (spill_reg_store, 0, sizeof spill_reg_store);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]