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


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

Re: [tuples] gimple-tuples-branch created


> You can make a GIMPLE_STATEMENT_LIST tree with only the struct
> gimple_stmt * member, and make the gimplifier create those, and change
> the small amount of code that knows about them to use it.

I talked it over with Diego and he thought this would be a better or less
invasive approach (FLW).

Let me see if we're on the same page.  Are you suggesting having a
GIMPLE_STATEMENT_LIST in addition to STATEMENT_LIST, like my header changes
below ??

If so, we would also need to:

- Handle GIMPLE_STATEMENT_LIST any place we currently handle STATEMENT_LIST.

- Change all append_to_statement_list to append_to_gimple_statement_list and
  alloc_stmt_list to alloc_gimple_stmt_list.

- Change all tree_stmt_iterator code to corresponding gimple_stmt_iterator
  code.

Is this what you had in mind?  If so, I don't see this being a "small amount
of code" (not that I'm complaining, just saying...).

Cheers.
Aldy

Index: tree.c
===================================================================
--- tree.c	(revision 116725)
+++ tree.c	(working copy)
@@ -390,6 +390,8 @@ tree_code_size (enum tree_code code)
 	case SSA_NAME:		return sizeof (struct tree_ssa_name);
 
 	case STATEMENT_LIST:	return sizeof (struct tree_statement_list);
+	case GIMPLE_STATEMENT_LIST:
+	  return sizeof (struct gimple_statement_list);
 	case BLOCK:		return sizeof (struct tree_block);
 	case VALUE_HANDLE:	return sizeof (struct tree_value_handle);
 	case CONSTRUCTOR:	return sizeof (struct tree_constructor);
@@ -2183,6 +2185,7 @@ tree_node_structure (tree t)
     case SSA_NAME:		return TS_SSA_NAME;
     case PLACEHOLDER_EXPR:	return TS_COMMON;
     case STATEMENT_LIST:	return TS_STATEMENT_LIST;
+    case GIMPLE_STATEMENT_LIST:	return TS_GIMPLE_STATEMENT_LIST;
     case BLOCK:			return TS_BLOCK;
     case CONSTRUCTOR:		return TS_CONSTRUCTOR;
     case TREE_BINFO:		return TS_BINFO;
Index: tree.h
===================================================================
--- tree.h	(revision 116725)
+++ tree.h	(working copy)
@@ -3157,7 +3157,7 @@ struct tree_type_decl GTY(())
 
 };
 
-/* A STATEMENT_LIST chains statements together in GENERIC and GIMPLE.
+/* A STATEMENT_LIST chains statements together in GENERIC.
    To reduce overhead, the nodes containing the statements are not trees.
    This avoids the overhead of tree_common on all linked list elements.
 
@@ -3184,6 +3184,25 @@ struct tree_statement_list
   struct tree_statement_list_node *tail;
 };
 
+/* A GIMPLE_STATEMENT_LIST is just like STATEMENT_LIST but for GIMPLE
+   statements.  */
+
+struct gimple_statement_list_node
+  GTY ((chain_next ("%h.next"), chain_prev ("%h.prev")))
+{
+  struct gimple_statement_list_node *prev;
+  struct gimple_statement_list_node *next;
+  struct gimple_stmt gs;
+};
+
+struct gimple_statement_list
+  GTY(())
+{
+  struct tree_common common;
+  struct gimple_statement_list_node *head;
+  struct gimple_statement_list_node *tail;
+};
+
 #define VALUE_HANDLE_ID(NODE)		\
   (VALUE_HANDLE_CHECK (NODE)->value_handle.id)
 
@@ -3248,6 +3267,7 @@ union tree_node GTY ((ptr_alias (union l
   struct tree_block GTY ((tag ("TS_BLOCK"))) block;
   struct tree_binfo GTY ((tag ("TS_BINFO"))) binfo;
   struct tree_statement_list GTY ((tag ("TS_STATEMENT_LIST"))) stmt_list;
+  struct gimple_statement_list GTY ((tag ("TS_GIMPLE_STATEMENT_LIST"))) gimple_stmt_list;
   struct tree_value_handle GTY ((tag ("TS_VALUE_HANDLE"))) value_handle;
   struct tree_constructor GTY ((tag ("TS_CONSTRUCTOR"))) constructor;
   struct tree_memory_tag GTY ((tag ("TS_MEMORY_TAG"))) mtag;
Index: treestruct.def
===================================================================
--- treestruct.def	(revision 116647)
+++ treestruct.def	(working copy)
@@ -57,6 +57,7 @@ DEFTREESTRUCT(TS_PHI_NODE, "phi node")
 DEFTREESTRUCT(TS_BLOCK, "block")
 DEFTREESTRUCT(TS_BINFO, "binfo")
 DEFTREESTRUCT(TS_STATEMENT_LIST, "statement list")
+DEFTREESTRUCT(TS_GIMPLE_STATEMENT_LIST, "gimple statement list")
 DEFTREESTRUCT(TS_VALUE_HANDLE, "value handle")
 DEFTREESTRUCT(TS_CONSTRUCTOR, "constructor")
 DEFTREESTRUCT(TS_MEMORY_TAG, "memory tag")


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