diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-03-19 05:26:48 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-03-19 05:26:48 +0000 |
commit | f1ab82bec0bcd2973783a648a073f6c65dc31985 (patch) | |
tree | 7e5085f497fa4f8351b62a15342abb5192c649b0 /gcc | |
parent | ad63a0fca1c16a7b56f4f29888a87ee535cb9f4c (diff) | |
download | gcc-f1ab82bec0bcd2973783a648a073f6c65dc31985.tar.gz |
* emit-rtl.c (remove_unncessary_notes): Check that all
NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes have an
associated NOTE_BLOCK.
* function.h (identify_blocks): Update comments.
(reorder_blocks): Declare.
* function.c (identify_blocks): Don't take paramters.
(reorder_blocks): Don't take parameters.
* loop.h (find_loop_tree_blocks): Remove.
(unroll_block_trees): Likewise.
* loop.c (loop_optimize): Don't call find_loop_tree_blocks. Use
reorder_blocks instead of unroll_block_trees.h
* sibcall.c (optimize_sibling_and_tail_recursive_calls): Likewise.
* stmt.c (find_loop_tree_blocks): Remove.
(unroll_block_trees): Likewise.
* toplev.c (rest_of_compilation): Don't call find_loop_tree_blocks
in whole-function mode.
* tree.h (reorder_blocks): Remove declaration.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32632 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 18 | ||||
-rw-r--r-- | gcc/emit-rtl.c | 13 | ||||
-rw-r--r-- | gcc/function.c | 46 | ||||
-rw-r--r-- | gcc/function.h | 12 | ||||
-rw-r--r-- | gcc/loop.c | 15 | ||||
-rw-r--r-- | gcc/loop.h | 3 | ||||
-rw-r--r-- | gcc/sibcall.c | 2 | ||||
-rw-r--r-- | gcc/stmt.c | 16 | ||||
-rw-r--r-- | gcc/toplev.c | 5 | ||||
-rw-r--r-- | gcc/tree.h | 2 |
10 files changed, 62 insertions, 70 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1301dab8e3c..5f9babb94dd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,23 @@ 2000-03-18 Mark Mitchell <mark@codesourcery.com> + * emit-rtl.c (remove_unncessary_notes): Check that all + NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes have an + associated NOTE_BLOCK. + * function.h (identify_blocks): Update comments. + (reorder_blocks): Declare. + * function.c (identify_blocks): Don't take paramters. + (reorder_blocks): Don't take parameters. + * loop.h (find_loop_tree_blocks): Remove. + (unroll_block_trees): Likewise. + * loop.c (loop_optimize): Don't call find_loop_tree_blocks. Use + reorder_blocks instead of unroll_block_trees.h + * sibcall.c (optimize_sibling_and_tail_recursive_calls): Likewise. + * stmt.c (find_loop_tree_blocks): Remove. + (unroll_block_trees): Likewise. + * toplev.c (rest_of_compilation): Don't call find_loop_tree_blocks + in whole-function mode. + * tree.h (reorder_blocks): Remove declaration. + * expr.c: Include intl.h. * Makefile.in (expr.o): Depend on intl.h. diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 3d6f73b69ac..764a5ad7f20 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -2667,9 +2667,8 @@ remove_unncessary_notes () rtx insn; rtx next; - /* Remove NOTE_INSN_DELETED notes. We must not remove the first - instruction in the function because the compiler depends on the - first instruction being a note. */ + /* We must not remove the first instruction in the function because + the compiler depends on the first instruction being a note. */ for (insn = NEXT_INSN (get_insns ()); insn; insn = next) { /* Remember what's next. */ @@ -2679,6 +2678,14 @@ remove_unncessary_notes () if (GET_CODE (insn) != NOTE) continue; + /* By now, all notes indicating lexical blocks should have + NOTE_BLOCK filled in. */ + if ((NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG + || NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END) + && NOTE_BLOCK (insn) == NULL_TREE) + abort (); + + /* Remove NOTE_INSN_DELETED notes. */ if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED) remove_insn (insn); else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END) diff --git a/gcc/function.c b/gcc/function.c index dfd87618396..e994558fdc8 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -5508,11 +5508,6 @@ round_trampoline_addr (tramp) return tramp; } -/* The functions identify_blocks and reorder_blocks provide a way to - reorder the tree of BLOCK nodes, for optimizers that reshuffle or - duplicate portions of the RTL code. Call identify_blocks before - changing the RTL, and call reorder_blocks after. */ - /* Put all this function's BLOCK nodes including those that are chained onto the first block into a vector, and return it. Also store in each NOTE for the beginning or end of a block @@ -5521,13 +5516,12 @@ round_trampoline_addr (tramp) and INSNS, the insn chain of the function. */ void -identify_blocks (block, insns) - tree block; - rtx insns; +identify_blocks () { int n_blocks; tree *block_vector, *last_block_vector; tree *block_stack; + tree block = DECL_INITIAL (current_function_decl); if (block == 0) return; @@ -5537,8 +5531,10 @@ identify_blocks (block, insns) block_vector = get_block_vector (block, &n_blocks); block_stack = (tree *) xmalloc (n_blocks * sizeof (tree)); - last_block_vector = identify_blocks_1 (insns, block_vector + 1, - block_vector + n_blocks, block_stack); + last_block_vector = identify_blocks_1 (get_insns (), + block_vector + 1, + block_vector + n_blocks, + block_stack); /* If we didn't use all of the subblocks, we've misplaced block notes. */ /* ??? This appears to happen all the time. Latent bugs elsewhere? */ @@ -5616,36 +5612,30 @@ identify_blocks_1 (insns, block_vector, end_block_vector, orig_block_stack) return block_vector; } -/* 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. */ +/* Identify BLOCKs referenced by more than one + NOTE_INSN_BLOCK_{BEG,END}, and create duplicate blocks. */ -tree -reorder_blocks (block, insns) - tree block; - rtx insns; +void +reorder_blocks () { - tree current_block = block; + tree block = DECL_INITIAL (current_function_decl); varray_type block_stack; if (block == NULL_TREE) - return NULL_TREE; + return; VARRAY_TREE_INIT (block_stack, 10, "block_stack"); - /* Prune the old trees away, so that it doesn't get in the way. */ - BLOCK_SUBBLOCKS (current_block) = 0; - BLOCK_CHAIN (current_block) = 0; + /* Prune the old trees away, so that they don't get in the way. */ + BLOCK_SUBBLOCKS (block) = NULL_TREE; + BLOCK_CHAIN (block) = NULL_TREE; - reorder_blocks_1 (insns, current_block, &block_stack); + reorder_blocks_1 (get_insns (), block, &block_stack); - BLOCK_SUBBLOCKS (current_block) - = blocks_nreverse (BLOCK_SUBBLOCKS (current_block)); + BLOCK_SUBBLOCKS (block) + = blocks_nreverse (BLOCK_SUBBLOCKS (block)); VARRAY_FREE (block_stack); - - return current_block; } /* Helper function for reorder_blocks. Process the insn chain beginning diff --git a/gcc/function.h b/gcc/function.h index 8b26ec2e371..5c7aa414d30 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -303,7 +303,7 @@ struct function /* Nonzero if this function is being processed in function-at-a-time mode. In other words, if all tree structure for this function, - including the BLOCK tree is created, before RTL generation + including the BLOCK tree, is created before RTL generation commences. */ int x_whole_function_mode_p; @@ -548,10 +548,12 @@ struct function *find_function_data PARAMS ((tree)); /* Pointer to chain of `struct function' for containing functions. */ 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 void identify_blocks PARAMS ((tree, rtx)); +/* Set NOTE_BLOCK for each block note in the current function. */ +extern void identify_blocks PARAMS ((void)); + +/* Identify BLOCKs referenced by more than one NOTE_INSN_BLOCK_{BEG,END}, + and create duplicate blocks. */ +extern void reorder_blocks PARAMS ((void)); /* Set BLOCK_NUMBER for all the blocks in FN. */ extern void number_blocks PARAMS ((tree)); diff --git a/gcc/loop.c b/gcc/loop.c index f7a12ded4cc..74ff0a6a7fd 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -518,14 +518,6 @@ loop_optimize (f, dumpfile, unroll_p, bct_p) if (uid_luid[i] == 0) uid_luid[i] = uid_luid[i - 1]; - /* If debugging and unrolling loops, we must replicate the tree - nodes corresponding to the BLOCKs inside the loop, so that the - original one to one mapping will remain. We sometimes unroll - loops even when unroll_p is false, so we must always do this when - debugging. */ - if (write_symbols != NO_DEBUG) - find_loop_tree_blocks (); - /* Determine if the function has indirect jump. On some systems this prevents low overhead loop instructions from being used. */ indirect_jump_in_function = indirect_jump_in_function_p (f); @@ -540,9 +532,12 @@ loop_optimize (f, dumpfile, unroll_p, bct_p) scan_loop (loop, unroll_p, bct_p); } - /* Replicate the BLOCKs. */ + /* 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) - unroll_block_trees (); + reorder_blocks (); end_alias_analysis (); diff --git a/gcc/loop.h b/gcc/loop.h index 8fbde2146ac..f7769f8ea4a 100644 --- a/gcc/loop.h +++ b/gcc/loop.h @@ -248,6 +248,3 @@ int back_branch_in_range_p PARAMS ((const struct loop *, rtx)); int loop_insn_first_p PARAMS ((rtx, rtx)); -/* Forward declarations for non-static functions declared in stmt.c. */ -void find_loop_tree_blocks PARAMS ((void)); -void unroll_block_trees PARAMS ((void)); diff --git a/gcc/sibcall.c b/gcc/sibcall.c index b399137a0bf..bbb70243e72 100644 --- a/gcc/sibcall.c +++ b/gcc/sibcall.c @@ -571,7 +571,7 @@ success: CALL_PLACEHOLDER alternatives that we didn't emit. Rebuild the lexical block tree to correspond to the notes that still exist. */ if (replaced_call_placeholder) - unroll_block_trees (); + reorder_blocks (); /* This information will be invalid after inline expansion. Kill it now. */ free_basic_block_vars (0); diff --git a/gcc/stmt.c b/gcc/stmt.c index e919cd2c152..837df5cb670 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -6372,19 +6372,3 @@ 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. */ - -void -find_loop_tree_blocks () -{ - identify_blocks (DECL_INITIAL (current_function_decl), get_insns ()); -} - -void -unroll_block_trees () -{ - tree block = DECL_INITIAL (current_function_decl); - - reorder_blocks (block, get_insns ()); -} diff --git a/gcc/toplev.c b/gcc/toplev.c index 1e1a650139c..f304144b3c8 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -2858,7 +2858,8 @@ rest_of_compilation (decl) /* First, make sure that NOTE_BLOCK is set correctly for each NOTE_INSN_BLOCK_BEG/NOTE_INSN_BLOCK_END note. */ - find_loop_tree_blocks (); + if (!cfun->x_whole_function_mode_p) + identify_blocks (); /* Then remove any notes we don't need. That will make iterating over the instruction sequence faster, and allow the garbage @@ -2868,7 +2869,7 @@ rest_of_compilation (decl) /* In function-at-a-time mode, we do not attempt to keep the BLOCK tree in sensible shape. So, we just recalculate it here. */ if (cfun->x_whole_function_mode_p) - unroll_block_trees (); + reorder_blocks (); /* If we are reconsidering an inline function at the end of compilation, skip the stuff for making it inline. */ diff --git a/gcc/tree.h b/gcc/tree.h index 9076d5ec39f..1c5cebc3cf3 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2524,8 +2524,6 @@ extern void push_temp_slots PARAMS ((void)); extern void preserve_temp_slots PARAMS ((struct rtx_def *)); extern void preserve_rtl_expr_temps PARAMS ((tree)); extern int aggregate_value_p PARAMS ((tree)); -extern tree reorder_blocks PARAMS ((tree, - struct rtx_def *)); extern void free_temps_for_rtl_expr PARAMS ((tree)); extern void instantiate_virtual_regs PARAMS ((tree, struct rtx_def *)); extern void unshare_all_rtl PARAMS ((tree, struct rtx_def *)); |