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]

PATCH to remove BLOCK cruft



This patch removes some cruft in BLOCK nodes that is no longer used.
This is worth about 3% space savings on some of my test-cases.  This
is nothing like the win we'll get from the GCSE suggestions Richard
and Jeff made, and which I've mostly implemented, but still worth
doing.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

Tue Oct 26 01:27:32 1999  Mark Mitchell  <mark@codesourcery.com>

	* tree.h (BLOCK_TYPE_TAGS): Remove.
	(BLOCK_END_NOTE): Likewise.
	(BLOCK_LIVE_RANGE_FLAG): Likewise.
	(BLOCK_LIVE_RANGE_START): Likewise.
	(BLOCK_LIVE_RANGE_END): Likewise.
	(tree_block): Remove live_range_flag, live_range_var_flag, and
	type_tags.  Remove end_note, live_range_start, and live_range_end.
	(remember_end_note): Remove prototype.
	* tree.c (build_block): Don't set BLOCK_TYPE_TAGS.
	* c-decl.c (poplevel): Don't set BLOCK_TYPE_TAGS or call
	remember_end_note.
	* ggc-common.c (ggc_mark_tree_children): Don't mark
	BLOCK_TYPE_TAGS or BLOCK_END_NOTE.
	* integrate.c (adjust_copied_decl_tree): Remove.
	* print-tree.c (print_node): Don't print BLOCK_TYPE_TAGS.
	* stmt.c (last_block_end_note): Remove.
	(init_stmt): Don't add a GC root for it.
	(expand_fixup): Don't set it.
	(remember_end_note): Remove.
	(expand_end_bindings): Don't set last_block_end_note.

1999-10-26  Mark Mitchell  <mark@codesourcery.com>

	* ch-tree.h (remember_end_note): Remove prototype.
	* decl.c (poplevel): Don't call remember_end_note.

1999-10-26  Mark Mitchell  <mark@codesourcery.com>

	* decl.c (poplevel): Don't set BLOCK_TYPE_TAGS.  Don't call
	remember_end_note.

Tue Oct 26 01:32:19 1999  Mark Mitchell  <mark@codesourcery.com>

	* com.c (poplevel): Don't call remember_end_note.

1999-10-26  Mark Mitchell  <mark@codesourcery.com>

	* decl.c (poplevel): Don't set BLOCK_TYPE_TAGS or call
	remember_end_note.

Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-decl.c,v
retrieving revision 1.87
diff -c -p -r1.87 c-decl.c
*** c-decl.c	1999/10/18 08:40:20	1.87
--- c-decl.c	1999/10/26 08:07:28
*************** poplevel (keep, reverse, functionbody)
*** 1055,1063 ****
    if (block != 0)
      {
        BLOCK_VARS (block) = decls;
-       BLOCK_TYPE_TAGS (block) = tags;
        BLOCK_SUBBLOCKS (block) = subblocks;
-       remember_end_note (block);
      }
  
    /* In each subblock, record that this is its superior.  */
--- 1055,1061 ----
Index: ggc-common.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ggc-common.c,v
retrieving revision 1.9
diff -c -p -r1.9 ggc-common.c
*** ggc-common.c	1999/10/13 17:09:18	1.9
--- ggc-common.c	1999/10/26 08:07:37
*************** ggc_mark_tree_children (t)
*** 389,399 ****
  
      case 'b': /* A lexical block.  */
        ggc_mark_tree (BLOCK_VARS (t));
-       ggc_mark_tree (BLOCK_TYPE_TAGS (t));
        ggc_mark_tree (BLOCK_SUBBLOCKS (t));
        ggc_mark_tree (BLOCK_SUPERCONTEXT (t));
        ggc_mark_tree (BLOCK_ABSTRACT_ORIGIN (t));
-       ggc_mark_rtx (BLOCK_END_NOTE (t));
        break;
  
      case 'c': /* A constant.  */
--- 389,397 ----
Index: integrate.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/integrate.c,v
retrieving revision 1.72
diff -c -p -r1.72 integrate.c
*** integrate.c	1999/10/24 04:08:16	1.72
--- integrate.c	1999/10/26 08:07:39
*************** extern struct obstack *function_maybeper
*** 63,69 ****
  #endif
  
  static rtvec initialize_for_inline	PROTO((tree));
- static void adjust_copied_decl_tree	PROTO((tree));
  static void note_modified_parmregs	PROTO((rtx, rtx));
  static void integrate_parm_decls	PROTO((tree, struct inline_remap *,
  					       rtvec));
--- 63,68 ----
*************** initialize_for_inline (fndecl)
*** 290,319 ****
      }
  
    return arg_vector;
- }
- 
- /* Adjust the BLOCK_END_NOTE pointers in a given copied DECL tree so that
-    they all point to the new (copied) rtxs.  */
- 
- static void
- adjust_copied_decl_tree (block)
-      register tree block;
- {
-   register tree subblock;
-   register rtx original_end;
- 
-   original_end = BLOCK_END_NOTE (block);
-   if (original_end)
-     {
-       BLOCK_END_NOTE (block) = (rtx) NOTE_SOURCE_FILE (original_end);
-       NOTE_SOURCE_FILE (original_end) = 0;
-     }
- 
-   /* Process all subblocks.  */
-   for (subblock = BLOCK_SUBBLOCKS (block);
-        subblock;
-        subblock = TREE_CHAIN (subblock))
-     adjust_copied_decl_tree (subblock);
  }
  
  /* Copy NODE (as with copy_node).  NODE must be a DECL.  Set the
--- 289,294 ----
Index: print-tree.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/print-tree.c,v
retrieving revision 1.19
diff -c -p -r1.19 print-tree.c
*** print-tree.c	1999/10/03 16:47:51	1.19
--- print-tree.c	1999/10/26 08:07:39
*************** print_node (file, prefix, node, indent)
*** 528,534 ****
  
      case 'b':
        print_node (file, "vars", BLOCK_VARS (node), indent + 4);
-       print_node (file, "tags", BLOCK_TYPE_TAGS (node), indent + 4);
        print_node (file, "supercontext", BLOCK_SUPERCONTEXT (node), indent + 4);
        print_node (file, "subblocks", BLOCK_SUBBLOCKS (node), indent + 4);
        print_node (file, "chain", BLOCK_CHAIN (node), indent + 4);
--- 528,533 ----
Index: stmt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/stmt.c,v
retrieving revision 1.101
diff -c -p -r1.101 stmt.c
*** stmt.c	1999/10/04 23:18:09	1.101
--- stmt.c	1999/10/26 08:07:45
*************** struct obstack stmt_obstack;
*** 64,75 ****
  #define CASE_VECTOR_PC_RELATIVE 0
  #endif
  
- /* Each time we expand the end of a binding contour (in `expand_end_bindings')
-    and we emit a new NOTE_INSN_BLOCK_END note, we save a pointer to it here.
-    This is used by the `remember_end_note' function to record the endpoint
-    of each generated block in its associated BLOCK node.  */
- 
- static rtx last_block_end_note;
  
  /* Functions and data structures for expanding case statements.  */
  
--- 64,69 ----
*************** init_stmt ()
*** 598,604 ****
    int i;
  
    gcc_obstack_init (&stmt_obstack);
-   ggc_add_rtx_root (&last_block_end_note, 1);
  
    for (i = 0; i < 10; i++)
      {
--- 592,597 ----
*************** expand_fixup (tree_label, rtl_label, las
*** 1046,1052 ****
          start_sequence ();
          start = emit_note (NULL_PTR, NOTE_INSN_BLOCK_BEG);
  	fixup->before_jump = emit_note (NULL_PTR, NOTE_INSN_DELETED);
!         last_block_end_note = emit_note (NULL_PTR, NOTE_INSN_BLOCK_END);
          fixup->context = block;
          end_sequence ();
          emit_insns_after (start, original_before_jump);
--- 1039,1045 ----
          start_sequence ();
          start = emit_note (NULL_PTR, NOTE_INSN_BLOCK_BEG);
  	fixup->before_jump = emit_note (NULL_PTR, NOTE_INSN_DELETED);
! 	emit_note (NULL_PTR, NOTE_INSN_BLOCK_END);
          fixup->context = block;
          end_sequence ();
          emit_insns_after (start, original_before_jump);
*************** is_eh_region ()
*** 3345,3362 ****
  	  && block_stack->data.block.exception_region);
  }
  
- /* Given a pointer to a BLOCK node, save a pointer to the most recently
-    generated NOTE_INSN_BLOCK_END in the BLOCK_END_NOTE field of the given
-    BLOCK node.  */
- 
- void
- remember_end_note (block)
-      register tree block;
- {
-   BLOCK_END_NOTE (block) = last_block_end_note;
-   last_block_end_note = NULL_RTX;
- }
- 
  /* Emit a handler label for a nonlocal goto handler.
     Also emit code to store the handler label in SLOT before BEFORE_INSN.  */
  
--- 3338,3343 ----
*************** expand_end_bindings (vars, mark_ends, do
*** 3676,3682 ****
       just going out of scope, so they are in scope for their cleanups.  */
  
    if (mark_ends)
!     last_block_end_note = emit_note (NULL_PTR, NOTE_INSN_BLOCK_END);
    else
      /* Get rid of the beginning-mark if we don't make an end-mark.  */
      NOTE_LINE_NUMBER (thisblock->data.block.first_insn) = NOTE_INSN_DELETED;
--- 3657,3663 ----
       just going out of scope, so they are in scope for their cleanups.  */
  
    if (mark_ends)
!     emit_note (NULL_PTR, NOTE_INSN_BLOCK_END);
    else
      /* Get rid of the beginning-mark if we don't make an end-mark.  */
      NOTE_LINE_NUMBER (thisblock->data.block.first_insn) = NOTE_INSN_DELETED;
Index: tree.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/tree.c,v
retrieving revision 1.98
diff -c -p -r1.98 tree.c
*** tree.c	1999/10/10 13:02:41	1.98
--- tree.c	1999/10/26 08:07:48
*************** build_block (vars, tags, subblocks, supe
*** 3299,3305 ****
  {
    register tree block = make_node (BLOCK);
    BLOCK_VARS (block) = vars;
-   BLOCK_TYPE_TAGS (block) = tags;
    BLOCK_SUBBLOCKS (block) = subblocks;
    BLOCK_SUPERCONTEXT (block) = supercontext;
    BLOCK_CHAIN (block) = chain;
--- 3299,3304 ----
Index: tree.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/tree.h,v
retrieving revision 1.98
diff -c -p -r1.98 tree.h
*** tree.h	1999/10/13 17:09:18	1.98
--- tree.h	1999/10/26 08:07:50
*************** struct tree_exp
*** 751,757 ****
  
  /* In a BLOCK node.  */
  #define BLOCK_VARS(NODE) (BLOCK_CHECK (NODE)->block.vars)
- #define BLOCK_TYPE_TAGS(NODE) (BLOCK_CHECK (NODE)->block.type_tags)
  #define BLOCK_SUBBLOCKS(NODE) (BLOCK_CHECK (NODE)->block.subblocks)
  #define BLOCK_SUPERCONTEXT(NODE) (BLOCK_CHECK (NODE)->block.supercontext)
  /* Note: when changing this, make sure to find the places
--- 751,756 ----
*************** struct tree_exp
*** 759,778 ****
  #define BLOCK_CHAIN(NODE) TREE_CHAIN (NODE)
  #define BLOCK_ABSTRACT_ORIGIN(NODE) (BLOCK_CHECK (NODE)->block.abstract_origin)
  #define BLOCK_ABSTRACT(NODE) (BLOCK_CHECK (NODE)->block.abstract_flag)
- #define BLOCK_END_NOTE(NODE) (BLOCK_CHECK (NODE)->block.end_note)
- /* Nonzero means that this block has separate live range regions */
- #define BLOCK_LIVE_RANGE_FLAG(NOTE) (BLOCK_CHECK (NOTE)->block.live_range_flag)
- 
- /* Nonzero means that this block has a variable declared in it
-    that is split into separate live ranges.  */
- #define BLOCK_LIVE_RANGE_VAR_FLAG(NOTE) (BLOCK_CHECK (NOTE)->block.live_range_var_flag)
  
- /* Index for marking the start of the block for live ranges.  */
- #define BLOCK_LIVE_RANGE_START(NOTE) (BLOCK_CHECK (NOTE)->block.live_range_start)
- 
- /* Index for marking the end of the block for live ranges.  */
- #define BLOCK_LIVE_RANGE_END(NOTE) (BLOCK_CHECK (NOTE)->block.live_range_end)
- 
  /* Nonzero means that this block is prepared to handle exceptions
     listed in the BLOCK_VARS slot.  */
  #define BLOCK_HANDLER_BLOCK(NODE) (BLOCK_CHECK (NODE)->block.handler_block_flag)
--- 758,764 ----
*************** struct tree_block
*** 783,799 ****
  
    unsigned handler_block_flag : 1;
    unsigned abstract_flag : 1;
-   unsigned live_range_flag : 1;
-   unsigned live_range_var_flag : 1;
  
    union tree_node *vars;
-   union tree_node *type_tags;
    union tree_node *subblocks;
    union tree_node *supercontext;
    union tree_node *abstract_origin;
-   struct rtx_def *end_note;
-   int live_range_start;
-   int live_range_end;
  };
  
  /* Define fields and accessors for nodes representing data types.  */
--- 769,779 ----
*************** extern void expand_asm_operands		PROTO (
*** 2439,2445 ****
  extern int any_pending_cleanups		PROTO ((int));
  extern void init_stmt			PROTO ((void));
  extern void init_stmt_for_function	PROTO ((void));
- extern void remember_end_note		PROTO ((tree));
  extern int drop_through_at_end_p	PROTO ((void));
  extern void expand_start_target_temps	PROTO ((void));
  extern void expand_end_target_temps	PROTO ((void));
--- 2419,2424 ----
Index: ch/ch-tree.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ch/ch-tree.h,v
retrieving revision 1.13
diff -c -p -r1.13 ch-tree.h
*** ch-tree.h	1999/09/24 10:06:53	1.13
--- ch-tree.h	1999/10/26 08:07:51
*************** extern void push_function_context       
*** 1120,1128 ****
  /* in integrate.c */
  extern void output_inline_function              PROTO((tree));
  
- /* in stmt.c */
- extern void remember_end_note                   PROTO((tree));
- 
  /* in toplev.c */
  extern void announce_function                   PROTO((tree));
  extern int  floor_log2_wide                     PROTO((unsigned HOST_WIDE_INT));
--- 1120,1125 ----
Index: ch/decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ch/decl.c,v
retrieving revision 1.14
diff -c -p -r1.14 decl.c
*** decl.c	1999/09/24 10:06:53	1.14
--- decl.c	1999/10/26 08:07:54
*************** poplevel (keep, reverse, functionbody)
*** 2940,2946 ****
  	    }
  
  	  BLOCK_SUBBLOCKS (block) = subblocks;
- 	  remember_end_note (block);
  	}
  
        /* In each subblock, record that this is its superior.  */
--- 2940,2945 ----
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.486
diff -c -p -r1.486 decl.c
*** decl.c	1999/10/25 06:38:42	1.486
--- decl.c	1999/10/26 08:08:03
*************** poplevel (keep, reverse, functionbody)
*** 1233,1243 ****
  	{
  	  if (decls || tags || subblocks)
  	    {
! 	      if (BLOCK_VARS (block) || BLOCK_TYPE_TAGS (block))
  		warning ("internal compiler error: debugging info corrupted");
  
  	      BLOCK_VARS (block) = decls;
- 	      BLOCK_TYPE_TAGS (block) = tags;
  
  	      /* We can have previous subblocks and new subblocks when
  		 doing fixup_gotos with complex cleanups.  We chain the new
--- 1233,1242 ----
  	{
  	  if (decls || tags || subblocks)
  	    {
! 	      if (BLOCK_VARS (block))
  		warning ("internal compiler error: debugging info corrupted");
  
  	      BLOCK_VARS (block) = decls;
  
  	      /* We can have previous subblocks and new subblocks when
  		 doing fixup_gotos with complex cleanups.  We chain the new
*************** poplevel (keep, reverse, functionbody)
*** 1245,1262 ****
  	      BLOCK_SUBBLOCKS (block) = chainon (BLOCK_SUBBLOCKS (block),
  						 subblocks);
  	    }
- 	  /* If we created the block earlier on, and we are just
- 	     diddling it now, then it already should have a proper
- 	     BLOCK_END_NOTE value associated with it.  */
  	}
        else
  	{
  	  BLOCK_VARS (block) = decls;
- 	  BLOCK_TYPE_TAGS (block) = tags;
  	  BLOCK_SUBBLOCKS (block) = subblocks;
- 	  /* Otherwise, for a new block, install a new BLOCK_END_NOTE
- 	     value.  */ 
- 	  remember_end_note (block);
  	}
      }
  
--- 1244,1254 ----
Index: f/com.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/f/com.c,v
retrieving revision 1.69
diff -c -p -r1.69 com.c
*** com.c	1999/10/16 01:22:40	1.69
--- com.c	1999/10/26 08:08:11
*************** poplevel (keep, reverse, functionbody)
*** 15112,15118 ****
      {
        BLOCK_VARS (block) = decls;
        BLOCK_SUBBLOCKS (block) = subblocks;
-       remember_end_note (block);
      }
  
    /* In each subblock, record that this is its superior.  */
--- 15112,15117 ----
Index: java/decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/decl.c,v
retrieving revision 1.40
diff -c -p -r1.40 decl.c
*** decl.c	1999/09/24 19:24:19	1.40
--- decl.c	1999/10/26 08:08:15
*************** poplevel (keep, reverse, functionbody)
*** 1192,1200 ****
    if (block != 0)
      {
        BLOCK_VARS (block) = decls;
-       BLOCK_TYPE_TAGS (block) = NULL_TREE;
        BLOCK_SUBBLOCKS (block) = subblocks;
-       remember_end_note (block);
      }
  
    /* In each subblock, record that this is its superior.  */
--- 1192,1198 ----


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