diff mbox

Improve RTL dumps

Message ID 20100729161942.GH18378@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek July 29, 2010, 4:19 p.m. UTC
On Tue, Jul 27, 2010 at 05:02:26PM +0200, Bernd Schmidt wrote:
> I've been annoyed for a while about the source file/line information in
> RTL dumps; their placement as operand 4 makes "diff -y" practically
> useless since you can't see the start of the pattern if the filenames
> are long.
> 
> This patch switches operands 4 and 5 of INSNs etc., and also tweaks
> print_rtx to place REG_NOTES on a new line.

It unfortunately broke printing of NOTEs, no NOTE_DATA is printed any more.

Attached is an (untested) patch to fix that, but I think it would be much
better to revert NOTE related changes in your patch.  They make things
worse, when the note name is moved before the note data, so the meat
of e.g. NOTE_INSN_VAR_LOCATION is shifted by 23 characters to the right.
So the second patch reverts those changes.

	Jakub
2010-07-29  Jakub Jelinek  <jakub@redhat.com>

	* rtl.def (NOTE): Adjust documentation.
	* print-rtl.c (print_rtx): Print NOTE_DATA for i == 5
	instead of i == 4.
2010-07-29  Jakub Jelinek  <jakub@redhat.com>

	Revert:
	* rtl.def (NOTE): Swap operands 4 and 5.
        * rtl.h (NOTE_DATA, NOTE_DELETED_LABEL_NAME, NOTE_BLOCK,
	NOTE_EH_HANDLER, NOTE_BASIC_BLOCK, NOTE_VAR_LOCATION, NOTE_KIND):
	Adjust accordingly.
        * gengtype.c (adjust_field_rtx_def): Swap operands 4 and 5 of NOTEs.

--- gcc/gengtype.c.jj	2010-07-28 10:36:00.000000000 +0200
+++ gcc/gengtype.c	2010-07-29 17:48:49.000000000 +0200
@@ -1112,9 +1112,9 @@ adjust_field_rtx_def (type_p t, options_
 	      else if (i == LABEL_REF
 		       && (aindex == 1 || aindex == 2))
 		t = rtx_tp, subname = "rt_rtx";
-	      else if (i == NOTE && aindex == 5)
-		t = note_union_tp, subname = "";
 	      else if (i == NOTE && aindex == 4)
+		t = note_union_tp, subname = "";
+	      else if (i == NOTE && aindex == 5)
 		t = scalar_tp, subname = "rt_int";
 	      else if (i == NOTE && aindex >= 7)
 		t = scalar_tp, subname = "rt_int";
--- gcc/rtl.def.jj	2010-07-28 10:36:00.000000000 +0200
+++ gcc/rtl.def	2010-07-29 17:45:51.000000000 +0200
@@ -155,7 +155,7 @@ DEF_RTL_EXPR(CODE_LABEL, "code_label", "
    4: note-specific data
    5: enum insn_note
    6: unique number if insn_note == note_insn_deleted_label.  */
-DEF_RTL_EXPR(NOTE, "note", "iuuBn0i", RTX_EXTRA)
+DEF_RTL_EXPR(NOTE, "note", "iuuB0ni", RTX_EXTRA)
 
 /* ----------------------------------------------------------------------
    Top level constituents of INSN, JUMP_INSN and CALL_INSN.
--- gcc/rtl.h.jj	2010-07-28 10:36:00.000000000 +0200
+++ gcc/rtl.h	2010-07-29 17:46:42.000000000 +0200
@@ -871,17 +871,17 @@ extern const char * const reg_note_name[
    */
 
 /* Opaque data.  */
-#define NOTE_DATA(INSN)	        RTL_CHECKC1 (INSN, 5, NOTE)
-#define NOTE_DELETED_LABEL_NAME(INSN) XCSTR (INSN, 5, NOTE)
+#define NOTE_DATA(INSN)	        RTL_CHECKC1 (INSN, 4, NOTE)
+#define NOTE_DELETED_LABEL_NAME(INSN) XCSTR (INSN, 4, NOTE)
 #define SET_INSN_DELETED(INSN) set_insn_deleted (INSN);
-#define NOTE_BLOCK(INSN)	XCTREE (INSN, 5, NOTE)
-#define NOTE_EH_HANDLER(INSN)	XCINT (INSN, 5, NOTE)
-#define NOTE_BASIC_BLOCK(INSN)	XCBBDEF (INSN, 5, NOTE)
-#define NOTE_VAR_LOCATION(INSN)	XCEXP (INSN, 5, NOTE)
+#define NOTE_BLOCK(INSN)	XCTREE (INSN, 4, NOTE)
+#define NOTE_EH_HANDLER(INSN)	XCINT (INSN, 4, NOTE)
+#define NOTE_BASIC_BLOCK(INSN)	XCBBDEF (INSN, 4, NOTE)
+#define NOTE_VAR_LOCATION(INSN)	XCEXP (INSN, 4, NOTE)
 
 /* In a NOTE that is a line number, this is the line number.
    Other kinds of NOTEs are identified by negative numbers here.  */
-#define NOTE_KIND(INSN) XCINT (INSN, 4, NOTE)
+#define NOTE_KIND(INSN) XCINT (INSN, 5, NOTE)
 
 /* Nonzero if INSN is a note marking the beginning of a basic block.  */
 #define NOTE_INSN_BASIC_BLOCK_P(INSN)			\

Comments

Bernd Schmidt July 29, 2010, 4:20 p.m. UTC | #1
On 07/29/2010 06:19 PM, Jakub Jelinek wrote:
> It unfortunately broke printing of NOTEs, no NOTE_DATA is printed any more.
> 
> Attached is an (untested) patch to fix that, but I think it would be much
> better to revert NOTE related changes in your patch.  They make things
> worse, when the note name is moved before the note data, so the meat
> of e.g. NOTE_INSN_VAR_LOCATION is shifted by 23 characters to the right.
> So the second patch reverts those changes.

Either one is fine.  Thanks.


Bernd
diff mbox

Patch

--- gcc/rtl.def.jj	2010-07-28 10:36:00.000000000 +0200
+++ gcc/rtl.def	2010-07-29 17:40:28.000000000 +0200
@@ -152,8 +152,8 @@  DEF_RTL_EXPR(CODE_LABEL, "code_label", "
 
 /* Say where in the code a source line starts, for symbol table's sake.
    Operand:
-   4: note-specific data
-   5: enum insn_note
+   4: enum insn_note
+   5: note-specific data
    6: unique number if insn_note == note_insn_deleted_label.  */
 DEF_RTL_EXPR(NOTE, "note", "iuuBn0i", RTX_EXTRA)
 
--- gcc/print-rtl.c.jj	2010-07-28 10:36:00.000000000 +0200
+++ gcc/print-rtl.c	2010-07-29 17:43:35.000000000 +0200
@@ -245,7 +245,7 @@  print_rtx (const_rtx in_rtx)
 	      print_node_brief (outfile, "", decl, dump_flags);
 	  }
 #endif
-	else if (i == 4 && NOTE_P (in_rtx))
+	else if (i == 5 && NOTE_P (in_rtx))
 	  {
 	    switch (NOTE_KIND (in_rtx))
 	      {