Commit 1a4450c7 by Mark Mitchell Committed by Mark Mitchell

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
parent 371534a9
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> Wed Sep 15 14:39:35 1999 Jason Merrill <jason@yorick.cygnus.com>
* gbl-ctors.h: Lose HAVE_ATEXIT. Don't define ON_EXIT. * gbl-ctors.h: Lose HAVE_ATEXIT. Don't define ON_EXIT.
......
...@@ -5348,67 +5348,65 @@ round_trampoline_addr (tramp) ...@@ -5348,67 +5348,65 @@ round_trampoline_addr (tramp)
The arguments are BLOCK, the chain of top-level blocks of the function, The arguments are BLOCK, the chain of top-level blocks of the function,
and INSNS, the insn chain of the function. */ and INSNS, the insn chain of the function. */
tree * void
identify_blocks (block, insns) identify_blocks (block, insns)
tree block; tree block;
rtx insns; rtx insns;
{ {
int n_blocks; int n_blocks;
tree *block_vector; tree *block_vector;
int *block_stack; tree *block_stack;
int depth = 0; int depth = 0;
int next_block_number = 1;
int current_block_number = 1; int current_block_number = 1;
rtx insn; rtx insn;
if (block == 0) 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); n_blocks = all_blocks (block, 0);
block_vector = (tree *) xmalloc (n_blocks * sizeof (tree)); block_vector = (tree *) xmalloc (n_blocks * sizeof (tree));
block_stack = (int *) alloca (n_blocks * sizeof (int));
all_blocks (block, block_vector); all_blocks (block, block_vector);
block_stack = (tree *) alloca (n_blocks * sizeof (tree));
for (insn = insns; insn; insn = NEXT_INSN (insn)) for (insn = insns; insn; insn = NEXT_INSN (insn))
if (GET_CODE (insn) == NOTE) if (GET_CODE (insn) == NOTE)
{ {
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG) if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG)
{ {
block_stack[depth++] = current_block_number; tree block;
current_block_number = next_block_number;
NOTE_BLOCK_NUMBER (insn) = next_block_number++; block = block_vector[current_block_number++];
NOTE_BLOCK (insn) = block;
block_stack[depth++] = block;
} }
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END) if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END)
{ NOTE_BLOCK (insn) = block_stack[--depth];
NOTE_BLOCK_NUMBER (insn) = current_block_number;
current_block_number = block_stack[--depth];
}
} }
if (n_blocks != next_block_number) if (n_blocks != current_block_number)
abort (); abort ();
return block_vector; free (block_vector);
} }
/* Given BLOCK_VECTOR which was returned by identify_blocks, /* Given a revised instruction chain, rebuild the tree structure of
and a revised instruction chain, rebuild the tree structure BLOCK nodes to correspond to the new order of RTL. The new block
of BLOCK nodes to correspond to the new order of RTL. tree is inserted below TOP_BLOCK. Returns the current top-level
The new block tree is inserted below TOP_BLOCK. block. */
Returns the current top-level block. */
tree tree
reorder_blocks (block_vector, block, insns) reorder_blocks (block, insns)
tree *block_vector;
tree block; tree block;
rtx insns; rtx insns;
{ {
tree current_block = block; tree current_block = block;
rtx insn; rtx insn;
if (block_vector == 0) if (block == NULL_TREE)
return block; return NULL_TREE;
/* Prune the old trees away, so that it doesn't get in the way. */ /* Prune the old trees away, so that it doesn't get in the way. */
BLOCK_SUBBLOCKS (current_block) = 0; BLOCK_SUBBLOCKS (current_block) = 0;
...@@ -5419,7 +5417,7 @@ reorder_blocks (block_vector, block, insns) ...@@ -5419,7 +5417,7 @@ reorder_blocks (block_vector, block, insns)
{ {
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG) 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 we have seen this block before, copy it. */
if (TREE_ASM_WRITTEN (block)) if (TREE_ASM_WRITTEN (block))
block = copy_node (block); block = copy_node (block);
......
...@@ -523,7 +523,7 @@ extern struct function *outer_function_chain; ...@@ -523,7 +523,7 @@ extern struct function *outer_function_chain;
/* Put all this function's BLOCK nodes into a vector and return it. /* 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 Also store in each NOTE for the beginning or end of a block
the index of that block in the vector. */ 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. /* Return size needed for stack frame based on slots so far allocated.
This size counts from zero. It is not rounded to STACK_BOUNDARY; This size counts from zero. It is not rounded to STACK_BOUNDARY;
......
...@@ -208,6 +208,11 @@ ggc_mark_rtx (r) ...@@ -208,6 +208,11 @@ ggc_mark_rtx (r)
ggc_mark_rtx (NOTE_RANGE_INFO (r)); ggc_mark_rtx (NOTE_RANGE_INFO (r));
break; break;
case NOTE_INSN_BLOCK_BEG:
case NOTE_INSN_BLOCK_END:
ggc_mark_tree (NOTE_BLOCK (r));
break;
default: default:
if (NOTE_LINE_NUMBER (r) >= 0) if (NOTE_LINE_NUMBER (r) >= 0)
ggc_mark_string (NOTE_SOURCE_FILE (r)); ggc_mark_string (NOTE_SOURCE_FILE (r));
......
...@@ -3939,9 +3939,12 @@ sched_analyze (head, tail) ...@@ -3939,9 +3939,12 @@ sched_analyze (head, tail)
|| (NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP || (NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP
&& GET_CODE (PREV_INSN (insn)) != CALL_INSN))) && GET_CODE (PREV_INSN (insn)) != CALL_INSN)))
{ {
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, loop_notes = alloc_EXPR_LIST (REG_DEAD,
GEN_INT (NOTE_BLOCK_NUMBER (insn)), GEN_INT (NOTE_EH_HANDLER (insn)),
loop_notes); loop_notes);
loop_notes = alloc_EXPR_LIST (REG_DEAD, loop_notes = alloc_EXPR_LIST (REG_DEAD,
GEN_INT (NOTE_LINE_NUMBER (insn)), GEN_INT (NOTE_LINE_NUMBER (insn)),
loop_notes); loop_notes);
...@@ -6494,7 +6497,7 @@ move_insn1 (insn, last) ...@@ -6494,7 +6497,7 @@ move_insn1 (insn, last)
/* Search INSN for fake REG_DEAD note pairs for NOTE_INSN_SETJMP, /* Search INSN for fake REG_DEAD note pairs for NOTE_INSN_SETJMP,
NOTE_INSN_{LOOP,EHREGION}_{BEG,END}; and convert them back into NOTE_INSN_{LOOP,EHREGION}_{BEG,END}; and convert them back into
NOTEs. The REG_DEAD note following first one is contains the saved 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 NOTE_INSN_EH_REGION_{BEG,END} NOTEs. LAST is the last instruction
output by the instruction scheduler. Return the new value of LAST. */ output by the instruction scheduler. Return the new value of LAST. */
...@@ -6516,8 +6519,6 @@ reemit_notes (insn, last) ...@@ -6516,8 +6519,6 @@ reemit_notes (insn, last)
{ {
retval = emit_note_after (NOTE_INSN_SETJMP, insn); retval = emit_note_after (NOTE_INSN_SETJMP, insn);
CONST_CALL_P (retval) = CONST_CALL_P (note); CONST_CALL_P (retval) = CONST_CALL_P (note);
remove_note (insn, note);
note = XEXP (note, 1);
} }
else if (note_type == NOTE_INSN_RANGE_START else if (note_type == NOTE_INSN_RANGE_START
|| note_type == NOTE_INSN_RANGE_END) || note_type == NOTE_INSN_RANGE_END)
...@@ -6530,9 +6531,13 @@ reemit_notes (insn, last) ...@@ -6530,9 +6531,13 @@ reemit_notes (insn, last)
else else
{ {
last = emit_note_before (note_type, last); last = emit_note_before (note_type, last);
if (note_type == NOTE_INSN_EH_REGION_BEG
|| note_type == NOTE_INSN_EH_REGION_END)
{
remove_note (insn, note); remove_note (insn, note);
note = XEXP (note, 1); note = XEXP (note, 1);
NOTE_BLOCK_NUMBER (last) = INTVAL (XEXP (note, 0)); NOTE_EH_HANDLER (last) = INTVAL (XEXP (note, 0));
}
} }
remove_note (insn, note); remove_note (insn, note);
} }
......
...@@ -166,7 +166,9 @@ print_rtx (in_rtx) ...@@ -166,7 +166,9 @@ print_rtx (in_rtx)
else if (NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_BLOCK_BEG else if (NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_BLOCK_BEG
|| NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_BLOCK_END) || 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; sawclose = 1;
} }
else if (NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_RANGE_START else if (NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_RANGE_START
......
...@@ -517,16 +517,12 @@ extern const char * const reg_note_name[]; ...@@ -517,16 +517,12 @@ extern const char * const reg_note_name[];
information as a rtx in the field. */ information as a rtx in the field. */
#define NOTE_SOURCE_FILE(INSN) XCSTR(INSN, 3, NOTE) #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_EH_HANDLER(INSN) XCINT(INSN, 3, NOTE)
#define NOTE_RANGE_INFO(INSN) XCEXP(INSN, 3, NOTE) #define NOTE_RANGE_INFO(INSN) XCEXP(INSN, 3, NOTE)
#define NOTE_LIVE_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_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. /* In a NOTE that is a line number, this is the line number.
Other kinds of NOTEs are identified by negative numbers here. */ Other kinds of NOTEs are identified by negative numbers here. */
#define NOTE_LINE_NUMBER(INSN) XCINT(INSN, 4, NOTE) #define NOTE_LINE_NUMBER(INSN) XCINT(INSN, 4, NOTE)
......
...@@ -6278,19 +6278,10 @@ emit_case_nodes (index, node, default_label, index_type) ...@@ -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 /* 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. */ 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 void
find_loop_tree_blocks () find_loop_tree_blocks ()
{ {
tree block = DECL_INITIAL (current_function_decl); identify_blocks (DECL_INITIAL (current_function_decl), get_insns ());
block_vector = identify_blocks (block, get_insns ());
} }
void void
...@@ -6298,9 +6289,5 @@ unroll_block_trees () ...@@ -6298,9 +6289,5 @@ unroll_block_trees ()
{ {
tree block = DECL_INITIAL (current_function_decl); tree block = DECL_INITIAL (current_function_decl);
reorder_blocks (block_vector, block, get_insns ()); reorder_blocks (block, get_insns ());
/* Release any memory allocated by identify_blocks. */
if (block_vector)
free (block_vector);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment