public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/7] Shrink some rtxes
@ 2014-05-10 19:55 Richard Sandiford
  2014-05-10 19:58 ` [PATCH 1/7] Fix GTY markup of u2 Richard Sandiford
                   ` (7 more replies)
  0 siblings, 8 replies; 30+ messages in thread
From: Richard Sandiford @ 2014-05-10 19:55 UTC (permalink / raw)
  To: gcc-patches

Until the wide-int merge there was a 32-bit hole on 64-bit hosts between
the end of the rtx flags and the start of the first field.  It was decided
that CONST_WIDE_INT should use this hole to store the number of HWIs.

This patch series moves the "i" and int-typed "0" fields of some
other rtxes to this region.  It mostly has to be "0" fields though.
There are other rtxes like ADDRESS and SUBREG (for the SUBREG_BYTE)
that would benefit in principle, but this would break various bits
of code that use GET_RTX_FORMAT.  Probably the most difficult format
user to update is genrecog.

UNSPEC and UNSPEC_VOLATILE would also benefit, but the bigger saving
there -- and for things like PARALLEL and CONST_VECTOR -- would be
to use a trailing array for the rtxes instead of a separate rtvec.
Something like a 24/8 split between the unspec number and number
of subrtxes should be plenty.

Tested on x86_64-linux-gnu.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 1/7] Fix GTY markup of u2
  2014-05-10 19:55 [PATCH 0/7] Shrink some rtxes Richard Sandiford
@ 2014-05-10 19:58 ` Richard Sandiford
  2014-05-11  0:21   ` Mike Stump
  2014-05-12 15:34   ` Jeff Law
  2014-05-10 20:00 ` [PATCH 2/7] Reduce GENERATOR_FILE ifndefs in print-rtl.c Richard Sandiford
                   ` (6 subsequent siblings)
  7 siblings, 2 replies; 30+ messages in thread
From: Richard Sandiford @ 2014-05-10 19:58 UTC (permalink / raw)
  To: gcc-patches

The rtx u2 field currently uses a desc/tag pair for GTY.  This seems
unnecessary though, since the field is specifically supposed to be
32 bits wide on 64-bit hosts and so cannot hold a pointer.

Tested on x86_64-linux-gnu.  OK to install?

Thanks,
Richard


gcc/
	* rtl.h (rtx_def): Mark u2 as GTY ((skip)).

Index: gcc/rtl.h
===================================================================
--- gcc/rtl.h	2014-05-10 09:35:05.112643742 +0100
+++ gcc/rtl.h	2014-05-10 14:02:52.349291772 +0100
@@ -354,8 +354,8 @@ struct GTY((chain_next ("RTX_NEXT (&%h)"
 
     /* In a CONST_WIDE_INT (aka hwivec_def), this is the number of
        HOST_WIDE_INTs in the hwivec_def.  */
-    unsigned GTY ((tag ("CONST_WIDE_INT"))) num_elem:32;
-  } GTY ((desc ("GET_CODE (&%0)"))) u2;
+    unsigned num_elem;
+  } GTY ((skip)) u2;
 
   /* The first element of the operands of this rtx.
      The number of operands and their types are controlled

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 2/7] Reduce GENERATOR_FILE ifndefs in print-rtl.c
  2014-05-10 19:55 [PATCH 0/7] Shrink some rtxes Richard Sandiford
  2014-05-10 19:58 ` [PATCH 1/7] Fix GTY markup of u2 Richard Sandiford
@ 2014-05-10 20:00 ` Richard Sandiford
  2014-05-12 15:37   ` Jeff Law
  2014-05-10 20:08 ` [PATCH 3/7] Move ORIGINAL_REGNO to rtx header Richard Sandiford
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 30+ messages in thread
From: Richard Sandiford @ 2014-05-10 20:00 UTC (permalink / raw)
  To: gcc-patches

The print-rtl.c code for '0' fields has a complicated sequence of
ifndef GENERATOR_FILEs.  None of the '0' data makes sense for generators
though, so it seems simpler to wrap the whole case instead.

Tested on x86_64-linux-gnu.  OK to install?

Thanks,
Richard


gcc/
	* print-rtl.c (print_rtx): Guard whole '0' block with ifndef
	GENERATOR_FILE.

Index: gcc/print-rtl.c
===================================================================
--- gcc/print-rtl.c	2014-05-10 14:02:58.125341066 +0100
+++ gcc/print-rtl.c	2014-05-10 20:37:19.251577206 +0100
@@ -215,12 +215,12 @@ print_rtx (const_rtx in_rtx)
 	   An exception is the third field of a NOTE, where it indicates
 	   that the field has several different valid contents.  */
       case '0':
+#ifndef GENERATOR_FILE
 	if (i == 1 && REG_P (in_rtx))
 	  {
 	    if (REGNO (in_rtx) != ORIGINAL_REGNO (in_rtx))
 	      fprintf (outfile, " [%d]", ORIGINAL_REGNO (in_rtx));
 	  }
-#ifndef GENERATOR_FILE
 	else if (i == 1 && GET_CODE (in_rtx) == SYMBOL_REF)
 	  {
 	    int flags = SYMBOL_REF_FLAGS (in_rtx);
@@ -233,7 +233,6 @@ print_rtx (const_rtx in_rtx)
 	    if (decl)
 	      print_node_brief (outfile, "", decl, dump_flags);
 	  }
-#endif
 	else if (i == 4 && NOTE_P (in_rtx))
 	  {
 	    switch (NOTE_KIND (in_rtx))
@@ -249,19 +248,15 @@ print_rtx (const_rtx in_rtx)
 
 	      case NOTE_INSN_BLOCK_BEG:
 	      case NOTE_INSN_BLOCK_END:
-#ifndef GENERATOR_FILE
 		dump_addr (outfile, " ", NOTE_BLOCK (in_rtx));
-#endif
 		sawclose = 1;
 		break;
 
 	      case NOTE_INSN_BASIC_BLOCK:
 		{
-#ifndef GENERATOR_FILE
 		  basic_block bb = NOTE_BASIC_BLOCK (in_rtx);
 		  if (bb != 0)
 		    fprintf (outfile, " [bb %d]", bb->index);
-#endif
 		  break;
 	        }
 
@@ -278,28 +273,22 @@ print_rtx (const_rtx in_rtx)
 
 	      case NOTE_INSN_SWITCH_TEXT_SECTIONS:
 		{
-#ifndef GENERATOR_FILE
 		  basic_block bb = NOTE_BASIC_BLOCK (in_rtx);
 		  if (bb != 0)
 		    fprintf (outfile, " [bb %d]", bb->index);
-#endif
 		  break;
 		}
 
 	      case NOTE_INSN_VAR_LOCATION:
 	      case NOTE_INSN_CALL_ARG_LOCATION:
-#ifndef GENERATOR_FILE
 		fputc (' ', outfile);
 		print_rtx (NOTE_VAR_LOCATION (in_rtx));
-#endif
 		break;
 
 	      case NOTE_INSN_CFI:
-#ifndef GENERATOR_FILE
 		fputc ('\n', outfile);
 		output_cfi_directive (outfile, NOTE_CFI (in_rtx));
 		fputc ('\t', outfile);
-#endif
 		break;
 
 	      default:
@@ -319,20 +308,16 @@ print_rtx (const_rtx in_rtx)
 	  }
 	else if (i == 0 && GET_CODE (in_rtx) == VALUE)
 	  {
-#ifndef GENERATOR_FILE
 	    cselib_val *val = CSELIB_VAL_PTR (in_rtx);
 
 	    fprintf (outfile, " %u:%u", val->uid, val->hash);
 	    dump_addr (outfile, " @", in_rtx);
 	    dump_addr (outfile, "/", (void*)val);
-#endif
 	  }
 	else if (i == 0 && GET_CODE (in_rtx) == DEBUG_EXPR)
 	  {
-#ifndef GENERATOR_FILE
 	    fprintf (outfile, " D#%i",
 		     DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (in_rtx)));
-#endif
 	  }
 	else if (i == 0 && GET_CODE (in_rtx) == ENTRY_VALUE)
 	  {
@@ -342,6 +327,7 @@ print_rtx (const_rtx in_rtx)
 	    print_rtx (ENTRY_VALUE_EXP (in_rtx));
 	    indent -= 2;
 	  }
+#endif
 	break;
 
       case 'e':

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 3/7] Move ORIGINAL_REGNO to rtx header
  2014-05-10 19:55 [PATCH 0/7] Shrink some rtxes Richard Sandiford
  2014-05-10 19:58 ` [PATCH 1/7] Fix GTY markup of u2 Richard Sandiford
  2014-05-10 20:00 ` [PATCH 2/7] Reduce GENERATOR_FILE ifndefs in print-rtl.c Richard Sandiford
@ 2014-05-10 20:08 ` Richard Sandiford
  2014-05-12 15:46   ` Jeff Law
  2014-05-10 20:13 ` [PATCH 4/7] Move INSN_UID to the " Richard Sandiford
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 30+ messages in thread
From: Richard Sandiford @ 2014-05-10 20:08 UTC (permalink / raw)
  To: gcc-patches

...and reduce the size of REGs by one field.  This is still OK for REG->MEM
conversion since MEMs only have 2 fields.

In some ways it would have been nicer to move REGNO to the header,
since we wouldn't then need to fetch the second word of the rtx when
checking whether something is a REG and then checking its REGNO.
But that's much more complicated and essentially breaks the LISPness
of rtxes; see the covering note for more details.

We currently print the ORIGINAL_REGNO twice if there are also REG_ATTRS.
I've kept this behaviour in order to ensure that the -da output wasn't
changed by the patch series, but I could turn the "if" into an "else if"
if that seems better.

Tested on x86_64-linux-gnu.  OK to install?

Thanks,
Richard


gcc/
	* rtl.def (REG): Remove middle field.
	* rtl.h (rtx_def): Add orignal_regno to u2.
	(ORIGINAL_REGNO): Use it instead of field 1.
	(REG_ATTRS): Lower field index accordingly.
	* gengtype.c (adjust_field_rtx_def): Remove handling of
	ORIGINAL_REGNO.  Move REG_ATTRS index down.
	* print-rtl.c (print_rtx): Move ORIGINAL_REGNO handling to the
	code that prints the REGNO.

Index: gcc/rtl.def
===================================================================
--- gcc/rtl.def	2014-05-10 14:02:58.078340665 +0100
+++ gcc/rtl.def	2014-05-10 21:05:20.359929520 +0100
@@ -378,12 +378,10 @@ DEF_RTL_EXPR(PC, "pc", "", RTX_OBJ)
 /* A register.  The "operand" is the register number, accessed with
    the REGNO macro.  If this number is less than FIRST_PSEUDO_REGISTER
    than a hardware register is being referred to.  The second operand
-   holds the original register number - this will be different for a
-   pseudo register that got turned into a hard register.  The third
-   operand points to a reg_attrs structure.
+   points to a reg_attrs structure.
    This rtx needs to have as many (or more) fields as a MEM, since we
    can change REG rtx's into MEMs during reload.  */
-DEF_RTL_EXPR(REG, "reg", "i00", RTX_OBJ)
+DEF_RTL_EXPR(REG, "reg", "i0", RTX_OBJ)
 
 /* A scratch register.  This represents a register used only within a
    single insn.  It will be turned into a REG during register allocation
Index: gcc/rtl.h
===================================================================
--- gcc/rtl.h	2014-05-10 20:30:19.508904129 +0100
+++ gcc/rtl.h	2014-05-10 21:06:00.723283830 +0100
@@ -352,6 +352,9 @@ struct GTY((chain_next ("RTX_NEXT (&%h)"
        layout for that case and use the gap for extra code-specific
        information.  */
 
+    /* The ORIGINAL_REGNO of a REG.  */
+    unsigned original_regno;
+
     /* In a CONST_WIDE_INT (aka hwivec_def), this is the number of
        HOST_WIDE_INTs in the hwivec_def.  */
     unsigned num_elem;
@@ -1194,7 +1197,8 @@ #define SET_REGNO_RAW(RTX,N) (XCUINT (RT
 /* ORIGINAL_REGNO holds the number the register originally had; for a
    pseudo register turned into a hard reg this will hold the old pseudo
    register number.  */
-#define ORIGINAL_REGNO(RTX) X0UINT (RTX, 1)
+#define ORIGINAL_REGNO(RTX) \
+  (RTL_FLAG_CHECK1 ("ORIGINAL_REGNO", (RTX), REG)->u2.original_regno)
 
 /* Force the REGNO macro to only be used on the lhs.  */
 static inline unsigned int
@@ -1641,7 +1645,7 @@ #define MEM_ATTRS(RTX) X0MEMATTR (RTX, 1
 
 /* The register attribute block.  We provide access macros for each value
    in the block and provide defaults if none specified.  */
-#define REG_ATTRS(RTX) X0REGATTR (RTX, 2)
+#define REG_ATTRS(RTX) X0REGATTR (RTX, 1)
 
 #ifndef GENERATOR_FILE
 /* For a MEM rtx, the alias set.  If 0, this MEM is not in any alias
Index: gcc/gengtype.c
===================================================================
--- gcc/gengtype.c	2014-05-10 14:02:58.078340665 +0100
+++ gcc/gengtype.c	2014-05-10 21:05:11.739853801 +0100
@@ -1248,8 +1248,6 @@ adjust_field_rtx_def (type_p t, options_
 	      else if (i == DEBUG_EXPR && aindex == 0)
 		t = tree_tp, subname = "rt_tree";
 	      else if (i == REG && aindex == 1)
-		t = scalar_tp, subname = "rt_int";
-	      else if (i == REG && aindex == 2)
 		t = reg_attrs_tp, subname = "rt_reg";
 	      else if (i == SCRATCH && aindex == 0)
 		t = scalar_tp, subname = "rt_int";
Index: gcc/print-rtl.c
===================================================================
--- gcc/print-rtl.c	2014-05-10 20:37:19.251577206 +0100
+++ gcc/print-rtl.c	2014-05-10 21:05:11.739853801 +0100
@@ -216,12 +216,7 @@ print_rtx (const_rtx in_rtx)
 	   that the field has several different valid contents.  */
       case '0':
 #ifndef GENERATOR_FILE
-	if (i == 1 && REG_P (in_rtx))
-	  {
-	    if (REGNO (in_rtx) != ORIGINAL_REGNO (in_rtx))
-	      fprintf (outfile, " [%d]", ORIGINAL_REGNO (in_rtx));
-	  }
-	else if (i == 1 && GET_CODE (in_rtx) == SYMBOL_REF)
+	if (i == 1 && GET_CODE (in_rtx) == SYMBOL_REF)
 	  {
 	    int flags = SYMBOL_REF_FLAGS (in_rtx);
 	    if (flags)
@@ -491,6 +486,8 @@ print_rtx (const_rtx in_rtx)
 			   REG_OFFSET (in_rtx));
 		fputs (" ]", outfile);
 	      }
+	    if (REG_P (in_rtx) && REGNO (in_rtx) != ORIGINAL_REGNO (in_rtx))
+	      fprintf (outfile, " [%d]", ORIGINAL_REGNO (in_rtx));
 #endif
 
 	    if (is_insn && &INSN_CODE (in_rtx) == &XINT (in_rtx, i)

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 4/7] Move INSN_UID to the rtx header
  2014-05-10 19:55 [PATCH 0/7] Shrink some rtxes Richard Sandiford
                   ` (2 preceding siblings ...)
  2014-05-10 20:08 ` [PATCH 3/7] Move ORIGINAL_REGNO to rtx header Richard Sandiford
@ 2014-05-10 20:13 ` Richard Sandiford
  2014-05-12 15:58   ` Jeff Law
  2014-05-10 20:17 ` [PATCH 5/7] Shrink SCRATCH Richard Sandiford
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 30+ messages in thread
From: Richard Sandiford @ 2014-05-10 20:13 UTC (permalink / raw)
  To: gcc-patches

This is a bit more complicated than REG because INSN_UID is an "i" field
and so is a parameter to the respective gen_rtx_FOOs.  However, in all
but one case these uids were dummy values; the one exception can simply
set the INSN_UID after the call instead.  These rtxes also don't matter
to genrecog or to the various equality routines, so the move should be
safe despite being an "i" field.

Tested on x86_64-linux-gnu.  OK to install?

Thanks,
Richard


gcc/
	* rtl.def (DEBUG_INSN, INSN, JUMP_INSN, CALL_INSN, JUMP_TABLE_DATA)
	(BARRIER, CODE_LABEL, NOTE): Remove first "i" field.
	* rtl.h (rtx_def): Add insn_uid to u2 field.
	(RTX_FLAG_CHECK8): Delete in favor of...
	(RTL_INSN_CHAIN_FLAG_CHECK): ...this new macro.
	(INSN_DELETED_P): Update accordingly.
	(INSN_UID): Use u2.insn_uid.
	(INSN_CHAIN_CODE_P): Define.
	(PREV_INSN, NEXT_INSN, BLOCK_FOR_INSN, PATTERN, INSN_LOCATION)
	(INSN_CODE, REG_NOTES, CALL_INSN_FUNCTION_USAGE, CODE_LABEL_NUMBER)
	(NOTE_DATA, NOTE_DELETED_LABEL_NAME, NOTE_BLOCK, NOTE_EH_HANDLER)
	(NOTE_BASIC_BLOCK, NOTE_VAR_LOCATION, NOTE_CFI, NOTE_LABEL_NUMBER)
	(NOTE_KIND, LABEL_NAME, LABEL_NUSES, JUMP_LABEL, LABEL_REFS): Lower
	indices accordingly.
	* print-rtl.c (print_rtx): Print INSN_UIDs before the main loop.
	Update indices for insn-chain rtxes.
	* gengtype.c (gen_rtx_next): Adjust test for insn-chain rtxes.
	(adjust_field_rtx_def): Lower '0' indices for all insn-chain rtxes.
	* emit-rtl.c (gen_label_rtx): Update gen_rtx_LABEL call.
	* caller-save.c (init_caller_save): Update gen_rtx_INSN calls.
	* combine.c (try_combine): Likewise.
	* ira.c (setup_prohibited_mode_move_regs): Likewise.

Index: gcc/rtl.def
===================================================================
--- gcc/rtl.def	2014-05-10 20:37:31.906684788 +0100
+++ gcc/rtl.def	2014-05-10 20:37:58.073907510 +0100
@@ -139,46 +139,46 @@ DEF_RTL_EXPR(ADDRESS, "address", "i", RT
    ---------------------------------------------------------------------- */
 
 /* An annotation for variable assignment tracking.  */
-DEF_RTL_EXPR(DEBUG_INSN, "debug_insn", "iuuBeiie", RTX_INSN)
+DEF_RTL_EXPR(DEBUG_INSN, "debug_insn", "uuBeiie", RTX_INSN)
 
 /* An instruction that cannot jump.  */
-DEF_RTL_EXPR(INSN, "insn", "iuuBeiie", RTX_INSN)
+DEF_RTL_EXPR(INSN, "insn", "uuBeiie", RTX_INSN)
 
 /* An instruction that can possibly jump.
    Fields ( rtx->u.fld[] ) have exact same meaning as INSN's.  */
-DEF_RTL_EXPR(JUMP_INSN, "jump_insn", "iuuBeiie0", RTX_INSN)
+DEF_RTL_EXPR(JUMP_INSN, "jump_insn", "uuBeiie0", RTX_INSN)
 
 /* An instruction that can possibly call a subroutine
    but which will not change which instruction comes next
    in the current function.
    Field ( rtx->u.fld[8] ) is CALL_INSN_FUNCTION_USAGE.
    All other fields ( rtx->u.fld[] ) have exact same meaning as INSN's.  */
-DEF_RTL_EXPR(CALL_INSN, "call_insn", "iuuBeiiee", RTX_INSN)
+DEF_RTL_EXPR(CALL_INSN, "call_insn", "uuBeiiee", RTX_INSN)
 
 /* Placeholder for tablejump JUMP_INSNs.  The pattern of this kind
    of rtx is always either an ADDR_VEC or an ADDR_DIFF_VEC.  These
    placeholders do not appear as real instructions inside a basic
    block, but are considered active_insn_p instructions for historical
    reasons, when jump table data was represented with JUMP_INSNs.  */
-DEF_RTL_EXPR(JUMP_TABLE_DATA, "jump_table_data", "iuuBe0000", RTX_INSN)
+DEF_RTL_EXPR(JUMP_TABLE_DATA, "jump_table_data", "uuBe0000", RTX_INSN)
 
 /* A marker that indicates that control will not flow through.  */
-DEF_RTL_EXPR(BARRIER, "barrier", "iuu00000", RTX_EXTRA)
+DEF_RTL_EXPR(BARRIER, "barrier", "uu00000", RTX_EXTRA)
 
 /* Holds a label that is followed by instructions.
    Operand:
-   4: is used in jump.c for the use-count of the label.
-   5: is used in the sh backend.
-   6: is a number that is unique in the entire compilation.
-   7: is the user-given name of the label, if any.  */
-DEF_RTL_EXPR(CODE_LABEL, "code_label", "iuuB00is", RTX_EXTRA)
+   3: is used in jump.c for the use-count of the label.
+   4: is used in the sh backend.
+   5: is a number that is unique in the entire compilation.
+   6: is the user-given name of the label, if any.  */
+DEF_RTL_EXPR(CODE_LABEL, "code_label", "uuB00is", RTX_EXTRA)
 
 /* Say where in the code a source line starts, for symbol table's sake.
    Operand:
-   4: note-specific data
-   5: enum insn_note
-   6: unique number if insn_note == note_insn_deleted_label.  */
-DEF_RTL_EXPR(NOTE, "note", "iuuB0ni", RTX_EXTRA)
+   3: note-specific data
+   4: enum insn_note
+   5: unique number if insn_note == note_insn_deleted_label.  */
+DEF_RTL_EXPR(NOTE, "note", "uuB0ni", RTX_EXTRA)
 
 /* ----------------------------------------------------------------------
    Top level constituents of INSN, JUMP_INSN and CALL_INSN.
Index: gcc/rtl.h
===================================================================
--- gcc/rtl.h	2014-05-10 20:37:31.906684788 +0100
+++ gcc/rtl.h	2014-05-10 20:37:58.074907518 +0100
@@ -109,6 +109,10 @@ #define GET_RTX_FORMAT(CODE)		(rtx_forma
 extern const enum rtx_class rtx_class[NUM_RTX_CODE];
 #define GET_RTX_CLASS(CODE)		(rtx_class[(int) (CODE)])
 
+/* True if CODE is part of the insn chain (i.e. has INSN_UID, PREV_INSN
+   and NEXT_INSN fields).  */
+#define INSN_CHAIN_CODE_P(CODE) IN_RANGE (CODE, DEBUG_INSN, NOTE)
+
 extern const unsigned char rtx_code_size[NUM_RTX_CODE];
 extern const unsigned char rtx_next[NUM_RTX_CODE];
 \f
@@ -355,6 +359,9 @@ struct GTY((chain_next ("RTX_NEXT (&%h)"
     /* The ORIGINAL_REGNO of a REG.  */
     unsigned original_regno;
 
+    /* The INSN_UID of an RTX_INSN-class code.  */
+    int insn_uid;
+
     /* In a CONST_WIDE_INT (aka hwivec_def), this is the number of
        HOST_WIDE_INTs in the hwivec_def.  */
     unsigned num_elem;
@@ -817,15 +824,12 @@ #define RTL_FLAG_CHECK7(NAME, RTX, C1, C
 			     __FUNCTION__);				\
    _rtx; })
 
-#define RTL_FLAG_CHECK8(NAME, RTX, C1, C2, C3, C4, C5, C6, C7, C8)	\
+#define RTL_INSN_CHAIN_FLAG_CHECK(NAME, RTX) 				\
   __extension__								\
 ({ __typeof (RTX) const _rtx = (RTX);					\
-   if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2			\
-       && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4		\
-       && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6		\
-       && GET_CODE (_rtx) != C7 && GET_CODE (_rtx) != C8)		\
-     rtl_check_failed_flag  (NAME, _rtx, __FILE__, __LINE__,		\
-			     __FUNCTION__);				\
+   if (!INSN_CHAIN_CODE_P (GET_CODE (_rtx)))				\
+     rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__,		\
+			    __FUNCTION__);				\
    _rtx; })
 
 extern void rtl_check_failed_flag (const char *, const_rtx, const char *,
@@ -839,10 +843,10 @@ #define RTL_FLAG_CHECK1(NAME, RTX, C1)
 #define RTL_FLAG_CHECK2(NAME, RTX, C1, C2)				(RTX)
 #define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3)				(RTX)
 #define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4)			(RTX)
-#define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5)		(RTX)
+#define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5)			(RTX)
 #define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6)		(RTX)
 #define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7)		(RTX)
-#define RTL_FLAG_CHECK8(NAME, RTX, C1, C2, C3, C4, C5, C6, C7, C8)	(RTX)
+#define RTL_INSN_CHAIN_FLAG_CHECK(NAME, RTX) 				(RTX)
 #endif
 
 #define XINT(RTX, N)	(RTL_CHECK2 (RTX, N, 'i', 'n').rt_int)
@@ -899,18 +903,19 @@ #define XC2EXP(RTX, N, C1, C2)      (RTL
 
 /* Holds a unique number for each insn.
    These are not necessarily sequentially increasing.  */
-#define INSN_UID(INSN)  XINT (INSN, 0)
+#define INSN_UID(INSN) \
+  (RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID", (INSN))->u2.insn_uid)
 
 /* Chain insns together in sequence.  */
-#define PREV_INSN(INSN)	XEXP (INSN, 1)
-#define NEXT_INSN(INSN)	XEXP (INSN, 2)
+#define PREV_INSN(INSN)	XEXP (INSN, 0)
+#define NEXT_INSN(INSN)	XEXP (INSN, 1)
 
-#define BLOCK_FOR_INSN(INSN) XBBDEF (INSN, 3)
+#define BLOCK_FOR_INSN(INSN) XBBDEF (INSN, 2)
 
 /* The body of an insn.  */
-#define PATTERN(INSN)	XEXP (INSN, 4)
+#define PATTERN(INSN)	XEXP (INSN, 3)
 
-#define INSN_LOCATION(INSN) XUINT (INSN, 5)
+#define INSN_LOCATION(INSN) XUINT (INSN, 4)
 
 #define INSN_HAS_LOCATION(INSN) ((LOCATION_LOCUS (INSN_LOCATION (INSN)))\
   != UNKNOWN_LOCATION)
@@ -921,7 +926,7 @@ #define RTL_LOCATION(X) (INSN_P (X) ? \
 
 /* Code number of instruction, from when it was recognized.
    -1 means this instruction has not been recognized yet.  */
-#define INSN_CODE(INSN) XINT (INSN, 6)
+#define INSN_CODE(INSN) XINT (INSN, 5)
 
 #define RTX_FRAME_RELATED_P(RTX)					\
   (RTL_FLAG_CHECK6 ("RTX_FRAME_RELATED_P", (RTX), DEBUG_INSN, INSN,	\
@@ -929,9 +934,7 @@ #define RTX_FRAME_RELATED_P(RTX)					\
 
 /* 1 if RTX is an insn that has been deleted.  */
 #define INSN_DELETED_P(RTX)						\
-  (RTL_FLAG_CHECK8 ("INSN_DELETED_P", (RTX), DEBUG_INSN, INSN,		\
-		    CALL_INSN, JUMP_INSN, JUMP_TABLE_DATA,		\
-		    CODE_LABEL, BARRIER, NOTE)->volatil)
+  (RTL_INSN_CHAIN_FLAG_CHECK ("INSN_DELETED_P", (RTX))->volatil)
 
 /* 1 if RTX is a call to a const function.  Built from ECF_CONST and
    TREE_READONLY.  */
@@ -981,7 +984,7 @@ #define CSELIB_VAL_PTR(RTX) X0CSELIB (RT
    chain pointer and the first operand is the REG being described.
    The mode field of the EXPR_LIST contains not a real machine mode
    but a value from enum reg_note.  */
-#define REG_NOTES(INSN)	XEXP(INSN, 7)
+#define REG_NOTES(INSN)	XEXP(INSN, 6)
 
 /* In an ENTRY_VALUE this is the DECL_INCOMING_RTL of the argument in
    question.  */
@@ -1012,12 +1015,12 @@ #define GET_REG_NOTE_NAME(MODE) (reg_not
      CLOBBER expressions document the registers explicitly clobbered
    by this CALL_INSN.
      Pseudo registers can not be mentioned in this list.  */
-#define CALL_INSN_FUNCTION_USAGE(INSN)	XEXP(INSN, 8)
+#define CALL_INSN_FUNCTION_USAGE(INSN)	XEXP(INSN, 7)
 
 /* The label-number of a code-label.  The assembler label
    is made from `L' and the label-number printed in decimal.
    Label numbers are unique in a compilation.  */
-#define CODE_LABEL_NUMBER(INSN)	XINT (INSN, 6)
+#define CODE_LABEL_NUMBER(INSN)	XINT (INSN, 5)
 
 /* In a NOTE that is a line number, this is a string for the file name that the
    line is in.  We use the same field to record block numbers temporarily in
@@ -1026,19 +1029,19 @@ #define CODE_LABEL_NUMBER(INSN)	XINT (IN
    */
 
 /* Opaque data.  */
-#define NOTE_DATA(INSN)	        RTL_CHECKC1 (INSN, 4, NOTE)
-#define NOTE_DELETED_LABEL_NAME(INSN) XCSTR (INSN, 4, NOTE)
+#define NOTE_DATA(INSN)	        RTL_CHECKC1 (INSN, 3, NOTE)
+#define NOTE_DELETED_LABEL_NAME(INSN) XCSTR (INSN, 3, NOTE)
 #define SET_INSN_DELETED(INSN) set_insn_deleted (INSN);
-#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)
-#define NOTE_CFI(INSN)		XCCFI (INSN, 4, NOTE)
-#define NOTE_LABEL_NUMBER(INSN)	XCINT (INSN, 4, NOTE)
+#define NOTE_BLOCK(INSN)	XCTREE (INSN, 3, NOTE)
+#define NOTE_EH_HANDLER(INSN)	XCINT (INSN, 3, NOTE)
+#define NOTE_BASIC_BLOCK(INSN)	XCBBDEF (INSN, 3, NOTE)
+#define NOTE_VAR_LOCATION(INSN)	XCEXP (INSN, 3, NOTE)
+#define NOTE_CFI(INSN)		XCCFI (INSN, 3, NOTE)
+#define NOTE_LABEL_NUMBER(INSN)	XCINT (INSN, 3, 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, 5, NOTE)
+#define NOTE_KIND(INSN) XCINT (INSN, 4, NOTE)
 
 /* Nonzero if INSN is a note marking the beginning of a basic block.  */
 #define NOTE_INSN_BASIC_BLOCK_P(INSN) \
@@ -1121,11 +1124,11 @@ #define GET_NOTE_INSN_NAME(NOTE_CODE) \
 
 /* The name of a label, in case it corresponds to an explicit label
    in the input source code.  */
-#define LABEL_NAME(RTX) XCSTR (RTX, 7, CODE_LABEL)
+#define LABEL_NAME(RTX) XCSTR (RTX, 6, CODE_LABEL)
 
 /* In jump.c, each label contains a count of the number
    of LABEL_REFs that point at it, so unused labels can be deleted.  */
-#define LABEL_NUSES(RTX) XCINT (RTX, 5, CODE_LABEL)
+#define LABEL_NUSES(RTX) XCINT (RTX, 4, CODE_LABEL)
 
 /* Labels carry a two-bit field composed of the ->jump and ->call
    bits.  This field indicates whether the label is an alternate
@@ -1180,12 +1183,12 @@ #define LABEL_ALT_ENTRY_P(LABEL) (LABEL_
 /* In jump.c, each JUMP_INSN can point to a label that it can jump to,
    so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
    be decremented and possibly the label can be deleted.  */
-#define JUMP_LABEL(INSN)   XCEXP (INSN, 8, JUMP_INSN)
+#define JUMP_LABEL(INSN)   XCEXP (INSN, 7, JUMP_INSN)
 
 /* Once basic blocks are found, each CODE_LABEL starts a chain that
    goes through all the LABEL_REFs that jump to that label.  The chain
    eventually winds up at the CODE_LABEL: it is circular.  */
-#define LABEL_REFS(LABEL) XCEXP (LABEL, 4, CODE_LABEL)
+#define LABEL_REFS(LABEL) XCEXP (LABEL, 3, CODE_LABEL)
 \f
 /* For a REG rtx, REGNO extracts the register number.  REGNO can only
    be used on RHS.  Use SET_REGNO to change the value.  */
Index: gcc/print-rtl.c
===================================================================
--- gcc/print-rtl.c	2014-05-10 20:37:31.906684788 +0100
+++ gcc/print-rtl.c	2014-05-10 20:37:58.074907518 +0100
@@ -187,6 +187,9 @@ print_rtx (const_rtx in_rtx)
     i = 5;
 #endif
 
+  if (INSN_CHAIN_CODE_P (GET_CODE (in_rtx)))
+    fprintf (outfile, " %d", INSN_UID (in_rtx));
+
   /* Get the format string and skip the first elements if we have handled
      them already.  */
   format_ptr = GET_RTX_FORMAT (GET_CODE (in_rtx)) + i;
@@ -228,7 +231,7 @@ print_rtx (const_rtx in_rtx)
 	    if (decl)
 	      print_node_brief (outfile, "", decl, dump_flags);
 	  }
-	else if (i == 4 && NOTE_P (in_rtx))
+	else if (i == 3 && NOTE_P (in_rtx))
 	  {
 	    switch (NOTE_KIND (in_rtx))
 	      {
@@ -290,7 +293,7 @@ print_rtx (const_rtx in_rtx)
 		break;
 	      }
 	  }
-	else if (i == 8 && JUMP_P (in_rtx) && JUMP_LABEL (in_rtx) != NULL)
+	else if (i == 7 && JUMP_P (in_rtx) && JUMP_LABEL (in_rtx) != NULL)
 	  {
 	    /* Output the JUMP_LABEL reference.  */
 	    fprintf (outfile, "\n%s%*s -> ", print_rtx_head, indent * 2, "");
@@ -328,13 +331,13 @@ print_rtx (const_rtx in_rtx)
       case 'e':
       do_e:
 	indent += 2;
-	if (i == 7 && INSN_P (in_rtx))
+	if (i == 6 && INSN_P (in_rtx))
 	  /* Put REG_NOTES on their own line.  */
 	  fprintf (outfile, "\n%s%*s",
 		   print_rtx_head, indent * 2, "");
 	if (!sawclose)
 	  fprintf (outfile, " ");
-	if (i == 8 && CALL_P (in_rtx))
+	if (i == 7 && CALL_P (in_rtx))
 	  {
 	    in_call_function_usage = true;
 	    print_rtx (XEXP (in_rtx, i));
@@ -384,7 +387,7 @@ print_rtx (const_rtx in_rtx)
 	break;
 
       case 'i':
-	if (i == 5 && INSN_P (in_rtx))
+	if (i == 4 && INSN_P (in_rtx))
 	  {
 #ifndef GENERATOR_FILE
 	    /*  Pretty-print insn locations.  Ignore scoping as it is mostly
@@ -413,7 +416,7 @@ print_rtx (const_rtx in_rtx)
 		       LOCATION_LINE (ASM_INPUT_SOURCE_LOCATION (in_rtx)));
 #endif
 	  }
-	else if (i == 6 && NOTE_P (in_rtx))
+	else if (i == 5 && NOTE_P (in_rtx))
 	  {
 	    /* This field is only used for NOTE_INSN_DELETED_LABEL, and
 	       other times often contains garbage from INSN->NOTE death.  */
Index: gcc/gengtype.c
===================================================================
--- gcc/gengtype.c	2014-05-10 20:37:31.905684776 +0100
+++ gcc/gengtype.c	2014-05-10 20:37:58.072907502 +0100
@@ -1086,8 +1086,8 @@ gen_rtx_next (void)
       int k;
 
       rtx_next_new[i] = -1;
-      if (strncmp (rtx_format[i], "iuu", 3) == 0)
-	rtx_next_new[i] = 2;
+      if (strncmp (rtx_format[i], "uu", 2) == 0)
+	rtx_next_new[i] = 1;
       else if (i == COND_EXEC || i == SET || i == EXPR_LIST || i == INSN_LIST)
 	rtx_next_new[i] = 1;
       else
@@ -1227,19 +1227,19 @@ adjust_field_rtx_def (type_p t, options_
 	    case '0':
 	      if (i == MEM && aindex == 1)
 		t = mem_attrs_tp, subname = "rt_mem";
-	      else if (i == JUMP_INSN && aindex == 8)
+	      else if (i == JUMP_INSN && aindex == 7)
 		t = rtx_tp, subname = "rt_rtx";
-	      else if (i == CODE_LABEL && aindex == 5)
-		t = scalar_tp, subname = "rt_int";
 	      else if (i == CODE_LABEL && aindex == 4)
+		t = scalar_tp, subname = "rt_int";
+	      else if (i == CODE_LABEL && aindex == 3)
 		t = rtx_tp, subname = "rt_rtx";
 	      else if (i == LABEL_REF && (aindex == 1 || aindex == 2))
 		t = rtx_tp, subname = "rt_rtx";
-	      else if (i == NOTE && aindex == 4)
+	      else if (i == NOTE && aindex == 3)
 		t = note_union_tp, subname = "";
-	      else if (i == NOTE && aindex == 5)
+	      else if (i == NOTE && aindex == 4)
 		t = scalar_tp, subname = "rt_int";
-	      else if (i == NOTE && aindex >= 7)
+	      else if (i == NOTE && aindex >= 6)
 		t = scalar_tp, subname = "rt_int";
 	      else if (i == ADDR_DIFF_VEC && aindex == 4)
 		t = scalar_tp, subname = "rt_int";
@@ -1255,9 +1255,9 @@ adjust_field_rtx_def (type_p t, options_
 		t = scalar_tp, subname = "rt_int";
 	      else if (i == SYMBOL_REF && aindex == 2)
 		t = symbol_union_tp, subname = "";
-	      else if (i == JUMP_TABLE_DATA && aindex >= 5)
+	      else if (i == JUMP_TABLE_DATA && aindex >= 4)
 		t = scalar_tp, subname = "rt_int";
-	      else if (i == BARRIER && aindex >= 3)
+	      else if (i == BARRIER && aindex >= 2)
 		t = scalar_tp, subname = "rt_int";
 	      else if (i == ENTRY_VALUE && aindex == 0)
 		t = rtx_tp, subname = "rt_rtx";
Index: gcc/emit-rtl.c
===================================================================
--- gcc/emit-rtl.c	2014-05-10 14:02:58.026340221 +0100
+++ gcc/emit-rtl.c	2014-05-10 20:37:58.071907494 +0100
@@ -2451,7 +2451,7 @@ set_mem_attrs_for_spill (rtx mem)
 rtx
 gen_label_rtx (void)
 {
-  return gen_rtx_CODE_LABEL (VOIDmode, 0, NULL_RTX, NULL_RTX,
+  return gen_rtx_CODE_LABEL (VOIDmode, NULL_RTX, NULL_RTX,
 			     NULL, label_num++, NULL);
 }
 \f
Index: gcc/caller-save.c
===================================================================
--- gcc/caller-save.c	2014-05-10 14:02:58.026340221 +0100
+++ gcc/caller-save.c	2014-05-10 20:37:58.067907458 +0100
@@ -265,8 +265,8 @@ init_caller_save (void)
   savepat = gen_rtx_SET (VOIDmode, test_mem, test_reg);
   restpat = gen_rtx_SET (VOIDmode, test_reg, test_mem);
 
-  saveinsn = gen_rtx_INSN (VOIDmode, 0, 0, 0, 0, savepat, 0, -1, 0);
-  restinsn = gen_rtx_INSN (VOIDmode, 0, 0, 0, 0, restpat, 0, -1, 0);
+  saveinsn = gen_rtx_INSN (VOIDmode, 0, 0, 0, savepat, 0, -1, 0);
+  restinsn = gen_rtx_INSN (VOIDmode, 0, 0, 0, restpat, 0, -1, 0);
 
   for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
     for (j = 1; j <= MOVE_MAX_WORDS; j++)
Index: gcc/combine.c
===================================================================
--- gcc/combine.c	2014-05-10 14:02:58.026340221 +0100
+++ gcc/combine.c	2014-05-10 20:37:58.070907486 +0100
@@ -2739,9 +2739,10 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx
 	     never appear in the insn stream so giving it the same INSN_UID
 	     as I2 will not cause a problem.  */
 
-	  i1 = gen_rtx_INSN (VOIDmode, INSN_UID (i2), NULL_RTX, i2,
-			     BLOCK_FOR_INSN (i2), XVECEXP (PATTERN (i2), 0, 1),
-			     INSN_LOCATION (i2), -1, NULL_RTX);
+	  i1 = gen_rtx_INSN (VOIDmode, NULL_RTX, i2, BLOCK_FOR_INSN (i2),
+			     XVECEXP (PATTERN (i2), 0, 1), INSN_LOCATION (i2),
+			     -1, NULL_RTX);
+	  INSN_UID (i1) = INSN_UID (i2);
 
 	  SUBST (PATTERN (i2), XVECEXP (PATTERN (i2), 0, 0));
 	  SUBST (XEXP (SET_SRC (PATTERN (i2)), 0),
Index: gcc/ira.c
===================================================================
--- gcc/ira.c	2014-05-10 14:02:58.026340221 +0100
+++ gcc/ira.c	2014-05-10 20:37:58.072907502 +0100
@@ -1744,7 +1744,7 @@ setup_prohibited_mode_move_regs (void)
   test_reg1 = gen_rtx_REG (VOIDmode, 0);
   test_reg2 = gen_rtx_REG (VOIDmode, 0);
   move_pat = gen_rtx_SET (VOIDmode, test_reg1, test_reg2);
-  move_insn = gen_rtx_INSN (VOIDmode, 0, 0, 0, 0, move_pat, 0, -1, 0);
+  move_insn = gen_rtx_INSN (VOIDmode, 0, 0, 0, move_pat, 0, -1, 0);
   for (i = 0; i < NUM_MACHINE_MODES; i++)
     {
       SET_HARD_REG_SET (ira_prohibited_mode_move_regs[i]);

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 5/7] Shrink SCRATCH
  2014-05-10 19:55 [PATCH 0/7] Shrink some rtxes Richard Sandiford
                   ` (3 preceding siblings ...)
  2014-05-10 20:13 ` [PATCH 4/7] Move INSN_UID to the " Richard Sandiford
@ 2014-05-10 20:17 ` Richard Sandiford
  2014-05-12 16:00   ` Jeff Law
  2014-05-10 20:22 ` [PATCH 6/7] Move PAT_VAR_LOCATION_STATUS to rtx header Richard Sandiford
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 30+ messages in thread
From: Richard Sandiford @ 2014-05-10 20:17 UTC (permalink / raw)
  To: gcc-patches

SCRATCH has a single "0" field because reload used to turn it directly
into a REG.  It no longer does (or could do) that since REG has three
fields rather than one.  This patch therefore updates the comment and
removes the field.

Tested on x86_64-linux-gnu.  OK to install?

Thanks,
Richard


gcc/
	* rtl.def (scratch): Fix outdated comment and remove "0" field.
	* gengtype.c (adjust_field_rtx_def): Update accordingly.

Index: gcc/rtl.def
===================================================================
--- gcc/rtl.def	2014-05-10 21:13:03.383968475 +0100
+++ gcc/rtl.def	2014-05-10 21:13:06.240993266 +0100
@@ -384,11 +384,10 @@ DEF_RTL_EXPR(PC, "pc", "", RTX_OBJ)
 DEF_RTL_EXPR(REG, "reg", "i0", RTX_OBJ)
 
 /* A scratch register.  This represents a register used only within a
-   single insn.  It will be turned into a REG during register allocation
+   single insn.  It will be replaced by a REG during register allocation
    or reload unless the constraint indicates that the register won't be
-   needed, in which case it can remain a SCRATCH.  This code is
-   marked as having one operand so it can be turned into a REG.  */
-DEF_RTL_EXPR(SCRATCH, "scratch", "0", RTX_OBJ)
+   needed, in which case it can remain a SCRATCH.  */
+DEF_RTL_EXPR(SCRATCH, "scratch", "", RTX_OBJ)
 
 /* A reference to a part of another value.  The first operand is the
    complete value and the second is the byte offset of the selected part.   */
Index: gcc/gengtype.c
===================================================================
--- gcc/gengtype.c	2014-05-10 21:13:03.381968458 +0100
+++ gcc/gengtype.c	2014-05-10 21:13:06.242993283 +0100
@@ -1249,8 +1249,6 @@ adjust_field_rtx_def (type_p t, options_
 		t = tree_tp, subname = "rt_tree";
 	      else if (i == REG && aindex == 1)
 		t = reg_attrs_tp, subname = "rt_reg";
-	      else if (i == SCRATCH && aindex == 0)
-		t = scalar_tp, subname = "rt_int";
 	      else if (i == SYMBOL_REF && aindex == 1)
 		t = scalar_tp, subname = "rt_int";
 	      else if (i == SYMBOL_REF && aindex == 2)

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 6/7] Move PAT_VAR_LOCATION_STATUS to rtx header
  2014-05-10 19:55 [PATCH 0/7] Shrink some rtxes Richard Sandiford
                   ` (4 preceding siblings ...)
  2014-05-10 20:17 ` [PATCH 5/7] Shrink SCRATCH Richard Sandiford
@ 2014-05-10 20:22 ` Richard Sandiford
  2014-05-12 16:01   ` Jeff Law
  2014-05-10 20:24 ` [PATCH 7/7] Move SYMBOL_REF_FLAGS " Richard Sandiford
  2014-05-10 20:25 ` [PATCH 0/7] Shrink some rtxes Richard Sandiford
  7 siblings, 1 reply; 30+ messages in thread
From: Richard Sandiford @ 2014-05-10 20:22 UTC (permalink / raw)
  To: gcc-patches

This is the other case (apart from INSN_UID) in which the field being
moved is an "i".  I kept the gen_rtx_VAR_LOCATION interface the same
by writing it in C code.  As with INSN_UID, removing an "i" is safe
because genrecog and the equality routines don't care about VAR_LOCATIONs.
(Equality would only being meaningful if we also checked the decl in the
't' field.)

Tested on x86_64-linux-gnu.  OK to install?

Thanks,
Richard


gcc/
	* rtl.def (VAR_LOCATION): Remove "i" field.
	* rtl.h (rtx_def): Add u2.var_location_status.
	(PAT_VAR_LOCATION_STATUS): Use it.
	(gen_rtx_VAR_LOCATION): Declare.
	* gengenrtl.c (excluded_rtx): Add VAR_LOCATION.
	* emit-rtl.c (gen_rtx_VAR_LOCATION): New function.
	* var-tracking.c (emit_note_insn_var_location): Remove casts.

Index: gcc/rtl.def
===================================================================
--- gcc/rtl.def	2014-05-10 21:13:06.240993266 +0100
+++ gcc/rtl.def	2014-05-10 21:17:11.883121021 +0100
@@ -747,9 +747,7 @@ DEF_RTL_EXPR(US_TRUNCATE, "us_truncate",
 DEF_RTL_EXPR(FMA, "fma", "eee", RTX_TERNARY)
 
 /* Information about the variable and its location.  */
-/* Changed 'te' to 'tei'; the 'i' field is for recording
-   initialization status of variables.  */
-DEF_RTL_EXPR(VAR_LOCATION, "var_location", "tei", RTX_EXTRA)
+DEF_RTL_EXPR(VAR_LOCATION, "var_location", "te", RTX_EXTRA)
 
 /* Used in VAR_LOCATION for a pointer to a decl that is no longer
    addressable.  */
Index: gcc/rtl.h
===================================================================
--- gcc/rtl.h	2014-05-10 21:13:03.383968475 +0100
+++ gcc/rtl.h	2014-05-10 21:17:11.883121021 +0100
@@ -362,6 +362,9 @@ struct GTY((chain_next ("RTX_NEXT (&%h)"
     /* The INSN_UID of an RTX_INSN-class code.  */
     int insn_uid;
 
+    /* The PAT_VAR_LOCATION_STATUS of a VAR_LOCATION.  */
+    enum var_init_status var_location_status;
+
     /* In a CONST_WIDE_INT (aka hwivec_def), this is the number of
        HOST_WIDE_INTs in the hwivec_def.  */
     unsigned num_elem;
@@ -1055,7 +1058,8 @@ #define PAT_VAR_LOCATION_LOC(PAT) (XCEXP
    can be unknown, uninitialized or initialized.  See enumeration
    type below.  */
 #define PAT_VAR_LOCATION_STATUS(PAT) \
-  ((enum var_init_status) (XCINT ((PAT), 2, VAR_LOCATION)))
+  (RTL_FLAG_CHECK1 ("PAT_VAR_LOCATION_STATUS", PAT, VAR_LOCATION) \
+   ->u2.var_location_status)
 
 /* Accessors for a NOTE_INSN_VAR_LOCATION.  */
 #define NOTE_VAR_LOCATION_DECL(NOTE) \
@@ -2561,6 +2565,8 @@ extern rtx gen_raw_REG (enum machine_mod
 extern rtx gen_rtx_REG (enum machine_mode, unsigned);
 extern rtx gen_rtx_SUBREG (enum machine_mode, rtx, int);
 extern rtx gen_rtx_MEM (enum machine_mode, rtx);
+extern rtx gen_rtx_VAR_LOCATION (enum machine_mode, tree, rtx,
+				 enum var_init_status);
 
 #define GEN_INT(N)  gen_rtx_CONST_INT (VOIDmode, (N))
 
Index: gcc/gengenrtl.c
===================================================================
--- gcc/gengenrtl.c	2014-05-10 21:05:11.696853423 +0100
+++ gcc/gengenrtl.c	2014-05-10 21:17:11.885121038 +0100
@@ -141,9 +141,10 @@ special_rtx (int idx)
 static int
 excluded_rtx (int idx)
 {
-  return ((strcmp (defs[idx].enumname, "CONST_DOUBLE") == 0)
-	  || (strcmp (defs[idx].enumname, "CONST_WIDE_INT") == 0)
-	  || (strcmp (defs[idx].enumname, "CONST_FIXED") == 0));
+  return (strcmp (defs[idx].enumname, "VAR_LOCATION") == 0
+	  || strcmp (defs[idx].enumname, "CONST_DOUBLE") == 0
+	  || strcmp (defs[idx].enumname, "CONST_WIDE_INT") == 0
+	  || strcmp (defs[idx].enumname, "CONST_FIXED") == 0);
 }
 
 /* Place a list of all format specifiers we use into the array FORMAT.  */
Index: gcc/emit-rtl.c
===================================================================
--- gcc/emit-rtl.c	2014-05-10 21:13:03.380968449 +0100
+++ gcc/emit-rtl.c	2014-05-10 21:17:11.882121012 +0100
@@ -859,6 +859,15 @@ gen_lowpart_SUBREG (enum machine_mode mo
   return gen_rtx_SUBREG (mode, reg,
 			 subreg_lowpart_offset (mode, inmode));
 }
+
+rtx
+gen_rtx_VAR_LOCATION (enum machine_mode mode, tree decl, rtx loc,
+		      enum var_init_status status)
+{
+  rtx x = gen_rtx_fmt_te (VAR_LOCATION, mode, decl, loc);
+  PAT_VAR_LOCATION_STATUS (x) = status;
+  return x;
+}
 \f
 
 /* Create an rtvec and stores within it the RTXen passed in the arguments.  */
Index: gcc/var-tracking.c
===================================================================
--- gcc/var-tracking.c	2014-05-10 21:05:11.696853423 +0100
+++ gcc/var-tracking.c	2014-05-10 21:17:11.885121038 +0100
@@ -8748,8 +8748,7 @@ emit_note_insn_var_location (variable_de
 
   note_vl = NULL_RTX;
   if (!complete)
-    note_vl = gen_rtx_VAR_LOCATION (VOIDmode, decl, NULL_RTX,
-				    (int) initialized);
+    note_vl = gen_rtx_VAR_LOCATION (VOIDmode, decl, NULL_RTX, initialized);
   else if (n_var_parts == 1)
     {
       rtx expr_list;
@@ -8759,8 +8758,7 @@ emit_note_insn_var_location (variable_de
       else
 	expr_list = loc[0];
 
-      note_vl = gen_rtx_VAR_LOCATION (VOIDmode, decl, expr_list,
-				      (int) initialized);
+      note_vl = gen_rtx_VAR_LOCATION (VOIDmode, decl, expr_list, initialized);
     }
   else if (n_var_parts)
     {
@@ -8773,7 +8771,7 @@ emit_note_insn_var_location (variable_de
       parallel = gen_rtx_PARALLEL (VOIDmode,
 				   gen_rtvec_v (n_var_parts, loc));
       note_vl = gen_rtx_VAR_LOCATION (VOIDmode, decl,
-				      parallel, (int) initialized);
+				      parallel, initialized);
     }
 
   if (where != EMIT_NOTE_BEFORE_INSN)

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 7/7] Move SYMBOL_REF_FLAGS to rtx header
  2014-05-10 19:55 [PATCH 0/7] Shrink some rtxes Richard Sandiford
                   ` (5 preceding siblings ...)
  2014-05-10 20:22 ` [PATCH 6/7] Move PAT_VAR_LOCATION_STATUS to rtx header Richard Sandiford
@ 2014-05-10 20:24 ` Richard Sandiford
  2014-05-12 10:32   ` Michael Matz
                     ` (2 more replies)
  2014-05-10 20:25 ` [PATCH 0/7] Shrink some rtxes Richard Sandiford
  7 siblings, 3 replies; 30+ messages in thread
From: Richard Sandiford @ 2014-05-10 20:24 UTC (permalink / raw)
  To: gcc-patches

Very much like the code to move ORIGINAL_REGNO, but with a few more
knock-on changes.  I handled the printing by dumping the flags
immediately before the SYMBOL_REF_DATA.

Tested on x86_64-linux-gnu.  OK to install?

Thanks,
Richard


gcc/
	* rtl.def (SYMBOL_REF): Remove middle "0" field.
	* rtl.h (block_symbol): Reduce number of fields to 2.
	(rtx_def): Add u2.symbol_ref_flags.
	(SYMBOL_REF_FLAGS): Use it.
	(SYMBOL_REF_DATA, SET_SYMBOL_REF_DECL, SYMBOL_REF_DECL)
	(SET_SYMBOL_REF_CONSTANT, SYMBOL_REF_CONSTANT): Lower index.
	* gengtype.c (adjust_field_rtx_def): Remove SYMBOL_REF_FLAGS handling.
	Lower index of SYMBOL_REF_DATA.
	* print-rtl.c (print_rtx): Lower index for SYMBOL_REF_DATA.
	Print SYMBOL_REF_FLAGS at the same time.
	* genattrtab.c (attr_rtx_1): Only initialize 1 "0" SYMBOL_REF field.

Index: gcc/rtl.def
===================================================================
--- gcc/rtl.def	2014-05-10 21:17:11.883121021 +0100
+++ gcc/rtl.def	2014-05-10 21:22:23.685816826 +0100
@@ -429,10 +429,9 @@ DEF_RTL_EXPR(LABEL_REF, "label_ref", "u"
 
 /* Reference to a named label:
    Operand 0: label name
-   Operand 1: flags (see SYMBOL_FLAG_* in rtl.h)
-   Operand 2: tree from which this symbol is derived, or null.
+   Operand 1: tree from which this symbol is derived, or null.
    This is either a DECL node, or some kind of constant.  */
-DEF_RTL_EXPR(SYMBOL_REF, "symbol_ref", "s00", RTX_CONST_OBJ)
+DEF_RTL_EXPR(SYMBOL_REF, "symbol_ref", "s0", RTX_CONST_OBJ)
 
 /* The condition code register is represented, in our imagination,
    as a register holding a value that can be compared to zero.
Index: gcc/rtl.h
===================================================================
--- gcc/rtl.h	2014-05-10 21:17:11.883121021 +0100
+++ gcc/rtl.h	2014-05-10 21:22:23.686816835 +0100
@@ -211,7 +211,7 @@ struct GTY(()) reg_attrs {
    if SYMBOL_REF_HAS_BLOCK_INFO_P is true.  */
 struct GTY(()) block_symbol {
   /* The usual SYMBOL_REF fields.  */
-  rtunion GTY ((skip)) fld[3];
+  rtunion GTY ((skip)) fld[2];
 
   /* The block that contains this object.  */
   struct object_block *block;
@@ -362,6 +362,9 @@ struct GTY((chain_next ("RTX_NEXT (&%h)"
     /* The INSN_UID of an RTX_INSN-class code.  */
     int insn_uid;
 
+    /* The SYMBOL_REF_FLAGS of a SYMBOL_REF.  */
+    unsigned int symbol_ref_flags;
+
     /* The PAT_VAR_LOCATION_STATUS of a VAR_LOCATION.  */
     enum var_init_status var_location_status;
 
@@ -1765,24 +1768,24 @@ #define SYMBOL_REF_WEAK(RTX)						\
 
 /* A pointer attached to the SYMBOL_REF; either SYMBOL_REF_DECL or
    SYMBOL_REF_CONSTANT.  */
-#define SYMBOL_REF_DATA(RTX) X0ANY ((RTX), 2)
+#define SYMBOL_REF_DATA(RTX) X0ANY ((RTX), 1)
 
 /* Set RTX's SYMBOL_REF_DECL to DECL.  RTX must not be a constant
    pool symbol.  */
 #define SET_SYMBOL_REF_DECL(RTX, DECL) \
-  (gcc_assert (!CONSTANT_POOL_ADDRESS_P (RTX)), X0TREE ((RTX), 2) = (DECL))
+  (gcc_assert (!CONSTANT_POOL_ADDRESS_P (RTX)), X0TREE ((RTX), 1) = (DECL))
 
 /* The tree (decl or constant) associated with the symbol, or null.  */
 #define SYMBOL_REF_DECL(RTX) \
-  (CONSTANT_POOL_ADDRESS_P (RTX) ? NULL : X0TREE ((RTX), 2))
+  (CONSTANT_POOL_ADDRESS_P (RTX) ? NULL : X0TREE ((RTX), 1))
 
 /* Set RTX's SYMBOL_REF_CONSTANT to C.  RTX must be a constant pool symbol.  */
 #define SET_SYMBOL_REF_CONSTANT(RTX, C) \
-  (gcc_assert (CONSTANT_POOL_ADDRESS_P (RTX)), X0CONSTANT ((RTX), 2) = (C))
+  (gcc_assert (CONSTANT_POOL_ADDRESS_P (RTX)), X0CONSTANT ((RTX), 1) = (C))
 
 /* The rtx constant pool entry for a symbol, or null.  */
 #define SYMBOL_REF_CONSTANT(RTX) \
-  (CONSTANT_POOL_ADDRESS_P (RTX) ? X0CONSTANT ((RTX), 2) : NULL)
+  (CONSTANT_POOL_ADDRESS_P (RTX) ? X0CONSTANT ((RTX), 1) : NULL)
 
 /* A set of flags on a symbol_ref that are, in some respects, redundant with
    information derivable from the tree decl associated with this symbol.
@@ -1791,7 +1794,9 @@ #define SYMBOL_REF_CONSTANT(RTX) \
    this information to avoid recomputing it.  Finally, this allows space for
    the target to store more than one bit of information, as with
    SYMBOL_REF_FLAG.  */
-#define SYMBOL_REF_FLAGS(RTX)	X0INT ((RTX), 1)
+#define SYMBOL_REF_FLAGS(RTX) \
+  (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAGS", (RTX), SYMBOL_REF) \
+   ->u2.symbol_ref_flags)
 
 /* These flags are common enough to be defined for all targets.  They
    are computed by the default version of targetm.encode_section_info.  */
Index: gcc/gengtype.c
===================================================================
--- gcc/gengtype.c	2014-05-10 21:13:06.242993283 +0100
+++ gcc/gengtype.c	2014-05-10 21:22:23.685816826 +0100
@@ -1250,8 +1250,6 @@ adjust_field_rtx_def (type_p t, options_
 	      else if (i == REG && aindex == 1)
 		t = reg_attrs_tp, subname = "rt_reg";
 	      else if (i == SYMBOL_REF && aindex == 1)
-		t = scalar_tp, subname = "rt_int";
-	      else if (i == SYMBOL_REF && aindex == 2)
 		t = symbol_union_tp, subname = "";
 	      else if (i == JUMP_TABLE_DATA && aindex >= 4)
 		t = scalar_tp, subname = "rt_int";
Index: gcc/print-rtl.c
===================================================================
--- gcc/print-rtl.c	2014-05-10 21:13:03.384968484 +0100
+++ gcc/print-rtl.c	2014-05-10 21:22:23.686816835 +0100
@@ -224,9 +224,6 @@ print_rtx (const_rtx in_rtx)
 	    int flags = SYMBOL_REF_FLAGS (in_rtx);
 	    if (flags)
 	      fprintf (outfile, " [flags %#x]", flags);
-	  }
-	else if (i == 2 && GET_CODE (in_rtx) == SYMBOL_REF)
-	  {
 	    tree decl = SYMBOL_REF_DECL (in_rtx);
 	    if (decl)
 	      print_node_brief (outfile, "", decl, dump_flags);
Index: gcc/genattrtab.c
===================================================================
--- gcc/genattrtab.c	2014-05-10 21:05:11.673853221 +0100
+++ gcc/genattrtab.c	2014-05-10 21:22:23.684816818 +0100
@@ -472,10 +472,7 @@ attr_rtx_1 (enum rtx_code code, va_list
 	  rt_val = rtx_alloc (code);
 	  XSTR (rt_val, 0) = arg0;
 	  if (code == SYMBOL_REF)
-	    {
-	      X0EXP (rt_val, 1) = NULL_RTX;
-	      X0EXP (rt_val, 2) = NULL_RTX;
-	    }
+	    X0EXP (rt_val, 1) = NULL_RTX;
 	}
     }
   else if (GET_RTX_LENGTH (code) == 2

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 0/7] Shrink some rtxes
  2014-05-10 19:55 [PATCH 0/7] Shrink some rtxes Richard Sandiford
                   ` (6 preceding siblings ...)
  2014-05-10 20:24 ` [PATCH 7/7] Move SYMBOL_REF_FLAGS " Richard Sandiford
@ 2014-05-10 20:25 ` Richard Sandiford
  7 siblings, 0 replies; 30+ messages in thread
From: Richard Sandiford @ 2014-05-10 20:25 UTC (permalink / raw)
  To: gcc-patches

Richard Sandiford <rdsandiford@googlemail.com> writes:
> Until the wide-int merge there was a 32-bit hole on 64-bit hosts between
> the end of the rtx flags and the start of the first field.  It was decided
> that CONST_WIDE_INT should use this hole to store the number of HWIs.
>
> This patch series moves the "i" and int-typed "0" fields of some
> other rtxes to this region.  It mostly has to be "0" fields though.
> There are other rtxes like ADDRESS and SUBREG (for the SUBREG_BYTE)
> that would benefit in principle, but this would break various bits
> of code that use GET_RTX_FORMAT.  Probably the most difficult format
> user to update is genrecog.
>
> UNSPEC and UNSPEC_VOLATILE would also benefit, but the bigger saving
> there -- and for things like PARALLEL and CONST_VECTOR -- would be
> to use a trailing array for the rtxes instead of a separate rtvec.
> Something like a 24/8 split between the unspec number and number
> of subrtxes should be plenty.
>
> Tested on x86_64-linux-gnu.

Forgot to say that I also checked that the -da -fdump-noaddr output for
some -O2 -g tests was indentical before and after the patch.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/7] Fix GTY markup of u2
  2014-05-10 19:58 ` [PATCH 1/7] Fix GTY markup of u2 Richard Sandiford
@ 2014-05-11  0:21   ` Mike Stump
  2014-05-12 10:19     ` Michael Matz
  2014-05-12 15:34   ` Jeff Law
  1 sibling, 1 reply; 30+ messages in thread
From: Mike Stump @ 2014-05-11  0:21 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: gcc-patches

On May 10, 2014, at 12:58 PM, Richard Sandiford <rdsandiford@googlemail.com> wrote:
> The rtx u2 field currently uses a desc/tag pair for GTY.  This seems
> unnecessary though,

> OK to install?

Ick.  I don’t favor skip.  The change feels like a premature optimization that doesn’t net any code gen benefit.  I’ll defer to a gty person if they prefer skip.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/7] Fix GTY markup of u2
  2014-05-11  0:21   ` Mike Stump
@ 2014-05-12 10:19     ` Michael Matz
  2014-05-12 10:54       ` Richard Sandiford
  0 siblings, 1 reply; 30+ messages in thread
From: Michael Matz @ 2014-05-12 10:19 UTC (permalink / raw)
  To: Mike Stump; +Cc: Richard Sandiford, gcc-patches

[-- Attachment #1: Type: TEXT/PLAIN, Size: 634 bytes --]

Hi,

On Sat, 10 May 2014, Mike Stump wrote:

> > The rtx u2 field currently uses a desc/tag pair for GTY.  This seems
> > unnecessary though,
> 
> > OK to install?
> 
> Ick.  I donÂ’t favor skip.  The change feels like a premature 
> optimization that doesnÂ’t net any code gen benefit.  IÂ’ll defer to a gty 
> person if they prefer skip.

The skip is necessary, otherwise union members of GTY structs are required 
to have a 'desc' (and their members in turn are required to have a 'tag').  
So it's either the skip or the desc/tag pair.  The code-gen difference is 
one empty (but two-cased) switch statement less.


Ciao,
Michael.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 7/7] Move SYMBOL_REF_FLAGS to rtx header
  2014-05-10 20:24 ` [PATCH 7/7] Move SYMBOL_REF_FLAGS " Richard Sandiford
@ 2014-05-12 10:32   ` Michael Matz
  2014-05-12 11:00     ` Richard Sandiford
  2014-05-12 16:27   ` Jeff Law
  2014-05-29 11:28   ` Tom de Vries
  2 siblings, 1 reply; 30+ messages in thread
From: Michael Matz @ 2014-05-12 10:32 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: gcc-patches

Hi,

On Sat, 10 May 2014, Richard Sandiford wrote:

> @@ -362,6 +362,9 @@ struct GTY((chain_next ("RTX_NEXT (&%h)"
>      /* The INSN_UID of an RTX_INSN-class code.  */
>      int insn_uid;
>  
> +    /* The SYMBOL_REF_FLAGS of a SYMBOL_REF.  */
> +    unsigned int symbol_ref_flags;
> +

In [3/7] you used

+    /* The ORIGINAL_REGNO of a REG.  */
+    unsigned original_regno;
+

Should be consistent.  Also I'm idly wondering if the explicit sizing of 
the fields via a bit-field as originally would be better here or just 
confusing.  I guess unsigned and enums are 32bit for all hosts we care 
about, but if we ever have one where it's larger the rtx will suddenly 
contain another hole.


Ciao,
Michael.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/7] Fix GTY markup of u2
  2014-05-12 10:19     ` Michael Matz
@ 2014-05-12 10:54       ` Richard Sandiford
  2014-05-12 14:20         ` Mike Stump
  0 siblings, 1 reply; 30+ messages in thread
From: Richard Sandiford @ 2014-05-12 10:54 UTC (permalink / raw)
  To: Michael Matz; +Cc: Mike Stump, gcc-patches

Michael Matz <matz@suse.de> writes:
> Hi,
>
> On Sat, 10 May 2014, Mike Stump wrote:
>
>> > The rtx u2 field currently uses a desc/tag pair for GTY.  This seems
>> > unnecessary though,
>> 
>> > OK to install?
>> 
>> Ick.  I don’t favor skip.  The change feels like a premature 
>> optimization that doesn’t net any code gen benefit.  I’ll defer to a gty 
>> person if they prefer skip.
>
> The skip is necessary, otherwise union members of GTY structs are required 
> to have a 'desc' (and their members in turn are required to have a 'tag').  
> So it's either the skip or the desc/tag pair.  The code-gen difference is 
> one empty (but two-cased) switch statement less.

Yeah, but the reason I'm removing the desc/tag pair isn't so much to get
rid of that (the compiler should do it for us) but because marking it
anything other than "skip" gives the impression that we want to allow
GC pointers in the union.

Richard

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 7/7] Move SYMBOL_REF_FLAGS to rtx header
  2014-05-12 10:32   ` Michael Matz
@ 2014-05-12 11:00     ` Richard Sandiford
  2014-05-12 11:05       ` Michael Matz
  2014-05-12 15:49       ` Jeff Law
  0 siblings, 2 replies; 30+ messages in thread
From: Richard Sandiford @ 2014-05-12 11:00 UTC (permalink / raw)
  To: Michael Matz; +Cc: gcc-patches

Michael Matz <matz@suse.de> writes:
> Hi,
>
> On Sat, 10 May 2014, Richard Sandiford wrote:
>
>> @@ -362,6 +362,9 @@ struct GTY((chain_next ("RTX_NEXT (&%h)"
>>      /* The INSN_UID of an RTX_INSN-class code.  */
>>      int insn_uid;
>>  
>> +    /* The SYMBOL_REF_FLAGS of a SYMBOL_REF.  */
>> +    unsigned int symbol_ref_flags;
>> +
>
> In [3/7] you used
>
> +    /* The ORIGINAL_REGNO of a REG.  */
> +    unsigned original_regno;
> +
>
> Should be consistent.

Oops, indeed.  Will fix them all to use unsigned int if approved.

> Also I'm idly wondering if the explicit sizing of 
> the fields via a bit-field as originally would be better here or just 
> confusing.  I guess unsigned and enums are 32bit for all hosts we care 
> about, but if we ever have one where it's larger the rtx will suddenly 
> contain another hole.

But that'll happen anyway, which is why I thought having bitfields
was confusing.  Since this is a union, you'll always get the full
"unsigned int" regardless of the bitfield size; the bitfield can't
be packed with anything else.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 7/7] Move SYMBOL_REF_FLAGS to rtx header
  2014-05-12 11:00     ` Richard Sandiford
@ 2014-05-12 11:05       ` Michael Matz
  2014-05-12 15:49       ` Jeff Law
  1 sibling, 0 replies; 30+ messages in thread
From: Michael Matz @ 2014-05-12 11:05 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: gcc-patches

Hi,

On Mon, 12 May 2014, Richard Sandiford wrote:

> > Also I'm idly wondering if the explicit sizing of 
> > the fields via a bit-field as originally would be better here or just 
> > confusing.  I guess unsigned and enums are 32bit for all hosts we care 
> > about, but if we ever have one where it's larger the rtx will suddenly 
> > contain another hole.
> 
> But that'll happen anyway, which is why I thought having bitfields
> was confusing.  Since this is a union, you'll always get the full
> "unsigned int" regardless of the bitfield size; the bitfield can't
> be packed with anything else.

Hmm, true.  Okay, it'd be premature optimization for hosts which don't 
exist anyway :)


Ciao,
Michael.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/7] Fix GTY markup of u2
  2014-05-12 10:54       ` Richard Sandiford
@ 2014-05-12 14:20         ` Mike Stump
  0 siblings, 0 replies; 30+ messages in thread
From: Mike Stump @ 2014-05-12 14:20 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: Michael Matz, gcc-patches

On May 12, 2014, at 3:53 AM, Richard Sandiford <rdsandiford@googlemail.com> wrote:
> Yeah, but the reason I'm removing the desc/tag pair isn't so much to get
> rid of that (the compiler should do it for us) but because marking it
> anything other than "skip" gives the impression that we want to allow
> GC pointers in the union.

Yeah, though I might like the generality of being able to do that, I will confess, I don’t think we will ever add a GC pointer, or indeed change the data much in the next 15 years.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/7] Fix GTY markup of u2
  2014-05-10 19:58 ` [PATCH 1/7] Fix GTY markup of u2 Richard Sandiford
  2014-05-11  0:21   ` Mike Stump
@ 2014-05-12 15:34   ` Jeff Law
  1 sibling, 0 replies; 30+ messages in thread
From: Jeff Law @ 2014-05-12 15:34 UTC (permalink / raw)
  To: gcc-patches, rdsandiford

On 05/10/14 13:58, Richard Sandiford wrote:
> The rtx u2 field currently uses a desc/tag pair for GTY.  This seems
> unnecessary though, since the field is specifically supposed to be
> 32 bits wide on 64-bit hosts and so cannot hold a pointer.
>
> Tested on x86_64-linux-gnu.  OK to install?
>
> Thanks,
> Richard
>
>
> gcc/
> 	* rtl.h (rtx_def): Mark u2 as GTY ((skip)).
OK for the trunk.

Jeff

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/7] Reduce GENERATOR_FILE ifndefs in print-rtl.c
  2014-05-10 20:00 ` [PATCH 2/7] Reduce GENERATOR_FILE ifndefs in print-rtl.c Richard Sandiford
@ 2014-05-12 15:37   ` Jeff Law
  0 siblings, 0 replies; 30+ messages in thread
From: Jeff Law @ 2014-05-12 15:37 UTC (permalink / raw)
  To: gcc-patches, rdsandiford

On 05/10/14 14:00, Richard Sandiford wrote:
> The print-rtl.c code for '0' fields has a complicated sequence of
> ifndef GENERATOR_FILEs.  None of the '0' data makes sense for generators
> though, so it seems simpler to wrap the whole case instead.
>
> Tested on x86_64-linux-gnu.  OK to install?
>
> Thanks,
> Richard
>
>
> gcc/
> 	* print-rtl.c (print_rtx): Guard whole '0' block with ifndef
> 	GENERATOR_FILE.
OK.  Thanks.

Jeff


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/7] Move ORIGINAL_REGNO to rtx header
  2014-05-10 20:08 ` [PATCH 3/7] Move ORIGINAL_REGNO to rtx header Richard Sandiford
@ 2014-05-12 15:46   ` Jeff Law
  0 siblings, 0 replies; 30+ messages in thread
From: Jeff Law @ 2014-05-12 15:46 UTC (permalink / raw)
  To: gcc-patches, rdsandiford

On 05/10/14 14:08, Richard Sandiford wrote:
> ...and reduce the size of REGs by one field.  This is still OK for REG->MEM
> conversion since MEMs only have 2 fields.
>
> In some ways it would have been nicer to move REGNO to the header,
> since we wouldn't then need to fetch the second word of the rtx when
> checking whether something is a REG and then checking its REGNO.
> But that's much more complicated and essentially breaks the LISPness
> of rtxes; see the covering note for more details.
Yea, we certainly hit REGNO much  more often than ORIGINAL_REGNO, so 
it'be better to move the former.  However, there's still obviously 
benefit in decreasing the size of a REG by a word.

>
> We currently print the ORIGINAL_REGNO twice if there are also REG_ATTRS.
> I've kept this behaviour in order to ensure that the -da output wasn't
> changed by the patch series, but I could turn the "if" into an "else if"
> if that seems better.
Seems like a fine follow-up item.

I was briefly concerned that these objects may not fall into one of the 
special buckets in the gc-allocator.  But after looking at the code for 
how we initialize the extra_order_size_table we're probably OK.


>
> Tested on x86_64-linux-gnu.  OK to install?
>
> Thanks,
> Richard
>
>
> gcc/
> 	* rtl.def (REG): Remove middle field.
> 	* rtl.h (rtx_def): Add orignal_regno to u2.
> 	(ORIGINAL_REGNO): Use it instead of field 1.
> 	(REG_ATTRS): Lower field index accordingly.
> 	* gengtype.c (adjust_field_rtx_def): Remove handling of
> 	ORIGINAL_REGNO.  Move REG_ATTRS index down.
> 	* print-rtl.c (print_rtx): Move ORIGINAL_REGNO handling to the
> 	code that prints the REGNO.

This is fine for the trunk.

Thanks,
Jeff

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 7/7] Move SYMBOL_REF_FLAGS to rtx header
  2014-05-12 11:00     ` Richard Sandiford
  2014-05-12 11:05       ` Michael Matz
@ 2014-05-12 15:49       ` Jeff Law
  1 sibling, 0 replies; 30+ messages in thread
From: Jeff Law @ 2014-05-12 15:49 UTC (permalink / raw)
  To: Michael Matz, gcc-patches, rdsandiford

On 05/12/14 05:00, Richard Sandiford wrote:
> Michael Matz <matz@suse.de> writes:
>> Hi,
>>
>> On Sat, 10 May 2014, Richard Sandiford wrote:
>>
>>> @@ -362,6 +362,9 @@ struct GTY((chain_next ("RTX_NEXT (&%h)"
>>>       /* The INSN_UID of an RTX_INSN-class code.  */
>>>       int insn_uid;
>>>
>>> +    /* The SYMBOL_REF_FLAGS of a SYMBOL_REF.  */
>>> +    unsigned int symbol_ref_flags;
>>> +
>>
>> In [3/7] you used
>>
>> +    /* The ORIGINAL_REGNO of a REG.  */
>> +    unsigned original_regno;
>> +
>>
>> Should be consistent.
>
> Oops, indeed.  Will fix them all to use unsigned int if approved.
Approved with the consistency fix.
jeff

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 4/7] Move INSN_UID to the rtx header
  2014-05-10 20:13 ` [PATCH 4/7] Move INSN_UID to the " Richard Sandiford
@ 2014-05-12 15:58   ` Jeff Law
  0 siblings, 0 replies; 30+ messages in thread
From: Jeff Law @ 2014-05-12 15:58 UTC (permalink / raw)
  To: gcc-patches, rdsandiford

On 05/10/14 14:12, Richard Sandiford wrote:
> This is a bit more complicated than REG because INSN_UID is an "i" field
> and so is a parameter to the respective gen_rtx_FOOs.  However, in all
> but one case these uids were dummy values; the one exception can simply
> set the INSN_UID after the call instead.  These rtxes also don't matter
> to genrecog or to the various equality routines, so the move should be
> safe despite being an "i" field.
>
> Tested on x86_64-linux-gnu.  OK to install?
>
> Thanks,
> Richard
>
>
> gcc/
> 	* rtl.def (DEBUG_INSN, INSN, JUMP_INSN, CALL_INSN, JUMP_TABLE_DATA)
> 	(BARRIER, CODE_LABEL, NOTE): Remove first "i" field.
> 	* rtl.h (rtx_def): Add insn_uid to u2 field.
> 	(RTX_FLAG_CHECK8): Delete in favor of...
> 	(RTL_INSN_CHAIN_FLAG_CHECK): ...this new macro.
> 	(INSN_DELETED_P): Update accordingly.
> 	(INSN_UID): Use u2.insn_uid.
> 	(INSN_CHAIN_CODE_P): Define.
> 	(PREV_INSN, NEXT_INSN, BLOCK_FOR_INSN, PATTERN, INSN_LOCATION)
> 	(INSN_CODE, REG_NOTES, CALL_INSN_FUNCTION_USAGE, CODE_LABEL_NUMBER)
> 	(NOTE_DATA, NOTE_DELETED_LABEL_NAME, NOTE_BLOCK, NOTE_EH_HANDLER)
> 	(NOTE_BASIC_BLOCK, NOTE_VAR_LOCATION, NOTE_CFI, NOTE_LABEL_NUMBER)
> 	(NOTE_KIND, LABEL_NAME, LABEL_NUSES, JUMP_LABEL, LABEL_REFS): Lower
> 	indices accordingly.
> 	* print-rtl.c (print_rtx): Print INSN_UIDs before the main loop.
> 	Update indices for insn-chain rtxes.
> 	* gengtype.c (gen_rtx_next): Adjust test for insn-chain rtxes.
> 	(adjust_field_rtx_def): Lower '0' indices for all insn-chain rtxes.
> 	* emit-rtl.c (gen_label_rtx): Update gen_rtx_LABEL call.
> 	* caller-save.c (init_caller_save): Update gen_rtx_INSN calls.
> 	* combine.c (try_combine): Likewise.
> 	* ira.c (setup_prohibited_mode_move_regs): Likewise.
OK.

I guess my fingers are going to have to get used to a new way to set 
conditional breakpoints on uids..  But that's no reason to reject the 
patch :-)

Approved.   Thanks.

Jeff

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 5/7] Shrink SCRATCH
  2014-05-10 20:17 ` [PATCH 5/7] Shrink SCRATCH Richard Sandiford
@ 2014-05-12 16:00   ` Jeff Law
  2014-05-12 16:37     ` Richard Sandiford
  0 siblings, 1 reply; 30+ messages in thread
From: Jeff Law @ 2014-05-12 16:00 UTC (permalink / raw)
  To: gcc-patches, rdsandiford

On 05/10/14 14:16, Richard Sandiford wrote:
> SCRATCH has a single "0" field because reload used to turn it directly
> into a REG.  It no longer does (or could do) that since REG has three
> fields rather than one.  This patch therefore updates the comment and
> removes the field.
>
> Tested on x86_64-linux-gnu.  OK to install?
>
> Thanks,
> Richard
>
>
> gcc/
> 	* rtl.def (scratch): Fix outdated comment and remove "0" field.
> 	* gengtype.c (adjust_field_rtx_def): Update accordingly.
Are you sure reload doesn't still do this?  Do you have a pointer to 
when this code was removed?

While I would have expected something to break, perhaps the problems are 
just latent.

If you had a pointer which showed this code in reload being removed, I'd 
approve without hesitation.

Jeff

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 6/7] Move PAT_VAR_LOCATION_STATUS to rtx header
  2014-05-10 20:22 ` [PATCH 6/7] Move PAT_VAR_LOCATION_STATUS to rtx header Richard Sandiford
@ 2014-05-12 16:01   ` Jeff Law
  0 siblings, 0 replies; 30+ messages in thread
From: Jeff Law @ 2014-05-12 16:01 UTC (permalink / raw)
  To: gcc-patches, rdsandiford

On 05/10/14 14:22, Richard Sandiford wrote:
> This is the other case (apart from INSN_UID) in which the field being
> moved is an "i".  I kept the gen_rtx_VAR_LOCATION interface the same
> by writing it in C code.  As with INSN_UID, removing an "i" is safe
> because genrecog and the equality routines don't care about VAR_LOCATIONs.
> (Equality would only being meaningful if we also checked the decl in the
> 't' field.)
>
> Tested on x86_64-linux-gnu.  OK to install?
>
> Thanks,
> Richard
>
>
> gcc/
> 	* rtl.def (VAR_LOCATION): Remove "i" field.
> 	* rtl.h (rtx_def): Add u2.var_location_status.
> 	(PAT_VAR_LOCATION_STATUS): Use it.
> 	(gen_rtx_VAR_LOCATION): Declare.
> 	* gengenrtl.c (excluded_rtx): Add VAR_LOCATION.
> 	* emit-rtl.c (gen_rtx_VAR_LOCATION): New function.
> 	* var-tracking.c (emit_note_insn_var_location): Remove casts.
OK.
Jeff

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 7/7] Move SYMBOL_REF_FLAGS to rtx header
  2014-05-10 20:24 ` [PATCH 7/7] Move SYMBOL_REF_FLAGS " Richard Sandiford
  2014-05-12 10:32   ` Michael Matz
@ 2014-05-12 16:27   ` Jeff Law
  2014-05-29 11:28   ` Tom de Vries
  2 siblings, 0 replies; 30+ messages in thread
From: Jeff Law @ 2014-05-12 16:27 UTC (permalink / raw)
  To: gcc-patches, rdsandiford

On 05/10/14 14:24, Richard Sandiford wrote:
> Very much like the code to move ORIGINAL_REGNO, but with a few more
> knock-on changes.  I handled the printing by dumping the flags
> immediately before the SYMBOL_REF_DATA.
>
> Tested on x86_64-linux-gnu.  OK to install?
>
> Thanks,
> Richard
>
>
> gcc/
> 	* rtl.def (SYMBOL_REF): Remove middle "0" field.
> 	* rtl.h (block_symbol): Reduce number of fields to 2.
> 	(rtx_def): Add u2.symbol_ref_flags.
> 	(SYMBOL_REF_FLAGS): Use it.
> 	(SYMBOL_REF_DATA, SET_SYMBOL_REF_DECL, SYMBOL_REF_DECL)
> 	(SET_SYMBOL_REF_CONSTANT, SYMBOL_REF_CONSTANT): Lower index.
> 	* gengtype.c (adjust_field_rtx_def): Remove SYMBOL_REF_FLAGS handling.
> 	Lower index of SYMBOL_REF_DATA.
> 	* print-rtl.c (print_rtx): Lower index for SYMBOL_REF_DATA.
> 	Print SYMBOL_REF_FLAGS at the same time.
> 	* genattrtab.c (attr_rtx_1): Only initialize 1 "0" SYMBOL_REF field.
OK for the trunk.
jeff

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 5/7] Shrink SCRATCH
  2014-05-12 16:00   ` Jeff Law
@ 2014-05-12 16:37     ` Richard Sandiford
  2014-05-12 17:01       ` Jeff Law
  0 siblings, 1 reply; 30+ messages in thread
From: Richard Sandiford @ 2014-05-12 16:37 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc-patches

Jeff Law <law@redhat.com> writes:
> On 05/10/14 14:16, Richard Sandiford wrote:
>> SCRATCH has a single "0" field because reload used to turn it directly
>> into a REG.  It no longer does (or could do) that since REG has three
>> fields rather than one.  This patch therefore updates the comment and
>> removes the field.
>>
>> Tested on x86_64-linux-gnu.  OK to install?
>>
>> Thanks,
>> Richard
>>
>>
>> gcc/
>> 	* rtl.def (scratch): Fix outdated comment and remove "0" field.
>> 	* gengtype.c (adjust_field_rtx_def): Update accordingly.
> Are you sure reload doesn't still do this?  Do you have a pointer to 
> when this code was removed?

The rtl.def SCRATCH entry predates the repository (1991) and I couldn't
see anything in the initial versions of reload.c or reload1.c that set
the code to a REG.  local-alloc.c had:

  if (qty_scratch_rtx[q])
    {
      if (GET_CODE (qty_scratch_rtx[q]) == REG)
        abort ();
      PUT_CODE (qty_scratch_rtx[q], REG);
      REGNO (qty_scratch_rtx[q]) = qty_phys_reg[q];

but that was removed by:

Wed Oct 22 00:34:12 1997  Jeffrey A Law  (law@cygnus.com)

       * local-alloc.c (block_alloc): Don't lose if two SCRATCH expressions
       are shared.

(Disappointed that you don't remember what you did in 97. :-))

I couldn't see anything in global.c that would set the code to a REG.
No current calls to PUT_CODE would do that either.

REG became bigger than SCRATCH with:

Thu Jun 25 15:08:16 1998  Mark Mitchell  <mark@markmitchell.com>

       * invoke.texi (-fstrict-aliasing): Document.
       * rtl.texi (MEM_ALIAS_SET): Document.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 5/7] Shrink SCRATCH
  2014-05-12 16:37     ` Richard Sandiford
@ 2014-05-12 17:01       ` Jeff Law
  0 siblings, 0 replies; 30+ messages in thread
From: Jeff Law @ 2014-05-12 17:01 UTC (permalink / raw)
  To: gcc-patches, rdsandiford

On 05/12/14 10:37, Richard Sandiford wrote:
> The rtl.def SCRATCH entry predates the repository (1991) and I couldn't
> see anything in the initial versions of reload.c or reload1.c that set
> the code to a REG.  local-alloc.c had:
>
>    if (qty_scratch_rtx[q])
>      {
>        if (GET_CODE (qty_scratch_rtx[q]) == REG)
>          abort ();
>        PUT_CODE (qty_scratch_rtx[q], REG);
>        REGNO (qty_scratch_rtx[q]) = qty_phys_reg[q];
>
> but that was removed by:
>
> Wed Oct 22 00:34:12 1997  Jeffrey A Law  (law@cygnus.com)
>
>         * local-alloc.c (block_alloc): Don't lose if two SCRATCH expressions
>         are shared.
>
> (Disappointed that you don't remember what you did in 97. :-))
:-)  '97 to '99 were, umm, busy.

>
> I couldn't see anything in global.c that would set the code to a REG.
> No current calls to PUT_CODE would do that either.
>
> REG became bigger than SCRATCH with:
>
> Thu Jun 25 15:08:16 1998  Mark Mitchell  <mark@markmitchell.com>
>
>         * invoke.texi (-fstrict-aliasing): Document.
>         * rtl.texi (MEM_ALIAS_SET): Document.
OK.  Concerns addressed.  Go ahead with the change.

Thanks for the detective work! :-)

jeff

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 7/7] Move SYMBOL_REF_FLAGS to rtx header
  2014-05-10 20:24 ` [PATCH 7/7] Move SYMBOL_REF_FLAGS " Richard Sandiford
  2014-05-12 10:32   ` Michael Matz
  2014-05-12 16:27   ` Jeff Law
@ 2014-05-29 11:28   ` Tom de Vries
  2014-05-29 12:07     ` Richard Sandiford
  2014-05-29 12:27     ` Jeff Law
  2 siblings, 2 replies; 30+ messages in thread
From: Tom de Vries @ 2014-05-29 11:28 UTC (permalink / raw)
  To: rdsandiford; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2483 bytes --]

On 10-05-14 22:24, Richard Sandiford wrote:
>   /* A set of flags on a symbol_ref that are, in some respects, redundant with
>      information derivable from the tree decl associated with this symbol.
> @@ -1791,7 +1794,9 @@ #define SYMBOL_REF_CONSTANT(RTX) \
>      this information to avoid recomputing it.  Finally, this allows space for
>      the target to store more than one bit of information, as with
>      SYMBOL_REF_FLAG.  */
> -#define SYMBOL_REF_FLAGS(RTX)	X0INT ((RTX), 1)
> +#define SYMBOL_REF_FLAGS(RTX) \
> +  (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAGS", (RTX), SYMBOL_REF) \
> +   ->u2.symbol_ref_flags)
>

Richard,

with an arm-linux-gnueabi non-bootstrap build with --enable-checking=yes,rtl, I 
ran into the following error:
...
/home/vries/gcc_versions/devel/src/libgcc/libgcc2.c:819:1: internal compiler 
error: RTL check: attempt to treat non-block symbol as a block symbol in 
create_block_symbol, at varasm.c:394
  };
  ^
0xc3c16b rtl_check_failed_block_symbol(char const*, int, char const*)
	/home/vries/gcc_versions/devel/src/gcc/rtl.c:844
0x103c09d create_block_symbol
	/home/vries/gcc_versions/devel/src/gcc/varasm.c:394
0x103f42d make_decl_rtl(tree_node*)
	/home/vries/gcc_versions/devel/src/gcc/varasm.c:1379
0x103fc87 notice_global_symbol(tree_node*)
	/home/vries/gcc_versions/devel/src/gcc/varasm.c:1552
0x7588bf varpool_finalize_decl(tree_node*)
	/home/vries/gcc_versions/devel/src/gcc/cgraphunit.c:823
0xb4eaa0 rest_of_decl_compilation(tree_node*, int, int)
	/home/vries/gcc_versions/devel/src/gcc/passes.c:241
0x5902c4 finish_decl(tree_node*, unsigned int, tree_node*, tree_node*, tree_node*)
	/home/vries/gcc_versions/devel/src/gcc/c/c-decl.c:4521
0x5e8586 c_parser_declaration_or_fndef
	/home/vries/gcc_versions/devel/src/gcc/c/c-parser.c:1782
0x5e7644 c_parser_external_declaration
	/home/vries/gcc_versions/devel/src/gcc/c/c-parser.c:1399
0x5e72c7 c_parser_translation_unit
	/home/vries/gcc_versions/devel/src/gcc/c/c-parser.c:1286
0x606c6d c_parse_file()
	/home/vries/gcc_versions/devel/src/gcc/c/c-parser.c:14077
0x66b7fa c_common_parse_file()
	/home/vries/gcc_versions/devel/src/gcc/c-family/c-opts.c:1067
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
...

It looks like BLOCK_SYMBOL_CHECK hasn't been updated.

Patch below fixes it for me. OK for trunk if bootstrap on x86_64 succeeds?

Thanks,
- Tom



[-- Attachment #2: 0006-Fix-rtl-check-build.patch --]
[-- Type: text/x-patch, Size: 713 bytes --]

2014-05-29  Tom de Vries  <tom@codesourcery.com>

	* rtl.h (BLOCK_SYMBOL_CHECK): Use SYMBOL_REF_FLAGS.
---
 gcc/rtl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/rtl.h b/gcc/rtl.h
index 02ce424..51cfae5 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -708,7 +708,7 @@ struct GTY(()) rtvec_def {
 
 #define BLOCK_SYMBOL_CHECK(RTX) __extension__				\
 ({ __typeof (RTX) const _symbol = (RTX);				\
-   const unsigned int flags = RTL_CHECKC1 (_symbol, 1, SYMBOL_REF).rt_int; \
+   const unsigned int flags = SYMBOL_REF_FLAGS (_symbol);		\
    if ((flags & SYMBOL_FLAG_HAS_BLOCK_INFO) == 0)			\
      rtl_check_failed_block_symbol (__FILE__, __LINE__,			\
 				    __FUNCTION__);			\
-- 
1.9.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 7/7] Move SYMBOL_REF_FLAGS to rtx header
  2014-05-29 11:28   ` Tom de Vries
@ 2014-05-29 12:07     ` Richard Sandiford
  2014-05-29 12:29       ` Jeff Law
  2014-05-29 12:27     ` Jeff Law
  1 sibling, 1 reply; 30+ messages in thread
From: Richard Sandiford @ 2014-05-29 12:07 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gcc-patches

Tom de Vries <Tom_deVries@mentor.com> writes:
> On 10-05-14 22:24, Richard Sandiford wrote:
>>   /* A set of flags on a symbol_ref that are, in some respects, redundant with
>>      information derivable from the tree decl associated with this symbol.
>> @@ -1791,7 +1794,9 @@ #define SYMBOL_REF_CONSTANT(RTX) \
>>      this information to avoid recomputing it.  Finally, this allows space for
>>      the target to store more than one bit of information, as with
>>      SYMBOL_REF_FLAG.  */
>> -#define SYMBOL_REF_FLAGS(RTX)	X0INT ((RTX), 1)
>> +#define SYMBOL_REF_FLAGS(RTX) \
>> +  (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAGS", (RTX), SYMBOL_REF) \
>> +   ->u2.symbol_ref_flags)
>>
>
> Richard,
>
> with an arm-linux-gnueabi non-bootstrap build with --enable-checking=yes,rtl, I 
> ran into the following error:
> ...
> /home/vries/gcc_versions/devel/src/libgcc/libgcc2.c:819:1: internal compiler 
> error: RTL check: attempt to treat non-block symbol as a block symbol in 
> create_block_symbol, at varasm.c:394
>   };
>   ^
> 0xc3c16b rtl_check_failed_block_symbol(char const*, int, char const*)
> 	/home/vries/gcc_versions/devel/src/gcc/rtl.c:844
> 0x103c09d create_block_symbol
> 	/home/vries/gcc_versions/devel/src/gcc/varasm.c:394
> 0x103f42d make_decl_rtl(tree_node*)
> 	/home/vries/gcc_versions/devel/src/gcc/varasm.c:1379
> 0x103fc87 notice_global_symbol(tree_node*)
> 	/home/vries/gcc_versions/devel/src/gcc/varasm.c:1552
> 0x7588bf varpool_finalize_decl(tree_node*)
> 	/home/vries/gcc_versions/devel/src/gcc/cgraphunit.c:823
> 0xb4eaa0 rest_of_decl_compilation(tree_node*, int, int)
> 	/home/vries/gcc_versions/devel/src/gcc/passes.c:241
> 0x5902c4 finish_decl(tree_node*, unsigned int, tree_node*, tree_node*, tree_node*)
> 	/home/vries/gcc_versions/devel/src/gcc/c/c-decl.c:4521
> 0x5e8586 c_parser_declaration_or_fndef
> 	/home/vries/gcc_versions/devel/src/gcc/c/c-parser.c:1782
> 0x5e7644 c_parser_external_declaration
> 	/home/vries/gcc_versions/devel/src/gcc/c/c-parser.c:1399
> 0x5e72c7 c_parser_translation_unit
> 	/home/vries/gcc_versions/devel/src/gcc/c/c-parser.c:1286
> 0x606c6d c_parse_file()
> 	/home/vries/gcc_versions/devel/src/gcc/c/c-parser.c:14077
> 0x66b7fa c_common_parse_file()
> 	/home/vries/gcc_versions/devel/src/gcc/c-family/c-opts.c:1067
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <http://gcc.gnu.org/bugs.html> for instructions.
> ...
>
> It looks like BLOCK_SYMBOL_CHECK hasn't been updated.
>
> Patch below fixes it for me. OK for trunk if bootstrap on x86_64 succeeds?

Can't really approve it, but it looks obviously correct to me.
Thanks for the fix.

Richard

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 7/7] Move SYMBOL_REF_FLAGS to rtx header
  2014-05-29 11:28   ` Tom de Vries
  2014-05-29 12:07     ` Richard Sandiford
@ 2014-05-29 12:27     ` Jeff Law
  1 sibling, 0 replies; 30+ messages in thread
From: Jeff Law @ 2014-05-29 12:27 UTC (permalink / raw)
  To: Tom de Vries, rdsandiford; +Cc: gcc-patches

On 05/29/14 05:27, Tom de Vries wrote:
> On 10-05-14 22:24, Richard Sandiford wrote:
>>   /* A set of flags on a symbol_ref that are, in some respects,
>> redundant with
>>      information derivable from the tree decl associated with this
>> symbol.
>> @@ -1791,7 +1794,9 @@ #define SYMBOL_REF_CONSTANT(RTX) \
>>      this information to avoid recomputing it.  Finally, this allows
>> space for
>>      the target to store more than one bit of information, as with
>>      SYMBOL_REF_FLAG.  */
>> -#define SYMBOL_REF_FLAGS(RTX)    X0INT ((RTX), 1)
>> +#define SYMBOL_REF_FLAGS(RTX) \
>> +  (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAGS", (RTX), SYMBOL_REF) \
>> +   ->u2.symbol_ref_flags)
>>
>
> Richard,
>
> with an arm-linux-gnueabi non-bootstrap build with
> --enable-checking=yes,rtl, I ran into the following error:
> ...
> /home/vries/gcc_versions/devel/src/libgcc/libgcc2.c:819:1: internal
> compiler error: RTL check: attempt to treat non-block symbol as a block
> symbol in create_block_symbol, at varasm.c:394
>   };
>   ^
> 0xc3c16b rtl_check_failed_block_symbol(char const*, int, char const*)
>      /home/vries/gcc_versions/devel/src/gcc/rtl.c:844
> 0x103c09d create_block_symbol
>      /home/vries/gcc_versions/devel/src/gcc/varasm.c:394
> 0x103f42d make_decl_rtl(tree_node*)
>      /home/vries/gcc_versions/devel/src/gcc/varasm.c:1379
> 0x103fc87 notice_global_symbol(tree_node*)
>      /home/vries/gcc_versions/devel/src/gcc/varasm.c:1552
> 0x7588bf varpool_finalize_decl(tree_node*)
>      /home/vries/gcc_versions/devel/src/gcc/cgraphunit.c:823
> 0xb4eaa0 rest_of_decl_compilation(tree_node*, int, int)
>      /home/vries/gcc_versions/devel/src/gcc/passes.c:241
> 0x5902c4 finish_decl(tree_node*, unsigned int, tree_node*, tree_node*,
> tree_node*)
>      /home/vries/gcc_versions/devel/src/gcc/c/c-decl.c:4521
> 0x5e8586 c_parser_declaration_or_fndef
>      /home/vries/gcc_versions/devel/src/gcc/c/c-parser.c:1782
> 0x5e7644 c_parser_external_declaration
>      /home/vries/gcc_versions/devel/src/gcc/c/c-parser.c:1399
> 0x5e72c7 c_parser_translation_unit
>      /home/vries/gcc_versions/devel/src/gcc/c/c-parser.c:1286
> 0x606c6d c_parse_file()
>      /home/vries/gcc_versions/devel/src/gcc/c/c-parser.c:14077
> 0x66b7fa c_common_parse_file()
>      /home/vries/gcc_versions/devel/src/gcc/c-family/c-opts.c:1067
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <http://gcc.gnu.org/bugs.html> for instructions.
> ...
>
> It looks like BLOCK_SYMBOL_CHECK hasn't been updated.
>
> Patch below fixes it for me. OK for trunk if bootstrap on x86_64 succeeds?
Yes.  Ok.

jeff

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 7/7] Move SYMBOL_REF_FLAGS to rtx header
  2014-05-29 12:07     ` Richard Sandiford
@ 2014-05-29 12:29       ` Jeff Law
  0 siblings, 0 replies; 30+ messages in thread
From: Jeff Law @ 2014-05-29 12:29 UTC (permalink / raw)
  To: Tom de Vries, gcc-patches, rdsandiford

On 05/29/14 06:07, Richard Sandiford wrote:
>
> Can't really approve it, but it looks obviously correct to me.
> Thanks for the fix.
Is that something you'd like to see changed?

Jeff

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2014-05-29 12:29 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-10 19:55 [PATCH 0/7] Shrink some rtxes Richard Sandiford
2014-05-10 19:58 ` [PATCH 1/7] Fix GTY markup of u2 Richard Sandiford
2014-05-11  0:21   ` Mike Stump
2014-05-12 10:19     ` Michael Matz
2014-05-12 10:54       ` Richard Sandiford
2014-05-12 14:20         ` Mike Stump
2014-05-12 15:34   ` Jeff Law
2014-05-10 20:00 ` [PATCH 2/7] Reduce GENERATOR_FILE ifndefs in print-rtl.c Richard Sandiford
2014-05-12 15:37   ` Jeff Law
2014-05-10 20:08 ` [PATCH 3/7] Move ORIGINAL_REGNO to rtx header Richard Sandiford
2014-05-12 15:46   ` Jeff Law
2014-05-10 20:13 ` [PATCH 4/7] Move INSN_UID to the " Richard Sandiford
2014-05-12 15:58   ` Jeff Law
2014-05-10 20:17 ` [PATCH 5/7] Shrink SCRATCH Richard Sandiford
2014-05-12 16:00   ` Jeff Law
2014-05-12 16:37     ` Richard Sandiford
2014-05-12 17:01       ` Jeff Law
2014-05-10 20:22 ` [PATCH 6/7] Move PAT_VAR_LOCATION_STATUS to rtx header Richard Sandiford
2014-05-12 16:01   ` Jeff Law
2014-05-10 20:24 ` [PATCH 7/7] Move SYMBOL_REF_FLAGS " Richard Sandiford
2014-05-12 10:32   ` Michael Matz
2014-05-12 11:00     ` Richard Sandiford
2014-05-12 11:05       ` Michael Matz
2014-05-12 15:49       ` Jeff Law
2014-05-12 16:27   ` Jeff Law
2014-05-29 11:28   ` Tom de Vries
2014-05-29 12:07     ` Richard Sandiford
2014-05-29 12:29       ` Jeff Law
2014-05-29 12:27     ` Jeff Law
2014-05-10 20:25 ` [PATCH 0/7] Shrink some rtxes Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).