public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Nathan Froyd <froydnj@codesourcery.com>
To: gcc-patches@gcc.gnu.org
Cc: Nathan Froyd <froydnj@codesourcery.com>
Subject: [PATCH 01/18] add typed_tree structure
Date: Fri, 11 Mar 2011 04:24:00 -0000	[thread overview]
Message-ID: <1299817406-16745-2-git-send-email-froydnj@codesourcery.com> (raw)
In-Reply-To: <1299817406-16745-1-git-send-email-froydnj@codesourcery.com>

The first step in removing TREE_CHAIN (and even TREE_TYPE) from a select
few nodes is to create separate substructures for trees-with-type and
trees-with-chain.  Since trees-with-type but no chain are expected to be
more common that vice versa, make the hierarchy reflect that.  Modify a
few macros to reflect the new inheritance structure, and add a new tree
structure enum for the new structure.  Make note that we support the new
tree structure in the LTO streamer, even though we don't need to do
anything about it yet.

-Nathan

gcc/
	* tree.h (struct typed_tree): New.
	(struct tree_common): Include it instead of tree_base.
	(TREE_TYPE): Update for new location of type field.
	(TYPE_USER_ALIGN, TYPE_PACKED): Refer to base field directly.
	(DECL_USER_ALIGN, DECL_PACKED): Likewise.
	(union tree_node): Add typed field.
	* treestruct.def (TS_TYPED): New.
	* lto-streamer.c (check_handled_ts_structures): Handle it.
	* tree.c (MARK_TS_TYPED): New macro.
	(MARK_TS_COMMON): Call it instead of MARK_TS_BASE.

diff --git a/gcc/lto-streamer.c b/gcc/lto-streamer.c
index dba9d2d..546228c 100644
--- a/gcc/lto-streamer.c
+++ b/gcc/lto-streamer.c
@@ -270,6 +270,7 @@ check_handled_ts_structures (void)
   /* These are the TS_* structures that are either handled or
      explicitly ignored by the streamer routines.  */
   handled_p[TS_BASE] = true;
+  handled_p[TS_TYPED] = true;
   handled_p[TS_COMMON] = true;
   handled_p[TS_INT_CST] = true;
   handled_p[TS_REAL_CST] = true;
diff --git a/gcc/tree.c b/gcc/tree.c
index c947072..798bc08 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -356,9 +356,15 @@ initialize_tree_contains_struct (void)
     tree_contains_struct[C][TS_BASE] = 1;		\
   } while (0)
 
-#define MARK_TS_COMMON(C)				\
+#define MARK_TS_TYPED(C)				\
   do {							\
     MARK_TS_BASE (C);					\
+    tree_contains_struct[C][TS_TYPED] = 1;		\
+  } while (0)
+
+#define MARK_TS_COMMON(C)				\
+  do {							\
+    MARK_TS_TYPED (C);					\
     tree_contains_struct[C][TS_COMMON] = 1;		\
   } while (0)
 
diff --git a/gcc/tree.h b/gcc/tree.h
index a49e335..2f772e1 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -407,12 +407,16 @@ struct GTY(()) tree_base {
   unsigned address_space : 8;
 };
 
-struct GTY(()) tree_common {
+struct GTY(()) typed_tree {
   struct tree_base base;
-  tree chain;
   tree type;
 };
 
+struct GTY(()) tree_common {
+  struct typed_tree typed;
+  tree chain;
+};
+
 /* The following table lists the uses of each of the above flags and
    for which types of nodes they are defined.
 
@@ -869,7 +873,7 @@ enum tree_node_structure_enum {
    In VECTOR_TYPE nodes, this is the type of the elements.  */
 #define TREE_TYPE(NODE) __extension__ \
 (*({__typeof (NODE) const __t = (NODE);					\
-    &__t->common.type; }))
+    &__t->typed.type; }))
 
 extern void tree_contains_struct_check_failed (const_tree,
 					       const enum tree_node_structure_enum,
@@ -2151,7 +2155,7 @@ extern enum machine_mode vector_type_mode (const_tree);
 
 /* 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)->common.base.user_align)
+#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)
@@ -2289,7 +2293,7 @@ extern enum machine_mode vector_type_mode (const_tree);
 
 /* Indicated that objects of this type should be laid out in as
    compact a way as possible.  */
-#define TYPE_PACKED(NODE) (TYPE_CHECK (NODE)->common.base.packed_flag)
+#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
@@ -2632,7 +2636,7 @@ struct GTY(()) tree_decl_minimal {
 /* 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)->common.base.user_align)
+  (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.  */
@@ -2900,7 +2904,7 @@ struct GTY(()) tree_decl_with_rtl {
 #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)->common.base.packed_flag)
+#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.  */
@@ -3505,6 +3509,7 @@ extern tree build_target_option_node (void);
 union GTY ((ptr_alias (union lang_tree_node),
 	    desc ("tree_node_structure (&%h)"), variable_size)) tree_node {
   struct tree_base GTY ((tag ("TS_BASE"))) base;
+  struct typed_tree GTY ((tag ("TS_TYPED"))) typed;
   struct tree_common GTY ((tag ("TS_COMMON"))) common;
   struct tree_int_cst GTY ((tag ("TS_INT_CST"))) int_cst;
   struct tree_real_cst GTY ((tag ("TS_REAL_CST"))) real_cst;
diff --git a/gcc/treestruct.def b/gcc/treestruct.def
index baea46a..b65bdc2 100644
--- a/gcc/treestruct.def
+++ b/gcc/treestruct.def
@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3.  If not see
    specifying what structures contain what other structures in the
    tree_contains_struct array.  */
 DEFTREESTRUCT(TS_BASE, "base")
+DEFTREESTRUCT(TS_TYPED, "typed")
 DEFTREESTRUCT(TS_COMMON, "common")
 DEFTREESTRUCT(TS_INT_CST, "integer cst")
 DEFTREESTRUCT(TS_REAL_CST, "real cst")
-- 
1.7.0.4

  parent reply	other threads:[~2011-03-11  4:23 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-11  4:23 [4.7 PATCH 00/18] slim down a number of tree nodes Nathan Froyd
2011-03-11  4:23 ` [PATCH 05/18] remove TREE_CHAIN from CONSTRUCTOR nodes Nathan Froyd
2011-03-11 13:05   ` Richard Guenther
2011-03-11  4:23 ` [PATCH 04/18] remove TREE_CHAIN from SSA_NAME nodes Nathan Froyd
2011-03-11 13:06   ` Richard Guenther
2011-03-11  4:24 ` Nathan Froyd [this message]
2011-03-11 13:05   ` [PATCH 01/18] add typed_tree structure Richard Guenther
2011-03-11 15:21   ` Michael Matz
2011-03-11  4:24 ` [PATCH 13/18] move TS_EXP to be a substructure of TS_TYPED Nathan Froyd
2011-05-11  0:34   ` Nathan Froyd
2011-05-17 17:51     ` [PING][PATCH " Nathan Froyd
2011-05-23 14:58       ` Nathan Froyd
2011-05-23 15:34         ` Richard Guenther
2011-05-24 18:52           ` Nathan Froyd
2011-05-25  9:59             ` Richard Guenther
2011-03-11  4:24 ` [PATCH 10/18] convert cp SWITCH_STMTs to use private scope fields Nathan Froyd
2011-03-11  4:24 ` [PATCH 15/18] move REAL_IDENTIFIER_TYPE_VALUE to be a field of lang_identifier Nathan Froyd
2011-03-11 13:40   ` Jason Merrill
2011-03-11 14:04     ` Nathan Froyd
2011-03-11 14:20       ` Nathan Froyd
2011-03-11 15:04         ` Jason Merrill
2011-03-11 16:23           ` Nathan Froyd
2011-03-11 17:17             ` Jason Merrill
2011-03-11 14:41     ` Joseph S. Myers
2011-03-11  4:24 ` [PATCH 08/18] convert cp *FOR_STMTs to use private scope fields Nathan Froyd
2011-03-11  4:24 ` [PATCH 06/18] define CASE_CHAIN accessor for CASE_LABEL_EXPR Nathan Froyd
2011-03-11 13:07   ` Richard Guenther
2011-03-11  4:24 ` [PATCH 14/18] move TS_STATEMENT_LIST to be a substructure of TS_TYPED Nathan Froyd
2011-03-11  6:01   ` Jason Merrill
2011-03-11 12:23     ` Nathan Froyd
2011-03-11  4:24 ` [PATCH 16/18] make TS_IDENTIFIER be a substructure of TS_BASE Nathan Froyd
2011-03-11 13:12   ` Richard Guenther
2011-03-11 17:21     ` Nathan Froyd
2011-03-11  4:24 ` [PATCH 07/18] generalize build_case_label to the rest of the compiler Nathan Froyd
2011-03-11 13:01   ` Joseph S. Myers
2011-03-11 13:10     ` Richard Guenther
2011-03-11 14:56   ` Tom Tromey
2011-03-11  4:24 ` [PATCH 03/18] remove TREE_CHAIN from *_CST nodes Nathan Froyd
2011-03-11 13:05   ` Richard Guenther
2011-03-11  4:30 ` [PATCH 09/18] convert cp IF_STMTs to use private scope fields Nathan Froyd
2011-03-11  4:30 ` [PATCH 11/18] mark EXPR_PACK_EXPANSION as typed only Nathan Froyd
2011-03-11  4:31 ` [PATCH 17/18] introduce block_chainon and use BLOCK_CHAIN more Nathan Froyd
2011-03-11 13:15   ` Richard Guenther
2011-03-11 13:19     ` Nathan Froyd
2011-03-11 15:14   ` Tom Tromey
2011-03-12 12:23   ` Eric Botcazou
2011-03-11  4:31 ` [PATCH 02/18] enforce TREE_CHAIN and TREE_TYPE accesses Nathan Froyd
2011-03-11  8:12   ` Mike Stump
2011-03-11 13:21   ` Richard Guenther
2011-03-11 15:24   ` Tom Tromey
2011-03-12 12:13   ` Eric Botcazou
2011-03-21 13:50     ` Nathan Froyd
2011-03-21 17:50       ` Eric Botcazou
2011-04-13  2:43   ` Nathan Froyd
2011-04-13  2:57     ` Diego Novillo
2011-04-13  4:02     ` Ian Lance Taylor
2011-03-11  4:31 ` [PATCH 18/18] make TS_BLOCK a substructure of TS_BASE Nathan Froyd
2011-05-26 18:30   ` Nathan Froyd
2011-03-11  4:50 ` [PATCH 12/18] make CASE_LABEL_EXPR not abuse TREE_CHAIN Nathan Froyd
2011-03-11 13:19   ` Richard Guenther
2011-05-10 20:08     ` Nathan Froyd
2011-05-10 20:19     ` Diego Novillo
2011-05-11  9:21       ` Richard Guenther
2011-05-11 19:22   ` H.J. Lu
2011-03-11  8:18 ` [4.7 PATCH 00/18] slim down a number of tree nodes Mike Stump
2011-03-11 16:00   ` Nathan Froyd
2011-03-11 13:25 ` Richard Guenther
2011-03-11 13:42   ` Nathan Froyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1299817406-16745-2-git-send-email-froydnj@codesourcery.com \
    --to=froydnj@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).