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]

[PATCH] decrease storage requirements for tree EXPRs


struct tree_exp includes a `block' field, which, AFAICT, is only used
during expand to pass information from gimple stmts that contain the
block information down to the RTL level.  This is a waste of space, as
the relevant field is used only rarely and we pay for it throughout the
entire compilation.  (expand should be tweaked to do this differently,
but that'd be slightly more complicated than the below.)

Equally AFAICT, the TREE_CHAIN field is entirely unused in struct
tree_exp.  The patch below proposes to move the block information to
reside in this heretofore unused field and delete the `block' field,
thus making struct tree_exp one word smaller.  (Yes, I recognize the
humor in using TREE_CHAIN for *more* things.)  This saves ~1-2% of total
space in a typical compilation; I have not done any measurements on
whether it speeds up the compiler at all.

The patch has been bootstrapped on x86_64-linux-gnu with no ill effects.
I have run it through a full test run + the gdb testsuite; I do not have
the numbers in front of me at the moment (they're on a computer I don't
have access to right now), but I recall them looking good.

OK to commit?  Or would people rather see expand modified (probably in
stage1, rather than stage3)?

-Nathan

gcc/
	* tree.h (struct tree_exp): Delete block field.
	* tree.c (tree_block): Return t->common.chain for EXPRs.

gcc/lto/
	* lto.c (lto_fixup_tree): Don't fixup t->exp.block.

Index: gcc/tree.h
===================================================================
--- gcc/tree.h	(revision 167123)
+++ gcc/tree.h	(working copy)
@@ -1854,7 +1854,6 @@ enum omp_clause_default_kind
 struct GTY(()) tree_exp {
   struct tree_common common;
   location_t locus;
-  tree block;
   tree GTY ((special ("tree_exp"),
 	     desc ("TREE_CODE ((tree) &%0)")))
     operands[1];
Index: gcc/tree.c
===================================================================
--- gcc/tree.c	(revision 167123)
+++ gcc/tree.c	(working copy)
@@ -10526,7 +10526,7 @@ tree_block (tree t)
   char const c = TREE_CODE_CLASS (TREE_CODE (t));
 
   if (IS_EXPR_CODE_CLASS (c))
-    return &t->exp.block;
+    return &TREE_CHAIN (t);
   gcc_unreachable ();
   return NULL;
 }
Index: gcc/lto/lto.c
===================================================================
--- gcc/lto/lto.c	(revision 167123)
+++ gcc/lto/lto.c	(working copy)
@@ -1932,7 +1932,6 @@ lto_fixup_tree (tree *tp, int *walk_subt
 	{
 	  /* walk_tree only handles TREE_OPERANDs. Do the rest here.  */
 	  lto_fixup_common (t, data);
-	  LTO_FIXUP_SUBTREE (t->exp.block);
 	  *walk_subtrees = 1;
 	}
       else


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