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]

Kill BLOCK_FOR_INSN array and scoping ntoes


Hi,
this patch does two changes we've discussed for a while - it uses the
alternate scope representation everywhere and kills BLOCK_FOR_INSN notes
by adding extra fields in INSNS.

In case there will be problems, I will hapilly split the patch, but I
wanted to save some effort by doing this change at once as both modify
the INSN containers and I would get into problems otehrwsie.


Fri May 31 10:41:25 CEST 2002  Jan Hubicka  <jh@suse.cz>
	* basic-block.h (basic_block_for_insn, BLOCK_FOR_INSN): Kill.
	(set_block_for_insn): Turn into macro.
	* cfgbuild.c (find_basic_block): Do not clear basic_block_for_insn.
	* cfglayout.c (insn_scopes): Kill.
	(scope_to_insns_initialize): Do not use insn_scopes.
	(scope_to_insns_finalize): Likewise.
	(duplicate_insn_chain): Likewise.
	(cfg_layout_initialize, cfg_layout_finalize): Do not turn scopes to notes.
	* cfgrtl.c (basic_block_for_insn): Kill.
	(delete_insn_and_edges, delete_insn_chain_and_edges): Simplify.
	(create_basic_block_structure): Use reorder_insns.
	(compute_bb_for_insn): Do not use basic_block_for_insn.
	(merge_blocks_nomove): Likewise.
	(update_bb_for_insn): Likewise.
	(verify_flow_info): Likewise.
	(set_block_for_insn): Kill.
	* combine.c (try_combine): Update gen_rtx_INSN call.
	* emit-rtl.c (gen_label_rtx): Update gen_rtx_CODE_LABEL call.
	(mark_insn_raw, make_jump_insn_raw, make_call_insn_raw): Clear
	scopes and BBs.
	(add_insn_after, add_insn_before, remove_insn, reorder_insns): Simplify.
	(emit_note_before, emit_note_after, emit_line_note_after, emit_note):
	Clear BB.
	(emit_insns_after): Simplify.
	(emit_copy_of_insn_after): Copy scope.
	* final.c (final_start_function): Lower scopes.
	* flow.c (check_function_return_warnings): Do not rely on deleted insn.
	* integrate.c (copy_insn_list): Cope scopes.
	* jump.c (duplicate_loop_exit_test): LIkewise; simplify.
	* loop.c (loop_optimize): Do not care block notes.
	* print-rtl.c (print_rtx): Print BB.
	* recog.c (apply_change_group): Simplify.
	* rtl.c (copy_rtx): Handle 'B'.
	* rtl.def (INSN, CALL_INSN, JUMP_INSN, NOTE): Add extra fields.
	* rtl.h (Field accessors): Update indexes.
	* sched-ebb.c (schedule_ebbs): Do not lower notes.
	* sched-rgn.c (schedule_insns): Likewise.
	* toplev.c (rest_of_compilation): Lower notes.
	* unroll.c (unroll_loop): Do not care scoping notes.
	(copy_loop_body): Copy scopes.
Index: basic-block.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/basic-block.h,v
retrieving revision 1.149
diff -c -3 -p -r1.149 basic-block.h
*** basic-block.h	28 May 2002 12:53:33 -0000	1.149
--- basic-block.h	31 May 2002 08:38:52 -0000
*************** extern struct basic_block_def entry_exit
*** 299,312 ****
  #define ENTRY_BLOCK_PTR	(&entry_exit_blocks[0])
  #define EXIT_BLOCK_PTR	(&entry_exit_blocks[1])
  
- extern varray_type basic_block_for_insn;
- #define BLOCK_FOR_INSN(INSN)  VARRAY_BB (basic_block_for_insn, INSN_UID (INSN))
  #define BLOCK_NUM(INSN)	      (BLOCK_FOR_INSN (INSN)->index + 0)
  
  extern void compute_bb_for_insn		PARAMS ((int));
  extern void free_bb_for_insn		PARAMS ((void));
  extern void update_bb_for_insn		PARAMS ((basic_block));
- extern void set_block_for_insn		PARAMS ((rtx, basic_block));
  
  extern void free_basic_block_vars	PARAMS ((int));
  
--- 299,310 ----
  #define ENTRY_BLOCK_PTR	(&entry_exit_blocks[0])
  #define EXIT_BLOCK_PTR	(&entry_exit_blocks[1])
  
  #define BLOCK_NUM(INSN)	      (BLOCK_FOR_INSN (INSN)->index + 0)
+ #define set_block_for_insn(INSN, BB)  (BLOCK_FOR_INSN (INSN) = BB)
  
  extern void compute_bb_for_insn		PARAMS ((int));
  extern void free_bb_for_insn		PARAMS ((void));
  extern void update_bb_for_insn		PARAMS ((basic_block));
  
  extern void free_basic_block_vars	PARAMS ((int));
  
Index: cfgbuild.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cfgbuild.c,v
retrieving revision 1.21
diff -c -3 -p -r1.21 cfgbuild.c
*** cfgbuild.c	28 May 2002 12:53:36 -0000	1.21
--- cfgbuild.c	31 May 2002 08:38:52 -0000
*************** find_basic_blocks (f, nregs, file)
*** 617,624 ****
  
    timevar_push (TV_CFG);
  
-   basic_block_for_insn = 0;
- 
    /* Flush out existing data.  */
    if (basic_block_info != NULL)
      {
--- 617,622 ----
Index: cfglayout.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cfglayout.c,v
retrieving revision 1.17
diff -c -3 -p -r1.17 cfglayout.c
*** cfglayout.c	23 May 2002 19:23:37 -0000	1.17
--- cfglayout.c	31 May 2002 08:38:53 -0000
*************** static void cleanup_unconditional_jumps	
*** 50,58 ****
  static void fixup_fallthru_exit_predecessor PARAMS ((void));
  static rtx unlink_insn_chain PARAMS ((rtx, rtx));
  static rtx duplicate_insn_chain PARAMS ((rtx, rtx));
- 
- /* Map insn uid to lexical block.  */
- static varray_type insn_scopes;
  
  static rtx
  unlink_insn_chain (first, last)
--- 50,55 ----
*************** scope_to_insns_initialize ()
*** 219,226 ****
    tree block = NULL;
    rtx insn, next;
  
-   VARRAY_TREE_INIT (insn_scopes, get_max_uid (), "insn scopes");
- 
    for (insn = get_insns (); insn; insn = next)
      {
        next = NEXT_INSN (insn);
--- 216,221 ----
*************** scope_to_insns_initialize ()
*** 228,234 ****
        if (active_insn_p (insn)
  	  && GET_CODE (PATTERN (insn)) != ADDR_VEC
  	  && GET_CODE (PATTERN (insn)) != ADDR_DIFF_VEC)
! 	VARRAY_TREE (insn_scopes, INSN_UID (insn)) = block;
        else if (GET_CODE (insn) == NOTE)
  	{
  	  switch (NOTE_LINE_NUMBER (insn))
--- 223,229 ----
        if (active_insn_p (insn)
  	  && GET_CODE (PATTERN (insn)) != ADDR_VEC
  	  && GET_CODE (PATTERN (insn)) != ADDR_DIFF_VEC)
!         INSN_SCOPE (insn) = block;
        else if (GET_CODE (insn) == NOTE)
  	{
  	  switch (NOTE_LINE_NUMBER (insn))
*************** scope_to_insns_finalize ()
*** 324,336 ****
       the common parent easily.  */
    set_block_levels (cur_block, 0);
  
!   for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
      {
        tree this_block;
  
!       if ((size_t) INSN_UID (insn) >= insn_scopes->num_elements)
! 	continue;
!       this_block = VARRAY_TREE (insn_scopes, INSN_UID (insn));
        if (! this_block)
  	continue;
  
--- 319,332 ----
       the common parent easily.  */
    set_block_levels (cur_block, 0);
  
!   insn = get_insns ();
!   if (!active_insn_p (insn))
!     insn = next_active_insn (insn);
!   for (; insn; insn = next_active_insn (insn))
      {
        tree this_block;
  
!       this_block = INSN_SCOPE (insn);
        if (! this_block)
  	continue;
  
*************** scope_to_insns_finalize ()
*** 341,348 ****
  	}
      }
  
-   VARRAY_FREE (insn_scopes);
- 
    /* change_scope emits before the insn, not after.  */
    note = emit_note (NULL, NOTE_INSN_DELETED);
    change_scope (note, cur_block, DECL_INITIAL (cfun->decl));
--- 337,342 ----
*************** duplicate_insn_chain (from, to)
*** 742,751 ****
  	      || GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC)
  	    break;
  	  new = emit_copy_of_insn_after (insn, get_last_insn ());
- 	  /* Record the INSN_SCOPE.  */
- 	  VARRAY_GROW (insn_scopes, INSN_UID (new) + 1);
- 	  VARRAY_TREE (insn_scopes, INSN_UID (new))
- 	    = VARRAY_TREE (insn_scopes, INSN_UID (insn));
  	  break;
  
  	case CODE_LABEL:
--- 736,741 ----
*************** cfg_layout_initialize ()
*** 958,965 ****
  
    cleanup_unconditional_jumps ();
  
-   scope_to_insns_initialize ();
- 
    record_effective_endpoints ();
  }
  
--- 948,953 ----
*************** cfg_layout_finalize ()
*** 975,982 ****
  #ifdef ENABLE_CHECKING
    verify_insn_chain ();
  #endif
- 
-   scope_to_insns_finalize ();
  
    free_aux_for_blocks ();
  
--- 963,968 ----
Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cfgrtl.c,v
retrieving revision 1.53
diff -c -3 -p -r1.53 cfgrtl.c
*** cfgrtl.c	28 May 2002 12:53:37 -0000	1.53
--- cfgrtl.c	31 May 2002 08:38:54 -0000
*************** Software Foundation, 59 Temple Place - S
*** 64,72 ****
  #define gen_return() NULL_RTX
  #endif
  
- /* The basic block structure for every insn, indexed by uid.  */
- varray_type basic_block_for_insn;
- 
  /* The labels mentioned in non-jump rtl.  Valid during find_basic_blocks.  */
  /* ??? Should probably be using LABEL_NUSES instead.  It would take a
     bit of surgery to be able to use or co-opt the routines in jump.  */
--- 64,69 ----
*************** delete_insn_and_edges (insn)
*** 187,195 ****
    rtx x;
    bool purge = false;
  
!   if (basic_block_for_insn
!       && INSN_P (insn)
!       && (unsigned int)INSN_UID (insn) < basic_block_for_insn->num_elements
        && BLOCK_FOR_INSN (insn)
        && BLOCK_FOR_INSN (insn)->end == insn)
      purge = true;
--- 184,190 ----
    rtx x;
    bool purge = false;
  
!   if (INSN_P (insn)
        && BLOCK_FOR_INSN (insn)
        && BLOCK_FOR_INSN (insn)->end == insn)
      purge = true;
*************** delete_insn_chain_and_edges (first, last
*** 232,240 ****
  {
    bool purge = false;
  
!   if (basic_block_for_insn
!       && INSN_P (last)
!       && (unsigned int)INSN_UID (last) < basic_block_for_insn->num_elements
        && BLOCK_FOR_INSN (last)
        && BLOCK_FOR_INSN (last)->end == last)
      purge = true;
--- 227,233 ----
  {
    bool purge = false;
  
!   if (INSN_P (last)
        && BLOCK_FOR_INSN (last)
        && BLOCK_FOR_INSN (last)->end == last)
      purge = true;
*************** create_basic_block_structure (index, hea
*** 277,283 ****
  	}
  
        if (after != bb_note && NEXT_INSN (after) != bb_note)
! 	reorder_insns (bb_note, bb_note, after);
      }
    else
      {
--- 270,276 ----
  	}
  
        if (after != bb_note && NEXT_INSN (after) != bb_note)
! 	reorder_insns_nobb (bb_note, bb_note, after);
      }
    else
      {
*************** create_basic_block_structure (index, hea
*** 315,322 ****
    bb->flags = BB_NEW;
    link_block (bb, after);
    BASIC_BLOCK (index) = bb;
!   if (basic_block_for_insn)
!     update_bb_for_insn (bb);
  
    /* Tag the block so that we know it has been used when considering
       other basic block notes.  */
--- 308,314 ----
    bb->flags = BB_NEW;
    link_block (bb, after);
    BASIC_BLOCK (index) = bb;
!   update_bb_for_insn (bb);
  
    /* Tag the block so that we know it has been used when considering
       other basic block notes.  */
*************** compute_bb_for_insn (max)
*** 440,450 ****
  {
    basic_block bb;
  
-   if (basic_block_for_insn)
-     VARRAY_FREE (basic_block_for_insn);
- 
-   VARRAY_BB_INIT (basic_block_for_insn, max, "basic_block_for_insn");
- 
    FOR_EACH_BB (bb)
      {
        rtx end = bb->end;
--- 432,437 ----
*************** compute_bb_for_insn (max)
*** 452,460 ****
  
        for (insn = bb->head; ; insn = NEXT_INSN (insn))
  	{
! 	  if (INSN_UID (insn) < max)
! 	    VARRAY_BB (basic_block_for_insn, INSN_UID (insn)) = bb;
! 
  	  if (insn == end)
  	    break;
  	}
--- 439,445 ----
  
        for (insn = bb->head; ; insn = NEXT_INSN (insn))
  	{
! 	  BLOCK_FOR_INSN (insn) = bb;
  	  if (insn == end)
  	    break;
  	}
*************** compute_bb_for_insn (max)
*** 466,475 ****
  void
  free_bb_for_insn ()
  {
!   if (basic_block_for_insn)
!     VARRAY_FREE (basic_block_for_insn);
! 
!   basic_block_for_insn = 0;
  }
  
  /* Update insns block within BB.  */
--- 451,460 ----
  void
  free_bb_for_insn ()
  {
!   rtx insn;
!   for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
!     if (GET_CODE (insn) != BARRIER)
!       BLOCK_FOR_INSN (insn) = NULL;
  }
  
  /* Update insns block within BB.  */
*************** update_bb_for_insn (bb)
*** 480,488 ****
  {
    rtx insn;
  
-   if (! basic_block_for_insn)
-     return;
- 
    for (insn = bb->head; ; insn = NEXT_INSN (insn))
      {
        set_block_for_insn (insn, bb);
--- 465,470 ----
*************** update_bb_for_insn (bb)
*** 490,515 ****
  	break;
      }
  }
- 
- /* Record INSN's block as BB.  */
- 
- void
- set_block_for_insn (insn, bb)
-      rtx insn;
-      basic_block bb;
- {
-   size_t uid = INSN_UID (insn);
- 
-   if (uid >= basic_block_for_insn->num_elements)
-     {
-       /* Add one-eighth the size so we don't keep calling xrealloc.  */
-       size_t new_size = uid + (uid + 7) / 8;
- 
-       VARRAY_GROW (basic_block_for_insn, new_size);
-     }
- 
-   VARRAY_BB (basic_block_for_insn, uid) = bb;
- }
  
  /* Split a block BB after insn INSN creating a new fallthru edge.
     Return the new edge.  Note that to keep other parts of the compiler happy,
--- 472,477 ----
*************** merge_blocks_nomove (a, b)
*** 668,682 ****
    /* Reassociate the insns of B with A.  */
    if (!b_empty)
      {
!       if (basic_block_for_insn)
! 	{
! 	  rtx x;
  
! 	  for (x = a_end; x != b_end; x = NEXT_INSN (x))
! 	    set_block_for_insn (x, a);
  
! 	  set_block_for_insn (b_end, a);
! 	}
  
        a_end = b_end;
      }
--- 630,641 ----
    /* Reassociate the insns of B with A.  */
    if (!b_empty)
      {
!       rtx x;
  
!       for (x = a_end; x != b_end; x = NEXT_INSN (x))
! 	set_block_for_insn (x, a);
  
!       set_block_for_insn (b_end, a);
  
        a_end = b_end;
      }
*************** block_label (block)
*** 697,704 ****
    if (GET_CODE (block->head) != CODE_LABEL)
      {
        block->head = emit_label_before (gen_label_rtx (), block->head);
-       if (basic_block_for_insn)
- 	set_block_for_insn (block->head, block);
      }
  
    return block->head;
--- 656,661 ----
*************** verify_flow_info ()
*** 1972,1978 ****
  	}
  
        for (x = bb->head; x != NEXT_INSN (bb->end); x = NEXT_INSN (x))
! 	if (basic_block_for_insn && BLOCK_FOR_INSN (x) != bb)
  	  {
  	    debug_rtx (x);
  	    if (! BLOCK_FOR_INSN (x))
--- 1929,1935 ----
  	}
  
        for (x = bb->head; x != NEXT_INSN (bb->end); x = NEXT_INSN (x))
! 	if (BLOCK_FOR_INSN (x) != bb)
  	  {
  	    debug_rtx (x);
  	    if (! BLOCK_FOR_INSN (x))
Index: combine.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/combine.c,v
retrieving revision 1.295
diff -c -3 -p -r1.295 combine.c
*** combine.c	27 May 2002 13:45:13 -0000	1.295
--- combine.c	31 May 2002 08:39:12 -0000
*************** try_combine (i3, i2, i1, new_direct_jump
*** 1755,1760 ****
--- 1755,1761 ----
  
  	  subst_prev_insn = i1
  	    = gen_rtx_INSN (VOIDmode, INSN_UID (i2), NULL_RTX, i2,
+ 			    BLOCK_FOR_INSN (i2), INSN_SCOPE (i2),
  			    XVECEXP (PATTERN (i2), 0, 1), -1, NULL_RTX,
  			    NULL_RTX);
  
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/emit-rtl.c,v
retrieving revision 1.267
diff -c -3 -p -r1.267 emit-rtl.c
*** emit-rtl.c	30 May 2002 10:23:29 -0000	1.267
--- emit-rtl.c	31 May 2002 08:39:16 -0000
*************** gen_label_rtx ()
*** 2175,2182 ****
  {
    rtx label;
  
!   label = gen_rtx_CODE_LABEL (VOIDmode, 0, NULL_RTX,
! 			      NULL_RTX, label_num++, NULL, NULL);
  
    LABEL_NUSES (label) = 0;
    LABEL_ALTERNATE_NAME (label) = NULL;
--- 2175,2182 ----
  {
    rtx label;
  
!   label = gen_rtx_CODE_LABEL (VOIDmode, 0, NULL_RTX, NULL_RTX,
! 		  	      NULL, label_num++, NULL, NULL);
  
    LABEL_NUSES (label) = 0;
    LABEL_ALTERNATE_NAME (label) = NULL;
*************** make_insn_raw (pattern)
*** 3253,3258 ****
--- 3253,3260 ----
    INSN_CODE (insn) = -1;
    LOG_LINKS (insn) = NULL;
    REG_NOTES (insn) = NULL;
+   INSN_SCOPE (insn) = NULL;
+   BLOCK_FOR_INSN (insn) = NULL;
  
  #ifdef ENABLE_RTL_CHECKING
    if (insn
*************** make_jump_insn_raw (pattern)
*** 3285,3290 ****
--- 3287,3294 ----
    LOG_LINKS (insn) = NULL;
    REG_NOTES (insn) = NULL;
    JUMP_LABEL (insn) = NULL;
+   INSN_SCOPE (insn) = NULL;
+   BLOCK_FOR_INSN (insn) = NULL;
  
    return insn;
  }
*************** make_call_insn_raw (pattern)
*** 3305,3310 ****
--- 3309,3316 ----
    LOG_LINKS (insn) = NULL;
    REG_NOTES (insn) = NULL;
    CALL_INSN_FUNCTION_USAGE (insn) = NULL;
+   INSN_SCOPE (insn) = NULL;
+   BLOCK_FOR_INSN (insn) = NULL;
  
    return insn;
  }
*************** add_insn_after (insn, after)
*** 3369,3376 ****
  	abort ();
      }
  
!   if (basic_block_for_insn
!       && (unsigned int) INSN_UID (after) < basic_block_for_insn->num_elements
        && (bb = BLOCK_FOR_INSN (after)))
      {
        set_block_for_insn (insn, bb);
--- 3375,3382 ----
  	abort ();
      }
  
!   if (GET_CODE (after) != BARRIER
!       && GET_CODE (insn) != BARRIER
        && (bb = BLOCK_FOR_INSN (after)))
      {
        set_block_for_insn (insn, bb);
*************** add_insn_before (insn, before)
*** 3438,3445 ****
  	abort ();
      }
  
!   if (basic_block_for_insn
!       && (unsigned int) INSN_UID (before) < basic_block_for_insn->num_elements
        && (bb = BLOCK_FOR_INSN (before)))
      {
        set_block_for_insn (insn, bb);
--- 3444,3451 ----
  	abort ();
      }
  
!   if (GET_CODE (before) != BARRIER
!       && GET_CODE (insn) != BARRIER
        && (bb = BLOCK_FOR_INSN (before)))
      {
        set_block_for_insn (insn, bb);
*************** remove_insn (insn)
*** 3518,3525 ****
        if (stack == 0)
  	abort ();
      }
!   if (basic_block_for_insn
!       && (unsigned int) INSN_UID (insn) < basic_block_for_insn->num_elements
        && (bb = BLOCK_FOR_INSN (insn)))
      {
        if (INSN_P (insn))
--- 3524,3530 ----
        if (stack == 0)
  	abort ();
      }
!   if (GET_CODE (insn) != BARRIER
        && (bb = BLOCK_FOR_INSN (insn)))
      {
        if (INSN_P (insn))
*************** reorder_insns (from, to, after)
*** 3596,3611 ****
  
    reorder_insns_nobb (from, to, after);
  
!   if (basic_block_for_insn
!       && (unsigned int) INSN_UID (after) < basic_block_for_insn->num_elements
        && (bb = BLOCK_FOR_INSN (after)))
      {
        rtx x;
        bb->flags |= BB_DIRTY;
  
!       if (basic_block_for_insn
! 	  && ((unsigned int) INSN_UID (from)
! 	      < basic_block_for_insn->num_elements)
  	  && (bb2 = BLOCK_FOR_INSN (from)))
  	{
  	  if (bb2->end == to)
--- 3601,3613 ----
  
    reorder_insns_nobb (from, to, after);
  
!   if (GET_CODE (after) != BARRIER
        && (bb = BLOCK_FOR_INSN (after)))
      {
        rtx x;
        bb->flags |= BB_DIRTY;
  
!       if (GET_CODE (from) != BARRIER
  	  && (bb2 = BLOCK_FOR_INSN (from)))
  	{
  	  if (bb2->end == to)
*************** emit_note_before (subtype, before)
*** 3913,3918 ****
--- 3915,3921 ----
    INSN_UID (note) = cur_insn_uid++;
    NOTE_SOURCE_FILE (note) = 0;
    NOTE_LINE_NUMBER (note) = subtype;
+   BLOCK_FOR_INSN (note) = NULL;
  
    add_insn_before (note, before);
    return note;
*************** emit_note_after (subtype, after)
*** 4033,4038 ****
--- 4036,4042 ----
    INSN_UID (note) = cur_insn_uid++;
    NOTE_SOURCE_FILE (note) = 0;
    NOTE_LINE_NUMBER (note) = subtype;
+   BLOCK_FOR_INSN (note) = NULL;
    add_insn_after (note, after);
    return note;
  }
*************** emit_line_note_after (file, line, after)
*** 4057,4062 ****
--- 4061,4067 ----
    INSN_UID (note) = cur_insn_uid++;
    NOTE_SOURCE_FILE (note) = file;
    NOTE_LINE_NUMBER (note) = line;
+   BLOCK_FOR_INSN (note) = NULL;
    add_insn_after (note, after);
    return note;
  }
*************** emit_insns_after (first, after)
*** 4152,4165 ****
    if (!first)
      return after;
  
!   if (basic_block_for_insn
!       && (unsigned int) INSN_UID (after) < basic_block_for_insn->num_elements
        && (bb = BLOCK_FOR_INSN (after)))
      {
        bb->flags |= BB_DIRTY;
        for (last = first; NEXT_INSN (last); last = NEXT_INSN (last))
! 	set_block_for_insn (last, bb);
!       set_block_for_insn (last, bb);
        if (bb->end == after)
  	bb->end = last;
      }
--- 4157,4171 ----
    if (!first)
      return after;
  
!   if (GET_CODE (after) != BARRIER
        && (bb = BLOCK_FOR_INSN (after)))
      {
        bb->flags |= BB_DIRTY;
        for (last = first; NEXT_INSN (last); last = NEXT_INSN (last))
!         if (GET_CODE (last) != BARRIER)
! 	  set_block_for_insn (last, bb);
!       if (GET_CODE (last) != BARRIER)
!         set_block_for_insn (last, bb);
        if (bb->end == after)
  	bb->end = last;
      }
*************** emit_note (file, line)
*** 4295,4300 ****
--- 4301,4307 ----
    INSN_UID (note) = cur_insn_uid++;
    NOTE_SOURCE_FILE (note) = file;
    NOTE_LINE_NUMBER (note) = line;
+   BLOCK_FOR_INSN (note) = NULL;
    add_insn (note);
    return note;
  }
*************** emit_copy_of_insn_after (insn, after)
*** 5211,5216 ****
--- 5218,5225 ----
  
    /* Update LABEL_NUSES.  */
    mark_jump_label (PATTERN (new), new, 0);
+ 
+   INSN_SCOPE (new) = INSN_SCOPE (insn);
  
    /* Copy all REG_NOTES except REG_LABEL since mark_jump_label will
       make them.  */
Index: final.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/final.c,v
retrieving revision 1.257
diff -c -3 -p -r1.257 final.c
*** final.c	24 May 2002 21:40:21 -0000	1.257
--- final.c	31 May 2002 08:39:21 -0000
*************** final_start_function (first, file, optim
*** 1671,1677 ****
    if (write_symbols)
      {
        remove_unnecessary_notes ();
!       reorder_blocks ();
        number_blocks (current_function_decl);
        /* We never actually put out begin/end notes for the top-level
  	 block in the function.  But, conceptually, that block is
--- 1671,1677 ----
    if (write_symbols)
      {
        remove_unnecessary_notes ();
!       scope_to_insns_finalize ();
        number_blocks (current_function_decl);
        /* We never actually put out begin/end notes for the top-level
  	 block in the function.  But, conceptually, that block is
Index: flow.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/flow.c,v
retrieving revision 1.530
diff -c -3 -p -r1.530 flow.c
*** flow.c	29 May 2002 23:04:23 -0000	1.530
--- flow.c	31 May 2002 08:39:26 -0000
*************** check_function_return_warnings ()
*** 373,382 ****
  	 is no longer in the chain.  */
        if (INSN_UID (cfun->x_clobber_return_insn) < max_uid)
  	{
! 	  /* Recompute insn->block mapping, since the initial mapping is
! 	     set before we delete unreachable blocks.  */
! 	  if (BLOCK_FOR_INSN (cfun->x_clobber_return_insn) != NULL)
! 	    warning ("control reaches end of non-void function");
  	}
      }
  }
--- 373,386 ----
  	 is no longer in the chain.  */
        if (INSN_UID (cfun->x_clobber_return_insn) < max_uid)
  	{
! 	  rtx insn;
! 
! 	  for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
! 	    if (insn == cfun->x_clobber_return_insn)
! 	      {
! 	        warning ("control reaches end of non-void function");
! 		break;
! 	      }
  	}
      }
  }
Index: integrate.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/integrate.c,v
retrieving revision 1.192
diff -c -3 -p -r1.192 integrate.c
*** integrate.c	30 May 2002 10:23:30 -0000	1.192
--- integrate.c	31 May 2002 08:39:31 -0000
*************** copy_insn_list (insns, map, static_chain
*** 1334,1339 ****
--- 1334,1340 ----
        switch (GET_CODE (insn))
  	{
  	case INSN:
+ 	  INSN_SCOPE (copy) = INSN_SCOPE (insn);
  	  pattern = PATTERN (insn);
  	  set = single_set (insn);
  	  copy = 0;
*************** copy_insn_list (insns, map, static_chain
*** 1507,1512 ****
--- 1508,1514 ----
  	  break;
  
  	case JUMP_INSN:
+ 	  INSN_SCOPE (copy) = INSN_SCOPE (insn);
  	  if (map->integrating && returnjump_p (insn))
  	    {
  	      if (map->local_return_label == 0)
*************** copy_insn_list (insns, map, static_chain
*** 1553,1558 ****
--- 1555,1561 ----
  	  /* If this is a CALL_PLACEHOLDER insn then we need to copy the
  	     three attached sequences: normal call, sibling call and tail
  	     recursion.  */
+ 	  INSN_SCOPE (copy) = INSN_SCOPE (insn);
  	  if (GET_CODE (PATTERN (insn)) == CALL_PLACEHOLDER)
  	    {
  	      rtx sequence[3];
Index: jump.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/jump.c,v
retrieving revision 1.208
diff -c -3 -p -r1.208 jump.c
*** jump.c	10 Apr 2002 00:15:58 -0000	1.208
--- jump.c	31 May 2002 08:39:33 -0000
*************** duplicate_loop_exit_test (loop_start)
*** 305,312 ****
  	 is a CODE_LABEL
  	 has a REG_RETVAL or REG_LIBCALL note (hard to adjust)
  	 is a NOTE_INSN_LOOP_BEG because this means we have a nested loop
- 	 is a NOTE_INSN_BLOCK_{BEG,END} because duplicating these notes
- 	      is not valid.
  
       We also do not do this if we find an insn with ASM_OPERANDS.  While
       this restriction should not be necessary, copying an insn with
--- 305,310 ----
*************** duplicate_loop_exit_test (loop_start)
*** 326,343 ****
  	case CALL_INSN:
  	  return 0;
  	case NOTE:
- 	  /* We could be in front of the wrong NOTE_INSN_LOOP_END if there is
- 	     a jump immediately after the loop start that branches outside
- 	     the loop but within an outer loop, near the exit test.
- 	     If we copied this exit test and created a phony
- 	     NOTE_INSN_LOOP_VTOP, this could make instructions immediately
- 	     before the exit test look like these could be safely moved
- 	     out of the loop even if they actually may be never executed.
- 	     This can be avoided by checking here for NOTE_INSN_LOOP_CONT.  */
- 
- 	  if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG
- 	      || NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_CONT)
- 	    return 0;
  
  	  if (optimize < 2
  	      && (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG
--- 324,329 ----
*************** duplicate_loop_exit_test (loop_start)
*** 423,428 ****
--- 409,415 ----
  	    replace_regs (PATTERN (copy), reg_map, max_reg, 1);
  
  	  mark_jump_label (PATTERN (copy), copy, 0);
+ 	  INSN_SCOPE (copy) = INSN_SCOPE (insn);
  
  	  /* Copy all REG_NOTES except REG_LABEL since mark_jump_label will
  	     make them.  */
*************** duplicate_loop_exit_test (loop_start)
*** 448,453 ****
--- 435,441 ----
  	case JUMP_INSN:
  	  copy = emit_jump_insn_before (copy_insn (PATTERN (insn)),
  					loop_start);
+ 	  INSN_SCOPE (copy) = INSN_SCOPE (insn);
  	  if (reg_map)
  	    replace_regs (PATTERN (copy), reg_map, max_reg, 1);
  	  mark_jump_label (PATTERN (copy), copy, 0);
Index: loop.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/loop.c,v
retrieving revision 1.403
diff -c -3 -p -r1.403 loop.c
*** loop.c	17 May 2002 02:31:37 -0000	1.403
--- loop.c	31 May 2002 08:39:53 -0000
*************** loop_optimize (f, dumpfile, flags)
*** 566,578 ****
  	scan_loop (loop, flags);
      }
  
-   /* If there were lexical blocks inside the loop, they have been
-      replicated.  We will now have more than one NOTE_INSN_BLOCK_BEG
-      and NOTE_INSN_BLOCK_END for each such block.  We must duplicate
-      the BLOCKs as well.  */
-   if (write_symbols != NO_DEBUG)
-     reorder_blocks ();
- 
    end_alias_analysis ();
  
    /* Clean up.  */
--- 566,571 ----
Index: print-rtl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/print-rtl.c,v
retrieving revision 1.79
diff -c -3 -p -r1.79 print-rtl.c
*** print-rtl.c	20 May 2002 18:06:54 -0000	1.79
--- print-rtl.c	31 May 2002 08:39:53 -0000
*************** print_rtx (in_rtx)
*** 475,480 ****
--- 475,485 ----
  	sawclose = 0;
  	break;
  
+       case 'B':
+ 	if (XBBDEF (in_rtx, i))
+ 	  fprintf (outfile, " %i", XBBDEF (in_rtx, i)->index);
+ 	break;
+ 
        default:
  	fprintf (stderr,
  		 "switch format wrong in rtl.print_rtx(). format was: %c.\n",
Index: recog.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/recog.c,v
retrieving revision 1.156
diff -c -3 -p -r1.156 recog.c
*** recog.c	27 May 2002 13:45:38 -0000	1.156
--- recog.c	31 May 2002 08:39:56 -0000
*************** apply_change_group ()
*** 397,405 ****
        for (i = 0; i < num_changes; i++)
  	if (changes[i].object
  	    && INSN_P (changes[i].object)
- 	    && basic_block_for_insn
- 	    && ((unsigned int)INSN_UID (changes[i].object)
- 		< basic_block_for_insn->num_elements)
  	    && (bb = BLOCK_FOR_INSN (changes[i].object)))
  	  bb->flags |= BB_DIRTY;
  
--- 397,402 ----
Index: rtl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtl.c,v
retrieving revision 1.115
diff -c -3 -p -r1.115 rtl.c
*** rtl.c	9 May 2002 01:42:28 -0000	1.115
--- rtl.c	31 May 2002 08:39:56 -0000
*************** copy_rtx (orig)
*** 369,374 ****
--- 369,375 ----
  	case 'S':
  	case 'T':
  	case 'u':
+ 	case 'B':
  	case '0':
  	  /* These are left unchanged.  */
  	  break;
Index: rtl.def
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtl.def,v
retrieving revision 1.55
diff -c -3 -p -r1.55 rtl.def
*** rtl.def	29 Apr 2002 22:34:33 -0000	1.55
--- rtl.def	31 May 2002 08:39:58 -0000
*************** DEF_RTL_EXPR (ATTR_FLAG, "attr_flag", "s
*** 545,581 ****
     ---------------------------------------------------------------------- */
  
  /* An instruction that cannot jump.  */
! DEF_RTL_EXPR(INSN, "insn", "iuueiee", 'i')
  
  /* An instruction that can possibly jump.
     Fields ( rtx->fld[] ) have exact same meaning as INSN's.  */
! DEF_RTL_EXPR(JUMP_INSN, "jump_insn", "iuueiee0", 'i')
  
  /* An instruction that can possibly call a subroutine
     but which will not change which instruction comes next
     in the current function.
!    Field ( rtx->fld[7] ) is CALL_INSN_FUNCTION_USAGE.
     All other fields ( rtx->fld[] ) have exact same meaning as INSN's.  */
! DEF_RTL_EXPR(CALL_INSN, "call_insn", "iuueieee", 'i')
  
  /* A marker that indicates that control will not flow through.  */
  DEF_RTL_EXPR(BARRIER, "barrier", "iuu", 'x')
  
  /* Holds a label that is followed by instructions.
     Operand:
!    3: is used in jump.c for the use-count of the label.
!    4: is used in flow.c to point to the chain of label_ref's to this label.
!    5: is a number that is unique in the entire compilation.
!    6: is the user-given name of the label, if any.
!    7: is the alternate label name.  */
! DEF_RTL_EXPR(CODE_LABEL, "code_label", "iuu00iss", 'x')
       
  /* Say where in the code a source line starts, for symbol table's sake.
     Operand:
!    3: filename, if line number > 0, note-specific data otherwise.
!    4: line number if > 0, enum note_insn otherwise.
!    5: unique number if line number == note_insn_deleted_label.  */
! DEF_RTL_EXPR(NOTE, "note", "iuu0ni", 'x')
  
  /* ----------------------------------------------------------------------
     Top level constituents of INSN, JUMP_INSN and CALL_INSN.
--- 545,581 ----
     ---------------------------------------------------------------------- */
  
  /* An instruction that cannot jump.  */
! DEF_RTL_EXPR(INSN, "insn", "iuuBteiee", 'i')
  
  /* An instruction that can possibly jump.
     Fields ( rtx->fld[] ) have exact same meaning as INSN's.  */
! DEF_RTL_EXPR(JUMP_INSN, "jump_insn", "iuuBteiee0", 'i')
  
  /* An instruction that can possibly call a subroutine
     but which will not change which instruction comes next
     in the current function.
!    Field ( rtx->fld[9] ) is CALL_INSN_FUNCTION_USAGE.
     All other fields ( rtx->fld[] ) have exact same meaning as INSN's.  */
! DEF_RTL_EXPR(CALL_INSN, "call_insn", "iuuBteieee", 'i')
  
  /* A marker that indicates that control will not flow through.  */
  DEF_RTL_EXPR(BARRIER, "barrier", "iuu", 'x')
  
  /* Holds a label that is followed by instructions.
     Operand:
!    4: is used in jump.c for the use-count of the label.
!    5: is used in flow.c to point to the chain of label_ref's to this label.
!    6: is a number that is unique in the entire compilation.
!    7: is the user-given name of the label, if any.
!    8: is the alternate label name.  */
! DEF_RTL_EXPR(CODE_LABEL, "code_label", "iuuB00iss", 'x')
       
  /* Say where in the code a source line starts, for symbol table's sake.
     Operand:
!    4: filename, if line number > 0, note-specific data otherwise.
!    5: line number if > 0, enum note_insn otherwise.
!    6: unique number if line number == note_insn_deleted_label.  */
! DEF_RTL_EXPR(NOTE, "note", "iuuB0ni", 'x')
  
  /* ----------------------------------------------------------------------
     Top level constituents of INSN, JUMP_INSN and CALL_INSN.
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtl.h,v
retrieving revision 1.349
diff -c -3 -p -r1.349 rtl.h
*** rtl.h	30 May 2002 10:23:30 -0000	1.349
--- rtl.h	31 May 2002 08:40:03 -0000
*************** do {				\
*** 499,517 ****
  #define PREV_INSN(INSN)	XEXP (INSN, 1)
  #define NEXT_INSN(INSN)	XEXP (INSN, 2)
  
  /* The body of an insn.  */
! #define PATTERN(INSN)	XEXP (INSN, 3)
  
  /* Code number of instruction, from when it was recognized.
     -1 means this instruction has not been recognized yet.  */
! #define INSN_CODE(INSN) XINT (INSN, 4)
  
  /* Set up in flow.c; empty before then.
     Holds a chain of INSN_LIST rtx's whose first operands point at
     previous insns with direct data-flow connections to this one.
     That means that those insns set variables whose next use is in this insn.
     They are always in the same basic block as this insn.  */
! #define LOG_LINKS(INSN)	XEXP(INSN, 5)
  
  #define RTX_INTEGRATED_P(RTX)						\
    (RTL_FLAG_CHECK8("RTX_INTEGRATED_P", (RTX), INSN, CALL_INSN,		\
--- 499,519 ----
  #define PREV_INSN(INSN)	XEXP (INSN, 1)
  #define NEXT_INSN(INSN)	XEXP (INSN, 2)
  
+ #define BLOCK_FOR_INSN(INSN) XBBDEF (INSN, 3)
+ #define INSN_SCOPE(INSN) XTREE (INSN, 4)
  /* The body of an insn.  */
! #define PATTERN(INSN)	XEXP (INSN, 5)
  
  /* Code number of instruction, from when it was recognized.
     -1 means this instruction has not been recognized yet.  */
! #define INSN_CODE(INSN) XINT (INSN, 6)
  
  /* Set up in flow.c; empty before then.
     Holds a chain of INSN_LIST rtx's whose first operands point at
     previous insns with direct data-flow connections to this one.
     That means that those insns set variables whose next use is in this insn.
     They are always in the same basic block as this insn.  */
! #define LOG_LINKS(INSN)	XEXP(INSN, 7)
  
  #define RTX_INTEGRATED_P(RTX)						\
    (RTL_FLAG_CHECK8("RTX_INTEGRATED_P", (RTX), INSN, CALL_INSN,		\
*************** do {				\
*** 563,569 ****
     The mode field of the EXPR_LIST contains not a real machine mode
     but a value from enum reg_note.  */
  
! #define REG_NOTES(INSN)	XEXP(INSN, 6)
  
  /* Don't forget to change reg_note_name in rtl.c.  */
  enum reg_note
--- 565,571 ----
     The mode field of the EXPR_LIST contains not a real machine mode
     but a value from enum reg_note.  */
  
! #define REG_NOTES(INSN)	XEXP(INSN, 8)
  
  /* Don't forget to change reg_note_name in rtl.c.  */
  enum reg_note
*************** extern const char * const reg_note_name[
*** 732,743 ****
       CLOBBER expressions document the registers explicitly clobbered
     by this CALL_INSN.
       Pseudo registers can not be mentioned in this list.  */
! #define CALL_INSN_FUNCTION_USAGE(INSN)	XEXP(INSN, 7)
  
  /* The label-number of a code-label.  The assembler label
     is made from `L' and the label-number printed in decimal.
     Label numbers are unique in a compilation.  */
! #define CODE_LABEL_NUMBER(INSN)	XINT (INSN, 5)
  
  #define LINE_NUMBER NOTE
  
--- 734,745 ----
       CLOBBER expressions document the registers explicitly clobbered
     by this CALL_INSN.
       Pseudo registers can not be mentioned in this list.  */
! #define CALL_INSN_FUNCTION_USAGE(INSN)	XEXP(INSN, 9)
  
  /* The label-number of a code-label.  The assembler label
     is made from `L' and the label-number printed in decimal.
     Label numbers are unique in a compilation.  */
! #define CODE_LABEL_NUMBER(INSN)	XINT (INSN, 6)
  
  #define LINE_NUMBER NOTE
  
*************** extern const char * const reg_note_name[
*** 748,765 ****
     The NOTE_INSN_RANGE_{START,END} and NOTE_INSN_LIVE notes record their
     information as an rtx in the field.  */
  
! #define NOTE_SOURCE_FILE(INSN) 	XCSTR (INSN, 3, NOTE)
! #define NOTE_BLOCK(INSN)	XCTREE (INSN, 3, NOTE)
! #define NOTE_EH_HANDLER(INSN)	XCINT (INSN, 3, NOTE)
! #define NOTE_RANGE_INFO(INSN)  	XCEXP (INSN, 3, NOTE)
! #define NOTE_LIVE_INFO(INSN)   	XCEXP (INSN, 3, NOTE)
! #define NOTE_BASIC_BLOCK(INSN)	XCBBDEF (INSN, 3, NOTE)
! #define NOTE_EXPECTED_VALUE(INSN) XCEXP (INSN, 3, NOTE)
! #define NOTE_PREDICTION(INSN)   XCINT (INSN, 3, NOTE)
  
  /* In a NOTE that is a line number, this is the line number.
     Other kinds of NOTEs are identified by negative numbers here.  */
! #define NOTE_LINE_NUMBER(INSN) XCINT (INSN, 4, NOTE)
  
  /* Nonzero if INSN is a note marking the beginning of a basic block.  */
  #define NOTE_INSN_BASIC_BLOCK_P(INSN) 			\
--- 750,767 ----
     The NOTE_INSN_RANGE_{START,END} and NOTE_INSN_LIVE notes record their
     information as an rtx in the field.  */
  
! #define NOTE_SOURCE_FILE(INSN) 	XCSTR (INSN, 4, NOTE)
! #define NOTE_BLOCK(INSN)	XCTREE (INSN, 4, NOTE)
! #define NOTE_EH_HANDLER(INSN)	XCINT (INSN, 4, NOTE)
! #define NOTE_RANGE_INFO(INSN)  	XCEXP (INSN, 4, NOTE)
! #define NOTE_LIVE_INFO(INSN)   	XCEXP (INSN, 4, NOTE)
! #define NOTE_BASIC_BLOCK(INSN)	XCBBDEF (INSN, 4, NOTE)
! #define NOTE_EXPECTED_VALUE(INSN) XCEXP (INSN, 4, NOTE)
! #define NOTE_PREDICTION(INSN)   XCINT (INSN, 4, NOTE)
  
  /* In a NOTE that is a line number, this is the line number.
     Other kinds of NOTEs are identified by negative numbers here.  */
! #define NOTE_LINE_NUMBER(INSN) XCINT (INSN, 5, NOTE)
  
  /* Nonzero if INSN is a note marking the beginning of a basic block.  */
  #define NOTE_INSN_BASIC_BLOCK_P(INSN) 			\
*************** extern const char * const reg_note_name[
*** 767,774 ****
     && NOTE_LINE_NUMBER (INSN) == NOTE_INSN_BASIC_BLOCK)
  
  /* Algorithm and flags for prediction.  */
! #define NOTE_PREDICTION_ALG(INSN)   (XCINT(INSN, 3, NOTE)>>8)
! #define NOTE_PREDICTION_FLAGS(INSN) (XCINT(INSN, 3, NOTE)&0xff)
  #define NOTE_PREDICT(ALG,FLAGS)     ((ALG<<8)+(FLAGS))
  
  /* Codes that appear in the NOTE_LINE_NUMBER field
--- 769,776 ----
     && NOTE_LINE_NUMBER (INSN) == NOTE_INSN_BASIC_BLOCK)
  
  /* Algorithm and flags for prediction.  */
! #define NOTE_PREDICTION_ALG(INSN)   (XCINT(INSN, 4, NOTE)>>8)
! #define NOTE_PREDICTION_FLAGS(INSN) (XCINT(INSN, 4, NOTE)&0xff)
  #define NOTE_PREDICT(ALG,FLAGS)     ((ALG<<8)+(FLAGS))
  
  /* Codes that appear in the NOTE_LINE_NUMBER field
*************** extern const char * const note_insn_name
*** 873,886 ****
  
  /* The name of a label, in case it corresponds to an explicit label
     in the input source code.  */
! #define LABEL_NAME(RTX) XCSTR (RTX, 6, CODE_LABEL)
  
  /* In jump.c, each label contains a count of the number
     of LABEL_REFs that point at it, so unused labels can be deleted.  */
! #define LABEL_NUSES(RTX) XCINT (RTX, 3, CODE_LABEL)
  
  /* Associate a name with a CODE_LABEL.  */
! #define LABEL_ALTERNATE_NAME(RTX) XCSTR (RTX, 7, CODE_LABEL)
  
  /* The original regno this ADDRESSOF was built for.  */
  #define ADDRESSOF_REGNO(RTX) XCUINT (RTX, 1, ADDRESSOF)
--- 875,888 ----
  
  /* The name of a label, in case it corresponds to an explicit label
     in the input source code.  */
! #define LABEL_NAME(RTX) XCSTR (RTX, 7, CODE_LABEL)
  
  /* In jump.c, each label contains a count of the number
     of LABEL_REFs that point at it, so unused labels can be deleted.  */
! #define LABEL_NUSES(RTX) XCINT (RTX, 4, CODE_LABEL)
  
  /* Associate a name with a CODE_LABEL.  */
! #define LABEL_ALTERNATE_NAME(RTX) XCSTR (RTX, 8, CODE_LABEL)
  
  /* The original regno this ADDRESSOF was built for.  */
  #define ADDRESSOF_REGNO(RTX) XCUINT (RTX, 1, ADDRESSOF)
*************** extern const char * const note_insn_name
*** 891,903 ****
  /* In jump.c, each JUMP_INSN can point to a label that it can jump to,
     so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
     be decremented and possibly the label can be deleted.  */
! #define JUMP_LABEL(INSN)   XCEXP (INSN, 7, JUMP_INSN)
  
  /* Once basic blocks are found in flow.c,
     each CODE_LABEL starts a chain that goes through
     all the LABEL_REFs that jump to that label.
     The chain eventually winds up at the CODE_LABEL: it is circular.  */
! #define LABEL_REFS(LABEL) XCEXP (LABEL, 4, CODE_LABEL)
  
  /* This is the field in the LABEL_REF through which the circular chain
     of references to a particular label is linked.
--- 893,905 ----
  /* In jump.c, each JUMP_INSN can point to a label that it can jump to,
     so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
     be decremented and possibly the label can be deleted.  */
! #define JUMP_LABEL(INSN)   XCEXP (INSN, 9, JUMP_INSN)
  
  /* Once basic blocks are found in flow.c,
     each CODE_LABEL starts a chain that goes through
     all the LABEL_REFs that jump to that label.
     The chain eventually winds up at the CODE_LABEL: it is circular.  */
! #define LABEL_REFS(LABEL) XCEXP (LABEL, 5, CODE_LABEL)
  
  /* This is the field in the LABEL_REF through which the circular chain
     of references to a particular label is linked.
Index: sched-ebb.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/sched-ebb.c,v
retrieving revision 1.14
diff -c -3 -p -r1.14 sched-ebb.c
*** sched-ebb.c	23 May 2002 19:23:45 -0000	1.14
--- sched-ebb.c	31 May 2002 08:40:04 -0000
*************** schedule_ebbs (dump_file)
*** 286,293 ****
    if (n_basic_blocks == 0)
      return;
  
-   scope_to_insns_initialize ();
- 
    sched_init (dump_file);
  
    current_sched_info = &ebb_sched_info;
--- 286,291 ----
*************** schedule_ebbs (dump_file)
*** 354,361 ****
  
    if (write_symbols != NO_DEBUG)
      rm_redundant_line_notes ();
- 
-   scope_to_insns_finalize ();
  
    sched_finish ();
  }
--- 352,357 ----
Index: sched-rgn.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/sched-rgn.c,v
retrieving revision 1.43
diff -c -3 -p -r1.43 sched-rgn.c
*** sched-rgn.c	28 May 2002 12:53:47 -0000	1.43
--- sched-rgn.c	31 May 2002 08:40:06 -0000
*************** schedule_insns (dump_file)
*** 2989,2996 ****
    if (n_basic_blocks == 0)
      return;
  
-   scope_to_insns_initialize ();
- 
    nr_inter = 0;
    nr_spec = 0;
  
--- 2989,2994 ----
*************** schedule_insns (dump_file)
*** 3078,3085 ****
    /* Delete redundant line notes.  */
    if (write_symbols != NO_DEBUG)
      rm_redundant_line_notes ();
- 
-   scope_to_insns_finalize ();
  
    if (sched_verbose)
      {
--- 3076,3081 ----
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/toplev.c,v
retrieving revision 1.637
diff -c -3 -p -r1.637 toplev.c
*** toplev.c	25 May 2002 18:02:14 -0000	1.637
--- toplev.c	31 May 2002 08:40:11 -0000
*************** rest_of_compilation (decl)
*** 2562,2570 ****
  	    && NOTE_LINE_NUMBER (insn) == NOTE_INSN_PREDICTION)
  	  delete_insn (insn);
      }
!    close_dump_file (DFI_sibling, print_rtl, get_insns ());
!    timevar_pop (TV_JUMP);
  
    /* Complete generation of exception handling code.  */
    find_exception_handler_labels ();
    if (doing_eh (0))
--- 2565,2574 ----
  	    && NOTE_LINE_NUMBER (insn) == NOTE_INSN_PREDICTION)
  	  delete_insn (insn);
      }
!   close_dump_file (DFI_sibling, print_rtl, get_insns ());
!   timevar_pop (TV_JUMP);
  
+   scope_to_insns_initialize ();
    /* Complete generation of exception handling code.  */
    find_exception_handler_labels ();
    if (doing_eh (0))
Index: unroll.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/unroll.c,v
retrieving revision 1.164
diff -c -3 -p -r1.164 unroll.c
*** unroll.c	25 Mar 2002 02:49:09 -0000	1.164
--- unroll.c	31 May 2002 08:40:20 -0000
*************** unroll_loop (loop, insn_count, strength_
*** 268,320 ****
        return;
      }
  
-   /* When emitting debugger info, we can't unroll loops with unequal numbers
-      of block_beg and block_end notes, because that would unbalance the block
-      structure of the function.  This can happen as a result of the
-      "if (foo) bar; else break;" optimization in jump.c.  */
-   /* ??? Gcc has a general policy that -g is never supposed to change the code
-      that the compiler emits, so we must disable this optimization always,
-      even if debug info is not being output.  This is rare, so this should
-      not be a significant performance problem.  */
- 
-   if (1 /* write_symbols != NO_DEBUG */)
-     {
-       int block_begins = 0;
-       int block_ends = 0;
- 
-       for (insn = loop_start; insn != loop_end; insn = NEXT_INSN (insn))
- 	{
- 	  if (GET_CODE (insn) == NOTE)
- 	    {
- 	      if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG)
- 		block_begins++;
- 	      else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END)
- 		block_ends++;
- 	      if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG
- 		  || NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END)
- 		{
- 		  /* Note, would be nice to add code to unroll EH
- 		     regions, but until that time, we punt (don't
- 		     unroll).  For the proper way of doing it, see
- 		     expand_inline_function.  */
- 
- 		  if (loop_dump_stream)
- 		    fprintf (loop_dump_stream,
- 			     "Unrolling failure: cannot unroll EH regions.\n");
- 		  return;
- 		}
- 	    }
- 	}
- 
-       if (block_begins != block_ends)
- 	{
- 	  if (loop_dump_stream)
- 	    fprintf (loop_dump_stream,
- 		     "Unrolling failure: Unbalanced block notes.\n");
- 	  return;
- 	}
-     }
- 
    /* Determine type of unroll to perform.  Depends on the number of iterations
       and the size of the loop.  */
  
--- 268,273 ----
*************** copy_loop_body (loop, copy_start, copy_e
*** 2046,2051 ****
--- 1999,2005 ----
  	      copy = emit_insn (pattern);
  	    }
  	  REG_NOTES (copy) = initial_reg_note_copy (REG_NOTES (insn), map);
+ 	  INSN_SCOPE (copy) = INSN_SCOPE (insn);
  
  #ifdef HAVE_cc0
  	  /* If this insn is setting CC0, it may need to look at
*************** copy_loop_body (loop, copy_start, copy_e
*** 2092,2097 ****
--- 2046,2052 ----
  	  pattern = copy_rtx_and_substitute (PATTERN (insn), map, 0);
  	  copy = emit_jump_insn (pattern);
  	  REG_NOTES (copy) = initial_reg_note_copy (REG_NOTES (insn), map);
+ 	  INSN_SCOPE (copy) = INSN_SCOPE (insn);
  
  	  if (JUMP_LABEL (insn))
  	    {
*************** copy_loop_body (loop, copy_start, copy_e
*** 2215,2220 ****
--- 2170,2176 ----
  	  pattern = copy_rtx_and_substitute (PATTERN (insn), map, 0);
  	  copy = emit_call_insn (pattern);
  	  REG_NOTES (copy) = initial_reg_note_copy (REG_NOTES (insn), map);
+ 	  INSN_SCOPE (copy) = INSN_SCOPE (insn);
  	  SIBLING_CALL_P (copy) = SIBLING_CALL_P (insn);
  
  	  /* Because the USAGE information potentially contains objects other


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