summaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-15 23:05:05 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-15 23:05:05 +0000
commit0c45344eecbc62d3bfa3721e8e1a3bfda9c2ab6c (patch)
tree3d508285418ae3e6e9fa770aac8efa585f50fce9 /gcc/function.c
parent0407a27ffc4d2f32ec4a5ea1760a9a21ab30478d (diff)
downloadgcc-0c45344eecbc62d3bfa3721e8e1a3bfda9c2ab6c.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29441 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c48
1 files changed, 23 insertions, 25 deletions
diff --git a/gcc/function.c b/gcc/function.c
index b74442c05b3..c2d585e0cb5 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -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);