rtl.h (NOTE_BLOCK_NUMBER): Replace with ...
authorMark Mitchell <mark@codesourcery.com>
Wed, 15 Sep 1999 23:05:05 +0000 (23:05 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 15 Sep 1999 23:05:05 +0000 (23:05 +0000)
* rtl.h (NOTE_BLOCK_NUMBER): Replace with ...
(NOTE_BLOCK): New macro.
(NOTE_BLOCK_LIVE_RANGE_BLOCK): Remove.
* function.h (identify_blocks): CHange prototype.
* function.c (identify_blocks): Simplify.
(reorder_blocks): Likewise.
* ggc-common.c (ggc_mark_rtx): Mark the BLOCK associated with a
NOTE_INSN_BLOCK_{BEG,END}.
* haifa-sched.c (sched_analyze): Don't put NOTE_BLOCK_NUMBER on
the list of saved notes if the note isn't a
NOTE_INSN_BLOCK_{BEG,END}.
(move_insn1): Use NOTE_EH_HANDLER in comment, rather than
NOTE_BLOCK_NUMBER.
(reemit_notes): Adjust recreation of notes to reflect new saved
note structure.
* print-rtl.c (print_rtx): Print the address of the BLOCK when
printing a block note.
* stmt.c (block_vector): Remove.
(find_loop_tree_blocks): Simplify.
(unroll_block_trees): Likewise.

From-SVN: r29441

gcc/ChangeLog
gcc/function.c
gcc/function.h
gcc/ggc-common.c
gcc/haifa-sched.c
gcc/print-rtl.c
gcc/rtl.h
gcc/stmt.c

index b92675be7063288d16628a261df6a19a963035fe..870705219a2c4dd09b3d674840f5e772b8e0e010 100644 (file)
@@ -1,3 +1,26 @@
+Wed Sep 15 15:51:52 1999  Mark Mitchell  <mark@codesourcery.com>
+
+       * rtl.h (NOTE_BLOCK_NUMBER): Replace with ...
+       (NOTE_BLOCK): New macro.
+       (NOTE_BLOCK_LIVE_RANGE_BLOCK): Remove.
+       * function.h (identify_blocks): CHange prototype.
+       * function.c (identify_blocks): Simplify.
+       (reorder_blocks): Likewise.
+       * ggc-common.c (ggc_mark_rtx): Mark the BLOCK associated with a 
+       NOTE_INSN_BLOCK_{BEG,END}.
+       * haifa-sched.c (sched_analyze): Don't put NOTE_BLOCK_NUMBER on
+       the list of saved notes if the note isn't a
+       NOTE_INSN_BLOCK_{BEG,END}.
+       (move_insn1): Use NOTE_EH_HANDLER in comment, rather than
+       NOTE_BLOCK_NUMBER.
+       (reemit_notes): Adjust recreation of notes to reflect new saved
+       note structure.
+       * print-rtl.c (print_rtx): Print the address of the BLOCK when
+       printing a block note.
+       * stmt.c (block_vector): Remove.
+       (find_loop_tree_blocks): Simplify.
+       (unroll_block_trees): Likewise.
+       
 Wed Sep 15 14:39:35 1999  Jason Merrill  <jason@yorick.cygnus.com>
 
        * gbl-ctors.h: Lose HAVE_ATEXIT.  Don't define ON_EXIT.
index b74442c05b34b2b4e34717753d6ea2157ee387c0..c2d585e0cb5b83e8dad7cb4bfe703157dcad3a20 100644 (file)
@@ -5348,67 +5348,65 @@ round_trampoline_addr (tramp)
    The arguments are BLOCK, the chain of top-level blocks of the function,
    and INSNS, the insn chain of the function.  */
 
-tree *
+void
 identify_blocks (block, insns)
      tree block;
      rtx insns;
 {
   int n_blocks;
   tree *block_vector;
-  int *block_stack;
+  tree *block_stack;
   int depth = 0;
-  int next_block_number = 1;
   int current_block_number = 1;
   rtx insn;
 
   if (block == 0)
-    return 0;
+    return;
 
+  /* Fill the BLOCK_VECTOR with all of the BLOCKs in this function, in
+     depth-first order.  */
   n_blocks = all_blocks (block, 0);
   block_vector = (tree *) xmalloc (n_blocks * sizeof (tree));
-  block_stack = (int *) alloca (n_blocks * sizeof (int));
-
   all_blocks (block, block_vector);
 
+  block_stack = (tree *) alloca (n_blocks * sizeof (tree));
+
   for (insn = insns; insn; insn = NEXT_INSN (insn))
     if (GET_CODE (insn) == NOTE)
       {
        if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG)
          {
-           block_stack[depth++] = current_block_number;
-           current_block_number = next_block_number;
-           NOTE_BLOCK_NUMBER (insn) =  next_block_number++;
+           tree block;
+
+           block = block_vector[current_block_number++];
+           NOTE_BLOCK (insn) = block;
+           block_stack[depth++] = block;
          }
        if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END)
-         {
-           NOTE_BLOCK_NUMBER (insn) = current_block_number;
-           current_block_number = block_stack[--depth];
-         }
+         NOTE_BLOCK (insn) = block_stack[--depth];
       }
 
-  if (n_blocks != next_block_number)
+  if (n_blocks != current_block_number)
     abort ();
 
-  return block_vector;
+  free (block_vector);
 }
 
-/* Given BLOCK_VECTOR which was returned by identify_blocks,
-   and a revised instruction chain, rebuild the tree structure
-   of BLOCK nodes to correspond to the new order of RTL.
-   The new block tree is inserted below TOP_BLOCK.
-   Returns the current top-level block.  */
+/* Given a revised instruction chain, rebuild the tree structure of
+   BLOCK nodes to correspond to the new order of RTL.  The new block
+   tree is inserted below TOP_BLOCK.  Returns the current top-level
+   block.  */
 
 tree
-reorder_blocks (block_vector, block, insns)
-     tree *block_vector;
+reorder_blocks (block, insns)
      tree block;
      rtx insns;
 {
   tree current_block = block;
   rtx insn;
 
-  if (block_vector == 0)
-    return block;
+  if (block == NULL_TREE)
+    return NULL_TREE;
 
   /* Prune the old trees away, so that it doesn't get in the way.  */
   BLOCK_SUBBLOCKS (current_block) = 0;
@@ -5419,7 +5417,7 @@ reorder_blocks (block_vector, block, insns)
       {
        if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG)
          {
-           tree block = block_vector[NOTE_BLOCK_NUMBER (insn)];
+           tree block = NOTE_BLOCK (insn);
            /* If we have seen this block before, copy it.  */
            if (TREE_ASM_WRITTEN (block))
              block = copy_node (block);
index 789fdbf164716378c2c49005818702144f5c51b2..a574b67ca4b4a9db16fe3548323911bfbd16b0bd 100644 (file)
@@ -523,7 +523,7 @@ extern struct function *outer_function_chain;
 /* Put all this function's BLOCK nodes into a vector and return it.
    Also store in each NOTE for the beginning or end of a block
    the index of that block in the vector.  */
-extern tree *identify_blocks PROTO((tree, rtx));
+extern void identify_blocks PROTO((tree, rtx));
 
 /* Return size needed for stack frame based on slots so far allocated.
    This size counts from zero.  It is not rounded to STACK_BOUNDARY;
index 823d1b951143a6f6233342946d44ee19c56674b8..30725a28c867048a3f620498ac5e2a8f5cd2b8fe 100644 (file)
@@ -208,6 +208,11 @@ ggc_mark_rtx (r)
          ggc_mark_rtx (NOTE_RANGE_INFO (r));
          break;
 
+       case NOTE_INSN_BLOCK_BEG:
+       case NOTE_INSN_BLOCK_END:
+         ggc_mark_tree (NOTE_BLOCK (r));
+         break;
+
        default:
          if (NOTE_LINE_NUMBER (r) >= 0)
            ggc_mark_string (NOTE_SOURCE_FILE (r));
index 52ce9be26beda2e11ccecb44b21f233548a0c789..9d070f0fc0ff9645282937979ff9c7d87f3943d0 100644 (file)
@@ -3939,9 +3939,12 @@ sched_analyze (head, tail)
                   || (NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP
                       && GET_CODE (PREV_INSN (insn)) != CALL_INSN)))
        {
-         loop_notes = alloc_EXPR_LIST (REG_DEAD,
-                                       GEN_INT (NOTE_BLOCK_NUMBER (insn)),
-                                       loop_notes);
+         if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG
+             || NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END)
+           loop_notes = alloc_EXPR_LIST (REG_DEAD,
+                                         GEN_INT (NOTE_EH_HANDLER (insn)),
+                                         loop_notes);
+
          loop_notes = alloc_EXPR_LIST (REG_DEAD,
                                        GEN_INT (NOTE_LINE_NUMBER (insn)),
                                        loop_notes);
@@ -6494,7 +6497,7 @@ move_insn1 (insn, last)
 /* Search INSN for fake REG_DEAD note pairs for NOTE_INSN_SETJMP,
    NOTE_INSN_{LOOP,EHREGION}_{BEG,END}; and convert them back into
    NOTEs.  The REG_DEAD note following first one is contains the saved
-   value for NOTE_BLOCK_NUMBER which is useful for
+   value for NOTE_EH_HANDLER which is useful for
    NOTE_INSN_EH_REGION_{BEG,END} NOTEs.  LAST is the last instruction
    output by the instruction scheduler.  Return the new value of LAST.  */
 
@@ -6516,8 +6519,6 @@ reemit_notes (insn, last)
            {
              retval = emit_note_after (NOTE_INSN_SETJMP, insn);
              CONST_CALL_P (retval) = CONST_CALL_P (note);
-             remove_note (insn, note);
-             note = XEXP (note, 1);
            }
          else if (note_type == NOTE_INSN_RANGE_START
                    || note_type == NOTE_INSN_RANGE_END)
@@ -6530,9 +6531,13 @@ reemit_notes (insn, last)
          else
            {
              last = emit_note_before (note_type, last);
-             remove_note (insn, note);
-             note = XEXP (note, 1);
-             NOTE_BLOCK_NUMBER (last) = INTVAL (XEXP (note, 0));
+             if (note_type == NOTE_INSN_EH_REGION_BEG
+                 || note_type == NOTE_INSN_EH_REGION_END)
+               {
+                 remove_note (insn, note);
+                 note = XEXP (note, 1);
+                 NOTE_EH_HANDLER (last) = INTVAL (XEXP (note, 0));
+               }
            }
          remove_note (insn, note);
        }
index 75a52ee99000a8d6221da8dc18120d3259789fe6..d32ed18c3634395fc1fa5b2cee1bb32a8f65daae 100644 (file)
@@ -166,7 +166,9 @@ print_rtx (in_rtx)
            else if (NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_BLOCK_BEG
                     || NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_BLOCK_END)
              {
-               fprintf (outfile, " %d", NOTE_BLOCK_NUMBER (in_rtx));
+               fprintf (outfile, " ");
+               fprintf (outfile, HOST_PTR_PRINTF, 
+                        (char *) NOTE_BLOCK (in_rtx));
                sawclose = 1;
              }
            else if (NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_RANGE_START
index 5a03a9c8bfde5626711a0357a8862a1e1e583a76..b31a98b202730bd837e32e92662bae907d6fce3b 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -517,16 +517,12 @@ extern const char * const reg_note_name[];
    information as a rtx in the field.  */
 
 #define NOTE_SOURCE_FILE(INSN)         XCSTR(INSN, 3, NOTE)
-#define NOTE_BLOCK_NUMBER(INSN)        XCINT(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)
 
-/* If the NOTE_BLOCK_NUMBER field gets a -1, it means create a new
-   block node for a live range block.  */
-#define NOTE_BLOCK_LIVE_RANGE_BLOCK -1
-
 /* 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)
index 22ddac8effee0df5e725ec336a7900c3f63e2f35..068803cd4d44fe80f0ae560bfc6ba72000bab666 100644 (file)
@@ -6278,19 +6278,10 @@ emit_case_nodes (index, node, default_label, index_type)
 /* These routines are used by the loop unrolling code.  They copy BLOCK trees
    so that the debugging info will be correct for the unrolled loop.  */
 
-/* Indexed by block number, contains a pointer to the N'th block node.
-
-  Allocated by the call to identify_blocks, then released after the call
-  to reorder_blocks in the function unroll_block_trees.  */
-
-static tree *block_vector;
-
 void
 find_loop_tree_blocks ()
 {
-  tree block = DECL_INITIAL (current_function_decl);
-
-  block_vector = identify_blocks (block, get_insns ());
+  identify_blocks (DECL_INITIAL (current_function_decl), get_insns ());
 }
 
 void
@@ -6298,9 +6289,5 @@ unroll_block_trees ()
 {
   tree block = DECL_INITIAL (current_function_decl);
 
-  reorder_blocks (block_vector, block, get_insns ());
-
-  /* Release any memory allocated by identify_blocks.  */
-  if (block_vector)
-    free (block_vector);
+  reorder_blocks (block, get_insns ());
 }