public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][RFC] Move TREE_VEC length and SSA_NAME version into tree_base
@ 2012-08-20 12:21 Richard Guenther
  2012-08-21 10:01 ` Richard Guenther
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Guenther @ 2012-08-20 12:21 UTC (permalink / raw)
  To: gcc-patches


This shrinks TREE_VEC from 40 bytes to 32 bytes and SSA_NAME from
80 bytes to 72 bytes on a 64bit host.  Both structures suffer
from the fact they need storage for an integer (length and version)
which leaves unused padding.  Both data structures do not require
as many flag bits as we keep in tree_base though, so they can
conveniently use the upper 4-bytes of the 8-bytes tree_base to
store length / version.

I added a union to tree_base to divide up the space between flags
(possibly) used for all tree kinds and flags that are not used
for those who chose to re-use the upper 4-bytes of tree_base for
something else.

This superseeds the patch that moved the C++ specific usage of
TREE_CHAIN on TREE_VECs to tree_base (same savings, but TREE_VEC
isn't any closer to be based on tree_base only).

Due to re-use of flags from frontends definitive checking for
flag accesses is not always possible (TREE_NOTRHOW for example).
Where appropriate I added TREE_NOT_CHECK (NODE, TREE_VEC) instead,
to catch mis-uses of the C++ frontend.  Changed ARGUMENT_PACK_INCOMPLETE_P
to use TREE_ADDRESSABLE instead of TREE_LANG_FLAG_0 then which
it used on TREE_VECs.

We are very lazy adjusting flag usage documentation :/

Bootstrap and regtest pending on x86_64-unknown-linux-gnu.

Any comments?

Thanks,
Richard.

2012-08-20  Richard Guenther  <rguenther@suse.de>

	cp/
	* cp-tree.h (TREE_INDIRECT_USING): Use TREE_LANG_FLAG_0 accessor.
	(ATTR_IS_DEPENDENT): Likewise.
	(ARGUMENT_PACK_INCOMPLETE_P): Use TREE_ADDRESSABLE instead of
	TREE_LANG_FLAG_0 on TREE_VECs.

	* tree.h (struct tree_base): Add union to make it possible to
	re-use the upper 4 bytes for tree codes that do not need as
	many flags as others.  Move visited and default_def_flag to
	common bits section in exchange for saturating_flag and
	unsigned_flag.  Add SSA name version and tree vec length
	fields here.
	(struct tree_vec): Remove length field here.
	(struct tree_ssa_name): Remove version field here.

Index: trunk/gcc/cp/cp-tree.h
===================================================================
*** trunk.orig/gcc/cp/cp-tree.h	2012-08-20 12:47:47.000000000 +0200
--- trunk/gcc/cp/cp-tree.h	2012-08-20 13:53:05.212969994 +0200
*************** struct GTY((variable_size)) lang_decl {
*** 2520,2530 ****
  
  /* In a TREE_LIST concatenating using directives, indicate indirect
     directives  */
! #define TREE_INDIRECT_USING(NODE) (TREE_LIST_CHECK (NODE)->base.lang_flag_0)
  
  /* In a TREE_LIST in an attribute list, indicates that the attribute
     must be applied at instantiation time.  */
! #define ATTR_IS_DEPENDENT(NODE) (TREE_LIST_CHECK (NODE)->base.lang_flag_0)
  
  extern tree decl_shadowed_for_var_lookup (tree);
  extern void decl_shadowed_for_var_insert (tree, tree);
--- 2520,2530 ----
  
  /* In a TREE_LIST concatenating using directives, indicate indirect
     directives  */
! #define TREE_INDIRECT_USING(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE))
  
  /* In a TREE_LIST in an attribute list, indicates that the attribute
     must be applied at instantiation time.  */
! #define ATTR_IS_DEPENDENT(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE))
  
  extern tree decl_shadowed_for_var_lookup (tree);
  extern void decl_shadowed_for_var_insert (tree, tree);
*************** extern void decl_shadowed_for_var_insert
*** 2881,2887 ****
     arguments will be placed into the beginning of the argument pack,
     but additional arguments might still be deduced.  */
  #define ARGUMENT_PACK_INCOMPLETE_P(NODE)        \
!   TREE_LANG_FLAG_0 (ARGUMENT_PACK_ARGS (NODE))
  
  /* When ARGUMENT_PACK_INCOMPLETE_P, stores the explicit template
     arguments used to fill this pack.  */
--- 2881,2887 ----
     arguments will be placed into the beginning of the argument pack,
     but additional arguments might still be deduced.  */
  #define ARGUMENT_PACK_INCOMPLETE_P(NODE)        \
!   TREE_ADDRESSABLE (ARGUMENT_PACK_ARGS (NODE))
  
  /* When ARGUMENT_PACK_INCOMPLETE_P, stores the explicit template
     arguments used to fill this pack.  */
Index: trunk/gcc/tree.h
===================================================================
*** trunk.orig/gcc/tree.h	2012-08-20 12:47:47.000000000 +0200
--- trunk/gcc/tree.h	2012-08-20 13:56:12.109963537 +0200
*************** struct GTY(()) tree_base {
*** 427,435 ****
    unsigned addressable_flag : 1;
    unsigned volatile_flag : 1;
    unsigned readonly_flag : 1;
-   unsigned unsigned_flag : 1;
    unsigned asm_written_flag: 1;
    unsigned nowarning_flag : 1;
  
    unsigned used_flag : 1;
    unsigned nothrow_flag : 1;
--- 427,435 ----
    unsigned addressable_flag : 1;
    unsigned volatile_flag : 1;
    unsigned readonly_flag : 1;
    unsigned asm_written_flag: 1;
    unsigned nowarning_flag : 1;
+   unsigned visited : 1;
  
    unsigned used_flag : 1;
    unsigned nothrow_flag : 1;
*************** struct GTY(()) tree_base {
*** 438,465 ****
    unsigned private_flag : 1;
    unsigned protected_flag : 1;
    unsigned deprecated_flag : 1;
-   unsigned saturating_flag : 1;
- 
    unsigned default_def_flag : 1;
-   unsigned lang_flag_0 : 1;
-   unsigned lang_flag_1 : 1;
-   unsigned lang_flag_2 : 1;
-   unsigned lang_flag_3 : 1;
-   unsigned lang_flag_4 : 1;
-   unsigned lang_flag_5 : 1;
-   unsigned lang_flag_6 : 1;
  
!   unsigned visited : 1;
!   unsigned packed_flag : 1;
!   unsigned user_align : 1;
!   unsigned nameless_flag : 1;
! 
!   unsigned spare : 12;
! 
!   /* This field is only used with type nodes; the only reason it is present
!      in tree_base instead of tree_type is to save space.  The size of the
!      field must be large enough to hold addr_space_t values.  */
!   unsigned address_space : 8;
  };
  
  struct GTY(()) tree_typed {
--- 438,476 ----
    unsigned private_flag : 1;
    unsigned protected_flag : 1;
    unsigned deprecated_flag : 1;
    unsigned default_def_flag : 1;
  
!   union {
!     struct {
!       unsigned saturating_flag : 1;
!       unsigned lang_flag_0 : 1;
!       unsigned lang_flag_1 : 1;
!       unsigned lang_flag_2 : 1;
!       unsigned lang_flag_3 : 1;
!       unsigned lang_flag_4 : 1;
!       unsigned lang_flag_5 : 1;
!       unsigned lang_flag_6 : 1;
! 
!       unsigned unsigned_flag : 1;
!       unsigned packed_flag : 1;
!       unsigned user_align : 1;
!       unsigned nameless_flag : 1;
! 
!       unsigned spare : 12;
! 
!       /* This field is only used with TREE_TYPE nodes; the only reason it is
! 	 present in tree_base instead of tree_type is to save space.  The size
! 	 of the field must be large enough to hold addr_space_t values.  */
!       unsigned address_space : 8;
!     } bits;
!     /* The following fields are present in tree_base to save space.  The
!        nodes using them do not require any of the flags above and so can
!        make better use of the 4-byte sized word.  */
!     /* VEC length.  This field is only used with TREE_VEC.  */
!     int length;
!     /* SSA version number.  This field is only used with SSA_NAME.  */
!     unsigned int version;
!   } GTY((skip(""))) u;
  };
  
  struct GTY(()) tree_typed {
*************** struct GTY(()) tree_common {
*** 638,644 ****
         TREE_ASM_WRITTEN in
             VAR_DECL, FUNCTION_DECL, TYPE_DECL
             RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE
!            BLOCK, SSA_NAME, STRING_CST
  
     used_flag:
  
--- 649,658 ----
         TREE_ASM_WRITTEN in
             VAR_DECL, FUNCTION_DECL, TYPE_DECL
             RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE
!            BLOCK, STRING_CST
! 
!        SSA_NAME_OCCURS_IN_ABNORMAL_PHI in
!            SSA_NAME
  
     used_flag:
  
*************** struct GTY(()) tree_common {
*** 659,664 ****
--- 673,681 ----
         TREE_THIS_NOTRAP in
            INDIRECT_REF, MEM_REF, TARGET_MEM_REF, ARRAY_REF, ARRAY_RANGE_REF
  
+        SSA_NAME_IN_FREELIST in
+           SSA_NAME
+ 
     deprecated_flag:
  
         TREE_DEPRECATED in
*************** extern void omp_clause_range_check_faile
*** 1226,1235 ****
  
  /* In a decl (most significantly a FIELD_DECL), means an unsigned field.  */
  #define DECL_UNSIGNED(NODE) \
!   (DECL_COMMON_CHECK (NODE)->base.unsigned_flag)
  
  /* In integral and pointer types, means an unsigned type.  */
! #define TYPE_UNSIGNED(NODE) (TYPE_CHECK (NODE)->base.unsigned_flag)
  
  /* True if overflow wraps around for the given integral type.  That
     is, TYPE_MAX + 1 == TYPE_MIN.  */
--- 1243,1252 ----
  
  /* In a decl (most significantly a FIELD_DECL), means an unsigned field.  */
  #define DECL_UNSIGNED(NODE) \
!   (DECL_COMMON_CHECK (NODE)->base.u.bits.unsigned_flag)
  
  /* In integral and pointer types, means an unsigned type.  */
! #define TYPE_UNSIGNED(NODE) (TYPE_CHECK (NODE)->base.u.bits.unsigned_flag)
  
  /* True if overflow wraps around for the given integral type.  That
     is, TYPE_MAX + 1 == TYPE_MIN.  */
*************** extern void omp_clause_range_check_faile
*** 1277,1283 ****
     throw an exception.  In a CALL_EXPR, nonzero means the call cannot
     throw.  We can't easily check the node type here as the C++
     frontend also uses this flag (for AGGR_INIT_EXPR).  */
! #define TREE_NOTHROW(NODE) ((NODE)->base.nothrow_flag)
  
  /* In a CALL_EXPR, means that it's safe to use the target of the call
     expansion as the return slot for a call that returns in memory.  */
--- 1294,1300 ----
     throw an exception.  In a CALL_EXPR, nonzero means the call cannot
     throw.  We can't easily check the node type here as the C++
     frontend also uses this flag (for AGGR_INIT_EXPR).  */
! #define TREE_NOTHROW(NODE) (TREE_NOT_CHECK (NODE, TREE_VEC)->base.nothrow_flag)
  
  /* In a CALL_EXPR, means that it's safe to use the target of the call
     expansion as the return slot for a call that returns in memory.  */
*************** extern void omp_clause_range_check_faile
*** 1347,1362 ****
    (IDENTIFIER_NODE_CHECK (NODE)->base.deprecated_flag)
  
  /* In fixed-point types, means a saturating type.  */
! #define TYPE_SATURATING(NODE) ((NODE)->base.saturating_flag)
  
  /* These flags are available for each language front end to use internally.  */
! #define TREE_LANG_FLAG_0(NODE) ((NODE)->base.lang_flag_0)
! #define TREE_LANG_FLAG_1(NODE) ((NODE)->base.lang_flag_1)
! #define TREE_LANG_FLAG_2(NODE) ((NODE)->base.lang_flag_2)
! #define TREE_LANG_FLAG_3(NODE) ((NODE)->base.lang_flag_3)
! #define TREE_LANG_FLAG_4(NODE) ((NODE)->base.lang_flag_4)
! #define TREE_LANG_FLAG_5(NODE) ((NODE)->base.lang_flag_5)
! #define TREE_LANG_FLAG_6(NODE) ((NODE)->base.lang_flag_6)
  \f
  /* Define additional fields and accessors for nodes representing constants.  */
  
--- 1364,1379 ----
    (IDENTIFIER_NODE_CHECK (NODE)->base.deprecated_flag)
  
  /* In fixed-point types, means a saturating type.  */
! #define TYPE_SATURATING(NODE) (TYPE_CHECK (NODE)->base.u.bits.saturating_flag)
  
  /* These flags are available for each language front end to use internally.  */
! #define TREE_LANG_FLAG_0(NODE) (TREE_NOT_CHECK(NODE, TREE_VEC)->base.u.bits.lang_flag_0)
! #define TREE_LANG_FLAG_1(NODE) (TREE_NOT_CHECK(NODE, TREE_VEC)->base.u.bits.lang_flag_1)
! #define TREE_LANG_FLAG_2(NODE) (TREE_NOT_CHECK(NODE, TREE_VEC)->base.u.bits.lang_flag_2)
! #define TREE_LANG_FLAG_3(NODE) (TREE_NOT_CHECK(NODE, TREE_VEC)->base.u.bits.lang_flag_3)
! #define TREE_LANG_FLAG_4(NODE) (TREE_NOT_CHECK(NODE, TREE_VEC)->base.u.bits.lang_flag_4)
! #define TREE_LANG_FLAG_5(NODE) (TREE_NOT_CHECK(NODE, TREE_VEC)->base.u.bits.lang_flag_5)
! #define TREE_LANG_FLAG_6(NODE) (TREE_NOT_CHECK(NODE, TREE_VEC)->base.u.bits.lang_flag_6)
  \f
  /* Define additional fields and accessors for nodes representing constants.  */
  
*************** struct GTY(()) tree_list {
*** 1476,1490 ****
  };
  
  /* In a TREE_VEC node.  */
! #define TREE_VEC_LENGTH(NODE) (TREE_VEC_CHECK (NODE)->vec.length)
  #define TREE_VEC_END(NODE) \
!   ((void) TREE_VEC_CHECK (NODE), &((NODE)->vec.a[(NODE)->vec.length]))
  
  #define TREE_VEC_ELT(NODE,I) TREE_VEC_ELT_CHECK (NODE, I)
  
  struct GTY(()) tree_vec {
    struct tree_common common;
-   int length;
    tree GTY ((length ("TREE_VEC_LENGTH ((tree)&%h)"))) a[1];
  };
  
--- 1493,1506 ----
  };
  
  /* In a TREE_VEC node.  */
! #define TREE_VEC_LENGTH(NODE) (TREE_VEC_CHECK (NODE)->base.u.length)
  #define TREE_VEC_END(NODE) \
!   ((void) TREE_VEC_CHECK (NODE), &((NODE)->vec.a[(NODE)->vec.base.u.length]))
  
  #define TREE_VEC_ELT(NODE,I) TREE_VEC_ELT_CHECK (NODE, I)
  
  struct GTY(()) tree_vec {
    struct tree_common common;
    tree GTY ((length ("TREE_VEC_LENGTH ((tree)&%h)"))) a[1];
  };
  
*************** struct GTY(()) tree_exp {
*** 1888,1894 ****
  
  /* Returns the SSA version number of this SSA name.  Note that in
     tree SSA, version numbers are not per variable and may be recycled.  */
! #define SSA_NAME_VERSION(NODE)	SSA_NAME_CHECK (NODE)->ssa_name.version
  
  /* Nonzero if this SSA name occurs in an abnormal PHI.  SSA_NAMES are
     never output, so we can safely use the ASM_WRITTEN_FLAG for this
--- 1904,1910 ----
  
  /* Returns the SSA version number of this SSA name.  Note that in
     tree SSA, version numbers are not per variable and may be recycled.  */
! #define SSA_NAME_VERSION(NODE)	SSA_NAME_CHECK (NODE)->base.u.version
  
  /* Nonzero if this SSA name occurs in an abnormal PHI.  SSA_NAMES are
     never output, so we can safely use the ASM_WRITTEN_FLAG for this
*************** struct GTY(()) tree_ssa_name {
*** 1943,1951 ****
    /* Statement that defines this SSA name.  */
    gimple def_stmt;
  
-   /* SSA version number.  */
-   unsigned int version;
- 
    /* Pointer attributes used for alias analysis.  */
    struct ptr_info_def *ptr_info;
  
--- 1959,1964 ----
*************** struct GTY(()) tree_omp_clause {
*** 2008,2014 ****
  #define BLOCK_ABSTRACT(NODE) (BLOCK_CHECK (NODE)->block.abstract_flag)
  
  /* True if BLOCK has the same ranges as its BLOCK_SUPERCONTEXT.  */
! #define BLOCK_SAME_RANGE(NODE) (BLOCK_CHECK (NODE)->base.nameless_flag)
  
  /* An index number for this block.  These values are not guaranteed to
     be unique across functions -- whether or not they are depends on
--- 2021,2027 ----
  #define BLOCK_ABSTRACT(NODE) (BLOCK_CHECK (NODE)->block.abstract_flag)
  
  /* True if BLOCK has the same ranges as its BLOCK_SUPERCONTEXT.  */
! #define BLOCK_SAME_RANGE(NODE) (BLOCK_CHECK (NODE)->base.u.bits.nameless_flag)
  
  /* An index number for this block.  These values are not guaranteed to
     be unique across functions -- whether or not they are depends on
*************** extern enum machine_mode vector_type_mod
*** 2148,2154 ****
  
  /* 1 if the alignment for this type was requested by "aligned" attribute,
     0 if it is the default for this type.  */
! #define TYPE_USER_ALIGN(NODE) (TYPE_CHECK (NODE)->base.user_align)
  
  /* The alignment for NODE, in bytes.  */
  #define TYPE_ALIGN_UNIT(NODE) (TYPE_ALIGN (NODE) / BITS_PER_UNIT)
--- 2161,2167 ----
  
  /* 1 if the alignment for this type was requested by "aligned" attribute,
     0 if it is the default for this type.  */
! #define TYPE_USER_ALIGN(NODE) (TYPE_CHECK (NODE)->base.u.bits.user_align)
  
  /* The alignment for NODE, in bytes.  */
  #define TYPE_ALIGN_UNIT(NODE) (TYPE_ALIGN (NODE) / BITS_PER_UNIT)
*************** extern enum machine_mode vector_type_mod
*** 2179,2188 ****
  #define TYPE_RESTRICT(NODE) (TYPE_CHECK (NODE)->type_common.restrict_flag)
  
  /* If nonzero, type's name shouldn't be emitted into debug info.  */
! #define TYPE_NAMELESS(NODE) (TYPE_CHECK (NODE)->base.nameless_flag)
  
  /* The address space the type is in.  */
! #define TYPE_ADDR_SPACE(NODE) (TYPE_CHECK (NODE)->base.address_space)
  
  /* There is a TYPE_QUAL value for each type qualifier.  They can be
     combined by bitwise-or to form the complete set of qualifiers for a
--- 2192,2201 ----
  #define TYPE_RESTRICT(NODE) (TYPE_CHECK (NODE)->type_common.restrict_flag)
  
  /* If nonzero, type's name shouldn't be emitted into debug info.  */
! #define TYPE_NAMELESS(NODE) (TYPE_CHECK (NODE)->base.u.bits.nameless_flag)
  
  /* The address space the type is in.  */
! #define TYPE_ADDR_SPACE(NODE) (TYPE_CHECK (NODE)->base.u.bits.address_space)
  
  /* There is a TYPE_QUAL value for each type qualifier.  They can be
     combined by bitwise-or to form the complete set of qualifiers for a
*************** enum cv_qualifier
*** 2272,2278 ****
  
  /* Indicated that objects of this type should be laid out in as
     compact a way as possible.  */
! #define TYPE_PACKED(NODE) (TYPE_CHECK (NODE)->base.packed_flag)
  
  /* Used by type_contains_placeholder_p to avoid recomputation.
     Values are: 0 (unknown), 1 (false), 2 (true).  Never access
--- 2285,2291 ----
  
  /* Indicated that objects of this type should be laid out in as
     compact a way as possible.  */
! #define TYPE_PACKED(NODE) (TYPE_CHECK (NODE)->base.u.bits.packed_flag)
  
  /* Used by type_contains_placeholder_p to avoid recomputation.
     Values are: 0 (unknown), 1 (false), 2 (true).  Never access
*************** struct function;
*** 2610,2616 ****
    (FIELD_DECL_CHECK (NODE)->decl_minimal.context)
  
  /* If nonzero, decl's name shouldn't be emitted into debug info.  */
! #define DECL_NAMELESS(NODE) (DECL_MINIMAL_CHECK (NODE)->base.nameless_flag)
  
  struct GTY(()) tree_decl_minimal {
    struct tree_common common;
--- 2623,2629 ----
    (FIELD_DECL_CHECK (NODE)->decl_minimal.context)
  
  /* If nonzero, decl's name shouldn't be emitted into debug info.  */
! #define DECL_NAMELESS(NODE) (DECL_MINIMAL_CHECK (NODE)->base.u.bits.nameless_flag)
  
  struct GTY(()) tree_decl_minimal {
    struct tree_common common;
*************** struct GTY(()) tree_decl_minimal {
*** 2671,2677 ****
  /* Set if the alignment of this DECL has been set by the user, for
     example with an 'aligned' attribute.  */
  #define DECL_USER_ALIGN(NODE) \
!   (DECL_COMMON_CHECK (NODE)->base.user_align)
  /* Holds the machine mode corresponding to the declaration of a variable or
     field.  Always equal to TYPE_MODE (TREE_TYPE (decl)) except for a
     FIELD_DECL.  */
--- 2684,2690 ----
  /* Set if the alignment of this DECL has been set by the user, for
     example with an 'aligned' attribute.  */
  #define DECL_USER_ALIGN(NODE) \
!   (DECL_COMMON_CHECK (NODE)->base.u.bits.user_align)
  /* Holds the machine mode corresponding to the declaration of a variable or
     field.  Always equal to TYPE_MODE (TREE_TYPE (decl)) except for a
     FIELD_DECL.  */
*************** struct GTY(()) tree_decl_with_rtl {
*** 2956,2962 ****
  #define DECL_FCONTEXT(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.fcontext)
  
  /* In a FIELD_DECL, indicates this field should be bit-packed.  */
! #define DECL_PACKED(NODE) (FIELD_DECL_CHECK (NODE)->base.packed_flag)
  
  /* Nonzero in a FIELD_DECL means it is a bit field, and must be accessed
     specially.  */
--- 2969,2975 ----
  #define DECL_FCONTEXT(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.fcontext)
  
  /* In a FIELD_DECL, indicates this field should be bit-packed.  */
! #define DECL_PACKED(NODE) (FIELD_DECL_CHECK (NODE)->base.u.bits.packed_flag)
  
  /* Nonzero in a FIELD_DECL means it is a bit field, and must be accessed
     specially.  */
*************** extern void decl_fini_priority_insert (t
*** 3246,3252 ****
  #define MAX_RESERVED_INIT_PRIORITY 100
  
  #define VAR_DECL_IS_VIRTUAL_OPERAND(NODE) \
!   (VAR_DECL_CHECK (NODE)->base.saturating_flag)
  
  struct GTY(()) tree_var_decl {
    struct tree_decl_with_vis common;
--- 3259,3265 ----
  #define MAX_RESERVED_INIT_PRIORITY 100
  
  #define VAR_DECL_IS_VIRTUAL_OPERAND(NODE) \
!   (VAR_DECL_CHECK (NODE)->base.u.bits.saturating_flag)
  
  struct GTY(()) tree_var_decl {
    struct tree_decl_with_vis common;
*************** tree_vec_elt_check (tree __t, int __i,
*** 3822,3829 ****
  {
    if (TREE_CODE (__t) != TREE_VEC)
      tree_check_failed (__t, __f, __l, __g, TREE_VEC, 0);
!   if (__i < 0 || __i >= __t->vec.length)
!     tree_vec_elt_check_failed (__i, __t->vec.length, __f, __l, __g);
    return &CONST_CAST_TREE (__t)->vec.a[__i];
  }
  
--- 3835,3842 ----
  {
    if (TREE_CODE (__t) != TREE_VEC)
      tree_check_failed (__t, __f, __l, __g, TREE_VEC, 0);
!   if (__i < 0 || __i >= __t->base.u.length)
!     tree_vec_elt_check_failed (__i, __t->base.u.length, __f, __l, __g);
    return &CONST_CAST_TREE (__t)->vec.a[__i];
  }
  
*************** tree_vec_elt_check (const_tree __t, int
*** 4028,4035 ****
  {
    if (TREE_CODE (__t) != TREE_VEC)
      tree_check_failed (__t, __f, __l, __g, TREE_VEC, 0);
!   if (__i < 0 || __i >= __t->vec.length)
!     tree_vec_elt_check_failed (__i, __t->vec.length, __f, __l, __g);
    return CONST_CAST (const_tree *, &__t->vec.a[__i]);
    //return &__t->vec.a[__i];
  }
--- 4041,4048 ----
  {
    if (TREE_CODE (__t) != TREE_VEC)
      tree_check_failed (__t, __f, __l, __g, TREE_VEC, 0);
!   if (__i < 0 || __i >= __t->base.u.length)
!     tree_vec_elt_check_failed (__i, __t->base.u.length, __f, __l, __g);
    return CONST_CAST (const_tree *, &__t->vec.a[__i]);
    //return &__t->vec.a[__i];
  }

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

* Re: [PATCH][RFC] Move TREE_VEC length and SSA_NAME version into tree_base
  2012-08-20 12:21 [PATCH][RFC] Move TREE_VEC length and SSA_NAME version into tree_base Richard Guenther
@ 2012-08-21 10:01 ` Richard Guenther
  2012-08-21 10:10   ` Jay Foad
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Guenther @ 2012-08-21 10:01 UTC (permalink / raw)
  To: gcc-patches

On Mon, 20 Aug 2012, Richard Guenther wrote:

> 
> This shrinks TREE_VEC from 40 bytes to 32 bytes and SSA_NAME from
> 80 bytes to 72 bytes on a 64bit host.  Both structures suffer
> from the fact they need storage for an integer (length and version)
> which leaves unused padding.  Both data structures do not require
> as many flag bits as we keep in tree_base though, so they can
> conveniently use the upper 4-bytes of the 8-bytes tree_base to
> store length / version.
> 
> I added a union to tree_base to divide up the space between flags
> (possibly) used for all tree kinds and flags that are not used
> for those who chose to re-use the upper 4-bytes of tree_base for
> something else.
> 
> This superseeds the patch that moved the C++ specific usage of
> TREE_CHAIN on TREE_VECs to tree_base (same savings, but TREE_VEC
> isn't any closer to be based on tree_base only).
> 
> Due to re-use of flags from frontends definitive checking for
> flag accesses is not always possible (TREE_NOTRHOW for example).
> Where appropriate I added TREE_NOT_CHECK (NODE, TREE_VEC) instead,
> to catch mis-uses of the C++ frontend.  Changed ARGUMENT_PACK_INCOMPLETE_P
> to use TREE_ADDRESSABLE instead of TREE_LANG_FLAG_0 then which
> it used on TREE_VECs.
> 
> We are very lazy adjusting flag usage documentation :/
> 
> Bootstrap and regtest pending on x86_64-unknown-linux-gnu.

After discussion on IRC I added !SSA_NAME checking to the lang flag
accessors.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2012-08-21  Richard Guenther  <rguenther@suse.de>

	cp/
	* cp-tree.h (TREE_INDIRECT_USING): Use TREE_LANG_FLAG_0 accessor.
	(ATTR_IS_DEPENDENT): Likewise.
	(ARGUMENT_PACK_INCOMPLETE_P): Use TREE_ADDRESSABLE instead of
	TREE_LANG_FLAG_0 on TREE_VECs.

	* tree.h (struct tree_base): Add union to make it possible to
	re-use the upper 4 bytes for tree codes that do not need as
	many flags as others.  Move visited and default_def_flag to
	common bits section in exchange for saturating_flag and
	unsigned_flag.  Add SSA name version and tree vec length
	fields here.
	(struct tree_vec): Remove length field here.
	(struct tree_ssa_name): Remove version field here.

Index: trunk/gcc/cp/cp-tree.h
===================================================================
*** trunk.orig/gcc/cp/cp-tree.h	2012-08-20 12:47:47.000000000 +0200
--- trunk/gcc/cp/cp-tree.h	2012-08-20 13:53:05.212969994 +0200
*************** struct GTY((variable_size)) lang_decl {
*** 2520,2530 ****
  
  /* In a TREE_LIST concatenating using directives, indicate indirect
     directives  */
! #define TREE_INDIRECT_USING(NODE) (TREE_LIST_CHECK (NODE)->base.lang_flag_0)
  
  /* In a TREE_LIST in an attribute list, indicates that the attribute
     must be applied at instantiation time.  */
! #define ATTR_IS_DEPENDENT(NODE) (TREE_LIST_CHECK (NODE)->base.lang_flag_0)
  
  extern tree decl_shadowed_for_var_lookup (tree);
  extern void decl_shadowed_for_var_insert (tree, tree);
--- 2520,2530 ----
  
  /* In a TREE_LIST concatenating using directives, indicate indirect
     directives  */
! #define TREE_INDIRECT_USING(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE))
  
  /* In a TREE_LIST in an attribute list, indicates that the attribute
     must be applied at instantiation time.  */
! #define ATTR_IS_DEPENDENT(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE))
  
  extern tree decl_shadowed_for_var_lookup (tree);
  extern void decl_shadowed_for_var_insert (tree, tree);
*************** extern void decl_shadowed_for_var_insert
*** 2881,2887 ****
     arguments will be placed into the beginning of the argument pack,
     but additional arguments might still be deduced.  */
  #define ARGUMENT_PACK_INCOMPLETE_P(NODE)        \
!   TREE_LANG_FLAG_0 (ARGUMENT_PACK_ARGS (NODE))
  
  /* When ARGUMENT_PACK_INCOMPLETE_P, stores the explicit template
     arguments used to fill this pack.  */
--- 2881,2887 ----
     arguments will be placed into the beginning of the argument pack,
     but additional arguments might still be deduced.  */
  #define ARGUMENT_PACK_INCOMPLETE_P(NODE)        \
!   TREE_ADDRESSABLE (ARGUMENT_PACK_ARGS (NODE))
  
  /* When ARGUMENT_PACK_INCOMPLETE_P, stores the explicit template
     arguments used to fill this pack.  */
Index: trunk/gcc/tree.h
===================================================================
*** trunk.orig/gcc/tree.h	2012-08-20 12:47:47.000000000 +0200
--- trunk/gcc/tree.h	2012-08-21 10:32:47.717394657 +0200
*************** enum omp_clause_code
*** 417,423 ****
     so all nodes have these fields.
  
     See the accessor macros, defined below, for documentation of the
!    fields.  */
  
  struct GTY(()) tree_base {
    ENUM_BITFIELD(tree_code) code : 16;
--- 417,424 ----
     so all nodes have these fields.
  
     See the accessor macros, defined below, for documentation of the
!    fields, and the table below which connects the fileds and the
!    accessor macros.  */
  
  struct GTY(()) tree_base {
    ENUM_BITFIELD(tree_code) code : 16;
*************** struct GTY(()) tree_base {
*** 427,435 ****
    unsigned addressable_flag : 1;
    unsigned volatile_flag : 1;
    unsigned readonly_flag : 1;
-   unsigned unsigned_flag : 1;
    unsigned asm_written_flag: 1;
    unsigned nowarning_flag : 1;
  
    unsigned used_flag : 1;
    unsigned nothrow_flag : 1;
--- 428,436 ----
    unsigned addressable_flag : 1;
    unsigned volatile_flag : 1;
    unsigned readonly_flag : 1;
    unsigned asm_written_flag: 1;
    unsigned nowarning_flag : 1;
+   unsigned visited : 1;
  
    unsigned used_flag : 1;
    unsigned nothrow_flag : 1;
*************** struct GTY(()) tree_base {
*** 438,475 ****
    unsigned private_flag : 1;
    unsigned protected_flag : 1;
    unsigned deprecated_flag : 1;
-   unsigned saturating_flag : 1;
- 
    unsigned default_def_flag : 1;
-   unsigned lang_flag_0 : 1;
-   unsigned lang_flag_1 : 1;
-   unsigned lang_flag_2 : 1;
-   unsigned lang_flag_3 : 1;
-   unsigned lang_flag_4 : 1;
-   unsigned lang_flag_5 : 1;
-   unsigned lang_flag_6 : 1;
  
!   unsigned visited : 1;
!   unsigned packed_flag : 1;
!   unsigned user_align : 1;
!   unsigned nameless_flag : 1;
! 
!   unsigned spare : 12;
! 
!   /* This field is only used with type nodes; the only reason it is present
!      in tree_base instead of tree_type is to save space.  The size of the
!      field must be large enough to hold addr_space_t values.  */
!   unsigned address_space : 8;
! };
! 
! struct GTY(()) tree_typed {
!   struct tree_base base;
!   tree type;
! };
! 
! struct GTY(()) tree_common {
!   struct tree_typed typed;
!   tree chain;
  };
  
  /* The following table lists the uses of each of the above flags and
--- 439,480 ----
    unsigned private_flag : 1;
    unsigned protected_flag : 1;
    unsigned deprecated_flag : 1;
    unsigned default_def_flag : 1;
  
!   union {
!     /* The bits in the following structure should only be used with
!        accessor macros that constrain inputs with tree checking.  */
!     struct {
!       unsigned lang_flag_0 : 1;
!       unsigned lang_flag_1 : 1;
!       unsigned lang_flag_2 : 1;
!       unsigned lang_flag_3 : 1;
!       unsigned lang_flag_4 : 1;
!       unsigned lang_flag_5 : 1;
!       unsigned lang_flag_6 : 1;
!       unsigned saturating_flag : 1;
! 
!       unsigned unsigned_flag : 1;
!       unsigned packed_flag : 1;
!       unsigned user_align : 1;
!       unsigned nameless_flag : 1;
!       unsigned spare0 : 4;
! 
!       unsigned spare1 : 8;
! 
!       /* This field is only used with TREE_TYPE nodes; the only reason it is
! 	 present in tree_base instead of tree_type is to save space.  The size
! 	 of the field must be large enough to hold addr_space_t values.  */
!       unsigned address_space : 8;
!     } bits;
!     /* The following fields are present in tree_base to save space.  The
!        nodes using them do not require any of the flags above and so can
!        make better use of the 4-byte sized word.  */
!     /* VEC length.  This field is only used with TREE_VEC.  */
!     int length;
!     /* SSA version number.  This field is only used with SSA_NAME.  */
!     unsigned int version;
!   } GTY((skip(""))) u;
  };
  
  /* The following table lists the uses of each of the above flags and
*************** struct GTY(()) tree_common {
*** 638,644 ****
         TREE_ASM_WRITTEN in
             VAR_DECL, FUNCTION_DECL, TYPE_DECL
             RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE
!            BLOCK, SSA_NAME, STRING_CST
  
     used_flag:
  
--- 643,652 ----
         TREE_ASM_WRITTEN in
             VAR_DECL, FUNCTION_DECL, TYPE_DECL
             RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE
!            BLOCK, STRING_CST
! 
!        SSA_NAME_OCCURS_IN_ABNORMAL_PHI in
!            SSA_NAME
  
     used_flag:
  
*************** struct GTY(()) tree_common {
*** 659,664 ****
--- 667,675 ----
         TREE_THIS_NOTRAP in
            INDIRECT_REF, MEM_REF, TARGET_MEM_REF, ARRAY_REF, ARRAY_RANGE_REF
  
+        SSA_NAME_IN_FREELIST in
+           SSA_NAME
+ 
     deprecated_flag:
  
         TREE_DEPRECATED in
*************** struct GTY(()) tree_common {
*** 699,704 ****
--- 710,725 ----
             SSA_NAME
  */
  
+ struct GTY(()) tree_typed {
+   struct tree_base base;
+   tree type;
+ };
+ 
+ struct GTY(()) tree_common {
+   struct tree_typed typed;
+   tree chain;
+ };
+ 
  #undef DEFTREESTRUCT
  #define DEFTREESTRUCT(ENUM, NAME) ENUM,
  enum tree_node_structure_enum {
*************** extern void omp_clause_range_check_faile
*** 1226,1235 ****
  
  /* In a decl (most significantly a FIELD_DECL), means an unsigned field.  */
  #define DECL_UNSIGNED(NODE) \
!   (DECL_COMMON_CHECK (NODE)->base.unsigned_flag)
  
  /* In integral and pointer types, means an unsigned type.  */
! #define TYPE_UNSIGNED(NODE) (TYPE_CHECK (NODE)->base.unsigned_flag)
  
  /* True if overflow wraps around for the given integral type.  That
     is, TYPE_MAX + 1 == TYPE_MIN.  */
--- 1247,1256 ----
  
  /* In a decl (most significantly a FIELD_DECL), means an unsigned field.  */
  #define DECL_UNSIGNED(NODE) \
!   (DECL_COMMON_CHECK (NODE)->base.u.bits.unsigned_flag)
  
  /* In integral and pointer types, means an unsigned type.  */
! #define TYPE_UNSIGNED(NODE) (TYPE_CHECK (NODE)->base.u.bits.unsigned_flag)
  
  /* True if overflow wraps around for the given integral type.  That
     is, TYPE_MAX + 1 == TYPE_MIN.  */
*************** extern void omp_clause_range_check_faile
*** 1277,1283 ****
     throw an exception.  In a CALL_EXPR, nonzero means the call cannot
     throw.  We can't easily check the node type here as the C++
     frontend also uses this flag (for AGGR_INIT_EXPR).  */
! #define TREE_NOTHROW(NODE) ((NODE)->base.nothrow_flag)
  
  /* In a CALL_EXPR, means that it's safe to use the target of the call
     expansion as the return slot for a call that returns in memory.  */
--- 1298,1304 ----
     throw an exception.  In a CALL_EXPR, nonzero means the call cannot
     throw.  We can't easily check the node type here as the C++
     frontend also uses this flag (for AGGR_INIT_EXPR).  */
! #define TREE_NOTHROW(NODE) (TREE_NOT_CHECK (NODE, TREE_VEC)->base.nothrow_flag)
  
  /* In a CALL_EXPR, means that it's safe to use the target of the call
     expansion as the return slot for a call that returns in memory.  */
*************** extern void omp_clause_range_check_faile
*** 1347,1362 ****
    (IDENTIFIER_NODE_CHECK (NODE)->base.deprecated_flag)
  
  /* In fixed-point types, means a saturating type.  */
! #define TYPE_SATURATING(NODE) ((NODE)->base.saturating_flag)
  
  /* These flags are available for each language front end to use internally.  */
! #define TREE_LANG_FLAG_0(NODE) ((NODE)->base.lang_flag_0)
! #define TREE_LANG_FLAG_1(NODE) ((NODE)->base.lang_flag_1)
! #define TREE_LANG_FLAG_2(NODE) ((NODE)->base.lang_flag_2)
! #define TREE_LANG_FLAG_3(NODE) ((NODE)->base.lang_flag_3)
! #define TREE_LANG_FLAG_4(NODE) ((NODE)->base.lang_flag_4)
! #define TREE_LANG_FLAG_5(NODE) ((NODE)->base.lang_flag_5)
! #define TREE_LANG_FLAG_6(NODE) ((NODE)->base.lang_flag_6)
  \f
  /* Define additional fields and accessors for nodes representing constants.  */
  
--- 1368,1390 ----
    (IDENTIFIER_NODE_CHECK (NODE)->base.deprecated_flag)
  
  /* In fixed-point types, means a saturating type.  */
! #define TYPE_SATURATING(NODE) (TYPE_CHECK (NODE)->base.u.bits.saturating_flag)
  
  /* These flags are available for each language front end to use internally.  */
! #define TREE_LANG_FLAG_0(NODE) \
!   (TREE_NOT_CHECK2(NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_0)
! #define TREE_LANG_FLAG_1(NODE) \
!   (TREE_NOT_CHECK2(NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_1)
! #define TREE_LANG_FLAG_2(NODE) \
!   (TREE_NOT_CHECK2(NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_2)
! #define TREE_LANG_FLAG_3(NODE) \
!   (TREE_NOT_CHECK2(NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_3)
! #define TREE_LANG_FLAG_4(NODE) \
!   (TREE_NOT_CHECK2(NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_4)
! #define TREE_LANG_FLAG_5(NODE) \
!   (TREE_NOT_CHECK2(NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_5)
! #define TREE_LANG_FLAG_6(NODE) \
!   (TREE_NOT_CHECK2(NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_6)
  \f
  /* Define additional fields and accessors for nodes representing constants.  */
  
*************** struct GTY(()) tree_list {
*** 1476,1490 ****
  };
  
  /* In a TREE_VEC node.  */
! #define TREE_VEC_LENGTH(NODE) (TREE_VEC_CHECK (NODE)->vec.length)
  #define TREE_VEC_END(NODE) \
!   ((void) TREE_VEC_CHECK (NODE), &((NODE)->vec.a[(NODE)->vec.length]))
  
  #define TREE_VEC_ELT(NODE,I) TREE_VEC_ELT_CHECK (NODE, I)
  
  struct GTY(()) tree_vec {
    struct tree_common common;
-   int length;
    tree GTY ((length ("TREE_VEC_LENGTH ((tree)&%h)"))) a[1];
  };
  
--- 1504,1517 ----
  };
  
  /* In a TREE_VEC node.  */
! #define TREE_VEC_LENGTH(NODE) (TREE_VEC_CHECK (NODE)->base.u.length)
  #define TREE_VEC_END(NODE) \
!   ((void) TREE_VEC_CHECK (NODE), &((NODE)->vec.a[(NODE)->vec.base.u.length]))
  
  #define TREE_VEC_ELT(NODE,I) TREE_VEC_ELT_CHECK (NODE, I)
  
  struct GTY(()) tree_vec {
    struct tree_common common;
    tree GTY ((length ("TREE_VEC_LENGTH ((tree)&%h)"))) a[1];
  };
  
*************** struct GTY(()) tree_exp {
*** 1888,1894 ****
  
  /* Returns the SSA version number of this SSA name.  Note that in
     tree SSA, version numbers are not per variable and may be recycled.  */
! #define SSA_NAME_VERSION(NODE)	SSA_NAME_CHECK (NODE)->ssa_name.version
  
  /* Nonzero if this SSA name occurs in an abnormal PHI.  SSA_NAMES are
     never output, so we can safely use the ASM_WRITTEN_FLAG for this
--- 1915,1921 ----
  
  /* Returns the SSA version number of this SSA name.  Note that in
     tree SSA, version numbers are not per variable and may be recycled.  */
! #define SSA_NAME_VERSION(NODE)	SSA_NAME_CHECK (NODE)->base.u.version
  
  /* Nonzero if this SSA name occurs in an abnormal PHI.  SSA_NAMES are
     never output, so we can safely use the ASM_WRITTEN_FLAG for this
*************** struct GTY(()) tree_ssa_name {
*** 1943,1951 ****
    /* Statement that defines this SSA name.  */
    gimple def_stmt;
  
-   /* SSA version number.  */
-   unsigned int version;
- 
    /* Pointer attributes used for alias analysis.  */
    struct ptr_info_def *ptr_info;
  
--- 1970,1975 ----
*************** struct GTY(()) tree_omp_clause {
*** 2008,2014 ****
  #define BLOCK_ABSTRACT(NODE) (BLOCK_CHECK (NODE)->block.abstract_flag)
  
  /* True if BLOCK has the same ranges as its BLOCK_SUPERCONTEXT.  */
! #define BLOCK_SAME_RANGE(NODE) (BLOCK_CHECK (NODE)->base.nameless_flag)
  
  /* An index number for this block.  These values are not guaranteed to
     be unique across functions -- whether or not they are depends on
--- 2032,2038 ----
  #define BLOCK_ABSTRACT(NODE) (BLOCK_CHECK (NODE)->block.abstract_flag)
  
  /* True if BLOCK has the same ranges as its BLOCK_SUPERCONTEXT.  */
! #define BLOCK_SAME_RANGE(NODE) (BLOCK_CHECK (NODE)->base.u.bits.nameless_flag)
  
  /* An index number for this block.  These values are not guaranteed to
     be unique across functions -- whether or not they are depends on
*************** extern enum machine_mode vector_type_mod
*** 2148,2154 ****
  
  /* 1 if the alignment for this type was requested by "aligned" attribute,
     0 if it is the default for this type.  */
! #define TYPE_USER_ALIGN(NODE) (TYPE_CHECK (NODE)->base.user_align)
  
  /* The alignment for NODE, in bytes.  */
  #define TYPE_ALIGN_UNIT(NODE) (TYPE_ALIGN (NODE) / BITS_PER_UNIT)
--- 2172,2178 ----
  
  /* 1 if the alignment for this type was requested by "aligned" attribute,
     0 if it is the default for this type.  */
! #define TYPE_USER_ALIGN(NODE) (TYPE_CHECK (NODE)->base.u.bits.user_align)
  
  /* The alignment for NODE, in bytes.  */
  #define TYPE_ALIGN_UNIT(NODE) (TYPE_ALIGN (NODE) / BITS_PER_UNIT)
*************** extern enum machine_mode vector_type_mod
*** 2179,2188 ****
  #define TYPE_RESTRICT(NODE) (TYPE_CHECK (NODE)->type_common.restrict_flag)
  
  /* If nonzero, type's name shouldn't be emitted into debug info.  */
! #define TYPE_NAMELESS(NODE) (TYPE_CHECK (NODE)->base.nameless_flag)
  
  /* The address space the type is in.  */
! #define TYPE_ADDR_SPACE(NODE) (TYPE_CHECK (NODE)->base.address_space)
  
  /* There is a TYPE_QUAL value for each type qualifier.  They can be
     combined by bitwise-or to form the complete set of qualifiers for a
--- 2203,2212 ----
  #define TYPE_RESTRICT(NODE) (TYPE_CHECK (NODE)->type_common.restrict_flag)
  
  /* If nonzero, type's name shouldn't be emitted into debug info.  */
! #define TYPE_NAMELESS(NODE) (TYPE_CHECK (NODE)->base.u.bits.nameless_flag)
  
  /* The address space the type is in.  */
! #define TYPE_ADDR_SPACE(NODE) (TYPE_CHECK (NODE)->base.u.bits.address_space)
  
  /* There is a TYPE_QUAL value for each type qualifier.  They can be
     combined by bitwise-or to form the complete set of qualifiers for a
*************** enum cv_qualifier
*** 2272,2278 ****
  
  /* Indicated that objects of this type should be laid out in as
     compact a way as possible.  */
! #define TYPE_PACKED(NODE) (TYPE_CHECK (NODE)->base.packed_flag)
  
  /* Used by type_contains_placeholder_p to avoid recomputation.
     Values are: 0 (unknown), 1 (false), 2 (true).  Never access
--- 2296,2302 ----
  
  /* Indicated that objects of this type should be laid out in as
     compact a way as possible.  */
! #define TYPE_PACKED(NODE) (TYPE_CHECK (NODE)->base.u.bits.packed_flag)
  
  /* Used by type_contains_placeholder_p to avoid recomputation.
     Values are: 0 (unknown), 1 (false), 2 (true).  Never access
*************** struct function;
*** 2610,2616 ****
    (FIELD_DECL_CHECK (NODE)->decl_minimal.context)
  
  /* If nonzero, decl's name shouldn't be emitted into debug info.  */
! #define DECL_NAMELESS(NODE) (DECL_MINIMAL_CHECK (NODE)->base.nameless_flag)
  
  struct GTY(()) tree_decl_minimal {
    struct tree_common common;
--- 2634,2640 ----
    (FIELD_DECL_CHECK (NODE)->decl_minimal.context)
  
  /* If nonzero, decl's name shouldn't be emitted into debug info.  */
! #define DECL_NAMELESS(NODE) (DECL_MINIMAL_CHECK (NODE)->base.u.bits.nameless_flag)
  
  struct GTY(()) tree_decl_minimal {
    struct tree_common common;
*************** struct GTY(()) tree_decl_minimal {
*** 2671,2677 ****
  /* Set if the alignment of this DECL has been set by the user, for
     example with an 'aligned' attribute.  */
  #define DECL_USER_ALIGN(NODE) \
!   (DECL_COMMON_CHECK (NODE)->base.user_align)
  /* Holds the machine mode corresponding to the declaration of a variable or
     field.  Always equal to TYPE_MODE (TREE_TYPE (decl)) except for a
     FIELD_DECL.  */
--- 2695,2701 ----
  /* Set if the alignment of this DECL has been set by the user, for
     example with an 'aligned' attribute.  */
  #define DECL_USER_ALIGN(NODE) \
!   (DECL_COMMON_CHECK (NODE)->base.u.bits.user_align)
  /* Holds the machine mode corresponding to the declaration of a variable or
     field.  Always equal to TYPE_MODE (TREE_TYPE (decl)) except for a
     FIELD_DECL.  */
*************** struct GTY(()) tree_decl_with_rtl {
*** 2956,2962 ****
  #define DECL_FCONTEXT(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.fcontext)
  
  /* In a FIELD_DECL, indicates this field should be bit-packed.  */
! #define DECL_PACKED(NODE) (FIELD_DECL_CHECK (NODE)->base.packed_flag)
  
  /* Nonzero in a FIELD_DECL means it is a bit field, and must be accessed
     specially.  */
--- 2980,2986 ----
  #define DECL_FCONTEXT(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.fcontext)
  
  /* In a FIELD_DECL, indicates this field should be bit-packed.  */
! #define DECL_PACKED(NODE) (FIELD_DECL_CHECK (NODE)->base.u.bits.packed_flag)
  
  /* Nonzero in a FIELD_DECL means it is a bit field, and must be accessed
     specially.  */
*************** extern void decl_fini_priority_insert (t
*** 3246,3252 ****
  #define MAX_RESERVED_INIT_PRIORITY 100
  
  #define VAR_DECL_IS_VIRTUAL_OPERAND(NODE) \
!   (VAR_DECL_CHECK (NODE)->base.saturating_flag)
  
  struct GTY(()) tree_var_decl {
    struct tree_decl_with_vis common;
--- 3270,3276 ----
  #define MAX_RESERVED_INIT_PRIORITY 100
  
  #define VAR_DECL_IS_VIRTUAL_OPERAND(NODE) \
!   (VAR_DECL_CHECK (NODE)->base.u.bits.saturating_flag)
  
  struct GTY(()) tree_var_decl {
    struct tree_decl_with_vis common;
*************** tree_vec_elt_check (tree __t, int __i,
*** 3822,3829 ****
  {
    if (TREE_CODE (__t) != TREE_VEC)
      tree_check_failed (__t, __f, __l, __g, TREE_VEC, 0);
!   if (__i < 0 || __i >= __t->vec.length)
!     tree_vec_elt_check_failed (__i, __t->vec.length, __f, __l, __g);
    return &CONST_CAST_TREE (__t)->vec.a[__i];
  }
  
--- 3846,3853 ----
  {
    if (TREE_CODE (__t) != TREE_VEC)
      tree_check_failed (__t, __f, __l, __g, TREE_VEC, 0);
!   if (__i < 0 || __i >= __t->base.u.length)
!     tree_vec_elt_check_failed (__i, __t->base.u.length, __f, __l, __g);
    return &CONST_CAST_TREE (__t)->vec.a[__i];
  }
  
*************** tree_vec_elt_check (const_tree __t, int
*** 4028,4035 ****
  {
    if (TREE_CODE (__t) != TREE_VEC)
      tree_check_failed (__t, __f, __l, __g, TREE_VEC, 0);
!   if (__i < 0 || __i >= __t->vec.length)
!     tree_vec_elt_check_failed (__i, __t->vec.length, __f, __l, __g);
    return CONST_CAST (const_tree *, &__t->vec.a[__i]);
    //return &__t->vec.a[__i];
  }
--- 4052,4059 ----
  {
    if (TREE_CODE (__t) != TREE_VEC)
      tree_check_failed (__t, __f, __l, __g, TREE_VEC, 0);
!   if (__i < 0 || __i >= __t->base.u.length)
!     tree_vec_elt_check_failed (__i, __t->base.u.length, __f, __l, __g);
    return CONST_CAST (const_tree *, &__t->vec.a[__i]);
    //return &__t->vec.a[__i];
  }

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

* Re: [PATCH][RFC] Move TREE_VEC length and SSA_NAME version into tree_base
  2012-08-21 10:01 ` Richard Guenther
@ 2012-08-21 10:10   ` Jay Foad
  0 siblings, 0 replies; 3+ messages in thread
From: Jay Foad @ 2012-08-21 10:10 UTC (permalink / raw)
  To: Richard Guenther; +Cc: gcc-patches

On 21 August 2012 10:58, Richard Guenther <rguenther@suse.de> wrote:
> Index: trunk/gcc/tree.h
> ===================================================================
> *** trunk.orig/gcc/tree.h       2012-08-20 12:47:47.000000000 +0200
> --- trunk/gcc/tree.h    2012-08-21 10:32:47.717394657 +0200
> *************** enum omp_clause_code
> *** 417,423 ****
>      so all nodes have these fields.
>
>      See the accessor macros, defined below, for documentation of the
> !    fields.  */
>
>   struct GTY(()) tree_base {
>     ENUM_BITFIELD(tree_code) code : 16;
> --- 417,424 ----
>      so all nodes have these fields.
>
>      See the accessor macros, defined below, for documentation of the
> !    fields, and the table below which connects the fileds and the
> !    accessor macros.  */

Typo "fileds".

Jay.

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

end of thread, other threads:[~2012-08-21 10:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-20 12:21 [PATCH][RFC] Move TREE_VEC length and SSA_NAME version into tree_base Richard Guenther
2012-08-21 10:01 ` Richard Guenther
2012-08-21 10:10   ` Jay Foad

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).