aboutsummaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-09-15 23:05:05 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-09-15 23:05:05 +0000
commit1a4450c78ff2b55ef5af7749ac56ef13b5c8dd0c (patch)
tree3d508285418ae3e6e9fa770aac8efa585f50fce9 /gcc/function.c
parent371534a917ce5751c5d05e2b7428a86374a73376 (diff)
downloadgcc-1a4450c78ff2b55ef5af7749ac56ef13b5c8dd0c.zip
gcc-1a4450c78ff2b55ef5af7749ac56ef13b5c8dd0c.tar.gz
gcc-1a4450c78ff2b55ef5af7749ac56ef13b5c8dd0c.tar.bz2
rtl.h (NOTE_BLOCK_NUMBER): Replace with ...
* 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
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 b74442c..c2d585e 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);