1992-01-15 22:33:30 +01:00
|
|
|
|
/* Data flow analysis for GNU compiler.
|
2000-08-11 14:45:05 +02:00
|
|
|
|
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
2001-01-02 08:00:49 +01:00
|
|
|
|
1999, 2000, 2001 Free Software Foundation, Inc.
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
This file is part of GNU CC.
|
|
|
|
|
|
|
|
|
|
GNU CC is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
|
|
GNU CC is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with GNU CC; see the file COPYING. If not, write to
|
1995-06-15 13:52:21 +02:00
|
|
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* This file contains the data flow analysis pass of the compiler. It
|
|
|
|
|
computes data flow information which tells combine_instructions
|
|
|
|
|
which insns to consider combining and controls register allocation.
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
Additional data flow information that is too bulky to record is
|
|
|
|
|
generated during the analysis, and is used at that time to create
|
|
|
|
|
autoincrement and autodecrement addressing.
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
The first step is dividing the function into basic blocks.
|
|
|
|
|
find_basic_blocks does this. Then life_analysis determines
|
|
|
|
|
where each register is live and where it is dead.
|
|
|
|
|
|
|
|
|
|
** find_basic_blocks **
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
find_basic_blocks divides the current function's rtl into basic
|
|
|
|
|
blocks and constructs the CFG. The blocks are recorded in the
|
|
|
|
|
basic_block_info array; the CFG exists in the edge structures
|
|
|
|
|
referenced by the blocks.
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
find_basic_blocks also finds any unreachable loops and deletes them.
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
** life_analysis **
|
|
|
|
|
|
|
|
|
|
life_analysis is called immediately after find_basic_blocks.
|
|
|
|
|
It uses the basic block information to determine where each
|
|
|
|
|
hard or pseudo register is live.
|
|
|
|
|
|
|
|
|
|
** live-register info **
|
|
|
|
|
|
|
|
|
|
The information about where each register is live is in two parts:
|
1999-02-26 00:45:42 +01:00
|
|
|
|
the REG_NOTES of insns, and the vector basic_block->global_live_at_start.
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
basic_block->global_live_at_start has an element for each basic
|
|
|
|
|
block, and the element is a bit-vector with a bit for each hard or
|
|
|
|
|
pseudo register. The bit is 1 if the register is live at the
|
|
|
|
|
beginning of the basic block.
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
Two types of elements can be added to an insn's REG_NOTES.
|
1992-01-15 22:33:30 +01:00
|
|
|
|
A REG_DEAD note is added to an insn's REG_NOTES for any register
|
|
|
|
|
that meets both of two conditions: The value in the register is not
|
|
|
|
|
needed in subsequent insns and the insn does not replace the value in
|
|
|
|
|
the register (in the case of multi-word hard registers, the value in
|
|
|
|
|
each register must be replaced by the insn to avoid a REG_DEAD note).
|
|
|
|
|
|
|
|
|
|
In the vast majority of cases, an object in a REG_DEAD note will be
|
|
|
|
|
used somewhere in the insn. The (rare) exception to this is if an
|
|
|
|
|
insn uses a multi-word hard register and only some of the registers are
|
|
|
|
|
needed in subsequent insns. In that case, REG_DEAD notes will be
|
|
|
|
|
provided for those hard registers that are not subsequently needed.
|
|
|
|
|
Partial REG_DEAD notes of this type do not occur when an insn sets
|
|
|
|
|
only some of the hard registers used in such a multi-word operand;
|
|
|
|
|
omitting REG_DEAD notes for objects stored in an insn is optional and
|
|
|
|
|
the desire to do so does not justify the complexity of the partial
|
|
|
|
|
REG_DEAD notes.
|
|
|
|
|
|
|
|
|
|
REG_UNUSED notes are added for each register that is set by the insn
|
|
|
|
|
but is unused subsequently (if every register set by the insn is unused
|
|
|
|
|
and the insn does not reference memory or have some other side-effect,
|
|
|
|
|
the insn is deleted instead). If only part of a multi-word hard
|
|
|
|
|
register is used in a subsequent insn, REG_UNUSED notes are made for
|
|
|
|
|
the parts that will not be used.
|
|
|
|
|
|
|
|
|
|
To determine which registers are live after any insn, one can
|
|
|
|
|
start from the beginning of the basic block and scan insns, noting
|
|
|
|
|
which registers are set by each insn and which die there.
|
|
|
|
|
|
|
|
|
|
** Other actions of life_analysis **
|
|
|
|
|
|
|
|
|
|
life_analysis sets up the LOG_LINKS fields of insns because the
|
|
|
|
|
information needed to do so is readily available.
|
|
|
|
|
|
|
|
|
|
life_analysis deletes insns whose only effect is to store a value
|
|
|
|
|
that is never used.
|
|
|
|
|
|
|
|
|
|
life_analysis notices cases where a reference to a register as
|
|
|
|
|
a memory address can be combined with a preceding or following
|
|
|
|
|
incrementation or decrementation of the register. The separate
|
|
|
|
|
instruction to increment or decrement is deleted and the address
|
|
|
|
|
is changed to a POST_INC or similar rtx.
|
|
|
|
|
|
|
|
|
|
Each time an incrementing or decrementing address is created,
|
|
|
|
|
a REG_INC element is added to the insn's REG_NOTES list.
|
|
|
|
|
|
|
|
|
|
life_analysis fills in certain vectors containing information about
|
1999-12-18 22:33:23 +01:00
|
|
|
|
register usage: REG_N_REFS, REG_N_DEATHS, REG_N_SETS, REG_LIVE_LENGTH,
|
|
|
|
|
REG_N_CALLS_CROSSED and REG_BASIC_BLOCK.
|
1998-10-12 12:06:49 +02:00
|
|
|
|
|
|
|
|
|
life_analysis sets current_function_sp_is_unchanging if the function
|
|
|
|
|
doesn't modify the stack pointer. */
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* TODO:
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
Split out from life_analysis:
|
|
|
|
|
- local property discovery (bb->local_live, bb->local_set)
|
|
|
|
|
- global property computation
|
|
|
|
|
- log links creation
|
|
|
|
|
- pre/post modify transformation
|
|
|
|
|
*/
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
#include "config.h"
|
Major cutover to using system.h:
* Makefile.in (alias.o, bitmap.o, c-aux-info.o, c-common.o,
c-decl.o, c-iterate.o, c-lang.o, c-lex.o, c-pragma.o, c-typeck.o,
caller-save.o, calls.o, collect2.o, combine.o, cse.o, dbxout.o,
dwarf2out.o, dwarfout.o, emit-rtl.o, except.o, explow.o, expmed.o,
expr.o, final.o, flow.o, function.o, getpwd.o, global.o,
integrate.o, jump.o, local-alloc.o, loop.o, optabs.o, pexecute.o,
prefix.o, print-rtl.o, print-tree.o, profile.o, real.o, recog.o,
reg-stack.o, regclass.o, regmove.o, reload.o, reload1.o, reorg.o,
rtl.o, rtlanal.o, sdbout.o, stmt.o, stor-layout.o, stupid.o,
tlink.o, toplev.o, tree.o, unroll.o, varasm.o, xcoffout.o): Depend
on system.h.
* alias.c, bitmap.c, c-aux-info.c, c-common.c, c-decl.c,
c-iterate.c, c-lang.c, c-lex.c, c-pragma.c, c-typeck.c,
caller-save.c, calls.c, collect2.c, combine.c, cse.c, dbxout.c,
dwarf2out.c, dwarfout.c, emit-rtl.c, except.c, explow.c, expmed.c,
expr.c, final.c, flow.c, function.c, gcc.c, getpwd.c, global.c,
integrate.c, jump.c, local-alloc.c, loop.c, optabs.c, pexecute.c,
prefix.c, print-rtl.c, print-tree.c, profile.c, real.c, recog.c,
reg-stack.c, regclass.c, regmove.c, reload.c, reload1.c, reorg.c,
rtl.c, rtlanal.c, sched.c, sdbout.c, stmt.c, stor-layout.c,
stupid.c, tlink.c, toplev.c, tree.c, unroll.c, varasm.c,
xcoffout.c: Include system.h. Organize include ordering so
that stdarg/varargs comes before other system headers. Remove
spurious casts of functions assured of a prototype in system.h.
From-SVN: r18726
1998-03-20 15:58:42 +01:00
|
|
|
|
#include "system.h"
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
#include "tree.h"
|
1992-01-15 22:33:30 +01:00
|
|
|
|
#include "rtl.h"
|
1999-09-20 12:00:03 +02:00
|
|
|
|
#include "tm_p.h"
|
2000-05-20 00:27:28 +02:00
|
|
|
|
#include "hard-reg-set.h"
|
1992-01-15 22:33:30 +01:00
|
|
|
|
#include "basic-block.h"
|
|
|
|
|
#include "insn-config.h"
|
|
|
|
|
#include "regs.h"
|
|
|
|
|
#include "flags.h"
|
|
|
|
|
#include "output.h"
|
1999-07-31 14:46:53 +02:00
|
|
|
|
#include "function.h"
|
1996-07-23 21:58:32 +02:00
|
|
|
|
#include "except.h"
|
1998-06-20 01:37:04 +02:00
|
|
|
|
#include "toplev.h"
|
1998-10-17 22:26:29 +02:00
|
|
|
|
#include "recog.h"
|
1999-02-26 00:45:42 +01:00
|
|
|
|
#include "insn-flags.h"
|
2000-02-14 20:34:06 +01:00
|
|
|
|
#include "expr.h"
|
2000-08-02 06:21:27 +02:00
|
|
|
|
#include "ssa.h"
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
#include "obstack.h"
|
2000-04-30 12:37:57 +02:00
|
|
|
|
#include "splay-tree.h"
|
1999-09-07 07:49:18 +02:00
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
#define obstack_chunk_alloc xmalloc
|
|
|
|
|
#define obstack_chunk_free free
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
|
|
|
|
|
the stack pointer does not matter. The value is tested only in
|
|
|
|
|
functions that have frame pointers.
|
|
|
|
|
No definition is equivalent to always zero. */
|
|
|
|
|
#ifndef EXIT_IGNORE_STACK
|
|
|
|
|
#define EXIT_IGNORE_STACK 0
|
|
|
|
|
#endif
|
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
#ifndef HAVE_epilogue
|
|
|
|
|
#define HAVE_epilogue 0
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef HAVE_prologue
|
|
|
|
|
#define HAVE_prologue 0
|
|
|
|
|
#endif
|
2000-03-17 23:40:45 +01:00
|
|
|
|
#ifndef HAVE_sibcall_epilogue
|
|
|
|
|
#define HAVE_sibcall_epilogue 0
|
|
|
|
|
#endif
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
2000-08-08 10:28:00 +02:00
|
|
|
|
#ifndef LOCAL_REGNO
|
|
|
|
|
#define LOCAL_REGNO(REGNO) 0
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef EPILOGUE_USES
|
|
|
|
|
#define EPILOGUE_USES(REGNO) 0
|
|
|
|
|
#endif
|
|
|
|
|
|
2000-10-13 08:26:46 +02:00
|
|
|
|
/* The obstack on which the flow graph components are allocated. */
|
1997-06-05 22:35:53 +02:00
|
|
|
|
|
2000-10-13 08:26:46 +02:00
|
|
|
|
struct obstack flow_obstack;
|
|
|
|
|
static char *flow_firstobj;
|
1997-06-05 22:35:53 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Number of basic blocks in the current function. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
int n_basic_blocks;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
/* Number of edges in the current function. */
|
|
|
|
|
|
|
|
|
|
int n_edges;
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* The basic block array. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
varray_type basic_block_info;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* The special entry and exit blocks. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1999-12-18 22:33:23 +01:00
|
|
|
|
struct basic_block_def entry_exit_blocks[2]
|
|
|
|
|
= {{NULL, /* head */
|
1999-02-26 00:45:42 +01:00
|
|
|
|
NULL, /* end */
|
|
|
|
|
NULL, /* pred */
|
|
|
|
|
NULL, /* succ */
|
|
|
|
|
NULL, /* local_set */
|
2000-11-27 18:50:11 +01:00
|
|
|
|
NULL, /* cond_local_set */
|
1999-02-26 00:45:42 +01:00
|
|
|
|
NULL, /* global_live_at_start */
|
|
|
|
|
NULL, /* global_live_at_end */
|
|
|
|
|
NULL, /* aux */
|
|
|
|
|
ENTRY_BLOCK, /* index */
|
1999-09-21 23:15:37 +02:00
|
|
|
|
0, /* loop_depth */
|
basic-block.h (struct edge_def): New field "count".
* basic-block.h (struct edge_def): New field "count".
(struct basic_block_def): Likewise.
* flow.c (entry_exit_blocks): Add count fileds.
(split_edge): Keep count information up-to-date.
(dump_edge_info, dump_flow_info): Dump count fields.
* final.c (count_instrumented_edges): Rename to edge from arc.
(end_final): Update users.
* profile.c: Include expr.h, basic-block.h.
(struct adj_list, ARC_TARGET, ARC_SOURCE, ARC_COUNT): Kill.
(struct bb_info, label_to_bb, label_to_bb_size, bb_graph): Kill.
(ignore_next_note, return_label_execution_count): Kill.
(bbg_file_name, da_file_name): Kill.
(edge_info, bb_info): New structures.
(EDGE_INFO, BB_INFO, GCOV_INDEX_TO_BB, BB_TO_GCOV_INDEX): New macros.
(count_instrumented_edges, total_num_edges): Rename to edge from arc.
(total_num_edges_instrumented): Likewise.
(init_arc, expand_spanning_tree): Kill.
(fill_spanning_tree, tablejump_entry_p): Kill.
(instrument_edges): Rewrite from instrument_arcs to use
commit_edge_insertions infrastructure.
(compute_branch_probabilities): Remove arguments; rewrite for
CFG infrastructure; use rtl_dump_file directly.
(branch_prob, find_spanning_tree): Likewise.
(union_groups, find_group): New.
(init_branch_prob): Make bbg_file_name and da_file_name local.
(end_branch_prob): Use rtl_dump_file directly.
(init_edge_profiler): Rename to edge from arc.
(output_arc_profiler): Kill.
(gen_edge_profiler): New.
(output_func_start_profiler): Turn off profiling. Make the
constructor static when we can.
* rtl.h (branch_prob, end_branch_prob): Update prototypes.
* toplev.c (DFI_flow): Remove.
(DFI_cfg, DFI_life): New.
(dump_file): Update accordingly.
(compile_file): Call end_branch_prob if profile_arc_flag too.
(rest_of_compilation): Move flow1 cfg creation to DFI_cfg. Do edge
profiling after the CFG is built. Move flow1 life analysis to
DFI_life. Always estimate remaining probabilities.
Co-Authored-By: Richard Henderson <rth@cygnus.com>
From-SVN: r34037
2000-05-19 22:51:49 +02:00
|
|
|
|
-1, -1, /* eh_beg, eh_end */
|
|
|
|
|
0 /* count */
|
1999-02-26 00:45:42 +01:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
NULL, /* head */
|
|
|
|
|
NULL, /* end */
|
|
|
|
|
NULL, /* pred */
|
|
|
|
|
NULL, /* succ */
|
|
|
|
|
NULL, /* local_set */
|
2000-11-27 18:50:11 +01:00
|
|
|
|
NULL, /* cond_local_set */
|
1999-02-26 00:45:42 +01:00
|
|
|
|
NULL, /* global_live_at_start */
|
|
|
|
|
NULL, /* global_live_at_end */
|
|
|
|
|
NULL, /* aux */
|
|
|
|
|
EXIT_BLOCK, /* index */
|
1999-09-21 23:15:37 +02:00
|
|
|
|
0, /* loop_depth */
|
basic-block.h (struct edge_def): New field "count".
* basic-block.h (struct edge_def): New field "count".
(struct basic_block_def): Likewise.
* flow.c (entry_exit_blocks): Add count fileds.
(split_edge): Keep count information up-to-date.
(dump_edge_info, dump_flow_info): Dump count fields.
* final.c (count_instrumented_edges): Rename to edge from arc.
(end_final): Update users.
* profile.c: Include expr.h, basic-block.h.
(struct adj_list, ARC_TARGET, ARC_SOURCE, ARC_COUNT): Kill.
(struct bb_info, label_to_bb, label_to_bb_size, bb_graph): Kill.
(ignore_next_note, return_label_execution_count): Kill.
(bbg_file_name, da_file_name): Kill.
(edge_info, bb_info): New structures.
(EDGE_INFO, BB_INFO, GCOV_INDEX_TO_BB, BB_TO_GCOV_INDEX): New macros.
(count_instrumented_edges, total_num_edges): Rename to edge from arc.
(total_num_edges_instrumented): Likewise.
(init_arc, expand_spanning_tree): Kill.
(fill_spanning_tree, tablejump_entry_p): Kill.
(instrument_edges): Rewrite from instrument_arcs to use
commit_edge_insertions infrastructure.
(compute_branch_probabilities): Remove arguments; rewrite for
CFG infrastructure; use rtl_dump_file directly.
(branch_prob, find_spanning_tree): Likewise.
(union_groups, find_group): New.
(init_branch_prob): Make bbg_file_name and da_file_name local.
(end_branch_prob): Use rtl_dump_file directly.
(init_edge_profiler): Rename to edge from arc.
(output_arc_profiler): Kill.
(gen_edge_profiler): New.
(output_func_start_profiler): Turn off profiling. Make the
constructor static when we can.
* rtl.h (branch_prob, end_branch_prob): Update prototypes.
* toplev.c (DFI_flow): Remove.
(DFI_cfg, DFI_life): New.
(dump_file): Update accordingly.
(compile_file): Call end_branch_prob if profile_arc_flag too.
(rest_of_compilation): Move flow1 cfg creation to DFI_cfg. Do edge
profiling after the CFG is built. Move flow1 life analysis to
DFI_life. Always estimate remaining probabilities.
Co-Authored-By: Richard Henderson <rth@cygnus.com>
From-SVN: r34037
2000-05-19 22:51:49 +02:00
|
|
|
|
-1, -1, /* eh_beg, eh_end */
|
|
|
|
|
0 /* count */
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
};
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1998-11-04 21:45:03 +01:00
|
|
|
|
/* Nonzero if the second flow pass has completed. */
|
|
|
|
|
int flow2_completed;
|
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
/* Maximum register number used in this function, plus one. */
|
|
|
|
|
|
|
|
|
|
int max_regno;
|
|
|
|
|
|
1997-05-30 20:19:19 +02:00
|
|
|
|
/* Indexed by n, giving various register information */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1998-07-02 15:49:34 +02:00
|
|
|
|
varray_type reg_n_info;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
/* Size of a regset for the current function,
|
|
|
|
|
in (1) bytes and (2) elements. */
|
|
|
|
|
|
|
|
|
|
int regset_bytes;
|
|
|
|
|
int regset_size;
|
|
|
|
|
|
|
|
|
|
/* Regset of regs live when calls to `setjmp'-like functions happen. */
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* ??? Does this exist only for the setjmp-clobbered warning message? */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
regset regs_live_at_setjmp;
|
|
|
|
|
|
|
|
|
|
/* List made of EXPR_LIST rtx's which gives pairs of pseudo registers
|
|
|
|
|
that have to go in the same hard reg.
|
|
|
|
|
The first two regs in the list are a pair, and the next two
|
|
|
|
|
are another pair, etc. */
|
|
|
|
|
rtx regs_may_share;
|
|
|
|
|
|
2001-01-02 08:00:49 +01:00
|
|
|
|
/* Callback that determines if it's ok for a function to have no
|
|
|
|
|
noreturn attribute. */
|
|
|
|
|
int (*lang_missing_noreturn_ok_p) PARAMS ((tree));
|
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
/* Set of registers that may be eliminable. These are handled specially
|
|
|
|
|
in updating regs_ever_live. */
|
|
|
|
|
|
|
|
|
|
static HARD_REG_SET elim_reg_set;
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* The basic block structure for every insn, indexed by uid. */
|
|
|
|
|
|
|
|
|
|
varray_type basic_block_for_insn;
|
|
|
|
|
|
|
|
|
|
/* The labels mentioned in non-jump rtl. Valid during find_basic_blocks. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* ??? Should probably be using LABEL_NUSES instead. It would take a
|
1999-02-26 00:45:42 +01:00
|
|
|
|
bit of surgery to be able to use or co-opt the routines in jump. */
|
|
|
|
|
|
|
|
|
|
static rtx label_value_list;
|
2000-05-12 18:26:15 +02:00
|
|
|
|
static rtx tail_recursion_label_list;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
2000-04-30 12:37:57 +02:00
|
|
|
|
/* Holds information for tracking conditional register life information. */
|
|
|
|
|
struct reg_cond_life_info
|
|
|
|
|
{
|
|
|
|
|
/* An EXPR_LIST of conditions under which a register is dead. */
|
|
|
|
|
rtx condition;
|
|
|
|
|
|
|
|
|
|
/* ??? Could store mask of bytes that are dead, so that we could finally
|
|
|
|
|
track lifetimes of multi-word registers accessed via subregs. */
|
|
|
|
|
};
|
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
/* For use in communicating between propagate_block and its subroutines.
|
|
|
|
|
Holds all information needed to compute life and def-use information. */
|
|
|
|
|
|
|
|
|
|
struct propagate_block_info
|
|
|
|
|
{
|
|
|
|
|
/* The basic block we're considering. */
|
|
|
|
|
basic_block bb;
|
|
|
|
|
|
|
|
|
|
/* Bit N is set if register N is conditionally or unconditionally live. */
|
|
|
|
|
regset reg_live;
|
|
|
|
|
|
2000-04-27 13:17:04 +02:00
|
|
|
|
/* Bit N is set if register N is set this insn. */
|
|
|
|
|
regset new_set;
|
2000-04-12 03:38:15 +02:00
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
/* Element N is the next insn that uses (hard or pseudo) register N
|
|
|
|
|
within the current basic block; or zero, if there is no such insn. */
|
|
|
|
|
rtx *reg_next_use;
|
|
|
|
|
|
|
|
|
|
/* Contains a list of all the MEMs we are tracking for dead store
|
|
|
|
|
elimination. */
|
|
|
|
|
rtx mem_set_list;
|
|
|
|
|
|
2000-11-27 18:50:11 +01:00
|
|
|
|
/* If non-null, record the set of registers set unconditionally in the
|
|
|
|
|
basic block. */
|
2000-04-08 01:33:47 +02:00
|
|
|
|
regset local_set;
|
|
|
|
|
|
2000-11-27 18:50:11 +01:00
|
|
|
|
/* If non-null, record the set of registers set conditionally in the
|
|
|
|
|
basic block. */
|
|
|
|
|
regset cond_local_set;
|
|
|
|
|
|
2000-04-30 12:37:57 +02:00
|
|
|
|
#ifdef HAVE_conditional_execution
|
|
|
|
|
/* Indexed by register number, holds a reg_cond_life_info for each
|
|
|
|
|
register that is not unconditionally live or dead. */
|
|
|
|
|
splay_tree reg_cond_dead;
|
|
|
|
|
|
|
|
|
|
/* Bit N is set if register N is in an expression in reg_cond_dead. */
|
|
|
|
|
regset reg_cond_reg;
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-01-16 14:57:17 +01:00
|
|
|
|
/* The length of mem_set_list. */
|
|
|
|
|
int mem_set_list_len;
|
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
/* Non-zero if the value of CC0 is live. */
|
|
|
|
|
int cc0_live;
|
|
|
|
|
|
|
|
|
|
/* Flags controling the set of information propagate_block collects. */
|
|
|
|
|
int flags;
|
|
|
|
|
};
|
|
|
|
|
|
2001-01-16 14:57:17 +01:00
|
|
|
|
/* Maximum length of pbi->mem_set_list before we start dropping
|
|
|
|
|
new elements on the floor. */
|
|
|
|
|
#define MAX_MEM_SET_LIST_LEN 100
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Store the data structures necessary for depth-first search. */
|
2000-08-02 06:21:27 +02:00
|
|
|
|
struct depth_first_search_dsS {
|
|
|
|
|
/* stack for backtracking during the algorithm */
|
|
|
|
|
basic_block *stack;
|
|
|
|
|
|
|
|
|
|
/* number of edges in the stack. That is, positions 0, ..., sp-1
|
2000-08-11 14:45:05 +02:00
|
|
|
|
have edges. */
|
2000-08-02 06:21:27 +02:00
|
|
|
|
unsigned int sp;
|
|
|
|
|
|
|
|
|
|
/* record of basic blocks already seen by depth-first search */
|
|
|
|
|
sbitmap visited_blocks;
|
|
|
|
|
};
|
|
|
|
|
typedef struct depth_first_search_dsS *depth_first_search_ds;
|
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
/* Forward declarations */
|
2000-01-14 18:14:43 +01:00
|
|
|
|
static int count_basic_blocks PARAMS ((rtx));
|
2000-05-12 18:26:15 +02:00
|
|
|
|
static void find_basic_blocks_1 PARAMS ((rtx));
|
2000-05-26 12:30:47 +02:00
|
|
|
|
static rtx find_label_refs PARAMS ((rtx, rtx));
|
2000-01-14 18:14:43 +01:00
|
|
|
|
static void clear_edges PARAMS ((void));
|
|
|
|
|
static void make_edges PARAMS ((rtx));
|
|
|
|
|
static void make_label_edge PARAMS ((sbitmap *, basic_block,
|
|
|
|
|
rtx, int));
|
|
|
|
|
static void make_eh_edge PARAMS ((sbitmap *, eh_nesting_info *,
|
|
|
|
|
basic_block, rtx, int));
|
|
|
|
|
static void mark_critical_edges PARAMS ((void));
|
|
|
|
|
static void move_stray_eh_region_notes PARAMS ((void));
|
|
|
|
|
static void record_active_eh_regions PARAMS ((rtx));
|
|
|
|
|
|
|
|
|
|
static void commit_one_edge_insertion PARAMS ((edge));
|
|
|
|
|
|
|
|
|
|
static void delete_unreachable_blocks PARAMS ((void));
|
|
|
|
|
static void delete_eh_regions PARAMS ((void));
|
|
|
|
|
static int can_delete_note_p PARAMS ((rtx));
|
|
|
|
|
static void expunge_block PARAMS ((basic_block));
|
|
|
|
|
static int can_delete_label_p PARAMS ((rtx));
|
2000-05-12 18:26:15 +02:00
|
|
|
|
static int tail_recursion_label_p PARAMS ((rtx));
|
2000-01-14 18:14:43 +01:00
|
|
|
|
static int merge_blocks_move_predecessor_nojumps PARAMS ((basic_block,
|
|
|
|
|
basic_block));
|
|
|
|
|
static int merge_blocks_move_successor_nojumps PARAMS ((basic_block,
|
1999-09-21 23:15:37 +02:00
|
|
|
|
basic_block));
|
2000-01-14 18:14:43 +01:00
|
|
|
|
static int merge_blocks PARAMS ((edge,basic_block,basic_block));
|
|
|
|
|
static void try_merge_blocks PARAMS ((void));
|
2000-02-09 00:48:32 +01:00
|
|
|
|
static void tidy_fallthru_edges PARAMS ((void));
|
2000-01-14 18:14:43 +01:00
|
|
|
|
static int verify_wide_reg_1 PARAMS ((rtx *, void *));
|
|
|
|
|
static void verify_wide_reg PARAMS ((int, rtx, rtx));
|
|
|
|
|
static void verify_local_live_at_start PARAMS ((regset, basic_block));
|
|
|
|
|
static int set_noop_p PARAMS ((rtx));
|
|
|
|
|
static int noop_move_p PARAMS ((rtx));
|
2000-02-16 08:54:53 +01:00
|
|
|
|
static void delete_noop_moves PARAMS ((rtx));
|
|
|
|
|
static void notice_stack_pointer_modification_1 PARAMS ((rtx, rtx, void *));
|
|
|
|
|
static void notice_stack_pointer_modification PARAMS ((rtx));
|
2000-02-04 22:30:22 +01:00
|
|
|
|
static void mark_reg PARAMS ((rtx, void *));
|
2000-01-14 18:14:43 +01:00
|
|
|
|
static void mark_regs_live_at_end PARAMS ((regset));
|
2000-04-06 23:22:49 +02:00
|
|
|
|
static int set_phi_alternative_reg PARAMS ((rtx, int, int, void *));
|
2000-01-14 18:14:43 +01:00
|
|
|
|
static void calculate_global_regs_live PARAMS ((sbitmap, sbitmap, int));
|
2000-04-08 01:33:47 +02:00
|
|
|
|
static void propagate_block_delete_insn PARAMS ((basic_block, rtx));
|
|
|
|
|
static rtx propagate_block_delete_libcall PARAMS ((basic_block, rtx, rtx));
|
|
|
|
|
static int insn_dead_p PARAMS ((struct propagate_block_info *,
|
|
|
|
|
rtx, int, rtx));
|
|
|
|
|
static int libcall_dead_p PARAMS ((struct propagate_block_info *,
|
2000-07-17 12:16:18 +02:00
|
|
|
|
rtx, rtx));
|
2000-04-08 01:33:47 +02:00
|
|
|
|
static void mark_set_regs PARAMS ((struct propagate_block_info *,
|
2000-04-12 03:38:15 +02:00
|
|
|
|
rtx, rtx));
|
2000-04-08 01:33:47 +02:00
|
|
|
|
static void mark_set_1 PARAMS ((struct propagate_block_info *,
|
2000-04-27 07:42:25 +02:00
|
|
|
|
enum rtx_code, rtx, rtx,
|
|
|
|
|
rtx, int));
|
2000-04-30 12:37:57 +02:00
|
|
|
|
#ifdef HAVE_conditional_execution
|
|
|
|
|
static int mark_regno_cond_dead PARAMS ((struct propagate_block_info *,
|
|
|
|
|
int, rtx));
|
|
|
|
|
static void free_reg_cond_life_info PARAMS ((splay_tree_value));
|
|
|
|
|
static int flush_reg_cond_reg_1 PARAMS ((splay_tree_node, void *));
|
|
|
|
|
static void flush_reg_cond_reg PARAMS ((struct propagate_block_info *,
|
|
|
|
|
int));
|
2000-12-19 17:52:23 +01:00
|
|
|
|
static rtx elim_reg_cond PARAMS ((rtx, unsigned int));
|
|
|
|
|
static rtx ior_reg_cond PARAMS ((rtx, rtx, int));
|
2000-04-30 12:37:57 +02:00
|
|
|
|
static rtx not_reg_cond PARAMS ((rtx));
|
2000-12-19 17:52:23 +01:00
|
|
|
|
static rtx and_reg_cond PARAMS ((rtx, rtx, int));
|
2000-04-30 12:37:57 +02:00
|
|
|
|
#endif
|
1997-12-20 12:31:54 +01:00
|
|
|
|
#ifdef AUTO_INC_DEC
|
2000-07-28 19:46:18 +02:00
|
|
|
|
static void attempt_auto_inc PARAMS ((struct propagate_block_info *,
|
|
|
|
|
rtx, rtx, rtx, rtx, rtx));
|
2000-04-08 01:33:47 +02:00
|
|
|
|
static void find_auto_inc PARAMS ((struct propagate_block_info *,
|
|
|
|
|
rtx, rtx));
|
|
|
|
|
static int try_pre_increment_1 PARAMS ((struct propagate_block_info *,
|
|
|
|
|
rtx));
|
2000-01-14 18:14:43 +01:00
|
|
|
|
static int try_pre_increment PARAMS ((rtx, rtx, HOST_WIDE_INT));
|
1997-12-20 12:31:54 +01:00
|
|
|
|
#endif
|
2000-04-08 01:33:47 +02:00
|
|
|
|
static void mark_used_reg PARAMS ((struct propagate_block_info *,
|
2000-04-12 03:38:15 +02:00
|
|
|
|
rtx, rtx, rtx));
|
2000-04-08 01:33:47 +02:00
|
|
|
|
static void mark_used_regs PARAMS ((struct propagate_block_info *,
|
2000-04-12 03:38:15 +02:00
|
|
|
|
rtx, rtx, rtx));
|
2000-01-14 18:14:43 +01:00
|
|
|
|
void dump_flow_info PARAMS ((FILE *));
|
|
|
|
|
void debug_flow_info PARAMS ((void));
|
|
|
|
|
static void dump_edge_info PARAMS ((FILE *, edge, int));
|
2000-11-23 19:19:18 +01:00
|
|
|
|
static void print_rtl_and_abort PARAMS ((void));
|
2000-01-14 18:14:43 +01:00
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
static void invalidate_mems_from_autoinc PARAMS ((struct propagate_block_info *,
|
|
|
|
|
rtx));
|
2000-11-10 03:03:28 +01:00
|
|
|
|
static void invalidate_mems_from_set PARAMS ((struct propagate_block_info *,
|
|
|
|
|
rtx));
|
2000-01-14 18:14:43 +01:00
|
|
|
|
static void remove_fake_successors PARAMS ((basic_block));
|
2001-01-02 08:00:49 +01:00
|
|
|
|
static void flow_nodes_print PARAMS ((const char *, const sbitmap,
|
2000-08-25 12:20:22 +02:00
|
|
|
|
FILE *));
|
|
|
|
|
static void flow_edge_list_print PARAMS ((const char *, const edge *,
|
|
|
|
|
int, FILE *));
|
|
|
|
|
static void flow_loops_cfg_dump PARAMS ((const struct loops *,
|
|
|
|
|
FILE *));
|
2001-01-02 08:00:49 +01:00
|
|
|
|
static int flow_loop_nested_p PARAMS ((struct loop *,
|
2000-08-25 12:20:22 +02:00
|
|
|
|
struct loop *));
|
2001-01-02 08:00:49 +01:00
|
|
|
|
static int flow_loop_entry_edges_find PARAMS ((basic_block, const sbitmap,
|
2000-08-25 12:20:22 +02:00
|
|
|
|
edge **));
|
|
|
|
|
static int flow_loop_exit_edges_find PARAMS ((const sbitmap, edge **));
|
2000-01-14 18:14:43 +01:00
|
|
|
|
static int flow_loop_nodes_find PARAMS ((basic_block, basic_block, sbitmap));
|
2000-07-30 12:35:03 +02:00
|
|
|
|
static int flow_depth_first_order_compute PARAMS ((int *, int *));
|
2000-08-02 06:21:27 +02:00
|
|
|
|
static void flow_dfs_compute_reverse_init
|
|
|
|
|
PARAMS ((depth_first_search_ds));
|
|
|
|
|
static void flow_dfs_compute_reverse_add_bb
|
|
|
|
|
PARAMS ((depth_first_search_ds, basic_block));
|
|
|
|
|
static basic_block flow_dfs_compute_reverse_execute
|
|
|
|
|
PARAMS ((depth_first_search_ds));
|
|
|
|
|
static void flow_dfs_compute_reverse_finish
|
|
|
|
|
PARAMS ((depth_first_search_ds));
|
2000-09-11 23:42:07 +02:00
|
|
|
|
static void flow_loop_pre_header_scan PARAMS ((struct loop *));
|
|
|
|
|
static basic_block flow_loop_pre_header_find PARAMS ((basic_block,
|
|
|
|
|
const sbitmap *));
|
2000-01-14 18:14:43 +01:00
|
|
|
|
static void flow_loop_tree_node_add PARAMS ((struct loop *, struct loop *));
|
|
|
|
|
static void flow_loops_tree_build PARAMS ((struct loops *));
|
|
|
|
|
static int flow_loop_level_compute PARAMS ((struct loop *, int));
|
|
|
|
|
static int flow_loops_level_compute PARAMS ((struct loops *));
|
2000-10-13 08:26:46 +02:00
|
|
|
|
static void allocate_bb_life_data PARAMS ((void));
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1998-03-05 23:31:51 +01:00
|
|
|
|
/* Find basic blocks of the current function.
|
1999-02-26 00:45:42 +01:00
|
|
|
|
F is the first insn of the function and NREGS the number of register
|
|
|
|
|
numbers in use. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
void
|
2000-01-28 23:22:50 +01:00
|
|
|
|
find_basic_blocks (f, nregs, file)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
rtx f;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
int nregs ATTRIBUTE_UNUSED;
|
|
|
|
|
FILE *file ATTRIBUTE_UNUSED;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
int max_uid;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Flush out existing data. */
|
|
|
|
|
if (basic_block_info != NULL)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
1998-10-30 00:18:51 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
clear_edges ();
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Clear bb->aux on all extant basic blocks. We'll use this as a
|
1999-02-26 00:45:42 +01:00
|
|
|
|
tag for reuse during create_basic_block, just in case some pass
|
|
|
|
|
copies around basic block notes improperly. */
|
|
|
|
|
for (i = 0; i < n_basic_blocks; ++i)
|
|
|
|
|
BASIC_BLOCK (i)->aux = NULL;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
VARRAY_FREE (basic_block_info);
|
|
|
|
|
}
|
1998-10-14 00:19:54 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
n_basic_blocks = count_basic_blocks (f);
|
1998-10-14 00:19:54 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Size the basic block table. The actual structures will be allocated
|
|
|
|
|
by find_basic_blocks_1, since we want to keep the structure pointers
|
|
|
|
|
stable across calls to find_basic_blocks. */
|
|
|
|
|
/* ??? This whole issue would be much simpler if we called find_basic_blocks
|
2000-08-11 14:45:05 +02:00
|
|
|
|
exactly once, and thereafter we don't have a single long chain of
|
1999-02-26 00:45:42 +01:00
|
|
|
|
instructions at all until close to the end of compilation when we
|
|
|
|
|
actually lay them out. */
|
1996-06-10 20:14:11 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
VARRAY_BB_INIT (basic_block_info, n_basic_blocks, "basic_block_info");
|
|
|
|
|
|
2000-05-12 18:26:15 +02:00
|
|
|
|
find_basic_blocks_1 (f);
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Record the block to which an insn belongs. */
|
|
|
|
|
/* ??? This should be done another way, by which (perhaps) a label is
|
|
|
|
|
tagged directly with the basic block that it starts. It is used for
|
|
|
|
|
more than that currently, but IMO that is the only valid use. */
|
|
|
|
|
|
|
|
|
|
max_uid = get_max_uid ();
|
1992-01-15 22:33:30 +01:00
|
|
|
|
#ifdef AUTO_INC_DEC
|
1998-03-05 23:31:51 +01:00
|
|
|
|
/* Leave space for insns life_analysis makes in some cases for auto-inc.
|
|
|
|
|
These cases are rare, so we don't need too much space. */
|
1999-02-26 00:45:42 +01:00
|
|
|
|
max_uid += max_uid / 10;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
#endif
|
|
|
|
|
|
1999-09-20 22:11:36 +02:00
|
|
|
|
compute_bb_for_insn (max_uid);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
/* Discover the edges of our cfg. */
|
1999-09-21 23:15:37 +02:00
|
|
|
|
record_active_eh_regions (f);
|
|
|
|
|
make_edges (label_value_list);
|
2000-02-09 00:48:32 +01:00
|
|
|
|
|
|
|
|
|
/* Do very simple cleanup now, for the benefit of code that runs between
|
|
|
|
|
here and cleanup_cfg, e.g. thread_prologue_and_epilogue_insns. */
|
|
|
|
|
tidy_fallthru_edges ();
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
mark_critical_edges ();
|
|
|
|
|
|
1999-04-07 00:10:53 +02:00
|
|
|
|
#ifdef ENABLE_CHECKING
|
|
|
|
|
verify_flow_info ();
|
|
|
|
|
#endif
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
1998-03-05 23:31:51 +01:00
|
|
|
|
|
2000-10-06 08:01:27 +02:00
|
|
|
|
void
|
|
|
|
|
check_function_return_warnings ()
|
|
|
|
|
{
|
|
|
|
|
if (warn_missing_noreturn
|
|
|
|
|
&& !TREE_THIS_VOLATILE (cfun->decl)
|
2001-01-02 08:00:49 +01:00
|
|
|
|
&& EXIT_BLOCK_PTR->pred == NULL
|
|
|
|
|
&& (lang_missing_noreturn_ok_p
|
|
|
|
|
&& !lang_missing_noreturn_ok_p (cfun->decl)))
|
2000-10-06 08:01:27 +02:00
|
|
|
|
warning ("function might be possible candidate for attribute `noreturn'");
|
|
|
|
|
|
|
|
|
|
/* If we have a path to EXIT, then we do return. */
|
|
|
|
|
if (TREE_THIS_VOLATILE (cfun->decl)
|
|
|
|
|
&& EXIT_BLOCK_PTR->pred != NULL)
|
|
|
|
|
warning ("`noreturn' function does return");
|
|
|
|
|
|
|
|
|
|
/* If the clobber_return_insn appears in some basic block, then we
|
|
|
|
|
do reach the end without returning a value. */
|
|
|
|
|
else if (warn_return_type
|
|
|
|
|
&& cfun->x_clobber_return_insn != NULL
|
|
|
|
|
&& EXIT_BLOCK_PTR->pred != NULL)
|
|
|
|
|
{
|
|
|
|
|
int max_uid = get_max_uid ();
|
|
|
|
|
|
|
|
|
|
/* If clobber_return_insn was excised by jump1, then renumber_insns
|
|
|
|
|
can make max_uid smaller than the number still recorded in our rtx.
|
|
|
|
|
That's fine, since this is a quick way of verifying that the insn
|
|
|
|
|
is no longer in the chain. */
|
|
|
|
|
if (INSN_UID (cfun->x_clobber_return_insn) < max_uid)
|
|
|
|
|
{
|
|
|
|
|
/* Recompute insn->block mapping, since the initial mapping is
|
|
|
|
|
set before we delete unreachable blocks. */
|
|
|
|
|
compute_bb_for_insn (max_uid);
|
|
|
|
|
|
|
|
|
|
if (BLOCK_FOR_INSN (cfun->x_clobber_return_insn) != NULL)
|
|
|
|
|
warning ("control reaches end of non-void function");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Count the basic blocks of the function. */
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
static int
|
1999-02-26 00:45:42 +01:00
|
|
|
|
count_basic_blocks (f)
|
|
|
|
|
rtx f;
|
|
|
|
|
{
|
|
|
|
|
register rtx insn;
|
|
|
|
|
register RTX_CODE prev_code;
|
|
|
|
|
register int count = 0;
|
|
|
|
|
int eh_region = 0;
|
|
|
|
|
int call_had_abnormal_edge = 0;
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
prev_code = JUMP_INSN;
|
|
|
|
|
for (insn = f; insn; insn = NEXT_INSN (insn))
|
|
|
|
|
{
|
|
|
|
|
register RTX_CODE code = GET_CODE (insn);
|
|
|
|
|
|
|
|
|
|
if (code == CODE_LABEL
|
|
|
|
|
|| (GET_RTX_CLASS (code) == 'i'
|
|
|
|
|
&& (prev_code == JUMP_INSN
|
|
|
|
|
|| prev_code == BARRIER
|
2000-04-15 17:20:58 +02:00
|
|
|
|
|| (prev_code == CALL_INSN && call_had_abnormal_edge))))
|
2000-04-15 00:04:58 +02:00
|
|
|
|
count++;
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Record whether this call created an edge. */
|
|
|
|
|
if (code == CALL_INSN)
|
|
|
|
|
{
|
1999-04-27 19:08:37 +02:00
|
|
|
|
rtx note = find_reg_note (insn, REG_EH_REGION, NULL_RTX);
|
2000-03-10 20:21:06 +01:00
|
|
|
|
int region = (note ? INTVAL (XEXP (note, 0)) : 1);
|
2000-04-15 00:04:58 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
call_had_abnormal_edge = 0;
|
1999-04-27 19:08:37 +02:00
|
|
|
|
|
2000-03-08 22:30:17 +01:00
|
|
|
|
/* If there is an EH region or rethrow, we have an edge. */
|
|
|
|
|
if ((eh_region && region > 0)
|
|
|
|
|
|| find_reg_note (insn, REG_EH_RETHROW, NULL_RTX))
|
1999-04-27 19:08:37 +02:00
|
|
|
|
call_had_abnormal_edge = 1;
|
2000-04-15 00:04:58 +02:00
|
|
|
|
else if (nonlocal_goto_handler_labels && region >= 0)
|
|
|
|
|
/* If there is a nonlocal goto label and the specified
|
|
|
|
|
region number isn't -1, we have an edge. (0 means
|
|
|
|
|
no throw, but might have a nonlocal goto). */
|
|
|
|
|
call_had_abnormal_edge = 1;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (code != NOTE)
|
|
|
|
|
prev_code = code;
|
|
|
|
|
else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG)
|
|
|
|
|
++eh_region;
|
|
|
|
|
else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END)
|
|
|
|
|
--eh_region;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The rest of the compiler works a bit smoother when we don't have to
|
|
|
|
|
check for the edge case of do-nothing functions with no basic blocks. */
|
|
|
|
|
if (count == 0)
|
|
|
|
|
{
|
|
|
|
|
emit_insn (gen_rtx_USE (VOIDmode, const0_rtx));
|
|
|
|
|
count = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
|
2000-07-23 01:29:14 +02:00
|
|
|
|
/* Scan a list of insns for labels referred to other than by jumps.
|
2000-05-26 12:30:47 +02:00
|
|
|
|
This is used to scan the alternatives of a call placeholder. */
|
2000-07-23 01:29:14 +02:00
|
|
|
|
static rtx
|
|
|
|
|
find_label_refs (f, lvl)
|
2000-05-26 12:30:47 +02:00
|
|
|
|
rtx f;
|
|
|
|
|
rtx lvl;
|
|
|
|
|
{
|
|
|
|
|
rtx insn;
|
|
|
|
|
|
|
|
|
|
for (insn = f; insn; insn = NEXT_INSN (insn))
|
2001-01-07 03:26:51 +01:00
|
|
|
|
if (INSN_P (insn) && GET_CODE (insn) != JUMP_INSN)
|
2000-05-26 12:30:47 +02:00
|
|
|
|
{
|
|
|
|
|
rtx note;
|
|
|
|
|
|
|
|
|
|
/* Make a list of all labels referred to other than by jumps
|
2000-08-11 14:45:05 +02:00
|
|
|
|
(which just don't have the REG_LABEL notes).
|
2000-05-26 12:30:47 +02:00
|
|
|
|
|
|
|
|
|
Make a special exception for labels followed by an ADDR*VEC,
|
2000-08-11 14:45:05 +02:00
|
|
|
|
as this would be a part of the tablejump setup code.
|
2000-05-26 12:30:47 +02:00
|
|
|
|
|
|
|
|
|
Make a special exception for the eh_return_stub_label, which
|
2001-01-07 03:26:51 +01:00
|
|
|
|
we know isn't part of any otherwise visible control flow.
|
|
|
|
|
|
|
|
|
|
Make a special exception to registers loaded with label
|
|
|
|
|
values just before jump insns that use them. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-05-26 12:30:47 +02:00
|
|
|
|
for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
|
|
|
|
|
if (REG_NOTE_KIND (note) == REG_LABEL)
|
|
|
|
|
{
|
|
|
|
|
rtx lab = XEXP (note, 0), next;
|
|
|
|
|
|
|
|
|
|
if (lab == eh_return_stub_label)
|
|
|
|
|
;
|
|
|
|
|
else if ((next = next_nonnote_insn (lab)) != NULL
|
|
|
|
|
&& GET_CODE (next) == JUMP_INSN
|
|
|
|
|
&& (GET_CODE (PATTERN (next)) == ADDR_VEC
|
|
|
|
|
|| GET_CODE (PATTERN (next)) == ADDR_DIFF_VEC))
|
|
|
|
|
;
|
|
|
|
|
else if (GET_CODE (lab) == NOTE)
|
|
|
|
|
;
|
2001-01-07 03:26:51 +01:00
|
|
|
|
else if (GET_CODE (NEXT_INSN (insn)) == JUMP_INSN
|
|
|
|
|
&& find_reg_note (NEXT_INSN (insn), REG_LABEL, lab))
|
|
|
|
|
;
|
2000-05-26 12:30:47 +02:00
|
|
|
|
else
|
|
|
|
|
lvl = alloc_EXPR_LIST (0, XEXP (note, 0), lvl);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return lvl;
|
|
|
|
|
}
|
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
/* Find all basic blocks of the function whose first insn is F.
|
|
|
|
|
|
1999-09-21 23:15:37 +02:00
|
|
|
|
Collect and return a list of labels whose addresses are taken. This
|
|
|
|
|
will be used in make_edges for use with computed gotos. */
|
1994-11-15 16:38:07 +01:00
|
|
|
|
|
2000-05-12 18:26:15 +02:00
|
|
|
|
static void
|
1999-09-21 23:15:37 +02:00
|
|
|
|
find_basic_blocks_1 (f)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
rtx f;
|
|
|
|
|
{
|
|
|
|
|
register rtx insn, next;
|
|
|
|
|
int i = 0;
|
|
|
|
|
rtx bb_note = NULL_RTX;
|
|
|
|
|
rtx eh_list = NULL_RTX;
|
2000-05-12 18:26:15 +02:00
|
|
|
|
rtx lvl = NULL_RTX;
|
|
|
|
|
rtx trll = NULL_RTX;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
rtx head = NULL_RTX;
|
|
|
|
|
rtx end = NULL_RTX;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* We process the instructions in a slightly different way than we did
|
|
|
|
|
previously. This is so that we see a NOTE_BASIC_BLOCK after we have
|
|
|
|
|
closed out the previous block, so that it gets attached at the proper
|
|
|
|
|
place. Since this form should be equivalent to the previous,
|
1999-09-21 23:15:37 +02:00
|
|
|
|
count_basic_blocks continues to use the old form as a check. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
for (insn = f; insn; insn = next)
|
|
|
|
|
{
|
|
|
|
|
enum rtx_code code = GET_CODE (insn);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
next = NEXT_INSN (insn);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
switch (code)
|
1994-02-03 21:27:23 +01:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
case NOTE:
|
|
|
|
|
{
|
|
|
|
|
int kind = NOTE_LINE_NUMBER (insn);
|
|
|
|
|
|
|
|
|
|
/* Keep a LIFO list of the currently active exception notes. */
|
|
|
|
|
if (kind == NOTE_INSN_EH_REGION_BEG)
|
1999-09-21 23:15:37 +02:00
|
|
|
|
eh_list = alloc_INSN_LIST (insn, eh_list);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
else if (kind == NOTE_INSN_EH_REGION_END)
|
1999-09-21 23:15:37 +02:00
|
|
|
|
{
|
|
|
|
|
rtx t = eh_list;
|
2000-04-15 00:04:58 +02:00
|
|
|
|
|
1999-09-21 23:15:37 +02:00
|
|
|
|
eh_list = XEXP (eh_list, 1);
|
|
|
|
|
free_INSN_LIST_node (t);
|
|
|
|
|
}
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Look for basic block notes with which to keep the
|
1999-02-26 00:45:42 +01:00
|
|
|
|
basic_block_info pointers stable. Unthread the note now;
|
|
|
|
|
we'll put it back at the right place in create_basic_block.
|
|
|
|
|
Or not at all if we've already found a note in this block. */
|
|
|
|
|
else if (kind == NOTE_INSN_BASIC_BLOCK)
|
|
|
|
|
{
|
|
|
|
|
if (bb_note == NULL_RTX)
|
|
|
|
|
bb_note = insn;
|
2000-05-10 07:48:40 +02:00
|
|
|
|
else
|
|
|
|
|
next = flow_delete_insn (insn);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
case CODE_LABEL:
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* A basic block starts at a label. If we've closed one off due
|
1999-02-26 00:45:42 +01:00
|
|
|
|
to a barrier or some such, no need to do it again. */
|
|
|
|
|
if (head != NULL_RTX)
|
1997-11-12 17:36:43 +01:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* While we now have edge lists with which other portions of
|
|
|
|
|
the compiler might determine a call ending a basic block
|
|
|
|
|
does not imply an abnormal edge, it will be a bit before
|
|
|
|
|
everything can be updated. So continue to emit a noop at
|
|
|
|
|
the end of such a block. */
|
2000-04-15 00:04:58 +02:00
|
|
|
|
if (GET_CODE (end) == CALL_INSN && ! SIBLING_CALL_P (end))
|
1999-02-26 00:45:42 +01:00
|
|
|
|
{
|
|
|
|
|
rtx nop = gen_rtx_USE (VOIDmode, const0_rtx);
|
|
|
|
|
end = emit_insn_after (nop, end);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
create_basic_block (i++, head, end, bb_note);
|
|
|
|
|
bb_note = NULL_RTX;
|
1997-11-12 17:36:43 +01:00
|
|
|
|
}
|
2000-04-15 00:04:58 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
head = end = insn;
|
|
|
|
|
break;
|
1998-09-21 15:59:47 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
case JUMP_INSN:
|
|
|
|
|
/* A basic block ends at a jump. */
|
|
|
|
|
if (head == NULL_RTX)
|
|
|
|
|
head = insn;
|
|
|
|
|
else
|
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* ??? Make a special check for table jumps. The way this
|
1999-10-05 05:44:26 +02:00
|
|
|
|
happens is truly and amazingly gross. We are about to
|
1999-02-26 00:45:42 +01:00
|
|
|
|
create a basic block that contains just a code label and
|
|
|
|
|
an addr*vec jump insn. Worse, an addr_diff_vec creates
|
|
|
|
|
its own natural loop.
|
1998-10-08 03:26:18 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
Prevent this bit of brain damage, pasting things together
|
2000-08-11 14:45:05 +02:00
|
|
|
|
correctly in make_edges.
|
1997-12-28 00:34:14 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
The correct solution involves emitting the table directly
|
|
|
|
|
on the tablejump instruction as a note, or JUMP_LABEL. */
|
1994-02-03 21:27:23 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (GET_CODE (PATTERN (insn)) == ADDR_VEC
|
|
|
|
|
|| GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC)
|
|
|
|
|
{
|
|
|
|
|
head = end = NULL;
|
|
|
|
|
n_basic_blocks--;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
end = insn;
|
|
|
|
|
goto new_bb_inclusive;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
case BARRIER:
|
|
|
|
|
/* A basic block ends at a barrier. It may be that an unconditional
|
|
|
|
|
jump already closed the basic block -- no need to do it again. */
|
|
|
|
|
if (head == NULL_RTX)
|
|
|
|
|
break;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* While we now have edge lists with which other portions of the
|
|
|
|
|
compiler might determine a call ending a basic block does not
|
|
|
|
|
imply an abnormal edge, it will be a bit before everything can
|
|
|
|
|
be updated. So continue to emit a noop at the end of such a
|
|
|
|
|
block. */
|
2000-04-15 00:04:58 +02:00
|
|
|
|
if (GET_CODE (end) == CALL_INSN && ! SIBLING_CALL_P (end))
|
1999-02-26 00:45:42 +01:00
|
|
|
|
{
|
|
|
|
|
rtx nop = gen_rtx_USE (VOIDmode, const0_rtx);
|
|
|
|
|
end = emit_insn_after (nop, end);
|
|
|
|
|
}
|
|
|
|
|
goto new_bb_exclusive;
|
|
|
|
|
|
|
|
|
|
case CALL_INSN:
|
2000-04-15 00:04:58 +02:00
|
|
|
|
{
|
|
|
|
|
/* Record whether this call created an edge. */
|
|
|
|
|
rtx note = find_reg_note (insn, REG_EH_REGION, NULL_RTX);
|
|
|
|
|
int region = (note ? INTVAL (XEXP (note, 0)) : 1);
|
|
|
|
|
int call_has_abnormal_edge = 0;
|
|
|
|
|
|
2000-05-26 12:30:47 +02:00
|
|
|
|
if (GET_CODE (PATTERN (insn)) == CALL_PLACEHOLDER)
|
|
|
|
|
{
|
|
|
|
|
/* Scan each of the alternatives for label refs. */
|
|
|
|
|
lvl = find_label_refs (XEXP (PATTERN (insn), 0), lvl);
|
|
|
|
|
lvl = find_label_refs (XEXP (PATTERN (insn), 1), lvl);
|
|
|
|
|
lvl = find_label_refs (XEXP (PATTERN (insn), 2), lvl);
|
|
|
|
|
/* Record its tail recursion label, if any. */
|
|
|
|
|
if (XEXP (PATTERN (insn), 3) != NULL_RTX)
|
|
|
|
|
trll = alloc_EXPR_LIST (0, XEXP (PATTERN (insn), 3), trll);
|
|
|
|
|
}
|
2000-05-12 18:26:15 +02:00
|
|
|
|
|
2000-04-15 00:04:58 +02:00
|
|
|
|
/* If there is an EH region or rethrow, we have an edge. */
|
|
|
|
|
if ((eh_list && region > 0)
|
|
|
|
|
|| find_reg_note (insn, REG_EH_RETHROW, NULL_RTX))
|
|
|
|
|
call_has_abnormal_edge = 1;
|
|
|
|
|
else if (nonlocal_goto_handler_labels && region >= 0)
|
|
|
|
|
/* If there is a nonlocal goto label and the specified
|
|
|
|
|
region number isn't -1, we have an edge. (0 means
|
|
|
|
|
no throw, but might have a nonlocal goto). */
|
|
|
|
|
call_has_abnormal_edge = 1;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
2000-04-15 00:04:58 +02:00
|
|
|
|
/* A basic block ends at a call that can either throw or
|
2000-04-15 17:20:58 +02:00
|
|
|
|
do a non-local goto. */
|
|
|
|
|
if (call_has_abnormal_edge)
|
2000-04-15 00:04:58 +02:00
|
|
|
|
{
|
|
|
|
|
new_bb_inclusive:
|
|
|
|
|
if (head == NULL_RTX)
|
|
|
|
|
head = insn;
|
|
|
|
|
end = insn;
|
|
|
|
|
|
|
|
|
|
new_bb_exclusive:
|
|
|
|
|
create_basic_block (i++, head, end, bb_note);
|
|
|
|
|
head = end = NULL_RTX;
|
|
|
|
|
bb_note = NULL_RTX;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2000-08-11 14:45:05 +02:00
|
|
|
|
}
|
|
|
|
|
/* Fall through. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
default:
|
|
|
|
|
if (GET_RTX_CLASS (code) == 'i')
|
|
|
|
|
{
|
|
|
|
|
if (head == NULL_RTX)
|
|
|
|
|
head = insn;
|
|
|
|
|
end = insn;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2001-01-07 03:26:51 +01:00
|
|
|
|
if (GET_RTX_CLASS (code) == 'i'
|
|
|
|
|
&& GET_CODE (insn) != JUMP_INSN)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
rtx note;
|
1998-10-30 00:18:51 +01:00
|
|
|
|
|
2001-01-07 03:26:51 +01:00
|
|
|
|
/* Make a list of all labels referred to other than by jumps.
|
1997-11-12 17:36:43 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
Make a special exception for labels followed by an ADDR*VEC,
|
2000-08-11 14:45:05 +02:00
|
|
|
|
as this would be a part of the tablejump setup code.
|
1998-10-30 00:18:51 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
Make a special exception for the eh_return_stub_label, which
|
2001-01-07 03:26:51 +01:00
|
|
|
|
we know isn't part of any otherwise visible control flow.
|
|
|
|
|
|
|
|
|
|
Make a special exception to registers loaded with label
|
|
|
|
|
values just before jump insns that use them. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
|
2000-04-15 17:20:58 +02:00
|
|
|
|
if (REG_NOTE_KIND (note) == REG_LABEL)
|
|
|
|
|
{
|
|
|
|
|
rtx lab = XEXP (note, 0), next;
|
2000-04-15 00:04:58 +02:00
|
|
|
|
|
2000-04-15 17:20:58 +02:00
|
|
|
|
if (lab == eh_return_stub_label)
|
2000-05-12 18:26:15 +02:00
|
|
|
|
;
|
2000-04-15 17:20:58 +02:00
|
|
|
|
else if ((next = next_nonnote_insn (lab)) != NULL
|
|
|
|
|
&& GET_CODE (next) == JUMP_INSN
|
|
|
|
|
&& (GET_CODE (PATTERN (next)) == ADDR_VEC
|
|
|
|
|
|| GET_CODE (PATTERN (next)) == ADDR_DIFF_VEC))
|
|
|
|
|
;
|
2000-05-12 18:26:15 +02:00
|
|
|
|
else if (GET_CODE (lab) == NOTE)
|
|
|
|
|
;
|
2001-01-07 03:26:51 +01:00
|
|
|
|
else if (GET_CODE (NEXT_INSN (insn)) == JUMP_INSN
|
|
|
|
|
&& find_reg_note (NEXT_INSN (insn), REG_LABEL, lab))
|
|
|
|
|
;
|
2000-04-15 17:20:58 +02:00
|
|
|
|
else
|
2000-05-12 18:26:15 +02:00
|
|
|
|
lvl = alloc_EXPR_LIST (0, XEXP (note, 0), lvl);
|
2000-04-15 17:20:58 +02:00
|
|
|
|
}
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (head != NULL_RTX)
|
1999-09-21 23:15:37 +02:00
|
|
|
|
create_basic_block (i++, head, end, bb_note);
|
2000-05-10 19:42:17 +02:00
|
|
|
|
else if (bb_note)
|
|
|
|
|
flow_delete_insn (bb_note);
|
1994-10-26 12:33:33 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (i != n_basic_blocks)
|
|
|
|
|
abort ();
|
1994-10-26 12:33:33 +01:00
|
|
|
|
|
2000-05-12 18:26:15 +02:00
|
|
|
|
label_value_list = lvl;
|
|
|
|
|
tail_recursion_label_list = trll;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
1998-03-05 23:31:51 +01:00
|
|
|
|
|
2000-01-28 23:22:50 +01:00
|
|
|
|
/* Tidy the CFG by deleting unreachable code and whatnot. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cleanup_cfg (f)
|
|
|
|
|
rtx f;
|
|
|
|
|
{
|
|
|
|
|
delete_unreachable_blocks ();
|
|
|
|
|
move_stray_eh_region_notes ();
|
|
|
|
|
record_active_eh_regions (f);
|
|
|
|
|
try_merge_blocks ();
|
|
|
|
|
mark_critical_edges ();
|
2000-02-02 14:56:01 +01:00
|
|
|
|
|
|
|
|
|
/* Kill the data we won't maintain. */
|
2000-05-12 18:26:15 +02:00
|
|
|
|
free_EXPR_LIST_list (&label_value_list);
|
|
|
|
|
free_EXPR_LIST_list (&tail_recursion_label_list);
|
2000-01-28 23:22:50 +01:00
|
|
|
|
}
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Create a new basic block consisting of the instructions between
|
|
|
|
|
HEAD and END inclusive. Reuses the note and basic block struct
|
|
|
|
|
in BB_NOTE, if any. */
|
1998-03-05 23:31:51 +01:00
|
|
|
|
|
2000-03-16 15:56:55 +01:00
|
|
|
|
void
|
1999-02-26 00:45:42 +01:00
|
|
|
|
create_basic_block (index, head, end, bb_note)
|
|
|
|
|
int index;
|
|
|
|
|
rtx head, end, bb_note;
|
1998-03-05 23:31:51 +01:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
basic_block bb;
|
|
|
|
|
|
|
|
|
|
if (bb_note
|
1999-02-28 17:41:04 +01:00
|
|
|
|
&& ! RTX_INTEGRATED_P (bb_note)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
&& (bb = NOTE_BASIC_BLOCK (bb_note)) != NULL
|
|
|
|
|
&& bb->aux == NULL)
|
1998-03-05 23:31:51 +01:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* If we found an existing note, thread it back onto the chain. */
|
|
|
|
|
|
2000-05-10 07:48:40 +02:00
|
|
|
|
rtx after;
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (GET_CODE (head) == CODE_LABEL)
|
2000-05-10 07:48:40 +02:00
|
|
|
|
after = head;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
2000-05-10 07:48:40 +02:00
|
|
|
|
after = PREV_INSN (head);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
head = bb_note;
|
|
|
|
|
}
|
2000-05-10 07:48:40 +02:00
|
|
|
|
|
|
|
|
|
if (after != bb_note && NEXT_INSN (after) != bb_note)
|
|
|
|
|
reorder_insns (bb_note, bb_note, after);
|
1998-03-05 23:31:51 +01:00
|
|
|
|
}
|
1999-02-26 00:45:42 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Otherwise we must create a note and a basic block structure.
|
|
|
|
|
Since we allow basic block structs in rtl, give the struct
|
|
|
|
|
the same lifetime by allocating it off the function obstack
|
|
|
|
|
rather than using malloc. */
|
1994-11-15 16:38:07 +01:00
|
|
|
|
|
2000-10-13 08:26:46 +02:00
|
|
|
|
bb = (basic_block) obstack_alloc (&flow_obstack, sizeof (*bb));
|
1999-02-26 00:45:42 +01:00
|
|
|
|
memset (bb, 0, sizeof (*bb));
|
1998-10-30 00:18:51 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (GET_CODE (head) == CODE_LABEL)
|
|
|
|
|
bb_note = emit_note_after (NOTE_INSN_BASIC_BLOCK, head);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bb_note = emit_note_before (NOTE_INSN_BASIC_BLOCK, head);
|
|
|
|
|
head = bb_note;
|
|
|
|
|
}
|
|
|
|
|
NOTE_BASIC_BLOCK (bb_note) = bb;
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-06 17:45:55 +02:00
|
|
|
|
/* Always include the bb note in the block. */
|
|
|
|
|
if (NEXT_INSN (end) == bb_note)
|
|
|
|
|
end = bb_note;
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
bb->head = head;
|
|
|
|
|
bb->end = end;
|
|
|
|
|
bb->index = index;
|
|
|
|
|
BASIC_BLOCK (index) = bb;
|
|
|
|
|
|
|
|
|
|
/* Tag the block so that we know it has been used when considering
|
|
|
|
|
other basic block notes. */
|
|
|
|
|
bb->aux = bb;
|
1998-10-30 00:18:51 +01:00
|
|
|
|
}
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
/* Records the basic block struct in BB_FOR_INSN, for every instruction
|
|
|
|
|
indexed by INSN_UID. MAX is the size of the array. */
|
1998-10-30 00:18:51 +01:00
|
|
|
|
|
1999-09-20 22:11:36 +02:00
|
|
|
|
void
|
|
|
|
|
compute_bb_for_insn (max)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
int max;
|
1998-10-30 00:18:51 +01:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
int i;
|
1998-10-30 00:18:51 +01:00
|
|
|
|
|
1999-10-20 16:04:12 +02:00
|
|
|
|
if (basic_block_for_insn)
|
|
|
|
|
VARRAY_FREE (basic_block_for_insn);
|
1999-09-20 22:11:36 +02:00
|
|
|
|
VARRAY_BB_INIT (basic_block_for_insn, max, "basic_block_for_insn");
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
for (i = 0; i < n_basic_blocks; ++i)
|
|
|
|
|
{
|
|
|
|
|
basic_block bb = BASIC_BLOCK (i);
|
|
|
|
|
rtx insn, end;
|
|
|
|
|
|
|
|
|
|
end = bb->end;
|
|
|
|
|
insn = bb->head;
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
int uid = INSN_UID (insn);
|
|
|
|
|
if (uid < max)
|
1999-09-20 22:11:36 +02:00
|
|
|
|
VARRAY_BB (basic_block_for_insn, uid) = bb;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (insn == end)
|
|
|
|
|
break;
|
|
|
|
|
insn = NEXT_INSN (insn);
|
|
|
|
|
}
|
|
|
|
|
}
|
1998-10-30 00:18:51 +01:00
|
|
|
|
}
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Free the memory associated with the edge structures. */
|
1998-10-30 00:18:51 +01:00
|
|
|
|
|
|
|
|
|
static void
|
1999-02-26 00:45:42 +01:00
|
|
|
|
clear_edges ()
|
1998-10-30 00:18:51 +01:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
int i;
|
|
|
|
|
edge n, e;
|
1998-10-30 00:18:51 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
for (i = 0; i < n_basic_blocks; ++i)
|
1998-10-30 00:18:51 +01:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
basic_block bb = BASIC_BLOCK (i);
|
1998-10-30 00:18:51 +01:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = bb->succ; e; e = n)
|
1998-10-30 00:18:51 +01:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
n = e->succ_next;
|
|
|
|
|
free (e);
|
1998-10-30 00:18:51 +01:00
|
|
|
|
}
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
bb->succ = 0;
|
|
|
|
|
bb->pred = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = ENTRY_BLOCK_PTR->succ; e; e = n)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
{
|
|
|
|
|
n = e->succ_next;
|
|
|
|
|
free (e);
|
1998-10-30 00:18:51 +01:00
|
|
|
|
}
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
ENTRY_BLOCK_PTR->succ = 0;
|
|
|
|
|
EXIT_BLOCK_PTR->pred = 0;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
|
|
|
|
n_edges = 0;
|
1998-10-30 00:18:51 +01:00
|
|
|
|
}
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Identify the edges between basic blocks.
|
|
|
|
|
|
|
|
|
|
NONLOCAL_LABEL_LIST is a list of non-local labels in the function. Blocks
|
|
|
|
|
that are otherwise unreachable may be reachable with a non-local goto.
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
BB_EH_END is an array indexed by basic block number in which we record
|
1999-02-26 00:45:42 +01:00
|
|
|
|
the list of exception regions active at the end of the basic block. */
|
|
|
|
|
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
static void
|
1999-09-21 23:15:37 +02:00
|
|
|
|
make_edges (label_value_list)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
rtx label_value_list;
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
int i;
|
1999-08-10 18:19:16 +02:00
|
|
|
|
eh_nesting_info *eh_nest_info = init_eh_nesting_info ();
|
1999-10-05 21:01:01 +02:00
|
|
|
|
sbitmap *edge_cache = NULL;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
/* Assume no computed jump; revise as we create edges. */
|
|
|
|
|
current_function_has_computed_jump = 0;
|
|
|
|
|
|
1999-10-05 21:01:01 +02:00
|
|
|
|
/* Heavy use of computed goto in machine-generated code can lead to
|
|
|
|
|
nearly fully-connected CFGs. In that case we spend a significant
|
|
|
|
|
amount of time searching the edge lists for duplicates. */
|
|
|
|
|
if (forced_labels || label_value_list)
|
|
|
|
|
{
|
|
|
|
|
edge_cache = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
|
|
|
|
|
sbitmap_vector_zero (edge_cache, n_basic_blocks);
|
|
|
|
|
}
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* By nature of the way these get numbered, block 0 is always the entry. */
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_edge (edge_cache, ENTRY_BLOCK_PTR, BASIC_BLOCK (0), EDGE_FALLTHRU);
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
for (i = 0; i < n_basic_blocks; ++i)
|
1998-10-30 00:18:51 +01:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
basic_block bb = BASIC_BLOCK (i);
|
1999-09-21 23:15:37 +02:00
|
|
|
|
rtx insn, x;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
enum rtx_code code;
|
1999-03-06 18:19:39 +01:00
|
|
|
|
int force_fallthru = 0;
|
1998-10-30 00:18:51 +01:00
|
|
|
|
|
1999-09-21 23:15:37 +02:00
|
|
|
|
/* Examine the last instruction of the block, and discover the
|
1999-02-26 00:45:42 +01:00
|
|
|
|
ways we can leave the block. */
|
|
|
|
|
|
|
|
|
|
insn = bb->end;
|
|
|
|
|
code = GET_CODE (insn);
|
|
|
|
|
|
|
|
|
|
/* A branch. */
|
|
|
|
|
if (code == JUMP_INSN)
|
|
|
|
|
{
|
|
|
|
|
rtx tmp;
|
|
|
|
|
|
2000-12-21 02:11:31 +01:00
|
|
|
|
/* Recognize a non-local goto as a branch outside the
|
|
|
|
|
current function. */
|
|
|
|
|
if (find_reg_note (insn, REG_NON_LOCAL_GOTO, NULL_RTX))
|
|
|
|
|
;
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* ??? Recognize a tablejump and do the right thing. */
|
2000-12-21 02:11:31 +01:00
|
|
|
|
else if ((tmp = JUMP_LABEL (insn)) != NULL_RTX
|
|
|
|
|
&& (tmp = NEXT_INSN (tmp)) != NULL_RTX
|
|
|
|
|
&& GET_CODE (tmp) == JUMP_INSN
|
|
|
|
|
&& (GET_CODE (PATTERN (tmp)) == ADDR_VEC
|
|
|
|
|
|| GET_CODE (PATTERN (tmp)) == ADDR_DIFF_VEC))
|
1999-02-26 00:45:42 +01:00
|
|
|
|
{
|
|
|
|
|
rtvec vec;
|
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (PATTERN (tmp)) == ADDR_VEC)
|
|
|
|
|
vec = XVEC (PATTERN (tmp), 0);
|
|
|
|
|
else
|
|
|
|
|
vec = XVEC (PATTERN (tmp), 1);
|
|
|
|
|
|
|
|
|
|
for (j = GET_NUM_ELEM (vec) - 1; j >= 0; --j)
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_label_edge (edge_cache, bb,
|
|
|
|
|
XEXP (RTVEC_ELT (vec, j), 0), 0);
|
1999-03-06 18:19:39 +01:00
|
|
|
|
|
|
|
|
|
/* Some targets (eg, ARM) emit a conditional jump that also
|
|
|
|
|
contains the out-of-range target. Scan for these and
|
|
|
|
|
add an edge if necessary. */
|
|
|
|
|
if ((tmp = single_set (insn)) != NULL
|
|
|
|
|
&& SET_DEST (tmp) == pc_rtx
|
|
|
|
|
&& GET_CODE (SET_SRC (tmp)) == IF_THEN_ELSE
|
|
|
|
|
&& GET_CODE (XEXP (SET_SRC (tmp), 2)) == LABEL_REF)
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_label_edge (edge_cache, bb,
|
|
|
|
|
XEXP (XEXP (SET_SRC (tmp), 2), 0), 0);
|
1999-03-06 18:19:39 +01:00
|
|
|
|
|
|
|
|
|
#ifdef CASE_DROPS_THROUGH
|
|
|
|
|
/* Silly VAXen. The ADDR_VEC is going to be in the way of
|
|
|
|
|
us naturally detecting fallthru into the next block. */
|
|
|
|
|
force_fallthru = 1;
|
|
|
|
|
#endif
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If this is a computed jump, then mark it as reaching
|
|
|
|
|
everything on the label_value_list and forced_labels list. */
|
|
|
|
|
else if (computed_jump_p (insn))
|
|
|
|
|
{
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
current_function_has_computed_jump = 1;
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
for (x = label_value_list; x; x = XEXP (x, 1))
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_label_edge (edge_cache, bb, XEXP (x, 0), EDGE_ABNORMAL);
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
for (x = forced_labels; x; x = XEXP (x, 1))
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_label_edge (edge_cache, bb, XEXP (x, 0), EDGE_ABNORMAL);
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Returns create an exit out. */
|
|
|
|
|
else if (returnjump_p (insn))
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_edge (edge_cache, bb, EXIT_BLOCK_PTR, 0);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
/* Otherwise, we have a plain conditional or unconditional jump. */
|
|
|
|
|
else
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (! JUMP_LABEL (insn))
|
|
|
|
|
abort ();
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_label_edge (edge_cache, bb, JUMP_LABEL (insn), 0);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* If this is a sibling call insn, then this is in effect a
|
2000-03-17 23:40:45 +01:00
|
|
|
|
combined call and return, and so we need an edge to the
|
|
|
|
|
exit block. No need to worry about EH edges, since we
|
|
|
|
|
wouldn't have created the sibling call in the first place. */
|
|
|
|
|
|
|
|
|
|
if (code == CALL_INSN && SIBLING_CALL_P (insn))
|
2000-10-07 22:53:21 +02:00
|
|
|
|
make_edge (edge_cache, bb, EXIT_BLOCK_PTR,
|
|
|
|
|
EDGE_ABNORMAL | EDGE_ABNORMAL_CALL);
|
2000-03-17 23:40:45 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* If this is a CALL_INSN, then mark it as reaching the active EH
|
|
|
|
|
handler for this CALL_INSN. If we're handling asynchronous
|
|
|
|
|
exceptions then any insn can reach any of the active handlers.
|
1999-01-19 10:39:37 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
Also mark the CALL_INSN as reaching any nonlocal goto handler. */
|
1999-01-19 10:39:37 +01:00
|
|
|
|
|
2000-10-07 22:53:21 +02:00
|
|
|
|
else if (code == CALL_INSN || asynchronous_exceptions)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
{
|
2000-03-08 22:30:17 +01:00
|
|
|
|
/* Add any appropriate EH edges. We do this unconditionally
|
|
|
|
|
since there may be a REG_EH_REGION or REG_EH_RETHROW note
|
|
|
|
|
on the call, and this needn't be within an EH region. */
|
|
|
|
|
make_eh_edge (edge_cache, eh_nest_info, bb, insn, bb->eh_end);
|
1999-09-21 23:15:37 +02:00
|
|
|
|
|
|
|
|
|
/* If we have asynchronous exceptions, do the same for *all*
|
|
|
|
|
exception regions active in the block. */
|
|
|
|
|
if (asynchronous_exceptions
|
|
|
|
|
&& bb->eh_beg != bb->eh_end)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
{
|
1999-09-21 23:15:37 +02:00
|
|
|
|
if (bb->eh_beg >= 0)
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_eh_edge (edge_cache, eh_nest_info, bb,
|
|
|
|
|
NULL_RTX, bb->eh_beg);
|
1999-09-21 23:15:37 +02:00
|
|
|
|
|
1999-10-05 05:44:26 +02:00
|
|
|
|
for (x = bb->head; x != bb->end; x = NEXT_INSN (x))
|
1999-09-21 23:15:37 +02:00
|
|
|
|
if (GET_CODE (x) == NOTE
|
|
|
|
|
&& (NOTE_LINE_NUMBER (x) == NOTE_INSN_EH_REGION_BEG
|
|
|
|
|
|| NOTE_LINE_NUMBER (x) == NOTE_INSN_EH_REGION_END))
|
|
|
|
|
{
|
|
|
|
|
int region = NOTE_EH_HANDLER (x);
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_eh_edge (edge_cache, eh_nest_info, bb,
|
|
|
|
|
NULL_RTX, region);
|
1999-09-21 23:15:37 +02:00
|
|
|
|
}
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (code == CALL_INSN && nonlocal_goto_handler_labels)
|
|
|
|
|
{
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
/* ??? This could be made smarter: in some cases it's possible
|
|
|
|
|
to tell that certain calls will not do a nonlocal goto.
|
|
|
|
|
|
|
|
|
|
For example, if the nested functions that do the nonlocal
|
|
|
|
|
gotos do not have their addresses taken, then only calls to
|
|
|
|
|
those functions or to other nested functions that use them
|
|
|
|
|
could possibly do nonlocal gotos. */
|
1999-08-10 18:19:16 +02:00
|
|
|
|
/* We do know that a REG_EH_REGION note with a value less
|
|
|
|
|
than 0 is guaranteed not to perform a non-local goto. */
|
|
|
|
|
rtx note = find_reg_note (insn, REG_EH_REGION, NULL_RTX);
|
2000-03-18 20:08:06 +01:00
|
|
|
|
if (!note || INTVAL (XEXP (note, 0)) >= 0)
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (x = nonlocal_goto_handler_labels; x; x = XEXP (x, 1))
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_label_edge (edge_cache, bb, XEXP (x, 0),
|
1999-08-10 18:19:16 +02:00
|
|
|
|
EDGE_ABNORMAL | EDGE_ABNORMAL_CALL);
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
/* We know something about the structure of the function __throw in
|
|
|
|
|
libgcc2.c. It is the only function that ever contains eh_stub
|
|
|
|
|
labels. It modifies its return address so that the last block
|
|
|
|
|
returns to one of the eh_stub labels within it. So we have to
|
|
|
|
|
make additional edges in the flow graph. */
|
|
|
|
|
if (i + 1 == n_basic_blocks && eh_return_stub_label != 0)
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_label_edge (edge_cache, bb, eh_return_stub_label, EDGE_EH);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
/* Find out if we can drop through to the next block. */
|
|
|
|
|
insn = next_nonnote_insn (insn);
|
1999-03-06 18:19:39 +01:00
|
|
|
|
if (!insn || (i + 1 == n_basic_blocks && force_fallthru))
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_edge (edge_cache, bb, EXIT_BLOCK_PTR, EDGE_FALLTHRU);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
else if (i + 1 < n_basic_blocks)
|
|
|
|
|
{
|
|
|
|
|
rtx tmp = BLOCK_HEAD (i + 1);
|
|
|
|
|
if (GET_CODE (tmp) == NOTE)
|
|
|
|
|
tmp = next_nonnote_insn (tmp);
|
1999-03-06 18:19:39 +01:00
|
|
|
|
if (force_fallthru || insn == tmp)
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_edge (edge_cache, bb, BASIC_BLOCK (i + 1), EDGE_FALLTHRU);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
}
|
1999-10-05 21:01:01 +02:00
|
|
|
|
|
1999-08-10 18:19:16 +02:00
|
|
|
|
free_eh_nesting_info (eh_nest_info);
|
1999-10-05 21:01:01 +02:00
|
|
|
|
if (edge_cache)
|
|
|
|
|
sbitmap_vector_free (edge_cache);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Create an edge between two basic blocks. FLAGS are auxiliary information
|
|
|
|
|
about the edge that is accumulated between calls. */
|
|
|
|
|
|
2000-02-06 14:01:03 +01:00
|
|
|
|
void
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_edge (edge_cache, src, dst, flags)
|
|
|
|
|
sbitmap *edge_cache;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
basic_block src, dst;
|
|
|
|
|
int flags;
|
|
|
|
|
{
|
1999-10-05 21:01:01 +02:00
|
|
|
|
int use_edge_cache;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
edge e;
|
|
|
|
|
|
1999-10-05 21:01:01 +02:00
|
|
|
|
/* Don't bother with edge cache for ENTRY or EXIT; there aren't that
|
|
|
|
|
many edges to them, and we didn't allocate memory for it. */
|
|
|
|
|
use_edge_cache = (edge_cache
|
|
|
|
|
&& src != ENTRY_BLOCK_PTR
|
|
|
|
|
&& dst != EXIT_BLOCK_PTR);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
1999-10-05 21:01:01 +02:00
|
|
|
|
/* Make sure we don't add duplicate edges. */
|
2000-11-30 22:40:33 +01:00
|
|
|
|
switch (use_edge_cache)
|
|
|
|
|
{
|
|
|
|
|
default:
|
|
|
|
|
/* Quick test for non-existance of the edge. */
|
|
|
|
|
if (! TEST_BIT (edge_cache[src->index], dst->index))
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* The edge exists; early exit if no work to do. */
|
|
|
|
|
if (flags == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* FALLTHRU */
|
|
|
|
|
case 0:
|
|
|
|
|
for (e = src->succ; e; e = e->succ_next)
|
|
|
|
|
if (e->dest == dst)
|
|
|
|
|
{
|
|
|
|
|
e->flags |= flags;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
e = (edge) xcalloc (1, sizeof (*e));
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
n_edges++;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
e->succ_next = src->succ;
|
|
|
|
|
e->pred_next = dst->pred;
|
|
|
|
|
e->src = src;
|
|
|
|
|
e->dest = dst;
|
|
|
|
|
e->flags = flags;
|
|
|
|
|
|
|
|
|
|
src->succ = e;
|
|
|
|
|
dst->pred = e;
|
1999-10-05 21:01:01 +02:00
|
|
|
|
|
|
|
|
|
if (use_edge_cache)
|
|
|
|
|
SET_BIT (edge_cache[src->index], dst->index);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Create an edge from a basic block to a label. */
|
|
|
|
|
|
|
|
|
|
static void
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_label_edge (edge_cache, src, label, flags)
|
|
|
|
|
sbitmap *edge_cache;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
basic_block src;
|
|
|
|
|
rtx label;
|
|
|
|
|
int flags;
|
|
|
|
|
{
|
|
|
|
|
if (GET_CODE (label) != CODE_LABEL)
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
/* If the label was never emitted, this insn is junk, but avoid a
|
|
|
|
|
crash trying to refer to BLOCK_FOR_INSN (label). This can happen
|
|
|
|
|
as a result of a syntax error and a diagnostic has already been
|
|
|
|
|
printed. */
|
|
|
|
|
|
|
|
|
|
if (INSN_UID (label) == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_edge (edge_cache, src, BLOCK_FOR_INSN (label), flags);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
1998-12-08 15:04:03 +01:00
|
|
|
|
|
1999-09-21 23:15:37 +02:00
|
|
|
|
/* Create the edges generated by INSN in REGION. */
|
|
|
|
|
|
|
|
|
|
static void
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_eh_edge (edge_cache, eh_nest_info, src, insn, region)
|
|
|
|
|
sbitmap *edge_cache;
|
1999-09-21 23:15:37 +02:00
|
|
|
|
eh_nesting_info *eh_nest_info;
|
|
|
|
|
basic_block src;
|
|
|
|
|
rtx insn;
|
|
|
|
|
int region;
|
|
|
|
|
{
|
|
|
|
|
handler_info **handler_list;
|
|
|
|
|
int num, is_call;
|
|
|
|
|
|
|
|
|
|
is_call = (insn && GET_CODE (insn) == CALL_INSN ? EDGE_ABNORMAL_CALL : 0);
|
|
|
|
|
num = reachable_handlers (region, eh_nest_info, insn, &handler_list);
|
|
|
|
|
while (--num >= 0)
|
|
|
|
|
{
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_label_edge (edge_cache, src, handler_list[num]->handler_label,
|
1999-09-21 23:15:37 +02:00
|
|
|
|
EDGE_ABNORMAL | EDGE_EH | is_call);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* EH_REGION notes appearing between basic blocks is ambiguous, and even
|
|
|
|
|
dangerous if we intend to move basic blocks around. Move such notes
|
|
|
|
|
into the following block. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
move_stray_eh_region_notes ()
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
basic_block b1, b2;
|
|
|
|
|
|
|
|
|
|
if (n_basic_blocks < 2)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
b2 = BASIC_BLOCK (n_basic_blocks - 1);
|
|
|
|
|
for (i = n_basic_blocks - 2; i >= 0; --i, b2 = b1)
|
|
|
|
|
{
|
|
|
|
|
rtx insn, next, list = NULL_RTX;
|
|
|
|
|
|
|
|
|
|
b1 = BASIC_BLOCK (i);
|
|
|
|
|
for (insn = NEXT_INSN (b1->end); insn != b2->head; insn = next)
|
|
|
|
|
{
|
|
|
|
|
next = NEXT_INSN (insn);
|
|
|
|
|
if (GET_CODE (insn) == NOTE
|
|
|
|
|
&& (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG
|
|
|
|
|
|| NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END))
|
|
|
|
|
{
|
|
|
|
|
/* Unlink from the insn chain. */
|
|
|
|
|
NEXT_INSN (PREV_INSN (insn)) = next;
|
|
|
|
|
PREV_INSN (next) = PREV_INSN (insn);
|
|
|
|
|
|
|
|
|
|
/* Queue it. */
|
|
|
|
|
NEXT_INSN (insn) = list;
|
|
|
|
|
list = insn;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (list == NULL_RTX)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* Find where to insert these things. */
|
|
|
|
|
insn = b2->head;
|
|
|
|
|
if (GET_CODE (insn) == CODE_LABEL)
|
|
|
|
|
insn = NEXT_INSN (insn);
|
|
|
|
|
|
|
|
|
|
while (list)
|
|
|
|
|
{
|
|
|
|
|
next = NEXT_INSN (list);
|
|
|
|
|
add_insn_after (list, insn);
|
|
|
|
|
list = next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Recompute eh_beg/eh_end for each basic block. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
record_active_eh_regions (f)
|
|
|
|
|
rtx f;
|
|
|
|
|
{
|
|
|
|
|
rtx insn, eh_list = NULL_RTX;
|
|
|
|
|
int i = 0;
|
|
|
|
|
basic_block bb = BASIC_BLOCK (0);
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (insn = f; insn; insn = NEXT_INSN (insn))
|
1999-09-21 23:15:37 +02:00
|
|
|
|
{
|
|
|
|
|
if (bb->head == insn)
|
|
|
|
|
bb->eh_beg = (eh_list ? NOTE_EH_HANDLER (XEXP (eh_list, 0)) : -1);
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (insn) == NOTE)
|
|
|
|
|
{
|
|
|
|
|
int kind = NOTE_LINE_NUMBER (insn);
|
|
|
|
|
if (kind == NOTE_INSN_EH_REGION_BEG)
|
|
|
|
|
eh_list = alloc_INSN_LIST (insn, eh_list);
|
|
|
|
|
else if (kind == NOTE_INSN_EH_REGION_END)
|
|
|
|
|
{
|
|
|
|
|
rtx t = XEXP (eh_list, 1);
|
|
|
|
|
free_INSN_LIST_node (eh_list);
|
|
|
|
|
eh_list = t;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bb->end == insn)
|
|
|
|
|
{
|
|
|
|
|
bb->eh_end = (eh_list ? NOTE_EH_HANDLER (XEXP (eh_list, 0)) : -1);
|
|
|
|
|
i += 1;
|
1999-09-22 14:09:23 +02:00
|
|
|
|
if (i == n_basic_blocks)
|
|
|
|
|
break;
|
1999-09-21 23:15:37 +02:00
|
|
|
|
bb = BASIC_BLOCK (i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Identify critical edges and set the bits appropriately. */
|
1999-09-21 23:15:37 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
static void
|
|
|
|
|
mark_critical_edges ()
|
|
|
|
|
{
|
|
|
|
|
int i, n = n_basic_blocks;
|
|
|
|
|
basic_block bb;
|
|
|
|
|
|
|
|
|
|
/* We begin with the entry block. This is not terribly important now,
|
|
|
|
|
but could be if a front end (Fortran) implemented alternate entry
|
|
|
|
|
points. */
|
|
|
|
|
bb = ENTRY_BLOCK_PTR;
|
|
|
|
|
i = -1;
|
|
|
|
|
|
|
|
|
|
while (1)
|
1998-12-08 15:04:03 +01:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
edge e;
|
|
|
|
|
|
|
|
|
|
/* (1) Critical edges must have a source with multiple successors. */
|
|
|
|
|
if (bb->succ && bb->succ->succ_next)
|
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = bb->succ; e; e = e->succ_next)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
{
|
|
|
|
|
/* (2) Critical edges must have a destination with multiple
|
|
|
|
|
predecessors. Note that we know there is at least one
|
|
|
|
|
predecessor -- the edge we followed to get here. */
|
|
|
|
|
if (e->dest->pred->pred_next)
|
|
|
|
|
e->flags |= EDGE_CRITICAL;
|
|
|
|
|
else
|
|
|
|
|
e->flags &= ~EDGE_CRITICAL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = bb->succ; e; e = e->succ_next)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
e->flags &= ~EDGE_CRITICAL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (++i >= n)
|
|
|
|
|
break;
|
|
|
|
|
bb = BASIC_BLOCK (i);
|
1998-12-08 15:04:03 +01:00
|
|
|
|
}
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-11 23:39:33 +02:00
|
|
|
|
/* Split a block BB after insn INSN creating a new fallthru edge.
|
|
|
|
|
Return the new edge. Note that to keep other parts of the compiler happy,
|
|
|
|
|
this function renumbers all the basic blocks so that the new
|
|
|
|
|
one has a number one greater than the block split. */
|
|
|
|
|
|
|
|
|
|
edge
|
|
|
|
|
split_block (bb, insn)
|
|
|
|
|
basic_block bb;
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
basic_block new_bb;
|
|
|
|
|
edge new_edge;
|
|
|
|
|
edge e;
|
|
|
|
|
rtx bb_note;
|
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
|
|
/* There is no point splitting the block after its end. */
|
|
|
|
|
if (bb->end == insn)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/* Create the new structures. */
|
2000-10-13 08:26:46 +02:00
|
|
|
|
new_bb = (basic_block) obstack_alloc (&flow_obstack, sizeof (*new_bb));
|
2000-09-11 23:39:33 +02:00
|
|
|
|
new_edge = (edge) xcalloc (1, sizeof (*new_edge));
|
|
|
|
|
n_edges++;
|
|
|
|
|
|
|
|
|
|
memset (new_bb, 0, sizeof (*new_bb));
|
|
|
|
|
|
|
|
|
|
new_bb->head = NEXT_INSN (insn);
|
|
|
|
|
new_bb->end = bb->end;
|
|
|
|
|
bb->end = insn;
|
|
|
|
|
|
|
|
|
|
new_bb->succ = bb->succ;
|
|
|
|
|
bb->succ = new_edge;
|
|
|
|
|
new_bb->pred = new_edge;
|
|
|
|
|
new_bb->count = bb->count;
|
|
|
|
|
new_bb->loop_depth = bb->loop_depth;
|
|
|
|
|
|
|
|
|
|
new_edge->src = bb;
|
|
|
|
|
new_edge->dest = new_bb;
|
|
|
|
|
new_edge->flags = EDGE_FALLTHRU;
|
|
|
|
|
new_edge->probability = REG_BR_PROB_BASE;
|
|
|
|
|
new_edge->count = bb->count;
|
|
|
|
|
|
|
|
|
|
/* Redirect the src of the successor edges of bb to point to new_bb. */
|
|
|
|
|
for (e = new_bb->succ; e; e = e->succ_next)
|
|
|
|
|
e->src = new_bb;
|
2001-01-02 08:00:49 +01:00
|
|
|
|
|
2000-09-11 23:39:33 +02:00
|
|
|
|
/* Place the new block just after the block being split. */
|
|
|
|
|
VARRAY_GROW (basic_block_info, ++n_basic_blocks);
|
|
|
|
|
|
|
|
|
|
/* Some parts of the compiler expect blocks to be number in
|
|
|
|
|
sequential order so insert the new block immediately after the
|
|
|
|
|
block being split.. */
|
|
|
|
|
j = bb->index;
|
|
|
|
|
for (i = n_basic_blocks - 1; i > j + 1; --i)
|
|
|
|
|
{
|
|
|
|
|
basic_block tmp = BASIC_BLOCK (i - 1);
|
|
|
|
|
BASIC_BLOCK (i) = tmp;
|
|
|
|
|
tmp->index = i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BASIC_BLOCK (i) = new_bb;
|
|
|
|
|
new_bb->index = i;
|
|
|
|
|
|
|
|
|
|
/* Create the basic block note. */
|
|
|
|
|
bb_note = emit_note_before (NOTE_INSN_BASIC_BLOCK,
|
|
|
|
|
new_bb->head);
|
|
|
|
|
NOTE_BASIC_BLOCK (bb_note) = new_bb;
|
|
|
|
|
new_bb->head = bb_note;
|
|
|
|
|
|
|
|
|
|
update_bb_for_insn (new_bb);
|
|
|
|
|
|
|
|
|
|
if (bb->global_live_at_start)
|
|
|
|
|
{
|
2000-10-13 08:26:46 +02:00
|
|
|
|
new_bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (&flow_obstack);
|
|
|
|
|
new_bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (&flow_obstack);
|
2000-09-11 23:39:33 +02:00
|
|
|
|
COPY_REG_SET (new_bb->global_live_at_end, bb->global_live_at_end);
|
|
|
|
|
|
|
|
|
|
/* We now have to calculate which registers are live at the end
|
|
|
|
|
of the split basic block and at the start of the new basic
|
|
|
|
|
block. Start with those registers that are known to be live
|
|
|
|
|
at the end of the original basic block and get
|
|
|
|
|
propagate_block to determine which registers are live. */
|
|
|
|
|
COPY_REG_SET (new_bb->global_live_at_start, bb->global_live_at_end);
|
2000-11-27 18:50:11 +01:00
|
|
|
|
propagate_block (new_bb, new_bb->global_live_at_start, NULL, NULL, 0);
|
2001-01-02 08:00:49 +01:00
|
|
|
|
COPY_REG_SET (bb->global_live_at_end,
|
2000-09-11 23:39:33 +02:00
|
|
|
|
new_bb->global_live_at_start);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new_edge;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Split a (typically critical) edge. Return the new block.
|
2000-08-11 14:45:05 +02:00
|
|
|
|
Abort on abnormal edges.
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
??? The code generally expects to be called on critical edges.
|
2000-08-11 14:45:05 +02:00
|
|
|
|
The case of a block ending in an unconditional jump to a
|
1999-02-26 00:45:42 +01:00
|
|
|
|
block with multiple predecessors is not handled optimally. */
|
|
|
|
|
|
|
|
|
|
basic_block
|
|
|
|
|
split_edge (edge_in)
|
|
|
|
|
edge edge_in;
|
|
|
|
|
{
|
|
|
|
|
basic_block old_pred, bb, old_succ;
|
|
|
|
|
edge edge_out;
|
|
|
|
|
rtx bb_note;
|
1999-09-21 20:57:12 +02:00
|
|
|
|
int i, j;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Abnormal edges cannot be split. */
|
|
|
|
|
if ((edge_in->flags & EDGE_ABNORMAL) != 0)
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
old_pred = edge_in->src;
|
|
|
|
|
old_succ = edge_in->dest;
|
|
|
|
|
|
|
|
|
|
/* Remove the existing edge from the destination's pred list. */
|
|
|
|
|
{
|
|
|
|
|
edge *pp;
|
|
|
|
|
for (pp = &old_succ->pred; *pp != edge_in; pp = &(*pp)->pred_next)
|
|
|
|
|
continue;
|
|
|
|
|
*pp = edge_in->pred_next;
|
1999-04-06 18:21:09 +02:00
|
|
|
|
edge_in->pred_next = NULL;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Create the new structures. */
|
2000-10-13 08:26:46 +02:00
|
|
|
|
bb = (basic_block) obstack_alloc (&flow_obstack, sizeof (*bb));
|
1999-02-26 00:45:42 +01:00
|
|
|
|
edge_out = (edge) xcalloc (1, sizeof (*edge_out));
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
n_edges++;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
memset (bb, 0, sizeof (*bb));
|
|
|
|
|
|
|
|
|
|
/* ??? This info is likely going to be out of date very soon. */
|
|
|
|
|
if (old_succ->global_live_at_start)
|
|
|
|
|
{
|
2000-10-13 08:26:46 +02:00
|
|
|
|
bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (&flow_obstack);
|
|
|
|
|
bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (&flow_obstack);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
COPY_REG_SET (bb->global_live_at_start, old_succ->global_live_at_start);
|
|
|
|
|
COPY_REG_SET (bb->global_live_at_end, old_succ->global_live_at_start);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Wire them up. */
|
|
|
|
|
bb->pred = edge_in;
|
|
|
|
|
bb->succ = edge_out;
|
basic-block.h (struct edge_def): New field "count".
* basic-block.h (struct edge_def): New field "count".
(struct basic_block_def): Likewise.
* flow.c (entry_exit_blocks): Add count fileds.
(split_edge): Keep count information up-to-date.
(dump_edge_info, dump_flow_info): Dump count fields.
* final.c (count_instrumented_edges): Rename to edge from arc.
(end_final): Update users.
* profile.c: Include expr.h, basic-block.h.
(struct adj_list, ARC_TARGET, ARC_SOURCE, ARC_COUNT): Kill.
(struct bb_info, label_to_bb, label_to_bb_size, bb_graph): Kill.
(ignore_next_note, return_label_execution_count): Kill.
(bbg_file_name, da_file_name): Kill.
(edge_info, bb_info): New structures.
(EDGE_INFO, BB_INFO, GCOV_INDEX_TO_BB, BB_TO_GCOV_INDEX): New macros.
(count_instrumented_edges, total_num_edges): Rename to edge from arc.
(total_num_edges_instrumented): Likewise.
(init_arc, expand_spanning_tree): Kill.
(fill_spanning_tree, tablejump_entry_p): Kill.
(instrument_edges): Rewrite from instrument_arcs to use
commit_edge_insertions infrastructure.
(compute_branch_probabilities): Remove arguments; rewrite for
CFG infrastructure; use rtl_dump_file directly.
(branch_prob, find_spanning_tree): Likewise.
(union_groups, find_group): New.
(init_branch_prob): Make bbg_file_name and da_file_name local.
(end_branch_prob): Use rtl_dump_file directly.
(init_edge_profiler): Rename to edge from arc.
(output_arc_profiler): Kill.
(gen_edge_profiler): New.
(output_func_start_profiler): Turn off profiling. Make the
constructor static when we can.
* rtl.h (branch_prob, end_branch_prob): Update prototypes.
* toplev.c (DFI_flow): Remove.
(DFI_cfg, DFI_life): New.
(dump_file): Update accordingly.
(compile_file): Call end_branch_prob if profile_arc_flag too.
(rest_of_compilation): Move flow1 cfg creation to DFI_cfg. Do edge
profiling after the CFG is built. Move flow1 life analysis to
DFI_life. Always estimate remaining probabilities.
Co-Authored-By: Richard Henderson <rth@cygnus.com>
From-SVN: r34037
2000-05-19 22:51:49 +02:00
|
|
|
|
bb->count = edge_in->count;
|
1999-04-06 18:21:09 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
edge_in->dest = bb;
|
1999-04-06 18:21:09 +02:00
|
|
|
|
edge_in->flags &= ~EDGE_CRITICAL;
|
|
|
|
|
|
|
|
|
|
edge_out->pred_next = old_succ->pred;
|
|
|
|
|
edge_out->succ_next = NULL;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
edge_out->src = bb;
|
|
|
|
|
edge_out->dest = old_succ;
|
1999-04-06 18:21:09 +02:00
|
|
|
|
edge_out->flags = EDGE_FALLTHRU;
|
|
|
|
|
edge_out->probability = REG_BR_PROB_BASE;
|
basic-block.h (struct edge_def): New field "count".
* basic-block.h (struct edge_def): New field "count".
(struct basic_block_def): Likewise.
* flow.c (entry_exit_blocks): Add count fileds.
(split_edge): Keep count information up-to-date.
(dump_edge_info, dump_flow_info): Dump count fields.
* final.c (count_instrumented_edges): Rename to edge from arc.
(end_final): Update users.
* profile.c: Include expr.h, basic-block.h.
(struct adj_list, ARC_TARGET, ARC_SOURCE, ARC_COUNT): Kill.
(struct bb_info, label_to_bb, label_to_bb_size, bb_graph): Kill.
(ignore_next_note, return_label_execution_count): Kill.
(bbg_file_name, da_file_name): Kill.
(edge_info, bb_info): New structures.
(EDGE_INFO, BB_INFO, GCOV_INDEX_TO_BB, BB_TO_GCOV_INDEX): New macros.
(count_instrumented_edges, total_num_edges): Rename to edge from arc.
(total_num_edges_instrumented): Likewise.
(init_arc, expand_spanning_tree): Kill.
(fill_spanning_tree, tablejump_entry_p): Kill.
(instrument_edges): Rewrite from instrument_arcs to use
commit_edge_insertions infrastructure.
(compute_branch_probabilities): Remove arguments; rewrite for
CFG infrastructure; use rtl_dump_file directly.
(branch_prob, find_spanning_tree): Likewise.
(union_groups, find_group): New.
(init_branch_prob): Make bbg_file_name and da_file_name local.
(end_branch_prob): Use rtl_dump_file directly.
(init_edge_profiler): Rename to edge from arc.
(output_arc_profiler): Kill.
(gen_edge_profiler): New.
(output_func_start_profiler): Turn off profiling. Make the
constructor static when we can.
* rtl.h (branch_prob, end_branch_prob): Update prototypes.
* toplev.c (DFI_flow): Remove.
(DFI_cfg, DFI_life): New.
(dump_file): Update accordingly.
(compile_file): Call end_branch_prob if profile_arc_flag too.
(rest_of_compilation): Move flow1 cfg creation to DFI_cfg. Do edge
profiling after the CFG is built. Move flow1 life analysis to
DFI_life. Always estimate remaining probabilities.
Co-Authored-By: Richard Henderson <rth@cygnus.com>
From-SVN: r34037
2000-05-19 22:51:49 +02:00
|
|
|
|
edge_out->count = edge_in->count;
|
1999-04-06 18:21:09 +02:00
|
|
|
|
|
|
|
|
|
old_succ->pred = edge_out;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
/* Tricky case -- if there existed a fallthru into the successor
|
|
|
|
|
(and we're not it) we must add a new unconditional jump around
|
2000-08-11 14:45:05 +02:00
|
|
|
|
the new block we're actually interested in.
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
Further, if that edge is critical, this means a second new basic
|
|
|
|
|
block must be created to hold it. In order to simplify correct
|
|
|
|
|
insn placement, do this before we touch the existing basic block
|
|
|
|
|
ordering for the block we were really wanting. */
|
|
|
|
|
if ((edge_in->flags & EDGE_FALLTHRU) == 0)
|
|
|
|
|
{
|
|
|
|
|
edge e;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = edge_out->pred_next; e; e = e->pred_next)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (e->flags & EDGE_FALLTHRU)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (e)
|
|
|
|
|
{
|
|
|
|
|
basic_block jump_block;
|
|
|
|
|
rtx pos;
|
|
|
|
|
|
2000-03-10 09:16:55 +01:00
|
|
|
|
if ((e->flags & EDGE_CRITICAL) == 0
|
|
|
|
|
&& e->src != ENTRY_BLOCK_PTR)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
{
|
|
|
|
|
/* Non critical -- we can simply add a jump to the end
|
|
|
|
|
of the existing predecessor. */
|
|
|
|
|
jump_block = e->src;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* We need a new block to hold the jump. The simplest
|
|
|
|
|
way to do the bulk of the work here is to recursively
|
|
|
|
|
call ourselves. */
|
|
|
|
|
jump_block = split_edge (e);
|
|
|
|
|
e = jump_block->succ;
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-06 18:21:09 +02:00
|
|
|
|
/* Now add the jump insn ... */
|
|
|
|
|
pos = emit_jump_insn_after (gen_jump (old_succ->head),
|
|
|
|
|
jump_block->end);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
jump_block->end = pos;
|
2000-01-14 12:21:22 +01:00
|
|
|
|
if (basic_block_for_insn)
|
|
|
|
|
set_block_for_insn (pos, jump_block);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
emit_barrier_after (pos);
|
1999-04-06 18:21:09 +02:00
|
|
|
|
|
|
|
|
|
/* ... let jump know that label is in use, ... */
|
1999-08-10 16:46:16 +02:00
|
|
|
|
JUMP_LABEL (pos) = old_succ->head;
|
1999-04-06 18:21:09 +02:00
|
|
|
|
++LABEL_NUSES (old_succ->head);
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* ... and clear fallthru on the outgoing edge. */
|
|
|
|
|
e->flags &= ~EDGE_FALLTHRU;
|
|
|
|
|
|
|
|
|
|
/* Continue splitting the interesting edge. */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Place the new block just in front of the successor. */
|
|
|
|
|
VARRAY_GROW (basic_block_info, ++n_basic_blocks);
|
1999-09-21 20:57:12 +02:00
|
|
|
|
if (old_succ == EXIT_BLOCK_PTR)
|
|
|
|
|
j = n_basic_blocks - 1;
|
|
|
|
|
else
|
|
|
|
|
j = old_succ->index;
|
|
|
|
|
for (i = n_basic_blocks - 1; i > j; --i)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
{
|
|
|
|
|
basic_block tmp = BASIC_BLOCK (i - 1);
|
|
|
|
|
BASIC_BLOCK (i) = tmp;
|
|
|
|
|
tmp->index = i;
|
|
|
|
|
}
|
|
|
|
|
BASIC_BLOCK (i) = bb;
|
|
|
|
|
bb->index = i;
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Create the basic block note.
|
1999-11-18 07:45:55 +01:00
|
|
|
|
|
|
|
|
|
Where we place the note can have a noticable impact on the generated
|
2000-08-11 14:45:05 +02:00
|
|
|
|
code. Consider this cfg:
|
1999-11-18 07:45:55 +01:00
|
|
|
|
|
|
|
|
|
E
|
|
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
/ \
|
|
|
|
|
+->1-->2--->E
|
|
|
|
|
| |
|
|
|
|
|
+--+
|
|
|
|
|
|
|
|
|
|
If we need to insert an insn on the edge from block 0 to block 1,
|
|
|
|
|
we want to ensure the instructions we insert are outside of any
|
|
|
|
|
loop notes that physically sit between block 0 and block 1. Otherwise
|
|
|
|
|
we confuse the loop optimizer into thinking the loop is a phony. */
|
|
|
|
|
if (old_succ != EXIT_BLOCK_PTR
|
|
|
|
|
&& PREV_INSN (old_succ->head)
|
|
|
|
|
&& GET_CODE (PREV_INSN (old_succ->head)) == NOTE
|
|
|
|
|
&& NOTE_LINE_NUMBER (PREV_INSN (old_succ->head)) == NOTE_INSN_LOOP_BEG)
|
|
|
|
|
bb_note = emit_note_before (NOTE_INSN_BASIC_BLOCK,
|
|
|
|
|
PREV_INSN (old_succ->head));
|
|
|
|
|
else if (old_succ != EXIT_BLOCK_PTR)
|
1999-09-21 20:57:12 +02:00
|
|
|
|
bb_note = emit_note_before (NOTE_INSN_BASIC_BLOCK, old_succ->head);
|
|
|
|
|
else
|
|
|
|
|
bb_note = emit_note_after (NOTE_INSN_BASIC_BLOCK, get_last_insn ());
|
1999-02-26 00:45:42 +01:00
|
|
|
|
NOTE_BASIC_BLOCK (bb_note) = bb;
|
|
|
|
|
bb->head = bb->end = bb_note;
|
|
|
|
|
|
|
|
|
|
/* Not quite simple -- for non-fallthru edges, we must adjust the
|
|
|
|
|
predecessor's jump instruction to target our new block. */
|
|
|
|
|
if ((edge_in->flags & EDGE_FALLTHRU) == 0)
|
|
|
|
|
{
|
|
|
|
|
rtx tmp, insn = old_pred->end;
|
|
|
|
|
rtx old_label = old_succ->head;
|
|
|
|
|
rtx new_label = gen_label_rtx ();
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (insn) != JUMP_INSN)
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
/* ??? Recognize a tablejump and adjust all matching cases. */
|
|
|
|
|
if ((tmp = JUMP_LABEL (insn)) != NULL_RTX
|
|
|
|
|
&& (tmp = NEXT_INSN (tmp)) != NULL_RTX
|
|
|
|
|
&& GET_CODE (tmp) == JUMP_INSN
|
|
|
|
|
&& (GET_CODE (PATTERN (tmp)) == ADDR_VEC
|
|
|
|
|
|| GET_CODE (PATTERN (tmp)) == ADDR_DIFF_VEC))
|
|
|
|
|
{
|
|
|
|
|
rtvec vec;
|
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (PATTERN (tmp)) == ADDR_VEC)
|
|
|
|
|
vec = XVEC (PATTERN (tmp), 0);
|
|
|
|
|
else
|
|
|
|
|
vec = XVEC (PATTERN (tmp), 1);
|
|
|
|
|
|
|
|
|
|
for (j = GET_NUM_ELEM (vec) - 1; j >= 0; --j)
|
|
|
|
|
if (XEXP (RTVEC_ELT (vec, j), 0) == old_label)
|
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
RTVEC_ELT (vec, j) = gen_rtx_LABEL_REF (VOIDmode, new_label);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
--LABEL_NUSES (old_label);
|
|
|
|
|
++LABEL_NUSES (new_label);
|
|
|
|
|
}
|
1999-10-20 14:45:22 +02:00
|
|
|
|
|
|
|
|
|
/* Handle casesi dispatch insns */
|
|
|
|
|
if ((tmp = single_set (insn)) != NULL
|
|
|
|
|
&& SET_DEST (tmp) == pc_rtx
|
|
|
|
|
&& GET_CODE (SET_SRC (tmp)) == IF_THEN_ELSE
|
|
|
|
|
&& GET_CODE (XEXP (SET_SRC (tmp), 2)) == LABEL_REF
|
|
|
|
|
&& XEXP (XEXP (SET_SRC (tmp), 2), 0) == old_label)
|
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
XEXP (SET_SRC (tmp), 2) = gen_rtx_LABEL_REF (VOIDmode,
|
1999-10-20 14:45:22 +02:00
|
|
|
|
new_label);
|
|
|
|
|
--LABEL_NUSES (old_label);
|
|
|
|
|
++LABEL_NUSES (new_label);
|
|
|
|
|
}
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* This would have indicated an abnormal edge. */
|
|
|
|
|
if (computed_jump_p (insn))
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
/* A return instruction can't be redirected. */
|
|
|
|
|
if (returnjump_p (insn))
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
/* If the insn doesn't go where we think, we're confused. */
|
|
|
|
|
if (JUMP_LABEL (insn) != old_label)
|
|
|
|
|
abort ();
|
|
|
|
|
|
2000-05-19 21:53:17 +02:00
|
|
|
|
redirect_jump (insn, new_label, 0);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
emit_label_before (new_label, bb_note);
|
|
|
|
|
bb->head = new_label;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return bb;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Queue instructions for insertion on an edge between two basic blocks.
|
|
|
|
|
The new instructions and basic blocks (if any) will not appear in the
|
|
|
|
|
CFG until commit_edge_insertions is called. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
insert_insn_on_edge (pattern, e)
|
|
|
|
|
rtx pattern;
|
|
|
|
|
edge e;
|
|
|
|
|
{
|
|
|
|
|
/* We cannot insert instructions on an abnormal critical edge.
|
|
|
|
|
It will be easier to find the culprit if we die now. */
|
|
|
|
|
if ((e->flags & (EDGE_ABNORMAL|EDGE_CRITICAL))
|
|
|
|
|
== (EDGE_ABNORMAL|EDGE_CRITICAL))
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
if (e->insns == NULL_RTX)
|
|
|
|
|
start_sequence ();
|
|
|
|
|
else
|
|
|
|
|
push_to_sequence (e->insns);
|
|
|
|
|
|
|
|
|
|
emit_insn (pattern);
|
|
|
|
|
|
|
|
|
|
e->insns = get_insns ();
|
2000-08-11 14:45:05 +02:00
|
|
|
|
end_sequence ();
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Update the CFG for the instructions queued on edge E. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
commit_one_edge_insertion (e)
|
|
|
|
|
edge e;
|
|
|
|
|
{
|
2000-05-17 03:44:03 +02:00
|
|
|
|
rtx before = NULL_RTX, after = NULL_RTX, insns, tmp, last;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
basic_block bb;
|
|
|
|
|
|
2000-01-28 23:22:50 +01:00
|
|
|
|
/* Pull the insns off the edge now since the edge might go away. */
|
|
|
|
|
insns = e->insns;
|
|
|
|
|
e->insns = NULL_RTX;
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Figure out where to put these things. If the destination has
|
|
|
|
|
one predecessor, insert there. Except for the exit block. */
|
|
|
|
|
if (e->dest->pred->pred_next == NULL
|
|
|
|
|
&& e->dest != EXIT_BLOCK_PTR)
|
|
|
|
|
{
|
|
|
|
|
bb = e->dest;
|
|
|
|
|
|
|
|
|
|
/* Get the location correct wrt a code label, and "nice" wrt
|
|
|
|
|
a basic block note, and before everything else. */
|
|
|
|
|
tmp = bb->head;
|
|
|
|
|
if (GET_CODE (tmp) == CODE_LABEL)
|
|
|
|
|
tmp = NEXT_INSN (tmp);
|
2000-07-27 19:25:14 +02:00
|
|
|
|
if (NOTE_INSN_BASIC_BLOCK_P (tmp))
|
1999-02-26 00:45:42 +01:00
|
|
|
|
tmp = NEXT_INSN (tmp);
|
|
|
|
|
if (tmp == bb->head)
|
|
|
|
|
before = tmp;
|
|
|
|
|
else
|
|
|
|
|
after = PREV_INSN (tmp);
|
|
|
|
|
}
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* If the source has one successor and the edge is not abnormal,
|
|
|
|
|
insert there. Except for the entry block. */
|
|
|
|
|
else if ((e->flags & EDGE_ABNORMAL) == 0
|
|
|
|
|
&& e->src->succ->succ_next == NULL
|
|
|
|
|
&& e->src != ENTRY_BLOCK_PTR)
|
|
|
|
|
{
|
|
|
|
|
bb = e->src;
|
2000-01-13 06:41:44 +01:00
|
|
|
|
/* It is possible to have a non-simple jump here. Consider a target
|
|
|
|
|
where some forms of unconditional jumps clobber a register. This
|
2000-08-11 14:45:05 +02:00
|
|
|
|
happens on the fr30 for example.
|
2000-01-13 06:41:44 +01:00
|
|
|
|
|
|
|
|
|
We know this block has a single successor, so we can just emit
|
|
|
|
|
the queued insns before the jump. */
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (GET_CODE (bb->end) == JUMP_INSN)
|
|
|
|
|
{
|
|
|
|
|
before = bb->end;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* We'd better be fallthru, or we've lost track of what's what. */
|
|
|
|
|
if ((e->flags & EDGE_FALLTHRU) == 0)
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
after = bb->end;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Otherwise we must split the edge. */
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bb = split_edge (e);
|
|
|
|
|
after = bb->end;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now that we've found the spot, do the insertion. */
|
1999-08-10 16:46:16 +02:00
|
|
|
|
|
|
|
|
|
/* Set the new block number for these insns, if structure is allocated. */
|
|
|
|
|
if (basic_block_for_insn)
|
|
|
|
|
{
|
|
|
|
|
rtx i;
|
2000-01-28 23:22:50 +01:00
|
|
|
|
for (i = insns; i != NULL_RTX; i = NEXT_INSN (i))
|
1999-08-10 16:46:16 +02:00
|
|
|
|
set_block_for_insn (i, bb);
|
|
|
|
|
}
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (before)
|
|
|
|
|
{
|
2000-01-28 23:22:50 +01:00
|
|
|
|
emit_insns_before (insns, before);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (before == bb->head)
|
2000-01-28 23:22:50 +01:00
|
|
|
|
bb->head = insns;
|
2000-05-17 03:44:03 +02:00
|
|
|
|
|
|
|
|
|
last = prev_nonnote_insn (before);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2000-05-17 03:44:03 +02:00
|
|
|
|
last = emit_insns_after (insns, after);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (after == bb->end)
|
2000-05-17 03:44:03 +02:00
|
|
|
|
bb->end = last;
|
|
|
|
|
}
|
2000-01-28 23:22:50 +01:00
|
|
|
|
|
2000-05-17 03:44:03 +02:00
|
|
|
|
if (returnjump_p (last))
|
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* ??? Remove all outgoing edges from BB and add one for EXIT.
|
2000-05-17 03:44:03 +02:00
|
|
|
|
This is not currently a problem because this only happens
|
|
|
|
|
for the (single) epilogue, which already has a fallthru edge
|
|
|
|
|
to EXIT. */
|
|
|
|
|
|
|
|
|
|
e = bb->succ;
|
|
|
|
|
if (e->dest != EXIT_BLOCK_PTR
|
|
|
|
|
|| e->succ_next != NULL
|
|
|
|
|
|| (e->flags & EDGE_FALLTHRU) == 0)
|
|
|
|
|
abort ();
|
|
|
|
|
e->flags &= ~EDGE_FALLTHRU;
|
|
|
|
|
|
|
|
|
|
emit_barrier_after (last);
|
|
|
|
|
bb->end = last;
|
|
|
|
|
|
|
|
|
|
if (before)
|
|
|
|
|
flow_delete_insn (before);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
2000-05-17 03:44:03 +02:00
|
|
|
|
else if (GET_CODE (last) == JUMP_INSN)
|
|
|
|
|
abort ();
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Update the CFG for all queued instructions. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
commit_edge_insertions ()
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
basic_block bb;
|
|
|
|
|
|
2000-01-28 23:22:50 +01:00
|
|
|
|
#ifdef ENABLE_CHECKING
|
|
|
|
|
verify_flow_info ();
|
|
|
|
|
#endif
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
i = -1;
|
|
|
|
|
bb = ENTRY_BLOCK_PTR;
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
edge e, next;
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = bb->succ; e; e = next)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
{
|
|
|
|
|
next = e->succ_next;
|
|
|
|
|
if (e->insns)
|
|
|
|
|
commit_one_edge_insertion (e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (++i >= n_basic_blocks)
|
|
|
|
|
break;
|
|
|
|
|
bb = BASIC_BLOCK (i);
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-01-11 10:13:02 +01:00
|
|
|
|
|
|
|
|
|
/* Add fake edges to the function exit for any non constant calls in
|
|
|
|
|
the bitmap of blocks specified by BLOCKS or to the whole CFG if
|
|
|
|
|
BLOCKS is zero. Return the nuber of blocks that were split. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
flow_call_edges_add (blocks)
|
|
|
|
|
sbitmap blocks;
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
int blocks_split = 0;
|
|
|
|
|
int bb_num = 0;
|
|
|
|
|
basic_block *bbs;
|
|
|
|
|
|
|
|
|
|
/* Map bb indicies into basic block pointers since split_block
|
|
|
|
|
will renumber the basic blocks. */
|
|
|
|
|
|
|
|
|
|
bbs = xmalloc (n_basic_blocks * sizeof (*bbs));
|
|
|
|
|
|
|
|
|
|
if (! blocks)
|
|
|
|
|
{
|
|
|
|
|
for (i = 0; i < n_basic_blocks; i++)
|
|
|
|
|
bbs[bb_num++] = BASIC_BLOCK (i);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i,
|
|
|
|
|
{
|
|
|
|
|
bbs[bb_num++] = BASIC_BLOCK (i);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Now add fake edges to the function exit for any non constant
|
|
|
|
|
calls since there is no way that we can determine if they will
|
|
|
|
|
return or not... */
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < bb_num; i++)
|
|
|
|
|
{
|
|
|
|
|
basic_block bb = bbs[i];
|
|
|
|
|
rtx insn;
|
|
|
|
|
rtx prev_insn;
|
|
|
|
|
|
|
|
|
|
for (insn = bb->end; ; insn = prev_insn)
|
|
|
|
|
{
|
|
|
|
|
prev_insn = PREV_INSN (insn);
|
|
|
|
|
if (GET_CODE (insn) == CALL_INSN && ! CONST_CALL_P (insn))
|
|
|
|
|
{
|
|
|
|
|
edge e;
|
|
|
|
|
|
|
|
|
|
/* Note that the following may create a new basic block
|
|
|
|
|
and renumber the existing basic blocks. */
|
|
|
|
|
e = split_block (bb, insn);
|
|
|
|
|
if (e)
|
|
|
|
|
blocks_split++;
|
|
|
|
|
|
|
|
|
|
make_edge (NULL, bb, EXIT_BLOCK_PTR, EDGE_FAKE);
|
|
|
|
|
}
|
|
|
|
|
if (insn == bb->head)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (blocks_split)
|
|
|
|
|
verify_flow_info ();
|
|
|
|
|
|
|
|
|
|
free (bbs);
|
|
|
|
|
return blocks_split;
|
|
|
|
|
}
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
/* Delete all unreachable basic blocks. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
delete_unreachable_blocks ()
|
|
|
|
|
{
|
|
|
|
|
basic_block *worklist, *tos;
|
|
|
|
|
int deleted_handler;
|
|
|
|
|
edge e;
|
|
|
|
|
int i, n;
|
|
|
|
|
|
|
|
|
|
n = n_basic_blocks;
|
1999-11-02 00:19:44 +01:00
|
|
|
|
tos = worklist = (basic_block *) xmalloc (sizeof (basic_block) * n);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
/* Use basic_block->aux as a marker. Clear them all. */
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < n; ++i)
|
|
|
|
|
BASIC_BLOCK (i)->aux = NULL;
|
|
|
|
|
|
|
|
|
|
/* Add our starting points to the worklist. Almost always there will
|
|
|
|
|
be only one. It isn't inconcievable that we might one day directly
|
|
|
|
|
support Fortran alternate entry points. */
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = ENTRY_BLOCK_PTR->succ; e; e = e->succ_next)
|
1999-03-04 16:01:06 +01:00
|
|
|
|
{
|
|
|
|
|
*tos++ = e->dest;
|
|
|
|
|
|
|
|
|
|
/* Mark the block with a handy non-null value. */
|
|
|
|
|
e->dest->aux = e;
|
|
|
|
|
}
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Iterate: find everything reachable from what we've already seen. */
|
|
|
|
|
|
|
|
|
|
while (tos != worklist)
|
|
|
|
|
{
|
|
|
|
|
basic_block b = *--tos;
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = b->succ; e; e = e->succ_next)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (!e->dest->aux)
|
1999-03-04 16:01:06 +01:00
|
|
|
|
{
|
|
|
|
|
*tos++ = e->dest;
|
|
|
|
|
e->dest->aux = e;
|
|
|
|
|
}
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Delete all unreachable basic blocks. Count down so that we don't
|
2000-08-11 14:45:05 +02:00
|
|
|
|
interfere with the block renumbering that happens in flow_delete_block. */
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
deleted_handler = 0;
|
|
|
|
|
|
|
|
|
|
for (i = n - 1; i >= 0; --i)
|
|
|
|
|
{
|
|
|
|
|
basic_block b = BASIC_BLOCK (i);
|
|
|
|
|
|
|
|
|
|
if (b->aux != NULL)
|
|
|
|
|
/* This block was found. Tidy up the mark. */
|
|
|
|
|
b->aux = NULL;
|
|
|
|
|
else
|
2000-04-27 06:26:47 +02:00
|
|
|
|
deleted_handler |= flow_delete_block (b);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-02-09 00:48:32 +01:00
|
|
|
|
tidy_fallthru_edges ();
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
/* If we deleted an exception handler, we may have EH region begin/end
|
2000-08-11 14:45:05 +02:00
|
|
|
|
blocks to remove as well. */
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (deleted_handler)
|
|
|
|
|
delete_eh_regions ();
|
1999-11-02 00:19:44 +01:00
|
|
|
|
|
|
|
|
|
free (worklist);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Find EH regions for which there is no longer a handler, and delete them. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
delete_eh_regions ()
|
|
|
|
|
{
|
|
|
|
|
rtx insn;
|
|
|
|
|
|
1999-08-10 18:19:16 +02:00
|
|
|
|
update_rethrow_references ();
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
|
|
|
|
|
if (GET_CODE (insn) == NOTE)
|
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
if ((NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG)
|
|
|
|
|
|| (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END))
|
1999-02-26 00:45:42 +01:00
|
|
|
|
{
|
rtl.h (RTL_CHECK1, RTL_CHECK2): New macros which type- and bounds- check RTL accesses if --enable-checking.
1999-08-31 12:20 -0700 Zack Weinberg <zack@bitmover.com>
* rtl.h (RTL_CHECK1, RTL_CHECK2): New macros which type- and
bounds- check RTL accesses if --enable-checking.
(RTVEC_ELT): Bounds check if --enable-checking.
(XWINT, XINT, XSTR, XEXP, XVEC, XMODE, XBITMAP, XTREE,
XBBDEF): Use RTL_CHECK1/RTL_CHECK2 as appropriate.
(XVECEXP, XVECLEN): Define in terms of XVEC, RTVEC_ELT, and
GET_NUM_ELEM.
(X0WINT, X0INT, X0STR, X0EXP, X0VEC, X0MODE, X0BITMAP, X0TREE,
X0BBDEF, X0ADVFLAGS): New macros for accessing '0' slots of RTXes.
(ADDR_DIFF_VEC_FLAGS): Use X0ADVFLAGS.
(NOTE_SOURCE_FILE): Use X0STR.
(NOTE_BLOCK_NUMBER, NOTE_EH_HANDLER, LABEL_NUSES,
MEM_ALIAS_SET): Use X0INT.
(NOTE_RANGE_INFO, NOTE_LIVE_INFO, NOTE_BASIC_BLOCK,
JUMP_LABEL, LABEL_REFS, LABEL_NEXTREF, CONTAINING_INSN):
Use X0EXP.
* real.h (CONST_DOUBLE_CHAIN): Use X0EXP.
* rtl.c (copy_rtx, copy_most_rtx): Copy '0' slots with X0WINT.
(rtl_check_failed_bounds, rtl_check_failed_type1,
rtl_check_failed_type2, rtvec_check_failed_bounds): New
functions.
(fancy_abort): Fix comment.
* cse.c (canon_hash): Read CONST_DOUBLE data slots with XWINT.
(cse_insn): Decrement LABEL_NUSES for jump target before
deleting jump insn.
* emit-rtl.c (gen_rtx_CONST_DOUBLE): Use X0EXP for slot 1.
* final.c (alter_subreg): Compute regno before changing x to
REG; set REGNO(x) after changing it.
* flow.c (count_basic_blocks): Use XWINT to inspect EH_REGION
notes containing CONST_INTs.
(delete_eh_regions): Use NOTE_EH_HANDLER.
* function.c (put_reg_into_stack): Make reg a MEM before
initializing it.
(fixup_var_refs_insns): Save REG_NOTES (insn) in case we
delete insn.
(gen_mem_addressof): Make reg a MEM before initializing it.
* integrate.c (copy_rtx_and_substitute): Copy '0' slots with
X0WINT.
* local-alloc.c (update_equiv_regs): Zap REG_NOTES before
deleting an insn, not after.
(block_alloc): Only look at PATTERN(insn) if we have to, and
only if it's format class 'i'.
* loop.c (check_dbra_loop): Check bl->biv->add_val is a
CONST_INT before using its INTVAL.
* print-rtl.c (print_rtx): Use X0STR.
* regmove.c (fixup_match_1): Don't look at PATTERN of
non-class-'i' insn chain elements.
* reload.c (loc_mentioned_in_p): Take address of
in->fld[1].rtx directly.
* reload1.c (reload): Change reg to a MEM before initializing
it.
* varasm.c (mark_constant_pool): Skip CONST_DOUBLES, which
have no names.
* config/i386/i386.md (decrement_and_branch_if_zero): Fix typo.
From-SVN: r29008
1999-08-31 21:39:10 +02:00
|
|
|
|
int num = NOTE_EH_HANDLER (insn);
|
1999-08-10 18:19:16 +02:00
|
|
|
|
/* A NULL handler indicates a region is no longer needed,
|
2000-03-08 22:30:17 +01:00
|
|
|
|
as long as its rethrow label isn't used. */
|
1999-08-10 18:19:16 +02:00
|
|
|
|
if (get_first_handler (num) == NULL && ! rethrow_used (num))
|
1999-02-26 00:45:42 +01:00
|
|
|
|
{
|
|
|
|
|
NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
|
|
|
|
|
NOTE_SOURCE_FILE (insn) = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return true if NOTE is not one of the ones that must be kept paired,
|
|
|
|
|
so that we may simply delete them. */
|
|
|
|
|
|
|
|
|
|
static int
|
1999-04-06 17:45:55 +02:00
|
|
|
|
can_delete_note_p (note)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
rtx note;
|
|
|
|
|
{
|
|
|
|
|
return (NOTE_LINE_NUMBER (note) == NOTE_INSN_DELETED
|
|
|
|
|
|| NOTE_LINE_NUMBER (note) == NOTE_INSN_BASIC_BLOCK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Unlink a chain of insns between START and FINISH, leaving notes
|
|
|
|
|
that must be paired. */
|
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
void
|
1999-08-29 01:29:55 +02:00
|
|
|
|
flow_delete_insn_chain (start, finish)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
rtx start, finish;
|
|
|
|
|
{
|
|
|
|
|
/* Unchain the insns one by one. It would be quicker to delete all
|
|
|
|
|
of these with a single unchaining, rather than one at a time, but
|
|
|
|
|
we need to keep the NOTE's. */
|
|
|
|
|
|
|
|
|
|
rtx next;
|
|
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
next = NEXT_INSN (start);
|
1999-04-06 17:45:55 +02:00
|
|
|
|
if (GET_CODE (start) == NOTE && !can_delete_note_p (start))
|
|
|
|
|
;
|
2000-05-12 18:26:15 +02:00
|
|
|
|
else if (GET_CODE (start) == CODE_LABEL
|
|
|
|
|
&& ! can_delete_label_p (start))
|
|
|
|
|
{
|
|
|
|
|
const char *name = LABEL_NAME (start);
|
|
|
|
|
PUT_CODE (start, NOTE);
|
|
|
|
|
NOTE_LINE_NUMBER (start) = NOTE_INSN_DELETED_LABEL;
|
|
|
|
|
NOTE_SOURCE_FILE (start) = name;
|
|
|
|
|
}
|
1999-04-06 17:45:55 +02:00
|
|
|
|
else
|
1999-02-26 00:45:42 +01:00
|
|
|
|
next = flow_delete_insn (start);
|
|
|
|
|
|
|
|
|
|
if (start == finish)
|
|
|
|
|
break;
|
|
|
|
|
start = next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Delete the insns in a (non-live) block. We physically delete every
|
|
|
|
|
non-deleted-note insn, and update the flow graph appropriately.
|
|
|
|
|
|
|
|
|
|
Return nonzero if we deleted an exception handler. */
|
|
|
|
|
|
|
|
|
|
/* ??? Preserving all such notes strikes me as wrong. It would be nice
|
|
|
|
|
to post-process the stream to remove empty blocks, loops, ranges, etc. */
|
|
|
|
|
|
2000-04-27 06:26:47 +02:00
|
|
|
|
int
|
|
|
|
|
flow_delete_block (b)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
basic_block b;
|
|
|
|
|
{
|
|
|
|
|
int deleted_handler = 0;
|
2000-03-19 12:30:38 +01:00
|
|
|
|
rtx insn, end, tmp;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
/* If the head of this block is a CODE_LABEL, then it might be the
|
|
|
|
|
label for an exception handler which can't be reached.
|
|
|
|
|
|
|
|
|
|
We need to remove the label from the exception_handler_label list
|
1999-08-25 08:44:46 +02:00
|
|
|
|
and remove the associated NOTE_INSN_EH_REGION_BEG and
|
|
|
|
|
NOTE_INSN_EH_REGION_END notes. */
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
insn = b->head;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-08-18 12:43:26 +02:00
|
|
|
|
never_reached_warning (insn);
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (GET_CODE (insn) == CODE_LABEL)
|
|
|
|
|
{
|
|
|
|
|
rtx x, *prev = &exception_handler_labels;
|
|
|
|
|
|
|
|
|
|
for (x = exception_handler_labels; x; x = XEXP (x, 1))
|
|
|
|
|
{
|
|
|
|
|
if (XEXP (x, 0) == insn)
|
|
|
|
|
{
|
|
|
|
|
/* Found a match, splice this label out of the EH label list. */
|
|
|
|
|
*prev = XEXP (x, 1);
|
|
|
|
|
XEXP (x, 1) = NULL_RTX;
|
|
|
|
|
XEXP (x, 0) = NULL_RTX;
|
|
|
|
|
|
|
|
|
|
/* Remove the handler from all regions */
|
|
|
|
|
remove_handler (insn);
|
|
|
|
|
deleted_handler = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
prev = &XEXP (x, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-03-19 12:30:38 +01:00
|
|
|
|
/* Include any jump table following the basic block. */
|
|
|
|
|
end = b->end;
|
|
|
|
|
if (GET_CODE (end) == JUMP_INSN
|
|
|
|
|
&& (tmp = JUMP_LABEL (end)) != NULL_RTX
|
|
|
|
|
&& (tmp = NEXT_INSN (tmp)) != NULL_RTX
|
|
|
|
|
&& GET_CODE (tmp) == JUMP_INSN
|
|
|
|
|
&& (GET_CODE (PATTERN (tmp)) == ADDR_VEC
|
|
|
|
|
|| GET_CODE (PATTERN (tmp)) == ADDR_DIFF_VEC))
|
|
|
|
|
end = tmp;
|
|
|
|
|
|
|
|
|
|
/* Include any barrier that may follow the basic block. */
|
2000-03-22 08:14:41 +01:00
|
|
|
|
tmp = next_nonnote_insn (end);
|
2000-03-19 12:30:38 +01:00
|
|
|
|
if (tmp && GET_CODE (tmp) == BARRIER)
|
|
|
|
|
end = tmp;
|
|
|
|
|
|
|
|
|
|
/* Selectively delete the entire chain. */
|
1999-08-29 01:29:55 +02:00
|
|
|
|
flow_delete_insn_chain (insn, end);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Remove the edges into and out of this block. Note that there may
|
1999-02-26 00:45:42 +01:00
|
|
|
|
indeed be edges in, if we are removing an unreachable loop. */
|
|
|
|
|
{
|
|
|
|
|
edge e, next, *q;
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = b->pred; e; e = next)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
{
|
|
|
|
|
for (q = &e->src->succ; *q != e; q = &(*q)->succ_next)
|
|
|
|
|
continue;
|
|
|
|
|
*q = e->succ_next;
|
|
|
|
|
next = e->pred_next;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
n_edges--;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
free (e);
|
|
|
|
|
}
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = b->succ; e; e = next)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
{
|
|
|
|
|
for (q = &e->dest->pred; *q != e; q = &(*q)->pred_next)
|
|
|
|
|
continue;
|
|
|
|
|
*q = e->pred_next;
|
|
|
|
|
next = e->succ_next;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
n_edges--;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
free (e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
b->pred = NULL;
|
|
|
|
|
b->succ = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Remove the basic block from the array, and compact behind it. */
|
|
|
|
|
expunge_block (b);
|
|
|
|
|
|
|
|
|
|
return deleted_handler;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Remove block B from the basic block array and compact behind it. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
expunge_block (b)
|
|
|
|
|
basic_block b;
|
|
|
|
|
{
|
|
|
|
|
int i, n = n_basic_blocks;
|
|
|
|
|
|
|
|
|
|
for (i = b->index; i + 1 < n; ++i)
|
|
|
|
|
{
|
|
|
|
|
basic_block x = BASIC_BLOCK (i + 1);
|
|
|
|
|
BASIC_BLOCK (i) = x;
|
|
|
|
|
x->index = i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
basic_block_info->num_elements--;
|
|
|
|
|
n_basic_blocks--;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Delete INSN by patching it out. Return the next insn. */
|
|
|
|
|
|
2000-02-06 14:01:03 +01:00
|
|
|
|
rtx
|
1999-02-26 00:45:42 +01:00
|
|
|
|
flow_delete_insn (insn)
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
rtx prev = PREV_INSN (insn);
|
|
|
|
|
rtx next = NEXT_INSN (insn);
|
2000-03-19 12:30:38 +01:00
|
|
|
|
rtx note;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
PREV_INSN (insn) = NULL_RTX;
|
|
|
|
|
NEXT_INSN (insn) = NULL_RTX;
|
2000-05-09 20:41:25 +02:00
|
|
|
|
INSN_DELETED_P (insn) = 1;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (prev)
|
|
|
|
|
NEXT_INSN (prev) = next;
|
|
|
|
|
if (next)
|
|
|
|
|
PREV_INSN (next) = prev;
|
|
|
|
|
else
|
|
|
|
|
set_last_insn (prev);
|
1998-12-08 15:04:03 +01:00
|
|
|
|
|
1999-04-12 04:18:55 +02:00
|
|
|
|
if (GET_CODE (insn) == CODE_LABEL)
|
|
|
|
|
remove_node_from_expr_list (insn, &nonlocal_goto_handler_labels);
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* If deleting a jump, decrement the use count of the label. Deleting
|
|
|
|
|
the label itself should happen in the normal course of block merging. */
|
2000-05-17 03:44:03 +02:00
|
|
|
|
if (GET_CODE (insn) == JUMP_INSN
|
|
|
|
|
&& JUMP_LABEL (insn)
|
|
|
|
|
&& GET_CODE (JUMP_LABEL (insn)) == CODE_LABEL)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
LABEL_NUSES (JUMP_LABEL (insn))--;
|
|
|
|
|
|
2000-03-19 12:30:38 +01:00
|
|
|
|
/* Also if deleting an insn that references a label. */
|
2000-05-17 03:44:03 +02:00
|
|
|
|
else if ((note = find_reg_note (insn, REG_LABEL, NULL_RTX)) != NULL_RTX
|
|
|
|
|
&& GET_CODE (XEXP (note, 0)) == CODE_LABEL)
|
2000-03-19 12:30:38 +01:00
|
|
|
|
LABEL_NUSES (XEXP (note, 0))--;
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
return next;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
1994-11-15 16:38:07 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* True if a given label can be deleted. */
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
static int
|
1999-02-26 00:45:42 +01:00
|
|
|
|
can_delete_label_p (label)
|
|
|
|
|
rtx label;
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
rtx x;
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (LABEL_PRESERVE_P (label))
|
|
|
|
|
return 0;
|
1998-10-30 00:18:51 +01:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (x = forced_labels; x; x = XEXP (x, 1))
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (label == XEXP (x, 0))
|
|
|
|
|
return 0;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (x = label_value_list; x; x = XEXP (x, 1))
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (label == XEXP (x, 0))
|
|
|
|
|
return 0;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (x = exception_handler_labels; x; x = XEXP (x, 1))
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (label == XEXP (x, 0))
|
|
|
|
|
return 0;
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
|
1999-04-09 03:23:05 +02:00
|
|
|
|
/* User declared labels must be preserved. */
|
1999-03-21 13:14:09 +01:00
|
|
|
|
if (LABEL_NAME (label) != 0)
|
1999-04-09 03:23:05 +02:00
|
|
|
|
return 0;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
1998-10-30 00:18:51 +01:00
|
|
|
|
|
2000-05-12 18:26:15 +02:00
|
|
|
|
static int
|
|
|
|
|
tail_recursion_label_p (label)
|
|
|
|
|
rtx label;
|
|
|
|
|
{
|
|
|
|
|
rtx x;
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (x = tail_recursion_label_list; x; x = XEXP (x, 1))
|
2000-05-12 18:26:15 +02:00
|
|
|
|
if (label == XEXP (x, 0))
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2000-04-07 11:22:10 +02:00
|
|
|
|
/* Blocks A and B are to be merged into a single block A. The insns
|
|
|
|
|
are already contiguous, hence `nomove'. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
merge_blocks_nomove (a, b)
|
|
|
|
|
basic_block a, b;
|
|
|
|
|
{
|
|
|
|
|
edge e;
|
|
|
|
|
rtx b_head, b_end, a_end;
|
|
|
|
|
rtx del_first = NULL_RTX, del_last = NULL_RTX;
|
|
|
|
|
int b_empty = 0;
|
|
|
|
|
|
|
|
|
|
/* If there was a CODE_LABEL beginning B, delete it. */
|
|
|
|
|
b_head = b->head;
|
|
|
|
|
b_end = b->end;
|
|
|
|
|
if (GET_CODE (b_head) == CODE_LABEL)
|
|
|
|
|
{
|
|
|
|
|
/* Detect basic blocks with nothing but a label. This can happen
|
|
|
|
|
in particular at the end of a function. */
|
|
|
|
|
if (b_head == b_end)
|
|
|
|
|
b_empty = 1;
|
|
|
|
|
del_first = del_last = b_head;
|
|
|
|
|
b_head = NEXT_INSN (b_head);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Delete the basic block note. */
|
2000-07-27 19:25:14 +02:00
|
|
|
|
if (NOTE_INSN_BASIC_BLOCK_P (b_head))
|
2000-04-07 11:22:10 +02:00
|
|
|
|
{
|
|
|
|
|
if (b_head == b_end)
|
|
|
|
|
b_empty = 1;
|
|
|
|
|
if (! del_last)
|
|
|
|
|
del_first = b_head;
|
|
|
|
|
del_last = b_head;
|
|
|
|
|
b_head = NEXT_INSN (b_head);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If there was a jump out of A, delete it. */
|
|
|
|
|
a_end = a->end;
|
|
|
|
|
if (GET_CODE (a_end) == JUMP_INSN)
|
|
|
|
|
{
|
|
|
|
|
rtx prev;
|
|
|
|
|
|
2000-08-11 09:39:55 +02:00
|
|
|
|
for (prev = PREV_INSN (a_end); ; prev = PREV_INSN (prev))
|
2000-08-21 00:16:32 +02:00
|
|
|
|
if (GET_CODE (prev) != NOTE
|
|
|
|
|
|| NOTE_LINE_NUMBER (prev) == NOTE_INSN_BASIC_BLOCK
|
|
|
|
|
|| prev == a->head)
|
2000-08-11 09:39:55 +02:00
|
|
|
|
break;
|
2000-04-07 11:22:10 +02:00
|
|
|
|
|
|
|
|
|
del_first = a_end;
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_cc0
|
|
|
|
|
/* If this was a conditional jump, we need to also delete
|
|
|
|
|
the insn that set cc0. */
|
|
|
|
|
if (prev && sets_cc0_p (prev))
|
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
rtx tmp = prev;
|
2000-04-07 11:22:10 +02:00
|
|
|
|
prev = prev_nonnote_insn (prev);
|
|
|
|
|
if (!prev)
|
|
|
|
|
prev = a->head;
|
|
|
|
|
del_first = tmp;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
a_end = prev;
|
|
|
|
|
}
|
2000-06-01 01:57:00 +02:00
|
|
|
|
else if (GET_CODE (NEXT_INSN (a_end)) == BARRIER)
|
|
|
|
|
del_first = NEXT_INSN (a_end);
|
2000-04-07 11:22:10 +02:00
|
|
|
|
|
|
|
|
|
/* Delete everything marked above as well as crap that might be
|
|
|
|
|
hanging out between the two blocks. */
|
|
|
|
|
flow_delete_insn_chain (del_first, del_last);
|
|
|
|
|
|
|
|
|
|
/* Normally there should only be one successor of A and that is B, but
|
|
|
|
|
partway though the merge of blocks for conditional_execution we'll
|
|
|
|
|
be merging a TEST block with THEN and ELSE successors. Free the
|
|
|
|
|
whole lot of them and hope the caller knows what they're doing. */
|
|
|
|
|
while (a->succ)
|
|
|
|
|
remove_edge (a->succ);
|
|
|
|
|
|
|
|
|
|
/* Adjust the edges out of B for the new owner. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = b->succ; e; e = e->succ_next)
|
2000-04-07 11:22:10 +02:00
|
|
|
|
e->src = a;
|
|
|
|
|
a->succ = b->succ;
|
|
|
|
|
|
|
|
|
|
/* B hasn't quite yet ceased to exist. Attempt to prevent mishap. */
|
|
|
|
|
b->pred = b->succ = NULL;
|
|
|
|
|
|
|
|
|
|
/* Reassociate the insns of B with A. */
|
|
|
|
|
if (!b_empty)
|
|
|
|
|
{
|
|
|
|
|
if (basic_block_for_insn)
|
|
|
|
|
{
|
|
|
|
|
BLOCK_FOR_INSN (b_head) = a;
|
|
|
|
|
while (b_head != b_end)
|
|
|
|
|
{
|
|
|
|
|
b_head = NEXT_INSN (b_head);
|
|
|
|
|
BLOCK_FOR_INSN (b_head) = a;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
a_end = b_end;
|
|
|
|
|
}
|
|
|
|
|
a->end = a_end;
|
|
|
|
|
|
|
|
|
|
expunge_block (b);
|
|
|
|
|
}
|
|
|
|
|
|
1999-09-20 14:34:26 +02:00
|
|
|
|
/* Blocks A and B are to be merged into a single block. A has no incoming
|
|
|
|
|
fallthru edge, so it can be moved before B without adding or modifying
|
|
|
|
|
any jumps (aside from the jump from A to B). */
|
|
|
|
|
|
|
|
|
|
static int
|
1999-09-21 23:15:37 +02:00
|
|
|
|
merge_blocks_move_predecessor_nojumps (a, b)
|
1999-09-20 14:34:26 +02:00
|
|
|
|
basic_block a, b;
|
|
|
|
|
{
|
1999-10-27 05:24:24 +02:00
|
|
|
|
rtx start, end, barrier;
|
1999-10-20 14:39:01 +02:00
|
|
|
|
int index;
|
1999-09-20 14:34:26 +02:00
|
|
|
|
|
|
|
|
|
start = a->head;
|
|
|
|
|
end = a->end;
|
|
|
|
|
|
|
|
|
|
barrier = next_nonnote_insn (end);
|
2000-05-12 18:26:15 +02:00
|
|
|
|
if (GET_CODE (barrier) != BARRIER)
|
|
|
|
|
abort ();
|
|
|
|
|
flow_delete_insn (barrier);
|
1999-09-20 14:34:26 +02:00
|
|
|
|
|
|
|
|
|
/* Move block and loop notes out of the chain so that we do not
|
|
|
|
|
disturb their order.
|
|
|
|
|
|
|
|
|
|
??? A better solution would be to squeeze out all the non-nested notes
|
|
|
|
|
and adjust the block trees appropriately. Even better would be to have
|
|
|
|
|
a tighter connection between block trees and rtl so that this is not
|
|
|
|
|
necessary. */
|
|
|
|
|
start = squeeze_notes (start, end);
|
|
|
|
|
|
|
|
|
|
/* Scramble the insn chain. */
|
1999-10-27 05:24:24 +02:00
|
|
|
|
if (end != PREV_INSN (b->head))
|
|
|
|
|
reorder_insns (start, end, PREV_INSN (b->head));
|
1999-09-20 14:34:26 +02:00
|
|
|
|
|
1999-09-21 23:15:37 +02:00
|
|
|
|
if (rtl_dump_file)
|
|
|
|
|
{
|
|
|
|
|
fprintf (rtl_dump_file, "Moved block %d before %d and merged.\n",
|
|
|
|
|
a->index, b->index);
|
|
|
|
|
}
|
|
|
|
|
|
1999-10-20 14:39:01 +02:00
|
|
|
|
/* Swap the records for the two blocks around. Although we are deleting B,
|
|
|
|
|
A is now where B was and we want to compact the BB array from where
|
|
|
|
|
A used to be. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
BASIC_BLOCK (a->index) = b;
|
|
|
|
|
BASIC_BLOCK (b->index) = a;
|
1999-10-20 14:39:01 +02:00
|
|
|
|
index = a->index;
|
|
|
|
|
a->index = b->index;
|
|
|
|
|
b->index = index;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-10-20 14:39:01 +02:00
|
|
|
|
/* Now blocks A and B are contiguous. Merge them. */
|
|
|
|
|
merge_blocks_nomove (a, b);
|
|
|
|
|
|
1999-09-20 14:34:26 +02:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Blocks A and B are to be merged into a single block. B has no outgoing
|
|
|
|
|
fallthru edge, so it can be moved after A without adding or modifying
|
|
|
|
|
any jumps (aside from the jump from A to B). */
|
|
|
|
|
|
|
|
|
|
static int
|
1999-09-21 23:15:37 +02:00
|
|
|
|
merge_blocks_move_successor_nojumps (a, b)
|
1999-09-20 14:34:26 +02:00
|
|
|
|
basic_block a, b;
|
|
|
|
|
{
|
1999-10-27 05:24:24 +02:00
|
|
|
|
rtx start, end, barrier;
|
1999-09-20 14:34:26 +02:00
|
|
|
|
|
|
|
|
|
start = b->head;
|
|
|
|
|
end = b->end;
|
2000-05-12 18:26:15 +02:00
|
|
|
|
barrier = NEXT_INSN (end);
|
|
|
|
|
|
|
|
|
|
/* Recognize a jump table following block B. */
|
|
|
|
|
if (GET_CODE (barrier) == CODE_LABEL
|
|
|
|
|
&& NEXT_INSN (barrier)
|
|
|
|
|
&& GET_CODE (NEXT_INSN (barrier)) == JUMP_INSN
|
|
|
|
|
&& (GET_CODE (PATTERN (NEXT_INSN (barrier))) == ADDR_VEC
|
|
|
|
|
|| GET_CODE (PATTERN (NEXT_INSN (barrier))) == ADDR_DIFF_VEC))
|
|
|
|
|
{
|
|
|
|
|
end = NEXT_INSN (barrier);
|
|
|
|
|
barrier = NEXT_INSN (end);
|
|
|
|
|
}
|
1999-09-20 14:34:26 +02:00
|
|
|
|
|
2000-05-12 18:26:15 +02:00
|
|
|
|
/* There had better have been a barrier there. Delete it. */
|
|
|
|
|
if (GET_CODE (barrier) != BARRIER)
|
|
|
|
|
abort ();
|
|
|
|
|
flow_delete_insn (barrier);
|
1999-09-20 14:34:26 +02:00
|
|
|
|
|
|
|
|
|
/* Move block and loop notes out of the chain so that we do not
|
|
|
|
|
disturb their order.
|
|
|
|
|
|
|
|
|
|
??? A better solution would be to squeeze out all the non-nested notes
|
|
|
|
|
and adjust the block trees appropriately. Even better would be to have
|
|
|
|
|
a tighter connection between block trees and rtl so that this is not
|
|
|
|
|
necessary. */
|
|
|
|
|
start = squeeze_notes (start, end);
|
|
|
|
|
|
|
|
|
|
/* Scramble the insn chain. */
|
1999-10-27 05:24:24 +02:00
|
|
|
|
reorder_insns (start, end, a->end);
|
1999-09-20 14:34:26 +02:00
|
|
|
|
|
|
|
|
|
/* Now blocks A and B are contiguous. Merge them. */
|
|
|
|
|
merge_blocks_nomove (a, b);
|
1999-09-21 23:15:37 +02:00
|
|
|
|
|
|
|
|
|
if (rtl_dump_file)
|
|
|
|
|
{
|
|
|
|
|
fprintf (rtl_dump_file, "Moved block %d after %d and merged.\n",
|
|
|
|
|
b->index, a->index);
|
|
|
|
|
}
|
|
|
|
|
|
1999-09-20 14:34:26 +02:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Attempt to merge basic blocks that are potentially non-adjacent.
|
1999-02-26 00:45:42 +01:00
|
|
|
|
Return true iff the attempt succeeded. */
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
|
|
|
|
|
static int
|
1999-02-26 00:45:42 +01:00
|
|
|
|
merge_blocks (e, b, c)
|
|
|
|
|
edge e;
|
|
|
|
|
basic_block b, c;
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
{
|
2000-05-12 18:26:15 +02:00
|
|
|
|
/* If C has a tail recursion label, do not merge. There is no
|
|
|
|
|
edge recorded from the call_placeholder back to this label, as
|
|
|
|
|
that would make optimize_sibling_and_tail_recursive_calls more
|
|
|
|
|
complex for no gain. */
|
|
|
|
|
if (GET_CODE (c->head) == CODE_LABEL
|
|
|
|
|
&& tail_recursion_label_p (c->head))
|
|
|
|
|
return 0;
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* If B has a fallthru edge to C, no need to move anything. */
|
1999-09-21 23:15:37 +02:00
|
|
|
|
if (e->flags & EDGE_FALLTHRU)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
{
|
1999-09-21 23:15:37 +02:00
|
|
|
|
merge_blocks_nomove (b, c);
|
1999-09-20 14:34:26 +02:00
|
|
|
|
|
1999-09-21 23:15:37 +02:00
|
|
|
|
if (rtl_dump_file)
|
|
|
|
|
{
|
|
|
|
|
fprintf (rtl_dump_file, "Merged %d and %d without moving.\n",
|
|
|
|
|
b->index, c->index);
|
|
|
|
|
}
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
1999-09-21 23:15:37 +02:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
edge tmp_edge;
|
|
|
|
|
basic_block d;
|
|
|
|
|
int c_has_outgoing_fallthru;
|
|
|
|
|
int b_has_incoming_fallthru;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
1999-09-21 23:15:37 +02:00
|
|
|
|
/* We must make sure to not munge nesting of exception regions,
|
|
|
|
|
lexical blocks, and loop notes.
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-09-21 23:15:37 +02:00
|
|
|
|
The first is taken care of by requiring that the active eh
|
|
|
|
|
region at the end of one block always matches the active eh
|
|
|
|
|
region at the beginning of the next block.
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-09-21 23:15:37 +02:00
|
|
|
|
The later two are taken care of by squeezing out all the notes. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-09-21 23:15:37 +02:00
|
|
|
|
/* ??? A throw/catch edge (or any abnormal edge) should be rarely
|
|
|
|
|
executed and we may want to treat blocks which have two out
|
|
|
|
|
edges, one normal, one abnormal as only having one edge for
|
|
|
|
|
block merging purposes. */
|
1999-09-20 14:34:26 +02:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (tmp_edge = c->succ; tmp_edge; tmp_edge = tmp_edge->succ_next)
|
1999-09-20 14:34:26 +02:00
|
|
|
|
if (tmp_edge->flags & EDGE_FALLTHRU)
|
|
|
|
|
break;
|
|
|
|
|
c_has_outgoing_fallthru = (tmp_edge != NULL);
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (tmp_edge = b->pred; tmp_edge; tmp_edge = tmp_edge->pred_next)
|
1999-09-20 14:34:26 +02:00
|
|
|
|
if (tmp_edge->flags & EDGE_FALLTHRU)
|
|
|
|
|
break;
|
|
|
|
|
b_has_incoming_fallthru = (tmp_edge != NULL);
|
|
|
|
|
|
1999-09-21 23:15:37 +02:00
|
|
|
|
/* If B does not have an incoming fallthru, and the exception regions
|
|
|
|
|
match, then it can be moved immediately before C without introducing
|
1999-10-05 06:12:33 +02:00
|
|
|
|
or modifying jumps.
|
|
|
|
|
|
|
|
|
|
C can not be the first block, so we do not have to worry about
|
|
|
|
|
accessing a non-existent block. */
|
1999-09-21 23:15:37 +02:00
|
|
|
|
d = BASIC_BLOCK (c->index - 1);
|
|
|
|
|
if (! b_has_incoming_fallthru
|
|
|
|
|
&& d->eh_end == b->eh_beg
|
|
|
|
|
&& b->eh_end == c->eh_beg)
|
|
|
|
|
return merge_blocks_move_predecessor_nojumps (b, c);
|
|
|
|
|
|
|
|
|
|
/* Otherwise, we're going to try to move C after B. Make sure the
|
1999-10-05 06:12:33 +02:00
|
|
|
|
exception regions match.
|
|
|
|
|
|
|
|
|
|
If B is the last basic block, then we must not try to access the
|
|
|
|
|
block structure for block B + 1. Luckily in that case we do not
|
|
|
|
|
need to worry about matching exception regions. */
|
|
|
|
|
d = (b->index + 1 < n_basic_blocks ? BASIC_BLOCK (b->index + 1) : NULL);
|
1999-09-21 23:15:37 +02:00
|
|
|
|
if (b->eh_end == c->eh_beg
|
1999-10-05 06:12:33 +02:00
|
|
|
|
&& (d == NULL || c->eh_end == d->eh_beg))
|
1999-09-21 23:15:37 +02:00
|
|
|
|
{
|
|
|
|
|
/* If C does not have an outgoing fallthru, then it can be moved
|
|
|
|
|
immediately after B without introducing or modifying jumps. */
|
|
|
|
|
if (! c_has_outgoing_fallthru)
|
|
|
|
|
return merge_blocks_move_successor_nojumps (b, c);
|
|
|
|
|
|
|
|
|
|
/* Otherwise, we'll need to insert an extra jump, and possibly
|
|
|
|
|
a new block to contain it. */
|
|
|
|
|
/* ??? Not implemented yet. */
|
|
|
|
|
}
|
1999-09-20 14:34:26 +02:00
|
|
|
|
|
1999-09-21 23:15:37 +02:00
|
|
|
|
return 0;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
1999-09-21 23:15:37 +02:00
|
|
|
|
}
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
|
1999-09-21 23:15:37 +02:00
|
|
|
|
/* Top level driver for merge_blocks. */
|
1998-10-30 00:18:51 +01:00
|
|
|
|
|
1999-09-21 23:15:37 +02:00
|
|
|
|
static void
|
|
|
|
|
try_merge_blocks ()
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
/* Attempt to merge blocks as made possible by edge removal. If a block
|
2000-08-11 14:45:05 +02:00
|
|
|
|
has only one successor, and the successor has only one predecessor,
|
1999-09-21 23:15:37 +02:00
|
|
|
|
they may be combined. */
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (i = 0; i < n_basic_blocks;)
|
1999-09-21 23:15:37 +02:00
|
|
|
|
{
|
|
|
|
|
basic_block c, b = BASIC_BLOCK (i);
|
|
|
|
|
edge s;
|
|
|
|
|
|
|
|
|
|
/* A loop because chains of blocks might be combineable. */
|
|
|
|
|
while ((s = b->succ) != NULL
|
|
|
|
|
&& s->succ_next == NULL
|
|
|
|
|
&& (s->flags & EDGE_EH) == 0
|
|
|
|
|
&& (c = s->dest) != EXIT_BLOCK_PTR
|
|
|
|
|
&& c->pred->pred_next == NULL
|
|
|
|
|
/* If the jump insn has side effects, we can't kill the edge. */
|
|
|
|
|
&& (GET_CODE (b->end) != JUMP_INSN
|
|
|
|
|
|| onlyjump_p (b->end))
|
|
|
|
|
&& merge_blocks (s, b, c))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* Don't get confused by the index shift caused by deleting blocks. */
|
|
|
|
|
i = b->index + 1;
|
|
|
|
|
}
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
1998-10-30 00:18:51 +01:00
|
|
|
|
|
2000-02-09 00:48:32 +01:00
|
|
|
|
/* The given edge should potentially be a fallthru edge. If that is in
|
|
|
|
|
fact true, delete the jump and barriers that are in the way. */
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
2000-04-07 11:22:10 +02:00
|
|
|
|
void
|
1999-02-26 00:45:42 +01:00
|
|
|
|
tidy_fallthru_edge (e, b, c)
|
|
|
|
|
edge e;
|
|
|
|
|
basic_block b, c;
|
|
|
|
|
{
|
1999-04-06 17:45:55 +02:00
|
|
|
|
rtx q;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
/* ??? In a late-running flow pass, other folks may have deleted basic
|
|
|
|
|
blocks by nopping out blocks, leaving multiple BARRIERs between here
|
|
|
|
|
and the target label. They ought to be chastized and fixed.
|
|
|
|
|
|
1999-04-06 17:45:55 +02:00
|
|
|
|
We can also wind up with a sequence of undeletable labels between
|
|
|
|
|
one block and the next.
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
|
1999-04-06 17:45:55 +02:00
|
|
|
|
So search through a sequence of barriers, labels, and notes for
|
|
|
|
|
the head of block C and assert that we really do fall through. */
|
1998-10-30 00:18:51 +01:00
|
|
|
|
|
1999-04-06 17:45:55 +02:00
|
|
|
|
if (next_real_insn (b->end) != next_real_insn (PREV_INSN (c->head)))
|
1999-02-26 00:45:42 +01:00
|
|
|
|
return;
|
1998-10-30 00:18:51 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Remove what will soon cease being the jump insn from the source block.
|
|
|
|
|
If block B consisted only of this single jump, turn it into a deleted
|
|
|
|
|
note. */
|
|
|
|
|
q = b->end;
|
2000-04-27 08:47:16 +02:00
|
|
|
|
if (GET_CODE (q) == JUMP_INSN
|
combine.c (try_combine): Use any_condjump_p...
* combine.c (try_combine): Use any_condjump_p, any_uncondjump_p
and pc_set at the place of simplejump_p and condjump_p.
* cse.c (record_jump_equiv): Likewise.
* emit-rtl.c (emit): Likewise.
* explow.c (find_next_ref): Likewise.
* flow.c (tidy_fallthru_edge): Likewise.
(init_propagate_block_info): Likewise.
* gcse.c (delete_null_pointer_checks): Likewise.
* ifcvt.c (cond_exec_get_condition, noce_get_condition,
dead_or_predicable): Likewise.
* integrate.c (copy_insn_list): Likewise.
* loop.c (scan_loop, verify_dominator, find_and_verify_loops,
for_each_insn_in_loop, check_dbra_loop, get_condition,
insert_bct, load_mems): Likewise.
* resource.c (find_dead_or_set_registers): Likewise.
* sibcalls.c (simplejump_p): Likewise.
* unroll.c (copy_loop_body, reg_dead_after_loop): Likewise.
From-SVN: r34175
2000-05-25 23:38:49 +02:00
|
|
|
|
&& onlyjump_p (q)
|
|
|
|
|
&& (any_uncondjump_p (q)
|
2000-04-27 08:47:16 +02:00
|
|
|
|
|| (b->succ == e && e->succ_next == NULL)))
|
1998-10-30 00:18:51 +01:00
|
|
|
|
{
|
1999-03-09 16:49:53 +01:00
|
|
|
|
#ifdef HAVE_cc0
|
|
|
|
|
/* If this was a conditional jump, we need to also delete
|
|
|
|
|
the insn that set cc0. */
|
combine.c (try_combine): Use any_condjump_p...
* combine.c (try_combine): Use any_condjump_p, any_uncondjump_p
and pc_set at the place of simplejump_p and condjump_p.
* cse.c (record_jump_equiv): Likewise.
* emit-rtl.c (emit): Likewise.
* explow.c (find_next_ref): Likewise.
* flow.c (tidy_fallthru_edge): Likewise.
(init_propagate_block_info): Likewise.
* gcse.c (delete_null_pointer_checks): Likewise.
* ifcvt.c (cond_exec_get_condition, noce_get_condition,
dead_or_predicable): Likewise.
* integrate.c (copy_insn_list): Likewise.
* loop.c (scan_loop, verify_dominator, find_and_verify_loops,
for_each_insn_in_loop, check_dbra_loop, get_condition,
insert_bct, load_mems): Likewise.
* resource.c (find_dead_or_set_registers): Likewise.
* sibcalls.c (simplejump_p): Likewise.
* unroll.c (copy_loop_body, reg_dead_after_loop): Likewise.
From-SVN: r34175
2000-05-25 23:38:49 +02:00
|
|
|
|
if (any_condjump_p (q) && sets_cc0_p (PREV_INSN (q)))
|
1999-03-09 16:49:53 +01:00
|
|
|
|
q = PREV_INSN (q);
|
|
|
|
|
#endif
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (b->head == q)
|
|
|
|
|
{
|
|
|
|
|
PUT_CODE (q, NOTE);
|
|
|
|
|
NOTE_LINE_NUMBER (q) = NOTE_INSN_DELETED;
|
|
|
|
|
NOTE_SOURCE_FILE (q) = 0;
|
|
|
|
|
}
|
1998-12-02 00:19:12 +01:00
|
|
|
|
else
|
2000-08-22 20:12:15 +02:00
|
|
|
|
q = PREV_INSN (q);
|
|
|
|
|
|
|
|
|
|
b->end = q;
|
1998-10-30 00:18:51 +01:00
|
|
|
|
}
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Selectively unlink the sequence. */
|
1999-03-09 16:49:53 +01:00
|
|
|
|
if (q != PREV_INSN (c->head))
|
1999-08-29 01:29:55 +02:00
|
|
|
|
flow_delete_insn_chain (NEXT_INSN (q), PREV_INSN (c->head));
|
1998-12-02 10:14:57 +01:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
e->flags |= EDGE_FALLTHRU;
|
|
|
|
|
}
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
|
2000-02-09 00:48:32 +01:00
|
|
|
|
/* Fix up edges that now fall through, or rather should now fall through
|
|
|
|
|
but previously required a jump around now deleted blocks. Simplify
|
|
|
|
|
the search by only examining blocks numerically adjacent, since this
|
|
|
|
|
is how find_basic_blocks created them. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
tidy_fallthru_edges ()
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 1; i < n_basic_blocks; ++i)
|
|
|
|
|
{
|
|
|
|
|
basic_block b = BASIC_BLOCK (i - 1);
|
|
|
|
|
basic_block c = BASIC_BLOCK (i);
|
|
|
|
|
edge s;
|
|
|
|
|
|
|
|
|
|
/* We care about simple conditional or unconditional jumps with
|
|
|
|
|
a single successor.
|
|
|
|
|
|
|
|
|
|
If we had a conditional branch to the next instruction when
|
|
|
|
|
find_basic_blocks was called, then there will only be one
|
|
|
|
|
out edge for the block which ended with the conditional
|
|
|
|
|
branch (since we do not create duplicate edges).
|
|
|
|
|
|
|
|
|
|
Furthermore, the edge will be marked as a fallthru because we
|
|
|
|
|
merge the flags for the duplicate edges. So we do not want to
|
|
|
|
|
check that the edge is not a FALLTHRU edge. */
|
|
|
|
|
if ((s = b->succ) != NULL
|
|
|
|
|
&& s->succ_next == NULL
|
|
|
|
|
&& s->dest == c
|
|
|
|
|
/* If the jump insn has side effects, we can't tidy the edge. */
|
|
|
|
|
&& (GET_CODE (b->end) != JUMP_INSN
|
|
|
|
|
|| onlyjump_p (b->end)))
|
|
|
|
|
tidy_fallthru_edge (s, b, c);
|
|
|
|
|
}
|
|
|
|
|
}
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1998-03-05 23:31:51 +01:00
|
|
|
|
/* Perform data flow analysis.
|
2000-04-27 06:42:09 +02:00
|
|
|
|
F is the first insn of the function; FLAGS is a set of PROP_* flags
|
|
|
|
|
to be used in accumulating flow info. */
|
1998-03-05 23:31:51 +01:00
|
|
|
|
|
|
|
|
|
void
|
2000-04-27 06:42:09 +02:00
|
|
|
|
life_analysis (f, file, flags)
|
1998-03-05 23:31:51 +01:00
|
|
|
|
rtx f;
|
|
|
|
|
FILE *file;
|
2000-04-27 06:42:09 +02:00
|
|
|
|
int flags;
|
1998-03-05 23:31:51 +01:00
|
|
|
|
{
|
|
|
|
|
#ifdef ELIMINABLE_REGS
|
2000-02-22 00:27:01 +01:00
|
|
|
|
register int i;
|
1998-03-05 23:31:51 +01:00
|
|
|
|
static struct {int from, to; } eliminables[] = ELIMINABLE_REGS;
|
|
|
|
|
#endif
|
2000-04-06 23:22:49 +02:00
|
|
|
|
|
1998-03-05 23:31:51 +01:00
|
|
|
|
/* Record which registers will be eliminated. We use this in
|
|
|
|
|
mark_used_regs. */
|
|
|
|
|
|
|
|
|
|
CLEAR_HARD_REG_SET (elim_reg_set);
|
|
|
|
|
|
|
|
|
|
#ifdef ELIMINABLE_REGS
|
optabs.c (init_optabs): Initialize fixtab...
* optabs.c (init_optabs): Initialize fixtab, fixtrunctab, floattab,
and extendtab within their proper array boundaries.
* emit-rtl.c (init_emit_once): Pass `const_tiny_rtx' with bounds
for the entire array.
* config/arm/arm.c (arm_override_options): Use ARRAY_SIZE.
* config/alpha/alpha.c (alpha_lookup_xfloating_lib_func): Likewise.
* config/avr/avr.c (order_regs_for_local_alloc): Likewise.
* config/fr30/fr30.c (fr30_print_operand): Likewise.
* config/i386/dgux.c (output_options): Likewise.
* config/i386/dgux.h (ASM_FILE_START): Likewise.
* config/m88k/m88k.c (output_options): Likewise.
* config/m88k/m88k.h (ASM_FILE_START): Likewise.
* config/mcore/mcore.c (mcore_output_inline_const_forced,
layout_mcore_frame, handle_structs_in_regs): Likewise.
* config/mips/mips.c (output_block_move): Likewise.
* config/rs6000/rs6000.c (rs6000_override_options,
rs6000_file_start): Likewise.
* config/sparc/sparc.c (sparc_add_gc_roots): Likewise.
* fixinc/fixfixes.c (FIX_TABLE_CT): Likewise.
* fixinc/fixtests.c (TEST_TABLE_CT): Likewise.
* builtins.c (expand_builtin_setjmp): Likewise.
* expr.c (safe_from_p): Likewise.
* flow.c (life_analysis): Likewise.
* fold-const.c (size_int_type_wide): Likewise.
* gcc.c (translate_options, init_spec, set_spec, main): Likewise.
* genattrtab.c (make_length_attrs): Likewise.
* genopinit.c (gen_insn): Likewise.
* genrecog.c (NUM_KNOWN_PREDS, NUM_SPECIAL_MODE_PREDS): Likewise.
* global.c (global_alloc): Likewise.
* local-alloc.c (find_free_reg): Likewise.
* mips-tdump.c (print_symbol): Likewise.
* mips-tfile.c (parse_def, parse_input): Likewise.
* reload1.c (NUM_ELIMINABLE_REGS): Likewise.
* stmt.c (expand_nl_goto_receiver): Likewise.
* stor-layout.c (set_sizetype): Likewise.
* varasm.c (decode_reg_name): Likewise.
* toplev.c (decode_f_option, decode_W_option,
set_target_switch, print_switch_values): Likewise.
(NUM_ELEM): Remove macro.
(display_help, main): s/NUM_ELEM/ARRAY_SIZE/
From-SVN: r35949
2000-08-24 22:31:35 +02:00
|
|
|
|
for (i = 0; i < (int) ARRAY_SIZE (eliminables); i++)
|
1998-03-05 23:31:51 +01:00
|
|
|
|
SET_HARD_REG_BIT (elim_reg_set, eliminables[i].from);
|
|
|
|
|
#else
|
|
|
|
|
SET_HARD_REG_BIT (elim_reg_set, FRAME_POINTER_REGNUM);
|
|
|
|
|
#endif
|
|
|
|
|
|
2000-01-19 10:42:11 +01:00
|
|
|
|
if (! optimize)
|
2000-08-08 21:46:51 +02:00
|
|
|
|
flags &= ~(PROP_LOG_LINKS | PROP_AUTOINC);
|
1999-08-19 17:53:10 +02:00
|
|
|
|
|
2000-02-16 08:54:53 +01:00
|
|
|
|
/* The post-reload life analysis have (on a global basis) the same
|
|
|
|
|
registers live as was computed by reload itself. elimination
|
|
|
|
|
Otherwise offsets and such may be incorrect.
|
|
|
|
|
|
|
|
|
|
Reload will make some registers as live even though they do not
|
2000-08-11 14:45:05 +02:00
|
|
|
|
appear in the rtl.
|
2000-06-12 16:40:24 +02:00
|
|
|
|
|
|
|
|
|
We don't want to create new auto-incs after reload, since they
|
|
|
|
|
are unlikely to be useful and can cause problems with shared
|
|
|
|
|
stack slots. */
|
2000-02-16 08:54:53 +01:00
|
|
|
|
if (reload_completed)
|
2000-06-12 16:40:24 +02:00
|
|
|
|
flags &= ~(PROP_REG_INFO | PROP_AUTOINC);
|
2000-02-16 08:54:53 +01:00
|
|
|
|
|
2000-04-27 06:42:09 +02:00
|
|
|
|
/* We want alias analysis information for local dead store elimination. */
|
2000-08-08 21:46:51 +02:00
|
|
|
|
if (optimize && (flags & PROP_SCAN_DEAD_CODE))
|
2000-04-27 06:42:09 +02:00
|
|
|
|
init_alias_analysis ();
|
|
|
|
|
|
2000-02-16 08:54:53 +01:00
|
|
|
|
/* Always remove no-op moves. Do this before other processing so
|
|
|
|
|
that we don't have to keep re-scanning them. */
|
|
|
|
|
delete_noop_moves (f);
|
|
|
|
|
|
|
|
|
|
/* Some targets can emit simpler epilogues if they know that sp was
|
|
|
|
|
not ever modified during the function. After reload, of course,
|
|
|
|
|
we've already emitted the epilogue so there's no sense searching. */
|
1999-08-19 17:53:10 +02:00
|
|
|
|
if (! reload_completed)
|
2000-02-16 08:54:53 +01:00
|
|
|
|
notice_stack_pointer_modification (f);
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-02-16 08:54:53 +01:00
|
|
|
|
/* Allocate and zero out data structures that will record the
|
|
|
|
|
data from lifetime analysis. */
|
|
|
|
|
allocate_reg_life_data ();
|
|
|
|
|
allocate_bb_life_data ();
|
1999-08-19 17:53:10 +02:00
|
|
|
|
|
2000-02-16 08:54:53 +01:00
|
|
|
|
/* Find the set of registers live on function exit. */
|
|
|
|
|
mark_regs_live_at_end (EXIT_BLOCK_PTR->global_live_at_start);
|
|
|
|
|
|
|
|
|
|
/* "Update" life info from zero. It'd be nice to begin the
|
|
|
|
|
relaxation with just the exit and noreturn blocks, but that set
|
|
|
|
|
is not immediately handy. */
|
2000-02-24 23:32:10 +01:00
|
|
|
|
|
|
|
|
|
if (flags & PROP_REG_INFO)
|
2000-08-11 14:45:05 +02:00
|
|
|
|
memset (regs_ever_live, 0, sizeof (regs_ever_live));
|
2000-04-27 09:01:04 +02:00
|
|
|
|
update_life_info (NULL, UPDATE_LIFE_GLOBAL, flags);
|
2000-02-16 08:54:53 +01:00
|
|
|
|
|
|
|
|
|
/* Clean up. */
|
2000-08-08 21:46:51 +02:00
|
|
|
|
if (optimize && (flags & PROP_SCAN_DEAD_CODE))
|
2000-04-27 06:42:09 +02:00
|
|
|
|
end_alias_analysis ();
|
1999-01-18 04:01:26 +01:00
|
|
|
|
|
1998-03-05 23:31:51 +01:00
|
|
|
|
if (file)
|
|
|
|
|
dump_flow_info (file);
|
|
|
|
|
|
|
|
|
|
free_basic_block_vars (1);
|
|
|
|
|
}
|
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
/* A subroutine of verify_wide_reg, called through for_each_rtx.
|
|
|
|
|
Search for REGNO. If found, abort if it is not wider than word_mode. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
verify_wide_reg_1 (px, pregno)
|
|
|
|
|
rtx *px;
|
|
|
|
|
void *pregno;
|
|
|
|
|
{
|
|
|
|
|
rtx x = *px;
|
* Rework fields used to describe positions of bitfields and
modify sizes to be unsigned and use HOST_WIDE_INT.
* alias.c (reg_known_value_size): Now unsigned.
* c-typeck.c (build_unary_op, case ADDR_EXPR): Use byte_position.
(really_start_incremental_init): Use bitsize_zero_node.
(push_init_level, pop_init_level, output_init_element): Likewise.
Use bitsize_unit_node and bitsize_one_node.
(output_pending_init_elements, process_init_element): Likewise.
* combine.c (combine_max_regno, reg_sign_bit_copies): Now unsigned.
(make_extraction): Position and length HOST_WIDE_INT and unsigned
HOST_WIDE_INT, respectively.
(get_pos_from_mask): Passed in value is unsigned HOST_WIDE_INT.
(num_sign_bit_copies): Returns unsigned.
BITWIDTH now unsigned; rework arithmetic.
Remove recursive call from arg to MAX.
(combine_instructions, init_reg_last_arrays): NREGS now unsigned.
(setup_incoming_promotions, can_combine_p, try_combine, simplify_set):
REGNO now unsigned.
(set_nonzero_bit_and_sign_copies): NUM now unsigned.
(find_split_point, expand_compound_operation, make_extraction): LEN
now unsigned HOST_WIDE_INT, POS now HOST_WIDE_INT.
(make_field_assignment): Likewise.
(combine_simplify_rtx): Add cast.
(expand_compound_operation): MODEWIDTH now unsigned; rework arithmetic.
(force_to_mode): WIDTH now unsigned; add cast.
(if_then_else_cond): SIZE now unsigned.
(nonzero_bits): MODE_WIDTH, RESULT_WIDTH, and WIDTH now unsigned.
(extended_count): Now returns unsigned.
(simplify_shift_const): COUNT unsigned; arg is now INPUT_COUNT.
Add SIGNED_COUNT variable; MODE_WORDS and FIRST_COUNT now unsigned.
(simplify_comparison): MODE_WIDTH now unsigned.
(update_table_tick): REGNO and ENDREGNO now unsigned; new var R.
(mark_used_regs_combine): Likewise; rework arithmetic.
(record_value_for_reg): REGNO, ENDREGNO, and I now unsigned.
(record_dead_and_set_regs, reg_dead_at_p, distribute_notes): Likewise.
(record_promoted_value): REGNO now unsigned.
(get_last_value_validate): REGNO, ENDREGNO, and J now unsigned.
(get_last_value): REGNO now unsigned.
(use_crosses_set_p): REGNO and ENDREGNO now unsigned.
(reg_dead_regno, reg_dead_endregno): Now unsigned.
(remove_death): Arg REGNO now unsigned.
(move_deaths): REGNO, DEADREGNO, DEADEND, OUREND, and I now unsigned.
(reg_bitfield_target_p): REGNO, REGNO, ENDREGNO, and ENDTREGNO
now unsigned.
* convert.c (convert_to_integer): INPREC and OUTPREC now unsigned.
* cse.c (struct qty_table_elem): FIRST_REG and LAST_REG now unsigned.
(struct cse_reg_info): REGNO now unsigned.
(cached_regno): Now unsigned.
(REGNO_QTY_VALID_P): Add cast.
(make_new_qty, make_regs_eqv, delete_reg_eqiv): Regno args unsigned.
(remove_invalid_regs): Likewise.
(remove_invalid_subreg_refs): Likewise; arg WORD also unsigned
as are variables END and I.
(get_cse_reg_info, insert): Likewise.
(mention_regs, invalidate_for_call): REGNO, ENDREGNO, and I unsigned.
(canon_hash): Likewise.
(insert_regs, lookup_for_remove): REGNO now unsigned.
(invalidate): REGNO, ENDREGNO, TREGNO, and TENDREGNO now unsigned.
New variable RN.
* dbxout.c (dbxout_parms, dbxout_reg_parms): Don't check for REGNO < 0.
* dwarf2out.c (dwarf2ou_frame_debug_expr): Remove cast.
* emit-rtl.c (subreg_realpart_p): Add cast.
(operand_subword): Arg I is now unsigned as is var PARTWORDS.
(operand_subword_force): Arg I is now unsigned.
* except.c (eh_regs): Variable I is now unsigned.
* explow.c (hard_function_value): BYTES is unsigned HOST_WIDE_INT.
* expmed.c (store_fixed_bit_field): Position is HOST_WIDE_INT;
length is unsigned HOST_WIDE_INT; likewise for internal variables.
(store_split_bit_field, extract_fixed_bit_field): Likewise.
(extract_split_bit_field, store_bit_field, extract_bit_field):
Likewise.
* expr.c (store_constructor_fields, store_constructor, store_field):
Positions are HOST_WIDE_INT and lengths are unsigned HOST_WIDE_INT.
(expand_assignment, expand_expr, expand_expr_unaligned): Likewise.
(do_jump): Likewise.
(move_by_pieces, move_by_pieces_ninsns, clear_by_pieces):
MAX_SIZE is now unsigned.
(emit_group_load): BYTEPOS is HOST_WIDE_INT; BYTELEN is unsigned.
(emit_group_store): Likewise.
(emit_move_insn): I now unsigned.
(store_constructor): Use host_integerp, tree_low_cst, and
bitsize_unit_node.
(get_inner_reference): Return bitpos and bitsize as HOST_WIDE_INT.
Rework all calculations to use trees and new fields.
* expr.h (promoted_input_arg): Regno now unsigned.
(store_bit_field, extract_bit_field): Adjust types of pos and size.
(mark_seen_cases): Arg is HOST_WIDE_INT.
* flow.c (verify_wide_reg_1): REGNO now unsigned.
* fold-const.c (decode_field_reference): Size and pos HOST_WIDE_INT;
precisions and alignments are unsigned.
(optimize_bit_field_compare, fold_truthop): Likewise.
(int_const_binop): Adjust threshold for size_int_type_wide call.
(fold_convert): Likewise.
(size_int_type_wide): Make table larger and fix thinko that only
had half of table used.
(all_ones_mask_p, fold): Precisions are unsigned.
* function.c (put_reg_info_stack): REGNO is unsigned.
(instantiate_decl): Size is HOST_WIDE_INT.
(instantiate_virtual_regs): I is unsigned.
(assign_parms): REGNO, REGNOI, and REGNOR are unsigned.
(promoted_input_arg): REGNO is unsigned.
* function.h (struct function): x_max_parm_reg is now unsigned.
* gcse.c (max_gcse_regno): Now unsigned.
(struct null_pointer_info): min_reg and max_reg now unsigned.
(lookup_set, next_set): REGNO arg now unsigned.
(compute_hash_table): REGNO and I now unsigned.
(handle_avail_expr): regnum_for_replacing now unsigned.
(cprop_insn): REGNO now unsigned.
(delete_null_pointer_checks_1): BLOCK_REG now pointer to unsigned.
* ggc-common.c (ggc_mark_tree_children, case FIELD_DECL): New case.
* global.c (set_preference): SRC_REGNO, DEST_REGNO, and I now unsigned.
* hard-reg-set.h (reg_class_size): Now unsigned.
* integrate.c (mark_stores): LAST_REG and I now unsigned; new UREGNO.
* jump.c (mark_modified_reg): I now unsigned; add cast.
(rtx_equal_for_thread_p): Add cast.
* loop.c (max_reg_before_loop): Now unsigned.
(struct_movable): REGNO now unsigned.
(try_copy_prop): REGNO arg unsigned.
(regs_match_p): XN and YN now unsigned.
(consec_sets_invariant_p, maybe_eliminate_biv): REGNO now unsigned.
(strength_reduce): Likewise; NREGS also unsigned.
(first_increment_giv, last_increment_giv unsigned): Now unsigned.
* loop.h (struct iv_class): REGNO now unsigned.
(max_reg_before_loop, first_increment_giv, last_increment_giv):
Now unsigned.
* machmode.h (mode_size, mode_unit_size): Now unsigned.
(mode_for_size, smallest_mode_for_size): Pass size as unsigned.
* optabs.c (expand_binop): I and NWORDS now unsigned.
(expand_unop): I now unsigned.
* print-tree.c (print_node): Don't print DECL_FIELD_BITPOS, but do
print DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET.
* real.c (significand_size): Now returns unsigned.
* real.h (significand_size): Likewise.
* regclass.c (reg_class_size): Now unsigned.
(choose_hard_reg_mode): Both operands now unsigned.
(record_reg_classes): REGNO and NR now unsigned.
(reg_scan): NREGS now unsigned.
(reg_scan_update): old_max_regno now unsigned.
(reg_scan_mark_refs): Arg MIN_REGNO and var REGNO now unsigned.
* reload.c (find_valid_class): BEST_SIZE now unsigned.
(find_dummy_reload): REGNO, NWORDS, and I now unsigned.
(hard_reg_set_here_p): Args BEG_REGNO and END_REGNO now unsigned.
Likewise for variable R.
(refers_to_regno_for_reload_p): Args REGNO and END_REGNO now unsigned,
as are variables INNER_REGNO and INNER_ENDREGNO; add new variable R.
(find_equiv_reg): Add casts.
(regno_clobbered_p): Arg REGNO now unsigned.
* reload.h (struct reload): NREGS now unsigned.
(refers_to_regno_for_reload_p): Regno args are unsigned.
(regno_clobbered_p): Likewise.
* reload1.c (reg_max_ref_width, spill_stack_slot_width): Now unsigned.
(compute_use_by_pseudos): REGNO now unsigned.
(find_reg): I and J now unsigned, new variable K, and change loop
variables accordingly; THIS_NREGS now unsigned.
(alter_reg): INHERENT_SIZE and TOTAL_SIZE now unsigned.
(spill_hard_reg): REGNO arg now unsigned; add casts.
(forget_old_reloads_1): REGNO, NR, and I now unsigned.
(mark_reload_reg_in_use): Arg REGNO and vars NREGS and I now unsigned.
(clear_reload_reg_in_use): Arg REGNO and vars NREGS, START_REGNO,
END_REGNO, CONFLICT_START, and CONFLICT_END now unsigned.
(reload_reg_free_p, reload_reg_reaches_end_p): Arg REGNO now unsigned.
(choose_reload_regs): MAX_GROUP_SIZE now unsigned.
(emit_reload_insns): REGNO now unsigned.
(reload_cse_move2add): Add cast.
(move2add_note_store): REGNO and I now unsigned; new variable ENDREGNO
and rework loop.
* resource.c (mark_referenced_resources, mark_set_resources): New
variable R; REGNO and LAST_REGNO now unsigned.
(mark_target_live_regs): J and REGNO now unsigned.
* rtl.c (mode_size, mode_unit_size): Now unsigned.
* rtl.h (union rtunion_def): New field rtuint.
(XCUINT): New macro.
(ADDRESSOF_REGNO, REGNO, SUBREG_WORD): New XCUINT.
(operand_subword, operand_subword_force): Word number is unsigned.
(choose_hard_reg_mode): Operands are unsigned.
(refers_to-regno_p, dead_or_set_regno_p): Regno arg is unsigned.
(find_regno_note, find_regno_fusage, replace_regs): Likewise.
(regno_use_in, combine_instructions, remove_death): Likewise.
(reg_scan, reg_scan_update): Likewise.
(extended_count): Return is unsigned.
* rtlanal.c (refers_to_regno_p): Args REGNO and ENDREGNO and vars I,
INNER_REGNO, and INNER_ENDREGNO now unsigned; new variable X_REGNO.
(reg_overlap_mentioned_p): REGNO and ENDREGNO now unsigned.
(reg_set_last_first_regno, reg_set_last_last_regno): Now unsigned.
(reg_reg_last_1): FIRS and LAST now unsigned.
(dead_or_set_p): REGNO, LAST_REGNO, and I now unsigned.
(dead_or_set_regno_p): Arg TEST_REGNO and vars REGNO and ENDREGNO
now unsigned.
(find_regno_note, regno_use_in): Arg REGNO now unsigned.
(find_regno_fusage): Likewise; also var REGNOTE now unsigned.
(find_reg_fusage): Variables REGNO, END_REGNO, and I now unsigned.
(replace_regs): Arg NREGS now unsigned.
* sdbout.c (sdbout_parms, sdbout_reg_parms): Don't check REGNO < 0.
* simplify-rtx.c (simplify_unary_operation): WIDTH now unsigned.
(simplify_binary_operation): Likewise.
(cselib_invalidate_regno): Arg REGNO and variables ENDREGNO, I, and
THIS_LAST now unsigned.
(cselib_record_set): Add cast.
* ssa.c (ssa_max_reg_num): Now unsigned.
(rename_block): REGNO now unsigned.
* stmt.c (expand_return): Bit positions unsigned HOST_WIDE_INT;
sizes now unsigned.
(all_cases_count): Just return -1 not -2.
COUNT, MINVAL, and LASTVAL now HOST_WIDE_INT.
Rework tests to use trees whenever possible.
Use host_integerp and tree_low_cst.
(mark_seen_cases): COUNT arg now HOST_WIDE_INT;
Likewise variable NEXT_NODE_OFFSET; XLO now unsigned.
(check_for_full_enumeration_handing): BYTES_NEEDED, I to HOST_WIDE_INT.
* stor-layout.c (mode_for_size): SIZE arg now unsigned.
(smallest_mode_for_size): Likewise.
(layout_decl): Simplify handing of a specified DECL_SIZE_UNIT.
KNOWN_ALIGN is now an alignment, so simplify code.
Don't turn off DECL_BIT_FIELD if field is BLKmode, but not type.
(start_record_layout): Renamed from new_record_layout_info.
Update to new fields.
(debug_rli, normalize_rli, rli_size_unit_so_far, rli_size_so_far):
New functions.
(place_union_field): Renamed from layout_union_field.
Update to use new fields in rli.
(place_field): Renamed from layout_field.
Major rewrite to use new fields in rli; pass alignment to layout_decl.
(finalize_record_size): Rework to use new fields in rli and handle
union.
(compute_record_mode): Rework to simplify and to use new DECL fields.
(finalize_type_size): Make rounding more consistent.
(finish_union_layout): Deleted.
(layout_type, case VOID_TYPE): Don't set TYPE_SIZE_UNIT either.
(layout_type, case RECORD_TYPE): Call new function names.
(initialize_sizetypes): Set TYPE_IS_SIZETYPE.
(set_sizetype): Set TYPE_IS_SIZETYPE earlier.
(get_best_mode): UNIT is now unsigned; remove casts.
* tree.c (bit_position): Compute from new fields.
(byte_position, int_byte_position): New functions.
(print_type_hash_statistics): Cast to remove warning.
(build_range_type): Use host_integerp and tree_low_cst to try to hash.
(build_index_type): Likewise; make subtype of sizetype.
(build_index_2_type): Pass sizetype to build_range_type.
(build_common_tree_nodes): Use size_int and bitsize_int to
initialize nodes; add bitsize_{zero,one,unit}_node.
* tree.h (DECL_FIELD_CONTEXT): Use FIELD_DECL_CHECK.
(DECL_BIT_FIELD_TYPE, DECL_QUALIFIER, DECL_FCONTEXT): Likewise.
(DECL_PACKED, DECL_BIT_FIELD): Likewise.
(DECL_FIELD_BITPOS): Deleted.
(DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET): New fields.
(DECL_RESULT, DECL_SAVED_INSNS): Use FUNCTION_DECL_CHECK.
(DECL_FRAME_SIZE, DECL_FUNCTION_CODE, DECL_NO_STATIC_CHAIN): Likewise.
(DECL_INLINE, DECL_BUILT_IN_NONANSI, DECL_IS_MALLOC): Likewise.
(DECL_BUILT_IN_CLASS, DECL_STATIC_CONSTRUCTOR): Likewise.
(DECL_STATIC_DESTRUCTOR, DECL_NO_CHECK_MEMORY_USAGE): Likewise.
(DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, DECL_NO_LIMIT_STACK) Likewise.
(DECL_ORIGINAL_TYPE, TYPE_DECL_SUPPRESS_DEBUG): Use TYPE_DECL_CHECK.
(DECL_ARG_TYPE_AS_WRITEN, DECL_ARG_TYPE): Use PARM_DECL_CHECK.
(DECL_INCOMING_RTL, DECL_TRANSPARENT_UNION): Likewise.
(DECL_ALIGN): Adjust to new field in union.
(DECL_OFFSET_ALIGN): New field.
(DECL_ERROR_ISSUED, DECL_TOO_LATE): Use LABEL_DECL_CHECK.
(DECL_IN_TEXT_SECTION): Use VAR_DECL_CHECK.
(union tree_decl): Add struct for both aligns.
(enum tree_index): Add TI_BITSIZE_{ZERO,ONE,UNIT}.
(bitsize_zero_node, bitsize_one_node, bitsize_unit_node): Added.
(struct record_layout_info): Rework fields to have offset
alignment and byte and bit position.
(start_record_layout, place_field): Renamed from old names.
(rli_size_so_far, rli_size_unit_so_far, normalize_rli): New decls.
(byte_position, int_byte_position): Likewise.
(get_inner_reference): Change types of position and length.
* unroll.c (unroll_loop): New variable R; use for some loops.
MAX_LOCAL_REGNUM and MAXREGNUM now unsigned.
(calculate_giv_inc): Arg REGNO now unsigned.
(copy_loop_body): REGNO and SRC_REGNO now unsigned.
* varasm.c (assemble_variable): Clean up handling of size using
host_integerp and tree_low_cst.
(decode_addr_const): Use byte, not bit, position.
(output_constructor): bitpos and offsets are HOST_WIDE_INT;
use tree_low_cst and int_bit_position.
* objc/objc-act.c (build_ivar_list_initializer): Use byte_position.
* ch/actions.c (check_missing_cases): BYTES_NEEDED is HOST_WIDE_INT.
* ch/typeck.c (expand_constant_to_buffer): Use int_byte_position.
(extract_constant_from_buffer): Likewise.
* cp/class.c (build_vbase_pointer_fields): layout_field now
place_field.
(get_vfield_offset): Use byte_position.
(set_rtti_entry): Set OFFSET to ssizetype zero.
(get_binfo_offset_as_int): Deleted.
(dfs_record_base_offsets): Use tree_low_cst.
(dfs_search_base_offsets): Likewise.
(layout_nonempty_base_or_field): Reflect changes in RLI format
and call byte_position.
(layout_empty_base): Convert offset to ssizetype.
(build_base_field): use rli_size_unit_so_far.
(dfs_propagate_binfo_offsets): Do computation in proper type.
(layout_virtual_bases): Pass ssizetype to propagate_binfo_offsets.
(layout_class_type): Reflect changes in RLI names and fields.
(finish_struct_1): Set DECL_FIELD_OFFSET.
* cp/dump.c (dequeue_and_dump): Call bit_position.
* cp/expr.c (cplus_expand_constant): Use byte_position.
* cp/rtti.c (expand_class_desc): Use bitsize_one_node.
* cp/typeck.c (build_component_addr): Use byte_position and don't
special case for zero offset.
* f/com.c (ffecom_tree_canonize_ptr_): Use bitsize_zero_node.
(ffecom_tree_canonize_ref_): Likewise.
* java/class.c (make_field_value): Use byte_position.
* java/expr.c (JAVA_ARRAY_LENGTH_OFFSET): Use byte_position.
(java_array_data_offset): Likewise.
* java/java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Add case to
bzero call.
From-SVN: r32742
2000-03-25 19:34:13 +01:00
|
|
|
|
unsigned int regno = *(int *) pregno;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
|
|
|
|
if (GET_CODE (x) == REG && REGNO (x) == regno)
|
|
|
|
|
{
|
|
|
|
|
if (GET_MODE_BITSIZE (GET_MODE (x)) <= BITS_PER_WORD)
|
|
|
|
|
abort ();
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* A subroutine of verify_local_live_at_start. Search through insns
|
|
|
|
|
between HEAD and END looking for register REGNO. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
verify_wide_reg (regno, head, end)
|
|
|
|
|
int regno;
|
|
|
|
|
rtx head, end;
|
|
|
|
|
{
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
2000-08-04 22:28:08 +02:00
|
|
|
|
if (INSN_P (head)
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
&& for_each_rtx (&PATTERN (head), verify_wide_reg_1, ®no))
|
|
|
|
|
return;
|
|
|
|
|
if (head == end)
|
|
|
|
|
break;
|
|
|
|
|
head = NEXT_INSN (head);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We didn't find the register at all. Something's way screwy. */
|
2000-11-23 19:19:18 +01:00
|
|
|
|
if (rtl_dump_file)
|
|
|
|
|
fprintf (rtl_dump_file, "Aborting in verify_wide_reg; reg %d\n", regno);
|
|
|
|
|
print_rtl_and_abort ();
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* A subroutine of update_life_info. Verify that there are no untoward
|
|
|
|
|
changes in live_at_start during a local update. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
verify_local_live_at_start (new_live_at_start, bb)
|
|
|
|
|
regset new_live_at_start;
|
|
|
|
|
basic_block bb;
|
|
|
|
|
{
|
|
|
|
|
if (reload_completed)
|
|
|
|
|
{
|
|
|
|
|
/* After reload, there are no pseudos, nor subregs of multi-word
|
|
|
|
|
registers. The regsets should exactly match. */
|
|
|
|
|
if (! REG_SET_EQUAL_P (new_live_at_start, bb->global_live_at_start))
|
2000-11-23 19:19:18 +01:00
|
|
|
|
{
|
|
|
|
|
if (rtl_dump_file)
|
|
|
|
|
{
|
|
|
|
|
fprintf (rtl_dump_file,
|
|
|
|
|
"live_at_start mismatch in bb %d, aborting\n",
|
|
|
|
|
bb->index);
|
|
|
|
|
debug_bitmap_file (rtl_dump_file, bb->global_live_at_start);
|
|
|
|
|
debug_bitmap_file (rtl_dump_file, new_live_at_start);
|
|
|
|
|
}
|
|
|
|
|
print_rtl_and_abort ();
|
|
|
|
|
}
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
/* Find the set of changed registers. */
|
|
|
|
|
XOR_REG_SET (new_live_at_start, bb->global_live_at_start);
|
|
|
|
|
|
|
|
|
|
EXECUTE_IF_SET_IN_REG_SET (new_live_at_start, 0, i,
|
|
|
|
|
{
|
2000-11-07 07:28:34 +01:00
|
|
|
|
/* No registers should die. */
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
if (REGNO_REG_SET_P (bb->global_live_at_start, i))
|
2000-11-23 19:19:18 +01:00
|
|
|
|
{
|
|
|
|
|
if (rtl_dump_file)
|
|
|
|
|
fprintf (rtl_dump_file,
|
|
|
|
|
"Register %d died unexpectedly in block %d\n", i,
|
|
|
|
|
bb->index);
|
|
|
|
|
print_rtl_and_abort ();
|
|
|
|
|
}
|
|
|
|
|
|
2000-11-07 07:28:34 +01:00
|
|
|
|
/* Verify that the now-live register is wider than word_mode. */
|
|
|
|
|
verify_wide_reg (i, bb->head, bb->end);
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-02-16 08:54:53 +01:00
|
|
|
|
/* Updates life information starting with the basic blocks set in BLOCKS.
|
2000-04-27 09:01:04 +02:00
|
|
|
|
If BLOCKS is null, consider it to be the universal set.
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-04-27 09:01:04 +02:00
|
|
|
|
If EXTENT is UPDATE_LIFE_LOCAL, such as after splitting or peepholeing,
|
|
|
|
|
we are only expecting local modifications to basic blocks. If we find
|
|
|
|
|
extra registers live at the beginning of a block, then we either killed
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
useful data, or we have a broken split that wants data not provided.
|
|
|
|
|
If we find registers removed from live_at_start, that means we have
|
|
|
|
|
a broken peephole that is killing a register it shouldn't.
|
|
|
|
|
|
|
|
|
|
??? This is not true in one situation -- when a pre-reload splitter
|
|
|
|
|
generates subregs of a multi-word pseudo, current life analysis will
|
1999-10-20 16:04:12 +02:00
|
|
|
|
lose the kill. So we _can_ have a pseudo go live. How irritating.
|
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
Including PROP_REG_INFO does not properly refresh regs_ever_live
|
|
|
|
|
unless the caller resets it to zero. */
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
|
|
|
|
void
|
1999-10-20 16:04:12 +02:00
|
|
|
|
update_life_info (blocks, extent, prop_flags)
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
sbitmap blocks;
|
1999-10-11 01:34:17 +02:00
|
|
|
|
enum update_life_extent extent;
|
1999-10-20 16:04:12 +02:00
|
|
|
|
int prop_flags;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
{
|
|
|
|
|
regset tmp;
|
2000-03-05 23:35:27 +01:00
|
|
|
|
regset_head tmp_head;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
int i;
|
|
|
|
|
|
2000-03-05 23:35:27 +01:00
|
|
|
|
tmp = INITIALIZE_REG_SET (tmp_head);
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
|
|
|
|
/* For a global update, we go through the relaxation process again. */
|
1999-10-11 01:34:17 +02:00
|
|
|
|
if (extent != UPDATE_LIFE_LOCAL)
|
|
|
|
|
{
|
1999-10-20 16:04:12 +02:00
|
|
|
|
calculate_global_regs_live (blocks, blocks,
|
|
|
|
|
prop_flags & PROP_SCAN_DEAD_CODE);
|
1999-10-11 01:34:17 +02:00
|
|
|
|
|
|
|
|
|
/* If asked, remove notes from the blocks we'll update. */
|
|
|
|
|
if (extent == UPDATE_LIFE_GLOBAL_RM_NOTES)
|
|
|
|
|
count_or_remove_death_notes (blocks, 1);
|
|
|
|
|
}
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
2000-04-27 09:01:04 +02:00
|
|
|
|
if (blocks)
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
{
|
2000-04-27 09:01:04 +02:00
|
|
|
|
EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i,
|
|
|
|
|
{
|
|
|
|
|
basic_block bb = BASIC_BLOCK (i);
|
|
|
|
|
|
|
|
|
|
COPY_REG_SET (tmp, bb->global_live_at_end);
|
2000-11-27 18:50:11 +01:00
|
|
|
|
propagate_block (bb, tmp, NULL, NULL, prop_flags);
|
2000-04-27 09:01:04 +02:00
|
|
|
|
|
|
|
|
|
if (extent == UPDATE_LIFE_LOCAL)
|
|
|
|
|
verify_local_live_at_start (tmp, bb);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for (i = n_basic_blocks - 1; i >= 0; --i)
|
|
|
|
|
{
|
|
|
|
|
basic_block bb = BASIC_BLOCK (i);
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
2000-04-27 09:01:04 +02:00
|
|
|
|
COPY_REG_SET (tmp, bb->global_live_at_end);
|
2000-11-27 18:50:11 +01:00
|
|
|
|
propagate_block (bb, tmp, NULL, NULL, prop_flags);
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
2000-04-27 09:01:04 +02:00
|
|
|
|
if (extent == UPDATE_LIFE_LOCAL)
|
|
|
|
|
verify_local_live_at_start (tmp, bb);
|
|
|
|
|
}
|
|
|
|
|
}
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
|
|
|
|
FREE_REG_SET (tmp);
|
2000-02-16 08:54:53 +01:00
|
|
|
|
|
|
|
|
|
if (prop_flags & PROP_REG_INFO)
|
|
|
|
|
{
|
|
|
|
|
/* The only pseudos that are live at the beginning of the function
|
|
|
|
|
are those that were not set anywhere in the function. local-alloc
|
|
|
|
|
doesn't know how to handle these correctly, so mark them as not
|
|
|
|
|
local to any one basic block. */
|
|
|
|
|
EXECUTE_IF_SET_IN_REG_SET (ENTRY_BLOCK_PTR->global_live_at_end,
|
|
|
|
|
FIRST_PSEUDO_REGISTER, i,
|
|
|
|
|
{ REG_BASIC_BLOCK (i) = REG_BLOCK_GLOBAL; });
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* We have a problem with any pseudoreg that lives across the setjmp.
|
2000-02-16 08:54:53 +01:00
|
|
|
|
ANSI says that if a user variable does not change in value between
|
|
|
|
|
the setjmp and the longjmp, then the longjmp preserves it. This
|
|
|
|
|
includes longjmp from a place where the pseudo appears dead.
|
|
|
|
|
(In principle, the value still exists if it is in scope.)
|
|
|
|
|
If the pseudo goes in a hard reg, some other value may occupy
|
|
|
|
|
that hard reg where this pseudo is dead, thus clobbering the pseudo.
|
|
|
|
|
Conclusion: such a pseudo must not go in a hard reg. */
|
|
|
|
|
EXECUTE_IF_SET_IN_REG_SET (regs_live_at_setjmp,
|
|
|
|
|
FIRST_PSEUDO_REGISTER, i,
|
|
|
|
|
{
|
|
|
|
|
if (regno_reg_rtx[i] != 0)
|
|
|
|
|
{
|
|
|
|
|
REG_LIVE_LENGTH (i) = -1;
|
|
|
|
|
REG_BASIC_BLOCK (i) = REG_BLOCK_UNKNOWN;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
1998-03-05 23:31:51 +01:00
|
|
|
|
/* Free the variables allocated by find_basic_blocks.
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
KEEP_HEAD_END_P is non-zero if basic_block_info is not to be freed. */
|
1998-03-05 23:31:51 +01:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
free_basic_block_vars (keep_head_end_p)
|
|
|
|
|
int keep_head_end_p;
|
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (basic_block_for_insn)
|
1998-03-05 23:31:51 +01:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
VARRAY_FREE (basic_block_for_insn);
|
|
|
|
|
basic_block_for_insn = NULL;
|
1998-03-05 23:31:51 +01:00
|
|
|
|
}
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (! keep_head_end_p)
|
1998-03-05 23:31:51 +01:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
clear_edges ();
|
|
|
|
|
VARRAY_FREE (basic_block_info);
|
|
|
|
|
n_basic_blocks = 0;
|
1999-03-31 14:41:03 +02:00
|
|
|
|
|
|
|
|
|
ENTRY_BLOCK_PTR->aux = NULL;
|
|
|
|
|
ENTRY_BLOCK_PTR->global_live_at_end = NULL;
|
|
|
|
|
EXIT_BLOCK_PTR->aux = NULL;
|
|
|
|
|
EXIT_BLOCK_PTR->global_live_at_start = NULL;
|
1998-03-05 23:31:51 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
/* Return nonzero if the destination of SET equals the source. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
static int
|
|
|
|
|
set_noop_p (set)
|
|
|
|
|
rtx set;
|
|
|
|
|
{
|
|
|
|
|
rtx src = SET_SRC (set);
|
|
|
|
|
rtx dst = SET_DEST (set);
|
2000-02-16 08:54:53 +01:00
|
|
|
|
|
|
|
|
|
if (GET_CODE (src) == SUBREG && GET_CODE (dst) == SUBREG)
|
|
|
|
|
{
|
|
|
|
|
if (SUBREG_WORD (src) != SUBREG_WORD (dst))
|
|
|
|
|
return 0;
|
|
|
|
|
src = SUBREG_REG (src);
|
|
|
|
|
dst = SUBREG_REG (dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (GET_CODE (src) == REG && GET_CODE (dst) == REG
|
|
|
|
|
&& REGNO (src) == REGNO (dst));
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return nonzero if an insn consists only of SETs, each of which only sets a
|
|
|
|
|
value to itself. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
static int
|
|
|
|
|
noop_move_p (insn)
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
rtx pat = PATTERN (insn);
|
|
|
|
|
|
|
|
|
|
/* Insns carrying these notes are useful later on. */
|
|
|
|
|
if (find_reg_note (insn, REG_EQUAL, NULL_RTX))
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (pat) == SET && set_noop_p (pat))
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (pat) == PARALLEL)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
/* If nothing but SETs of registers to themselves,
|
|
|
|
|
this insn can also be deleted. */
|
|
|
|
|
for (i = 0; i < XVECLEN (pat, 0); i++)
|
|
|
|
|
{
|
|
|
|
|
rtx tem = XVECEXP (pat, 0, i);
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (tem) == USE
|
|
|
|
|
|| GET_CODE (tem) == CLOBBER)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (tem) != SET || ! set_noop_p (tem))
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2000-02-16 08:54:53 +01:00
|
|
|
|
/* Delete any insns that copy a register to itself. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
delete_noop_moves (f)
|
|
|
|
|
rtx f;
|
|
|
|
|
{
|
|
|
|
|
rtx insn;
|
|
|
|
|
for (insn = f; insn; insn = NEXT_INSN (insn))
|
|
|
|
|
{
|
|
|
|
|
if (GET_CODE (insn) == INSN && noop_move_p (insn))
|
|
|
|
|
{
|
|
|
|
|
PUT_CODE (insn, NOTE);
|
|
|
|
|
NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
|
|
|
|
|
NOTE_SOURCE_FILE (insn) = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Determine if the stack pointer is constant over the life of the function.
|
|
|
|
|
Only useful before prologues have been emitted. */
|
|
|
|
|
|
1998-10-12 12:06:49 +02:00
|
|
|
|
static void
|
2000-02-16 08:54:53 +01:00
|
|
|
|
notice_stack_pointer_modification_1 (x, pat, data)
|
1998-10-12 12:06:49 +02:00
|
|
|
|
rtx x;
|
|
|
|
|
rtx pat ATTRIBUTE_UNUSED;
|
1999-10-27 21:27:41 +02:00
|
|
|
|
void *data ATTRIBUTE_UNUSED;
|
1998-10-12 12:06:49 +02:00
|
|
|
|
{
|
|
|
|
|
if (x == stack_pointer_rtx
|
|
|
|
|
/* The stack pointer is only modified indirectly as the result
|
|
|
|
|
of a push until later in flow. See the comments in rtl.texi
|
|
|
|
|
regarding Embedded Side-Effects on Addresses. */
|
|
|
|
|
|| (GET_CODE (x) == MEM
|
2000-12-15 14:14:37 +01:00
|
|
|
|
&& GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == 'a'
|
1998-10-12 12:06:49 +02:00
|
|
|
|
&& XEXP (XEXP (x, 0), 0) == stack_pointer_rtx))
|
|
|
|
|
current_function_sp_is_unchanging = 0;
|
|
|
|
|
}
|
|
|
|
|
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
static void
|
2000-02-16 08:54:53 +01:00
|
|
|
|
notice_stack_pointer_modification (f)
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
rtx f;
|
|
|
|
|
{
|
|
|
|
|
rtx insn;
|
2000-02-16 08:54:53 +01:00
|
|
|
|
|
|
|
|
|
/* Assume that the stack pointer is unchanging if alloca hasn't
|
|
|
|
|
been used. */
|
|
|
|
|
current_function_sp_is_unchanging = !current_function_calls_alloca;
|
|
|
|
|
if (! current_function_sp_is_unchanging)
|
|
|
|
|
return;
|
|
|
|
|
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
for (insn = f; insn; insn = NEXT_INSN (insn))
|
|
|
|
|
{
|
2000-08-04 22:28:08 +02:00
|
|
|
|
if (INSN_P (insn))
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
{
|
2000-02-16 08:54:53 +01:00
|
|
|
|
/* Check if insn modifies the stack pointer. */
|
|
|
|
|
note_stores (PATTERN (insn), notice_stack_pointer_modification_1,
|
|
|
|
|
NULL);
|
|
|
|
|
if (! current_function_sp_is_unchanging)
|
|
|
|
|
return;
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
/* Mark a register in SET. Hard registers in large modes get all
|
|
|
|
|
of their component registers set as well. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
static void
|
2000-02-04 22:30:22 +01:00
|
|
|
|
mark_reg (reg, xset)
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
rtx reg;
|
2000-02-04 22:30:22 +01:00
|
|
|
|
void *xset;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
{
|
2000-02-04 22:30:22 +01:00
|
|
|
|
regset set = (regset) xset;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
int regno = REGNO (reg);
|
|
|
|
|
|
2000-02-04 22:30:22 +01:00
|
|
|
|
if (GET_MODE (reg) == BLKmode)
|
|
|
|
|
abort ();
|
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
SET_REGNO_REG_SET (set, regno);
|
|
|
|
|
if (regno < FIRST_PSEUDO_REGISTER)
|
|
|
|
|
{
|
|
|
|
|
int n = HARD_REGNO_NREGS (regno, GET_MODE (reg));
|
|
|
|
|
while (--n > 0)
|
|
|
|
|
SET_REGNO_REG_SET (set, regno + n);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
/* Mark those regs which are needed at the end of the function as live
|
|
|
|
|
at the end of the last basic block. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
static void
|
|
|
|
|
mark_regs_live_at_end (set)
|
|
|
|
|
regset set;
|
|
|
|
|
{
|
|
|
|
|
int i;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* If exiting needs the right stack value, consider the stack pointer
|
|
|
|
|
live at the end of the function. */
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
if ((HAVE_epilogue && reload_completed)
|
|
|
|
|
|| ! EXIT_IGNORE_STACK
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
|| (! FRAME_POINTER_REQUIRED
|
|
|
|
|
&& ! current_function_calls_alloca
|
1998-10-12 12:06:49 +02:00
|
|
|
|
&& flag_omit_frame_pointer)
|
|
|
|
|
|| current_function_sp_is_unchanging)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
{
|
|
|
|
|
SET_REGNO_REG_SET (set, STACK_POINTER_REGNUM);
|
|
|
|
|
}
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Mark the frame pointer if needed at the end of the function. If
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
we end up eliminating it, it will be removed from the live list
|
|
|
|
|
of each basic block by reload. */
|
|
|
|
|
|
1999-05-31 10:43:04 +02:00
|
|
|
|
if (! reload_completed || frame_pointer_needed)
|
|
|
|
|
{
|
|
|
|
|
SET_REGNO_REG_SET (set, FRAME_POINTER_REGNUM);
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
|
2000-08-08 10:28:00 +02:00
|
|
|
|
/* If they are different, also mark the hard frame pointer as live. */
|
|
|
|
|
if (! LOCAL_REGNO (HARD_FRAME_POINTER_REGNUM))
|
|
|
|
|
SET_REGNO_REG_SET (set, HARD_FRAME_POINTER_REGNUM);
|
2000-08-11 14:45:05 +02:00
|
|
|
|
#endif
|
1999-05-31 10:43:04 +02:00
|
|
|
|
}
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
#ifndef PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
|
|
|
|
|
/* Many architectures have a GP register even without flag_pic.
|
|
|
|
|
Assume the pic register is not in use, or will be handled by
|
|
|
|
|
other means, if it is not fixed. */
|
2001-02-13 21:17:45 +01:00
|
|
|
|
if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM
|
|
|
|
|
&& fixed_regs[PIC_OFFSET_TABLE_REGNUM])
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
SET_REGNO_REG_SET (set, PIC_OFFSET_TABLE_REGNUM);
|
|
|
|
|
#endif
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Mark all global registers, and all registers used by the epilogue
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
as being live at the end of the function since they may be
|
|
|
|
|
referenced by our caller. */
|
|
|
|
|
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
|
2000-08-08 10:28:00 +02:00
|
|
|
|
if (global_regs[i] || EPILOGUE_USES (i))
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
SET_REGNO_REG_SET (set, i);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
/* Mark all call-saved registers that we actaully used. */
|
|
|
|
|
if (HAVE_epilogue && reload_completed)
|
|
|
|
|
{
|
|
|
|
|
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
|
2000-08-08 10:28:00 +02:00
|
|
|
|
if (regs_ever_live[i] && ! call_used_regs[i] && ! LOCAL_REGNO (i))
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
SET_REGNO_REG_SET (set, i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Mark function return value. */
|
2000-02-04 22:30:22 +01:00
|
|
|
|
diddle_return_value (mark_reg, set);
|
flow.c (life_analysis_1): Break out some functions.
Fri Oct 9 15:57:51 1998 Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>
* flow.c (life_analysis_1): Break out some functions.
(find_basic_blocks_1): Likewise. Also move some variables out and
make them static.
Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize
new static var nonlocal_label_list with it.
(active_eh_region, nested_eh_region, label_value_list,
nonlocal_label_list): New static variables.
(make_edges, delete_unreachable_blocks, delete_block): New static
functions, broken out of find_basic_blocks_1.
(record_volatile_insns, mark_regs_live_at_end, set_noop_p,
noop_move_p): New static functions, broken out of life_analysis_1.
From-SVN: r22963
1998-10-09 17:58:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-04-06 23:22:49 +02:00
|
|
|
|
/* Callback function for for_each_successor_phi. DATA is a regset.
|
|
|
|
|
Sets the SRC_REGNO, the regno of the phi alternative for phi node
|
|
|
|
|
INSN, in the regset. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
set_phi_alternative_reg (insn, dest_regno, src_regno, data)
|
|
|
|
|
rtx insn ATTRIBUTE_UNUSED;
|
|
|
|
|
int dest_regno ATTRIBUTE_UNUSED;
|
|
|
|
|
int src_regno;
|
|
|
|
|
void *data;
|
|
|
|
|
{
|
|
|
|
|
regset live = (regset) data;
|
|
|
|
|
SET_REGNO_REG_SET (live, src_regno);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
/* Propagate global life info around the graph of basic blocks. Begin
|
2000-08-11 14:45:05 +02:00
|
|
|
|
considering blocks with their corresponding bit set in BLOCKS_IN.
|
2000-04-27 09:01:04 +02:00
|
|
|
|
If BLOCKS_IN is null, consider it the universal set.
|
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
BLOCKS_OUT is set for every block that was changed. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
calculate_global_regs_live (blocks_in, blocks_out, flags)
|
|
|
|
|
sbitmap blocks_in, blocks_out;
|
|
|
|
|
int flags;
|
|
|
|
|
{
|
|
|
|
|
basic_block *queue, *qhead, *qtail, *qend;
|
|
|
|
|
regset tmp, new_live_at_end;
|
2000-03-05 23:35:27 +01:00
|
|
|
|
regset_head tmp_head;
|
|
|
|
|
regset_head new_live_at_end_head;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
int i;
|
|
|
|
|
|
2000-03-05 23:35:27 +01:00
|
|
|
|
tmp = INITIALIZE_REG_SET (tmp_head);
|
|
|
|
|
new_live_at_end = INITIALIZE_REG_SET (new_live_at_end_head);
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
|
|
|
|
/* Create a worklist. Allocate an extra slot for ENTRY_BLOCK, and one
|
2000-08-11 14:45:05 +02:00
|
|
|
|
because the `head == tail' style test for an empty queue doesn't
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
work with a full queue. */
|
1999-11-02 00:19:44 +01:00
|
|
|
|
queue = (basic_block *) xmalloc ((n_basic_blocks + 2) * sizeof (*queue));
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
qtail = queue;
|
|
|
|
|
qhead = qend = queue + n_basic_blocks + 2;
|
|
|
|
|
|
|
|
|
|
/* Queue the blocks set in the initial mask. Do this in reverse block
|
2000-08-11 14:45:05 +02:00
|
|
|
|
number order so that we are more likely for the first round to do
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
useful work. We use AUX non-null to flag that the block is queued. */
|
2000-04-27 09:01:04 +02:00
|
|
|
|
if (blocks_in)
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
{
|
2000-11-30 22:40:33 +01:00
|
|
|
|
/* Clear out the garbage that might be hanging out in bb->aux. */
|
|
|
|
|
for (i = n_basic_blocks - 1; i >= 0; --i)
|
|
|
|
|
BASIC_BLOCK (i)->aux = NULL;
|
|
|
|
|
|
2000-04-27 09:01:04 +02:00
|
|
|
|
EXECUTE_IF_SET_IN_SBITMAP (blocks_in, 0, i,
|
|
|
|
|
{
|
|
|
|
|
basic_block bb = BASIC_BLOCK (i);
|
|
|
|
|
*--qhead = bb;
|
|
|
|
|
bb->aux = bb;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for (i = 0; i < n_basic_blocks; ++i)
|
|
|
|
|
{
|
|
|
|
|
basic_block bb = BASIC_BLOCK (i);
|
|
|
|
|
*--qhead = bb;
|
|
|
|
|
bb->aux = bb;
|
|
|
|
|
}
|
|
|
|
|
}
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
2000-04-27 09:01:04 +02:00
|
|
|
|
if (blocks_out)
|
|
|
|
|
sbitmap_zero (blocks_out);
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
|
|
|
|
while (qhead != qtail)
|
|
|
|
|
{
|
|
|
|
|
int rescan, changed;
|
|
|
|
|
basic_block bb;
|
|
|
|
|
edge e;
|
|
|
|
|
|
|
|
|
|
bb = *qhead++;
|
|
|
|
|
if (qhead == qend)
|
|
|
|
|
qhead = queue;
|
|
|
|
|
bb->aux = NULL;
|
|
|
|
|
|
|
|
|
|
/* Begin by propogating live_at_start from the successor blocks. */
|
|
|
|
|
CLEAR_REG_SET (new_live_at_end);
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = bb->succ; e; e = e->succ_next)
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
{
|
|
|
|
|
basic_block sb = e->dest;
|
|
|
|
|
IOR_REG_SET (new_live_at_end, sb->global_live_at_start);
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-07 20:29:24 +01:00
|
|
|
|
/* The all-important stack pointer must always be live. */
|
|
|
|
|
SET_REGNO_REG_SET (new_live_at_end, STACK_POINTER_REGNUM);
|
|
|
|
|
|
2000-12-05 08:58:18 +01:00
|
|
|
|
/* Before reload, there are a few registers that must be forced
|
2001-01-02 08:00:49 +01:00
|
|
|
|
live everywhere -- which might not already be the case for
|
2000-12-05 08:58:18 +01:00
|
|
|
|
blocks within infinite loops. */
|
2000-08-22 02:44:09 +02:00
|
|
|
|
if (! reload_completed)
|
2000-12-05 08:58:18 +01:00
|
|
|
|
{
|
|
|
|
|
/* Any reference to any pseudo before reload is a potential
|
|
|
|
|
reference of the frame pointer. */
|
|
|
|
|
SET_REGNO_REG_SET (new_live_at_end, FRAME_POINTER_REGNUM);
|
|
|
|
|
|
|
|
|
|
#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
|
|
|
|
|
/* Pseudos with argument area equivalences may require
|
|
|
|
|
reloading via the argument pointer. */
|
|
|
|
|
if (fixed_regs[ARG_POINTER_REGNUM])
|
|
|
|
|
SET_REGNO_REG_SET (new_live_at_end, ARG_POINTER_REGNUM);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Any constant, or pseudo with constant equivalences, may
|
|
|
|
|
require reloading from memory using the pic register. */
|
2001-02-13 21:17:45 +01:00
|
|
|
|
if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM
|
|
|
|
|
&& fixed_regs[PIC_OFFSET_TABLE_REGNUM])
|
2000-12-05 08:58:18 +01:00
|
|
|
|
SET_REGNO_REG_SET (new_live_at_end, PIC_OFFSET_TABLE_REGNUM);
|
|
|
|
|
}
|
2000-08-22 02:44:09 +02:00
|
|
|
|
|
2000-04-06 23:22:49 +02:00
|
|
|
|
/* Regs used in phi nodes are not included in
|
|
|
|
|
global_live_at_start, since they are live only along a
|
|
|
|
|
particular edge. Set those regs that are live because of a
|
|
|
|
|
phi node alternative corresponding to this particular block. */
|
2000-05-02 02:02:24 +02:00
|
|
|
|
if (in_ssa_form)
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for_each_successor_phi (bb, &set_phi_alternative_reg,
|
2000-05-02 02:02:24 +02:00
|
|
|
|
new_live_at_end);
|
2000-04-06 23:22:49 +02:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
if (bb == ENTRY_BLOCK_PTR)
|
|
|
|
|
{
|
|
|
|
|
COPY_REG_SET (bb->global_live_at_end, new_live_at_end);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* On our first pass through this block, we'll go ahead and continue.
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
Recognize first pass by local_set NULL. On subsequent passes, we
|
|
|
|
|
get to skip out early if live_at_end wouldn't have changed. */
|
|
|
|
|
|
|
|
|
|
if (bb->local_set == NULL)
|
|
|
|
|
{
|
2000-10-13 08:26:46 +02:00
|
|
|
|
bb->local_set = OBSTACK_ALLOC_REG_SET (&flow_obstack);
|
2000-11-27 18:50:11 +01:00
|
|
|
|
bb->cond_local_set = OBSTACK_ALLOC_REG_SET (&flow_obstack);
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
rescan = 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* If any bits were removed from live_at_end, we'll have to
|
|
|
|
|
rescan the block. This wouldn't be necessary if we had
|
|
|
|
|
precalculated local_live, however with PROP_SCAN_DEAD_CODE
|
2000-07-23 01:29:14 +02:00
|
|
|
|
local_live is really dependent on live_at_end. */
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
CLEAR_REG_SET (tmp);
|
|
|
|
|
rescan = bitmap_operation (tmp, bb->global_live_at_end,
|
|
|
|
|
new_live_at_end, BITMAP_AND_COMPL);
|
|
|
|
|
|
2000-11-27 18:50:11 +01:00
|
|
|
|
if (! rescan)
|
|
|
|
|
{
|
|
|
|
|
/* If any of the registers in the new live_at_end set are
|
|
|
|
|
conditionally set in this basic block, we must rescan.
|
|
|
|
|
This is because conditional lifetimes at the end of the
|
|
|
|
|
block do not just take the live_at_end set into account,
|
|
|
|
|
but also the liveness at the start of each successor
|
|
|
|
|
block. We can miss changes in those sets if we only
|
|
|
|
|
compare the new live_at_end against the previous one. */
|
|
|
|
|
CLEAR_REG_SET (tmp);
|
|
|
|
|
rescan = bitmap_operation (tmp, new_live_at_end,
|
|
|
|
|
bb->cond_local_set, BITMAP_AND);
|
|
|
|
|
}
|
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
if (! rescan)
|
|
|
|
|
{
|
|
|
|
|
/* Find the set of changed bits. Take this opportunity
|
|
|
|
|
to notice that this set is empty and early out. */
|
|
|
|
|
CLEAR_REG_SET (tmp);
|
|
|
|
|
changed = bitmap_operation (tmp, bb->global_live_at_end,
|
|
|
|
|
new_live_at_end, BITMAP_XOR);
|
|
|
|
|
if (! changed)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* If any of the changed bits overlap with local_set,
|
|
|
|
|
we'll have to rescan the block. Detect overlap by
|
|
|
|
|
the AND with ~local_set turning off bits. */
|
|
|
|
|
rescan = bitmap_operation (tmp, tmp, bb->local_set,
|
|
|
|
|
BITMAP_AND_COMPL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Let our caller know that BB changed enough to require its
|
|
|
|
|
death notes updated. */
|
2000-04-27 09:01:04 +02:00
|
|
|
|
if (blocks_out)
|
|
|
|
|
SET_BIT (blocks_out, bb->index);
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
|
|
|
|
if (! rescan)
|
|
|
|
|
{
|
|
|
|
|
/* Add to live_at_start the set of all registers in
|
|
|
|
|
new_live_at_end that aren't in the old live_at_end. */
|
|
|
|
|
|
|
|
|
|
bitmap_operation (tmp, new_live_at_end, bb->global_live_at_end,
|
|
|
|
|
BITMAP_AND_COMPL);
|
|
|
|
|
COPY_REG_SET (bb->global_live_at_end, new_live_at_end);
|
|
|
|
|
|
|
|
|
|
changed = bitmap_operation (bb->global_live_at_start,
|
|
|
|
|
bb->global_live_at_start,
|
|
|
|
|
tmp, BITMAP_IOR);
|
|
|
|
|
if (! changed)
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
COPY_REG_SET (bb->global_live_at_end, new_live_at_end);
|
|
|
|
|
|
|
|
|
|
/* Rescan the block insn by insn to turn (a copy of) live_at_end
|
|
|
|
|
into live_at_start. */
|
2000-11-27 18:50:11 +01:00
|
|
|
|
propagate_block (bb, new_live_at_end, bb->local_set,
|
|
|
|
|
bb->cond_local_set, flags);
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
|
|
|
|
/* If live_at start didn't change, no need to go farther. */
|
|
|
|
|
if (REG_SET_EQUAL_P (bb->global_live_at_start, new_live_at_end))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
COPY_REG_SET (bb->global_live_at_start, new_live_at_end);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Queue all predecessors of BB so that we may re-examine
|
|
|
|
|
their live_at_end. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = bb->pred; e; e = e->pred_next)
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
{
|
|
|
|
|
basic_block pb = e->src;
|
|
|
|
|
if (pb->aux == NULL)
|
|
|
|
|
{
|
|
|
|
|
*qtail++ = pb;
|
|
|
|
|
if (qtail == qend)
|
|
|
|
|
qtail = queue;
|
|
|
|
|
pb->aux = pb;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FREE_REG_SET (tmp);
|
|
|
|
|
FREE_REG_SET (new_live_at_end);
|
|
|
|
|
|
2000-04-27 09:01:04 +02:00
|
|
|
|
if (blocks_out)
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
{
|
2000-04-27 09:01:04 +02:00
|
|
|
|
EXECUTE_IF_SET_IN_SBITMAP (blocks_out, 0, i,
|
|
|
|
|
{
|
|
|
|
|
basic_block bb = BASIC_BLOCK (i);
|
|
|
|
|
FREE_REG_SET (bb->local_set);
|
2000-11-27 18:50:11 +01:00
|
|
|
|
FREE_REG_SET (bb->cond_local_set);
|
2000-04-27 09:01:04 +02:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for (i = n_basic_blocks - 1; i >= 0; --i)
|
|
|
|
|
{
|
|
|
|
|
basic_block bb = BASIC_BLOCK (i);
|
|
|
|
|
FREE_REG_SET (bb->local_set);
|
2000-11-27 18:50:11 +01:00
|
|
|
|
FREE_REG_SET (bb->cond_local_set);
|
2000-04-27 09:01:04 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
1999-11-02 00:19:44 +01:00
|
|
|
|
|
|
|
|
|
free (queue);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Subroutines of life analysis. */
|
|
|
|
|
|
|
|
|
|
/* Allocate the permanent data structures that represent the results
|
|
|
|
|
of life analysis. Not static since used also for stupid life analysis. */
|
|
|
|
|
|
2000-10-13 08:26:46 +02:00
|
|
|
|
static void
|
1999-03-31 14:41:03 +02:00
|
|
|
|
allocate_bb_life_data ()
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
|
|
|
|
register int i;
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
for (i = 0; i < n_basic_blocks; i++)
|
|
|
|
|
{
|
|
|
|
|
basic_block bb = BASIC_BLOCK (i);
|
|
|
|
|
|
2000-10-13 08:26:46 +02:00
|
|
|
|
bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (&flow_obstack);
|
|
|
|
|
bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (&flow_obstack);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ENTRY_BLOCK_PTR->global_live_at_end
|
2000-10-13 08:26:46 +02:00
|
|
|
|
= OBSTACK_ALLOC_REG_SET (&flow_obstack);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
EXIT_BLOCK_PTR->global_live_at_start
|
2000-10-13 08:26:46 +02:00
|
|
|
|
= OBSTACK_ALLOC_REG_SET (&flow_obstack);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-10-13 08:26:46 +02:00
|
|
|
|
regs_live_at_setjmp = OBSTACK_ALLOC_REG_SET (&flow_obstack);
|
1999-03-31 14:41:03 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
allocate_reg_life_data ()
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
2000-04-27 09:38:40 +02:00
|
|
|
|
max_regno = max_reg_num ();
|
|
|
|
|
|
1999-03-31 14:41:03 +02:00
|
|
|
|
/* Recalculate the register space, in case it has grown. Old style
|
|
|
|
|
vector oriented regsets would set regset_{size,bytes} here also. */
|
|
|
|
|
allocate_reg_info (max_regno, FALSE, FALSE);
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Reset all the data we'll collect in propagate_block and its
|
1999-10-20 16:04:12 +02:00
|
|
|
|
subroutines. */
|
1999-03-31 14:41:03 +02:00
|
|
|
|
for (i = 0; i < max_regno; i++)
|
1999-10-20 16:04:12 +02:00
|
|
|
|
{
|
|
|
|
|
REG_N_SETS (i) = 0;
|
|
|
|
|
REG_N_REFS (i) = 0;
|
|
|
|
|
REG_N_DEATHS (i) = 0;
|
|
|
|
|
REG_N_CALLS_CROSSED (i) = 0;
|
|
|
|
|
REG_LIVE_LENGTH (i) = 0;
|
|
|
|
|
REG_BASIC_BLOCK (i) = REG_BLOCK_UNKNOWN;
|
|
|
|
|
}
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
/* Delete dead instructions for propagate_block. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
static void
|
|
|
|
|
propagate_block_delete_insn (bb, insn)
|
|
|
|
|
basic_block bb;
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
rtx inote = find_reg_note (insn, REG_LABEL, NULL_RTX);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
/* If the insn referred to a label, and that label was attached to
|
|
|
|
|
an ADDR_VEC, it's safe to delete the ADDR_VEC. In fact, it's
|
|
|
|
|
pretty much mandatory to delete it, because the ADDR_VEC may be
|
|
|
|
|
referencing labels that no longer exist. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
if (inote)
|
|
|
|
|
{
|
|
|
|
|
rtx label = XEXP (inote, 0);
|
|
|
|
|
rtx next;
|
|
|
|
|
|
|
|
|
|
if (LABEL_NUSES (label) == 1
|
|
|
|
|
&& (next = next_nonnote_insn (label)) != NULL
|
|
|
|
|
&& GET_CODE (next) == JUMP_INSN
|
|
|
|
|
&& (GET_CODE (PATTERN (next)) == ADDR_VEC
|
|
|
|
|
|| GET_CODE (PATTERN (next)) == ADDR_DIFF_VEC))
|
|
|
|
|
{
|
|
|
|
|
rtx pat = PATTERN (next);
|
|
|
|
|
int diff_vec_p = GET_CODE (pat) == ADDR_DIFF_VEC;
|
|
|
|
|
int len = XVECLEN (pat, diff_vec_p);
|
|
|
|
|
int i;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
|
LABEL_NUSES (XEXP (XVECEXP (pat, diff_vec_p, i), 0))--;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
flow_delete_insn (next);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bb->end == insn)
|
|
|
|
|
bb->end = PREV_INSN (insn);
|
|
|
|
|
flow_delete_insn (insn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Delete dead libcalls for propagate_block. Return the insn
|
|
|
|
|
before the libcall. */
|
|
|
|
|
|
|
|
|
|
static rtx
|
|
|
|
|
propagate_block_delete_libcall (bb, insn, note)
|
2000-01-20 04:59:57 +01:00
|
|
|
|
basic_block bb;
|
2000-04-08 01:33:47 +02:00
|
|
|
|
rtx insn, note;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
2000-04-08 01:33:47 +02:00
|
|
|
|
rtx first = XEXP (note, 0);
|
|
|
|
|
rtx before = PREV_INSN (first);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
if (insn == bb->end)
|
|
|
|
|
bb->end = before;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
flow_delete_insn_chain (first, insn);
|
|
|
|
|
return before;
|
|
|
|
|
}
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-04-27 07:03:35 +02:00
|
|
|
|
/* Update the life-status of regs for one insn. Return the previous insn. */
|
|
|
|
|
|
|
|
|
|
rtx
|
|
|
|
|
propagate_one_insn (pbi, insn)
|
|
|
|
|
struct propagate_block_info *pbi;
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
rtx prev = PREV_INSN (insn);
|
|
|
|
|
int flags = pbi->flags;
|
|
|
|
|
int insn_is_dead = 0;
|
|
|
|
|
int libcall_is_dead = 0;
|
|
|
|
|
rtx note;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (! INSN_P (insn))
|
|
|
|
|
return prev;
|
|
|
|
|
|
|
|
|
|
note = find_reg_note (insn, REG_RETVAL, NULL_RTX);
|
|
|
|
|
if (flags & PROP_SCAN_DEAD_CODE)
|
|
|
|
|
{
|
2001-01-17 00:10:36 +01:00
|
|
|
|
insn_is_dead = insn_dead_p (pbi, PATTERN (insn), 0, REG_NOTES (insn));
|
2000-04-27 07:03:35 +02:00
|
|
|
|
libcall_is_dead = (insn_is_dead && note != 0
|
2000-07-17 12:16:18 +02:00
|
|
|
|
&& libcall_dead_p (pbi, note, insn));
|
2000-04-27 07:03:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If an instruction consists of just dead store(s) on final pass,
|
|
|
|
|
delete it. */
|
|
|
|
|
if ((flags & PROP_KILL_DEAD_CODE) && insn_is_dead)
|
|
|
|
|
{
|
2001-01-17 00:10:36 +01:00
|
|
|
|
/* If we're trying to delete a prologue or epilogue instruction
|
|
|
|
|
that isn't flagged as possibly being dead, something is wrong.
|
|
|
|
|
But if we are keeping the stack pointer depressed, we might well
|
|
|
|
|
be deleting insns that are used to compute the amount to update
|
|
|
|
|
it by, so they are fine. */
|
|
|
|
|
if (reload_completed
|
|
|
|
|
&& !(TREE_CODE (TREE_TYPE (current_function_decl)) == FUNCTION_TYPE
|
|
|
|
|
&& (TYPE_RETURNS_STACK_DEPRESSED
|
|
|
|
|
(TREE_TYPE (current_function_decl))))
|
|
|
|
|
&& (((HAVE_epilogue || HAVE_prologue)
|
|
|
|
|
&& prologue_epilogue_contains (insn))
|
|
|
|
|
|| (HAVE_sibcall_epilogue
|
|
|
|
|
&& sibcall_epilogue_contains (insn)))
|
|
|
|
|
&& find_reg_note (insn, REG_MAYBE_DEAD, NULL_RTX) == 0)
|
|
|
|
|
abort ();
|
|
|
|
|
|
2000-05-01 09:21:29 +02:00
|
|
|
|
/* Record sets. Do this even for dead instructions, since they
|
|
|
|
|
would have killed the values if they hadn't been deleted. */
|
|
|
|
|
mark_set_regs (pbi, PATTERN (insn), insn);
|
|
|
|
|
|
|
|
|
|
/* CC0 is now known to be dead. Either this insn used it,
|
|
|
|
|
in which case it doesn't anymore, or clobbered it,
|
|
|
|
|
so the next insn can't use it. */
|
|
|
|
|
pbi->cc0_live = 0;
|
|
|
|
|
|
2000-04-27 07:03:35 +02:00
|
|
|
|
if (libcall_is_dead)
|
|
|
|
|
{
|
|
|
|
|
prev = propagate_block_delete_libcall (pbi->bb, insn, note);
|
|
|
|
|
insn = NEXT_INSN (prev);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
propagate_block_delete_insn (pbi->bb, insn);
|
|
|
|
|
|
|
|
|
|
return prev;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* See if this is an increment or decrement that can be merged into
|
|
|
|
|
a following memory address. */
|
|
|
|
|
#ifdef AUTO_INC_DEC
|
|
|
|
|
{
|
|
|
|
|
register rtx x = single_set (insn);
|
|
|
|
|
|
|
|
|
|
/* Does this instruction increment or decrement a register? */
|
2000-06-12 16:40:24 +02:00
|
|
|
|
if ((flags & PROP_AUTOINC)
|
2000-04-27 07:03:35 +02:00
|
|
|
|
&& x != 0
|
|
|
|
|
&& GET_CODE (SET_DEST (x)) == REG
|
|
|
|
|
&& (GET_CODE (SET_SRC (x)) == PLUS
|
|
|
|
|
|| GET_CODE (SET_SRC (x)) == MINUS)
|
|
|
|
|
&& XEXP (SET_SRC (x), 0) == SET_DEST (x)
|
|
|
|
|
&& GET_CODE (XEXP (SET_SRC (x), 1)) == CONST_INT
|
|
|
|
|
/* Ok, look for a following memory ref we can combine with.
|
|
|
|
|
If one is found, change the memory ref to a PRE_INC
|
|
|
|
|
or PRE_DEC, cancel this insn, and return 1.
|
|
|
|
|
Return 0 if nothing has been done. */
|
|
|
|
|
&& try_pre_increment_1 (pbi, insn))
|
|
|
|
|
return prev;
|
|
|
|
|
}
|
|
|
|
|
#endif /* AUTO_INC_DEC */
|
|
|
|
|
|
2000-04-27 13:17:04 +02:00
|
|
|
|
CLEAR_REG_SET (pbi->new_set);
|
2000-04-27 07:03:35 +02:00
|
|
|
|
|
|
|
|
|
/* If this is not the final pass, and this insn is copying the value of
|
|
|
|
|
a library call and it's dead, don't scan the insns that perform the
|
|
|
|
|
library call, so that the call's arguments are not marked live. */
|
|
|
|
|
if (libcall_is_dead)
|
|
|
|
|
{
|
|
|
|
|
/* Record the death of the dest reg. */
|
|
|
|
|
mark_set_regs (pbi, PATTERN (insn), insn);
|
|
|
|
|
|
|
|
|
|
insn = XEXP (note, 0);
|
|
|
|
|
return PREV_INSN (insn);
|
|
|
|
|
}
|
|
|
|
|
else if (GET_CODE (PATTERN (insn)) == SET
|
|
|
|
|
&& SET_DEST (PATTERN (insn)) == stack_pointer_rtx
|
|
|
|
|
&& GET_CODE (SET_SRC (PATTERN (insn))) == PLUS
|
|
|
|
|
&& XEXP (SET_SRC (PATTERN (insn)), 0) == stack_pointer_rtx
|
|
|
|
|
&& GET_CODE (XEXP (SET_SRC (PATTERN (insn)), 1)) == CONST_INT)
|
|
|
|
|
/* We have an insn to pop a constant amount off the stack.
|
|
|
|
|
(Such insns use PLUS regardless of the direction of the stack,
|
|
|
|
|
and any insn to adjust the stack by a constant is always a pop.)
|
|
|
|
|
These insns, if not dead stores, have no effect on life. */
|
|
|
|
|
;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Any regs live at the time of a call instruction must not go
|
|
|
|
|
in a register clobbered by calls. Find all regs now live and
|
|
|
|
|
record this for them. */
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (insn) == CALL_INSN && (flags & PROP_REG_INFO))
|
|
|
|
|
EXECUTE_IF_SET_IN_REG_SET (pbi->reg_live, 0, i,
|
|
|
|
|
{ REG_N_CALLS_CROSSED (i)++; });
|
|
|
|
|
|
|
|
|
|
/* Record sets. Do this even for dead instructions, since they
|
|
|
|
|
would have killed the values if they hadn't been deleted. */
|
|
|
|
|
mark_set_regs (pbi, PATTERN (insn), insn);
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (insn) == CALL_INSN)
|
|
|
|
|
{
|
|
|
|
|
register int i;
|
|
|
|
|
rtx note, cond;
|
|
|
|
|
|
|
|
|
|
cond = NULL_RTX;
|
|
|
|
|
if (GET_CODE (PATTERN (insn)) == COND_EXEC)
|
|
|
|
|
cond = COND_EXEC_TEST (PATTERN (insn));
|
|
|
|
|
|
|
|
|
|
/* Non-constant calls clobber memory. */
|
|
|
|
|
if (! CONST_CALL_P (insn))
|
2001-01-16 14:57:17 +01:00
|
|
|
|
{
|
|
|
|
|
free_EXPR_LIST_list (&pbi->mem_set_list);
|
|
|
|
|
pbi->mem_set_list_len = 0;
|
|
|
|
|
}
|
2000-04-27 07:03:35 +02:00
|
|
|
|
|
|
|
|
|
/* There may be extra registers to be clobbered. */
|
|
|
|
|
for (note = CALL_INSN_FUNCTION_USAGE (insn);
|
|
|
|
|
note;
|
|
|
|
|
note = XEXP (note, 1))
|
|
|
|
|
if (GET_CODE (XEXP (note, 0)) == CLOBBER)
|
2000-04-27 07:42:25 +02:00
|
|
|
|
mark_set_1 (pbi, CLOBBER, XEXP (XEXP (note, 0), 0),
|
|
|
|
|
cond, insn, pbi->flags);
|
2000-04-27 07:03:35 +02:00
|
|
|
|
|
|
|
|
|
/* Calls change all call-used and global registers. */
|
|
|
|
|
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
|
|
|
|
|
if (call_used_regs[i] && ! global_regs[i]
|
|
|
|
|
&& ! fixed_regs[i])
|
|
|
|
|
{
|
2000-04-27 07:42:25 +02:00
|
|
|
|
/* We do not want REG_UNUSED notes for these registers. */
|
|
|
|
|
mark_set_1 (pbi, CLOBBER, gen_rtx_REG (reg_raw_mode[i], i),
|
2000-05-03 19:59:25 +02:00
|
|
|
|
cond, insn,
|
|
|
|
|
pbi->flags & ~(PROP_DEATH_NOTES | PROP_REG_INFO));
|
2000-04-27 07:03:35 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If an insn doesn't use CC0, it becomes dead since we assume
|
|
|
|
|
that every insn clobbers it. So show it dead here;
|
|
|
|
|
mark_used_regs will set it live if it is referenced. */
|
|
|
|
|
pbi->cc0_live = 0;
|
|
|
|
|
|
|
|
|
|
/* Record uses. */
|
|
|
|
|
if (! insn_is_dead)
|
|
|
|
|
mark_used_regs (pbi, PATTERN (insn), NULL_RTX, insn);
|
|
|
|
|
|
|
|
|
|
/* Sometimes we may have inserted something before INSN (such as a move)
|
|
|
|
|
when we make an auto-inc. So ensure we will scan those insns. */
|
|
|
|
|
#ifdef AUTO_INC_DEC
|
|
|
|
|
prev = PREV_INSN (insn);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (! insn_is_dead && GET_CODE (insn) == CALL_INSN)
|
|
|
|
|
{
|
|
|
|
|
register int i;
|
|
|
|
|
rtx note, cond;
|
|
|
|
|
|
|
|
|
|
cond = NULL_RTX;
|
|
|
|
|
if (GET_CODE (PATTERN (insn)) == COND_EXEC)
|
|
|
|
|
cond = COND_EXEC_TEST (PATTERN (insn));
|
|
|
|
|
|
|
|
|
|
/* Calls use their arguments. */
|
|
|
|
|
for (note = CALL_INSN_FUNCTION_USAGE (insn);
|
|
|
|
|
note;
|
|
|
|
|
note = XEXP (note, 1))
|
|
|
|
|
if (GET_CODE (XEXP (note, 0)) == USE)
|
|
|
|
|
mark_used_regs (pbi, XEXP (XEXP (note, 0), 0),
|
|
|
|
|
cond, insn);
|
|
|
|
|
|
|
|
|
|
/* The stack ptr is used (honorarily) by a CALL insn. */
|
|
|
|
|
SET_REGNO_REG_SET (pbi->reg_live, STACK_POINTER_REGNUM);
|
|
|
|
|
|
|
|
|
|
/* Calls may also reference any of the global registers,
|
|
|
|
|
so they are made live. */
|
|
|
|
|
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
|
|
|
|
|
if (global_regs[i])
|
|
|
|
|
mark_used_reg (pbi, gen_rtx_REG (reg_raw_mode[i], i),
|
|
|
|
|
cond, insn);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* On final pass, update counts of how many insns in which each reg
|
|
|
|
|
is live. */
|
|
|
|
|
if (flags & PROP_REG_INFO)
|
|
|
|
|
EXECUTE_IF_SET_IN_REG_SET (pbi->reg_live, 0, i,
|
|
|
|
|
{ REG_LIVE_LENGTH (i)++; });
|
|
|
|
|
|
|
|
|
|
return prev;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Initialize a propagate_block_info struct for public consumption.
|
|
|
|
|
Note that the structure itself is opaque to this file, but that
|
|
|
|
|
the user can use the regsets provided here. */
|
|
|
|
|
|
|
|
|
|
struct propagate_block_info *
|
2000-11-27 18:50:11 +01:00
|
|
|
|
init_propagate_block_info (bb, live, local_set, cond_local_set, flags)
|
2000-04-27 07:03:35 +02:00
|
|
|
|
basic_block bb;
|
2000-11-27 18:50:11 +01:00
|
|
|
|
regset live, local_set, cond_local_set;
|
2000-04-27 07:03:35 +02:00
|
|
|
|
int flags;
|
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
struct propagate_block_info *pbi = xmalloc (sizeof (*pbi));
|
2000-04-27 07:03:35 +02:00
|
|
|
|
|
|
|
|
|
pbi->bb = bb;
|
|
|
|
|
pbi->reg_live = live;
|
|
|
|
|
pbi->mem_set_list = NULL_RTX;
|
2001-01-16 14:57:17 +01:00
|
|
|
|
pbi->mem_set_list_len = 0;
|
2000-04-27 07:03:35 +02:00
|
|
|
|
pbi->local_set = local_set;
|
2000-11-27 18:50:11 +01:00
|
|
|
|
pbi->cond_local_set = cond_local_set;
|
2000-04-27 07:03:35 +02:00
|
|
|
|
pbi->cc0_live = 0;
|
|
|
|
|
pbi->flags = flags;
|
|
|
|
|
|
|
|
|
|
if (flags & (PROP_LOG_LINKS | PROP_AUTOINC))
|
|
|
|
|
pbi->reg_next_use = (rtx *) xcalloc (max_reg_num (), sizeof (rtx));
|
|
|
|
|
else
|
|
|
|
|
pbi->reg_next_use = NULL;
|
|
|
|
|
|
2000-04-27 13:17:04 +02:00
|
|
|
|
pbi->new_set = BITMAP_XMALLOC ();
|
2000-04-27 07:03:35 +02:00
|
|
|
|
|
2000-04-30 12:37:57 +02:00
|
|
|
|
#ifdef HAVE_conditional_execution
|
|
|
|
|
pbi->reg_cond_dead = splay_tree_new (splay_tree_compare_ints, NULL,
|
|
|
|
|
free_reg_cond_life_info);
|
|
|
|
|
pbi->reg_cond_reg = BITMAP_XMALLOC ();
|
|
|
|
|
|
|
|
|
|
/* If this block ends in a conditional branch, for each register live
|
|
|
|
|
from one side of the branch and not the other, record the register
|
|
|
|
|
as conditionally dead. */
|
2000-12-19 17:52:23 +01:00
|
|
|
|
if (GET_CODE (bb->end) == JUMP_INSN
|
combine.c (try_combine): Use any_condjump_p...
* combine.c (try_combine): Use any_condjump_p, any_uncondjump_p
and pc_set at the place of simplejump_p and condjump_p.
* cse.c (record_jump_equiv): Likewise.
* emit-rtl.c (emit): Likewise.
* explow.c (find_next_ref): Likewise.
* flow.c (tidy_fallthru_edge): Likewise.
(init_propagate_block_info): Likewise.
* gcse.c (delete_null_pointer_checks): Likewise.
* ifcvt.c (cond_exec_get_condition, noce_get_condition,
dead_or_predicable): Likewise.
* integrate.c (copy_insn_list): Likewise.
* loop.c (scan_loop, verify_dominator, find_and_verify_loops,
for_each_insn_in_loop, check_dbra_loop, get_condition,
insert_bct, load_mems): Likewise.
* resource.c (find_dead_or_set_registers): Likewise.
* sibcalls.c (simplejump_p): Likewise.
* unroll.c (copy_loop_body, reg_dead_after_loop): Likewise.
From-SVN: r34175
2000-05-25 23:38:49 +02:00
|
|
|
|
&& any_condjump_p (bb->end))
|
2000-04-30 12:37:57 +02:00
|
|
|
|
{
|
|
|
|
|
regset_head diff_head;
|
|
|
|
|
regset diff = INITIALIZE_REG_SET (diff_head);
|
|
|
|
|
basic_block bb_true, bb_false;
|
2000-07-31 01:05:52 +02:00
|
|
|
|
rtx cond_true, cond_false, set_src;
|
2000-04-30 12:37:57 +02:00
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
/* Identify the successor blocks. */
|
|
|
|
|
bb_true = bb->succ->dest;
|
2000-05-09 00:04:39 +02:00
|
|
|
|
if (bb->succ->succ_next != NULL)
|
2000-04-30 12:37:57 +02:00
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
bb_false = bb->succ->succ_next->dest;
|
2000-05-09 00:04:39 +02:00
|
|
|
|
|
|
|
|
|
if (bb->succ->flags & EDGE_FALLTHRU)
|
|
|
|
|
{
|
|
|
|
|
basic_block t = bb_false;
|
|
|
|
|
bb_false = bb_true;
|
|
|
|
|
bb_true = t;
|
|
|
|
|
}
|
|
|
|
|
else if (! (bb->succ->succ_next->flags & EDGE_FALLTHRU))
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* This can happen with a conditional jump to the next insn. */
|
|
|
|
|
if (JUMP_LABEL (bb->end) != bb_true->head)
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
/* Simplest way to do nothing. */
|
2000-04-30 12:37:57 +02:00
|
|
|
|
bb_false = bb_true;
|
|
|
|
|
}
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-04-30 12:37:57 +02:00
|
|
|
|
/* Extract the condition from the branch. */
|
2000-07-31 01:05:52 +02:00
|
|
|
|
set_src = SET_SRC (pc_set (bb->end));
|
|
|
|
|
cond_true = XEXP (set_src, 0);
|
2000-04-30 12:37:57 +02:00
|
|
|
|
cond_false = gen_rtx_fmt_ee (reverse_condition (GET_CODE (cond_true)),
|
|
|
|
|
GET_MODE (cond_true), XEXP (cond_true, 0),
|
|
|
|
|
XEXP (cond_true, 1));
|
2000-07-31 01:05:52 +02:00
|
|
|
|
if (GET_CODE (XEXP (set_src, 1)) == PC)
|
2000-04-30 12:37:57 +02:00
|
|
|
|
{
|
|
|
|
|
rtx t = cond_false;
|
|
|
|
|
cond_false = cond_true;
|
|
|
|
|
cond_true = t;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Compute which register lead different lives in the successors. */
|
|
|
|
|
if (bitmap_operation (diff, bb_true->global_live_at_start,
|
|
|
|
|
bb_false->global_live_at_start, BITMAP_XOR))
|
|
|
|
|
{
|
2000-08-21 11:18:05 +02:00
|
|
|
|
rtx reg = XEXP (cond_true, 0);
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (reg) == SUBREG)
|
|
|
|
|
reg = SUBREG_REG (reg);
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (reg) != REG)
|
2000-04-30 12:37:57 +02:00
|
|
|
|
abort ();
|
2000-08-21 11:18:05 +02:00
|
|
|
|
|
|
|
|
|
SET_REGNO_REG_SET (pbi->reg_cond_reg, REGNO (reg));
|
2000-04-30 12:37:57 +02:00
|
|
|
|
|
|
|
|
|
/* For each such register, mark it conditionally dead. */
|
|
|
|
|
EXECUTE_IF_SET_IN_REG_SET
|
|
|
|
|
(diff, 0, i,
|
|
|
|
|
{
|
|
|
|
|
struct reg_cond_life_info *rcli;
|
|
|
|
|
rtx cond;
|
|
|
|
|
|
|
|
|
|
rcli = (struct reg_cond_life_info *) xmalloc (sizeof (*rcli));
|
|
|
|
|
|
|
|
|
|
if (REGNO_REG_SET_P (bb_true->global_live_at_start, i))
|
|
|
|
|
cond = cond_false;
|
|
|
|
|
else
|
|
|
|
|
cond = cond_true;
|
2000-12-19 17:52:23 +01:00
|
|
|
|
rcli->condition = cond;
|
2000-04-30 12:37:57 +02:00
|
|
|
|
|
2000-05-05 12:53:47 +02:00
|
|
|
|
splay_tree_insert (pbi->reg_cond_dead, i,
|
2000-04-30 12:37:57 +02:00
|
|
|
|
(splay_tree_value) rcli);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FREE_REG_SET (diff);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2000-06-01 00:29:38 +02:00
|
|
|
|
/* If this block has no successors, any stores to the frame that aren't
|
|
|
|
|
used later in the block are dead. So make a pass over the block
|
|
|
|
|
recording any such that are made and show them dead at the end. We do
|
|
|
|
|
a very conservative and simple job here. */
|
2000-08-08 21:46:51 +02:00
|
|
|
|
if (optimize
|
2000-09-01 16:48:11 +02:00
|
|
|
|
&& ! (TREE_CODE (TREE_TYPE (current_function_decl)) == FUNCTION_TYPE
|
|
|
|
|
&& (TYPE_RETURNS_STACK_DEPRESSED
|
|
|
|
|
(TREE_TYPE (current_function_decl))))
|
2000-08-08 21:46:51 +02:00
|
|
|
|
&& (flags & PROP_SCAN_DEAD_CODE)
|
2000-06-01 00:29:38 +02:00
|
|
|
|
&& (bb->succ == NULL
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|| (bb->succ->succ_next == NULL
|
2000-06-01 00:29:38 +02:00
|
|
|
|
&& bb->succ->dest == EXIT_BLOCK_PTR)))
|
|
|
|
|
{
|
|
|
|
|
rtx insn;
|
|
|
|
|
for (insn = bb->end; insn != bb->head; insn = PREV_INSN (insn))
|
|
|
|
|
if (GET_CODE (insn) == INSN
|
|
|
|
|
&& GET_CODE (PATTERN (insn)) == SET
|
|
|
|
|
&& GET_CODE (SET_DEST (PATTERN (insn))) == MEM)
|
|
|
|
|
{
|
|
|
|
|
rtx mem = SET_DEST (PATTERN (insn));
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2001-01-24 03:23:54 +01:00
|
|
|
|
/* This optimization is performed by faking a store to the
|
|
|
|
|
memory at the end of the block. This doesn't work for
|
|
|
|
|
unchanging memories because multiple stores to unchanging
|
|
|
|
|
memory is illegal and alias analysis doesn't consider it. */
|
|
|
|
|
if (RTX_UNCHANGING_P (mem))
|
|
|
|
|
continue;
|
|
|
|
|
|
2000-06-01 00:29:38 +02:00
|
|
|
|
if (XEXP (mem, 0) == frame_pointer_rtx
|
|
|
|
|
|| (GET_CODE (XEXP (mem, 0)) == PLUS
|
|
|
|
|
&& XEXP (XEXP (mem, 0), 0) == frame_pointer_rtx
|
|
|
|
|
&& GET_CODE (XEXP (XEXP (mem, 0), 1)) == CONST_INT))
|
2000-11-09 01:26:34 +01:00
|
|
|
|
{
|
|
|
|
|
#ifdef AUTO_INC_DEC
|
|
|
|
|
/* Store a copy of mem, otherwise the address may be scrogged
|
|
|
|
|
by find_auto_inc. This matters because insn_dead_p uses
|
|
|
|
|
an rtx_equal_p check to determine if two addresses are
|
|
|
|
|
the same. This works before find_auto_inc, but fails
|
|
|
|
|
after find_auto_inc, causing discrepencies between the
|
|
|
|
|
set of live registers calculated during the
|
|
|
|
|
calculate_global_regs_live phase and what actually exists
|
|
|
|
|
after flow completes, leading to aborts. */
|
|
|
|
|
if (flags & PROP_AUTOINC)
|
|
|
|
|
mem = shallow_copy_rtx (mem);
|
|
|
|
|
#endif
|
|
|
|
|
pbi->mem_set_list = alloc_EXPR_LIST (0, mem, pbi->mem_set_list);
|
2001-01-16 14:57:17 +01:00
|
|
|
|
if (++pbi->mem_set_list_len >= MAX_MEM_SET_LIST_LEN)
|
|
|
|
|
break;
|
2000-11-09 01:26:34 +01:00
|
|
|
|
}
|
2000-06-01 00:29:38 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-04-27 07:03:35 +02:00
|
|
|
|
return pbi;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Release a propagate_block_info struct. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
free_propagate_block_info (pbi)
|
|
|
|
|
struct propagate_block_info *pbi;
|
|
|
|
|
{
|
|
|
|
|
free_EXPR_LIST_list (&pbi->mem_set_list);
|
|
|
|
|
|
2000-04-27 13:17:04 +02:00
|
|
|
|
BITMAP_XFREE (pbi->new_set);
|
2000-04-27 07:03:35 +02:00
|
|
|
|
|
2000-04-30 12:37:57 +02:00
|
|
|
|
#ifdef HAVE_conditional_execution
|
|
|
|
|
splay_tree_delete (pbi->reg_cond_dead);
|
|
|
|
|
BITMAP_XFREE (pbi->reg_cond_reg);
|
|
|
|
|
#endif
|
|
|
|
|
|
2000-04-27 07:03:35 +02:00
|
|
|
|
if (pbi->reg_next_use)
|
|
|
|
|
free (pbi->reg_next_use);
|
|
|
|
|
|
|
|
|
|
free (pbi);
|
|
|
|
|
}
|
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
/* Compute the registers live at the beginning of a basic block BB from
|
|
|
|
|
those live at the end.
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
When called, REG_LIVE contains those live at the end. On return, it
|
|
|
|
|
contains those live at the beginning.
|
|
|
|
|
|
2000-11-27 18:50:11 +01:00
|
|
|
|
LOCAL_SET, if non-null, will be set with all registers killed
|
|
|
|
|
unconditionally by this basic block.
|
|
|
|
|
Likewise, COND_LOCAL_SET, if non-null, will be set with all registers
|
|
|
|
|
killed conditionally by this basic block. If there is any unconditional
|
|
|
|
|
set of a register, then the corresponding bit will be set in LOCAL_SET
|
|
|
|
|
and cleared in COND_LOCAL_SET.
|
|
|
|
|
It is valid for LOCAL_SET and COND_LOCAL_SET to be the same set. In this
|
|
|
|
|
case, the resulting set will be equal to the union of the two sets that
|
|
|
|
|
would otherwise be computed. */
|
2000-04-08 01:33:47 +02:00
|
|
|
|
|
2000-04-27 07:03:35 +02:00
|
|
|
|
void
|
2000-11-27 18:50:11 +01:00
|
|
|
|
propagate_block (bb, live, local_set, cond_local_set, flags)
|
2000-04-08 01:33:47 +02:00
|
|
|
|
basic_block bb;
|
|
|
|
|
regset live;
|
|
|
|
|
regset local_set;
|
2000-11-27 18:50:11 +01:00
|
|
|
|
regset cond_local_set;
|
2000-04-08 01:33:47 +02:00
|
|
|
|
int flags;
|
|
|
|
|
{
|
2000-04-27 07:03:35 +02:00
|
|
|
|
struct propagate_block_info *pbi;
|
2000-04-08 01:33:47 +02:00
|
|
|
|
rtx insn, prev;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-11-27 18:50:11 +01:00
|
|
|
|
pbi = init_propagate_block_info (bb, live, local_set, cond_local_set, flags);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
if (flags & PROP_REG_INFO)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
1997-06-05 12:24:03 +02:00
|
|
|
|
register int i;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
/* Process the regs live at the end of the block.
|
2000-08-11 14:45:05 +02:00
|
|
|
|
Mark them as not local to any one basic block. */
|
2000-04-08 01:33:47 +02:00
|
|
|
|
EXECUTE_IF_SET_IN_REG_SET (live, 0, i,
|
2000-04-27 07:03:35 +02:00
|
|
|
|
{ REG_BASIC_BLOCK (i) = REG_BLOCK_GLOBAL; });
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Scan the block an insn at a time from end to beginning. */
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (insn = bb->end;; insn = prev)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
2000-04-27 07:03:35 +02:00
|
|
|
|
/* If this is a call to `setjmp' et al, warn if any
|
|
|
|
|
non-volatile datum is live. */
|
|
|
|
|
if ((flags & PROP_REG_INFO)
|
|
|
|
|
&& GET_CODE (insn) == NOTE
|
|
|
|
|
&& NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP)
|
|
|
|
|
IOR_REG_SET (regs_live_at_setjmp, pbi->reg_live);
|
1999-04-11 00:53:08 +02:00
|
|
|
|
|
2000-04-27 07:03:35 +02:00
|
|
|
|
prev = propagate_one_insn (pbi, insn);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-01-20 04:59:57 +01:00
|
|
|
|
if (insn == bb->head)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2000-04-27 07:03:35 +02:00
|
|
|
|
free_propagate_block_info (pbi);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return 1 if X (the body of an insn, or part of it) is just dead stores
|
|
|
|
|
(SET expressions whose destinations are registers dead after the insn).
|
|
|
|
|
NEEDED is the regset that says which regs are alive after the insn.
|
|
|
|
|
|
1998-11-17 10:14:33 +01:00
|
|
|
|
Unless CALL_OK is non-zero, an insn is needed if it contains a CALL.
|
|
|
|
|
|
|
|
|
|
If X is the entire body of an insn, NOTES contains the reg notes
|
|
|
|
|
pertaining to the insn. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
static int
|
2000-04-08 01:33:47 +02:00
|
|
|
|
insn_dead_p (pbi, x, call_ok, notes)
|
|
|
|
|
struct propagate_block_info *pbi;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
rtx x;
|
|
|
|
|
int call_ok;
|
1998-11-17 10:14:33 +01:00
|
|
|
|
rtx notes ATTRIBUTE_UNUSED;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
1998-04-04 15:32:39 +02:00
|
|
|
|
enum rtx_code code = GET_CODE (x);
|
|
|
|
|
|
1998-11-17 10:14:33 +01:00
|
|
|
|
#ifdef AUTO_INC_DEC
|
|
|
|
|
/* If flow is invoked after reload, we must take existing AUTO_INC
|
|
|
|
|
expresions into account. */
|
|
|
|
|
if (reload_completed)
|
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (; notes; notes = XEXP (notes, 1))
|
1998-11-17 10:14:33 +01:00
|
|
|
|
{
|
|
|
|
|
if (REG_NOTE_KIND (notes) == REG_INC)
|
|
|
|
|
{
|
|
|
|
|
int regno = REGNO (XEXP (notes, 0));
|
|
|
|
|
|
|
|
|
|
/* Don't delete insns to set global regs. */
|
|
|
|
|
if ((regno < FIRST_PSEUDO_REGISTER && global_regs[regno])
|
2000-04-08 01:33:47 +02:00
|
|
|
|
|| REGNO_REG_SET_P (pbi->reg_live, regno))
|
1998-11-17 10:14:33 +01:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
/* If setting something that's a reg or part of one,
|
|
|
|
|
see if that register's altered value will be live. */
|
|
|
|
|
|
|
|
|
|
if (code == SET)
|
|
|
|
|
{
|
1998-04-04 15:32:39 +02:00
|
|
|
|
rtx r = SET_DEST (x);
|
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
#ifdef HAVE_cc0
|
|
|
|
|
if (GET_CODE (r) == CC0)
|
2000-04-08 01:33:47 +02:00
|
|
|
|
return ! pbi->cc0_live;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
#endif
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-02-16 08:54:53 +01:00
|
|
|
|
/* A SET that is a subroutine call cannot be dead. */
|
|
|
|
|
if (GET_CODE (SET_SRC (x)) == CALL)
|
|
|
|
|
{
|
|
|
|
|
if (! call_ok)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Don't eliminate loads from volatile memory or volatile asms. */
|
|
|
|
|
else if (volatile_refs_p (SET_SRC (x)))
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (r) == MEM)
|
1999-01-18 04:01:26 +01:00
|
|
|
|
{
|
|
|
|
|
rtx temp;
|
2000-02-16 08:54:53 +01:00
|
|
|
|
|
|
|
|
|
if (MEM_VOLATILE_P (r))
|
|
|
|
|
return 0;
|
|
|
|
|
|
1999-01-18 04:01:26 +01:00
|
|
|
|
/* Walk the set of memory locations we are currently tracking
|
|
|
|
|
and see if one is an identical match to this memory location.
|
|
|
|
|
If so, this memory write is dead (remember, we're walking
|
basic-block.h (struct edge_def): New field "count".
* basic-block.h (struct edge_def): New field "count".
(struct basic_block_def): Likewise.
* flow.c (entry_exit_blocks): Add count fileds.
(split_edge): Keep count information up-to-date.
(dump_edge_info, dump_flow_info): Dump count fields.
* final.c (count_instrumented_edges): Rename to edge from arc.
(end_final): Update users.
* profile.c: Include expr.h, basic-block.h.
(struct adj_list, ARC_TARGET, ARC_SOURCE, ARC_COUNT): Kill.
(struct bb_info, label_to_bb, label_to_bb_size, bb_graph): Kill.
(ignore_next_note, return_label_execution_count): Kill.
(bbg_file_name, da_file_name): Kill.
(edge_info, bb_info): New structures.
(EDGE_INFO, BB_INFO, GCOV_INDEX_TO_BB, BB_TO_GCOV_INDEX): New macros.
(count_instrumented_edges, total_num_edges): Rename to edge from arc.
(total_num_edges_instrumented): Likewise.
(init_arc, expand_spanning_tree): Kill.
(fill_spanning_tree, tablejump_entry_p): Kill.
(instrument_edges): Rewrite from instrument_arcs to use
commit_edge_insertions infrastructure.
(compute_branch_probabilities): Remove arguments; rewrite for
CFG infrastructure; use rtl_dump_file directly.
(branch_prob, find_spanning_tree): Likewise.
(union_groups, find_group): New.
(init_branch_prob): Make bbg_file_name and da_file_name local.
(end_branch_prob): Use rtl_dump_file directly.
(init_edge_profiler): Rename to edge from arc.
(output_arc_profiler): Kill.
(gen_edge_profiler): New.
(output_func_start_profiler): Turn off profiling. Make the
constructor static when we can.
* rtl.h (branch_prob, end_branch_prob): Update prototypes.
* toplev.c (DFI_flow): Remove.
(DFI_cfg, DFI_life): New.
(dump_file): Update accordingly.
(compile_file): Call end_branch_prob if profile_arc_flag too.
(rest_of_compilation): Move flow1 cfg creation to DFI_cfg. Do edge
profiling after the CFG is built. Move flow1 life analysis to
DFI_life. Always estimate remaining probabilities.
Co-Authored-By: Richard Henderson <rth@cygnus.com>
From-SVN: r34037
2000-05-19 22:51:49 +02:00
|
|
|
|
backwards from the end of the block to the start). */
|
2000-04-08 01:33:47 +02:00
|
|
|
|
temp = pbi->mem_set_list;
|
1999-01-18 04:01:26 +01:00
|
|
|
|
while (temp)
|
|
|
|
|
{
|
2000-09-07 03:22:07 +02:00
|
|
|
|
rtx mem = XEXP (temp, 0);
|
|
|
|
|
|
|
|
|
|
if (rtx_equal_p (mem, r))
|
|
|
|
|
return 1;
|
|
|
|
|
#ifdef AUTO_INC_DEC
|
|
|
|
|
/* Check if memory reference matches an auto increment. Only
|
|
|
|
|
post increment/decrement or modify are valid. */
|
2001-01-02 08:00:49 +01:00
|
|
|
|
if (GET_MODE (mem) == GET_MODE (r)
|
2000-09-07 03:22:07 +02:00
|
|
|
|
&& (GET_CODE (XEXP (mem, 0)) == POST_DEC
|
|
|
|
|
|| GET_CODE (XEXP (mem, 0)) == POST_INC
|
|
|
|
|
|| GET_CODE (XEXP (mem, 0)) == POST_MODIFY)
|
|
|
|
|
&& GET_MODE (XEXP (mem, 0)) == GET_MODE (r)
|
|
|
|
|
&& rtx_equal_p (XEXP (XEXP (mem, 0), 0), XEXP (r, 0)))
|
1999-01-18 04:01:26 +01:00
|
|
|
|
return 1;
|
2000-09-07 03:22:07 +02:00
|
|
|
|
#endif
|
1999-01-18 04:01:26 +01:00
|
|
|
|
temp = XEXP (temp, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-02-16 08:54:53 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
while (GET_CODE (r) == SUBREG
|
|
|
|
|
|| GET_CODE (r) == STRICT_LOW_PART
|
|
|
|
|
|| GET_CODE (r) == ZERO_EXTRACT)
|
|
|
|
|
r = XEXP (r, 0);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-02-16 08:54:53 +01:00
|
|
|
|
if (GET_CODE (r) == REG)
|
|
|
|
|
{
|
|
|
|
|
int regno = REGNO (r);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-02-16 08:54:53 +01:00
|
|
|
|
/* Obvious. */
|
2000-04-08 01:33:47 +02:00
|
|
|
|
if (REGNO_REG_SET_P (pbi->reg_live, regno))
|
2000-02-16 08:54:53 +01:00
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/* If this is a hard register, verify that subsequent
|
|
|
|
|
words are not needed. */
|
|
|
|
|
if (regno < FIRST_PSEUDO_REGISTER)
|
|
|
|
|
{
|
|
|
|
|
int n = HARD_REGNO_NREGS (regno, GET_MODE (r));
|
|
|
|
|
|
|
|
|
|
while (--n > 0)
|
2000-04-08 01:33:47 +02:00
|
|
|
|
if (REGNO_REG_SET_P (pbi->reg_live, regno+n))
|
2000-02-16 08:54:53 +01:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Don't delete insns to set global regs. */
|
|
|
|
|
if (regno < FIRST_PSEUDO_REGISTER && global_regs[regno])
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/* Make sure insns to set the stack pointer aren't deleted. */
|
|
|
|
|
if (regno == STACK_POINTER_REGNUM)
|
|
|
|
|
return 0;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-12-05 08:58:18 +01:00
|
|
|
|
/* ??? These bits might be redundant with the force live bits
|
|
|
|
|
in calculate_global_regs_live. We would delete from
|
|
|
|
|
sequential sets; whether this actually affects real code
|
|
|
|
|
for anything but the stack pointer I don't know. */
|
2000-02-16 08:54:53 +01:00
|
|
|
|
/* Make sure insns to set the frame pointer aren't deleted. */
|
|
|
|
|
if (regno == FRAME_POINTER_REGNUM
|
1999-05-31 10:43:04 +02:00
|
|
|
|
&& (! reload_completed || frame_pointer_needed))
|
2000-02-16 08:54:53 +01:00
|
|
|
|
return 0;
|
1993-09-24 21:40:36 +02:00
|
|
|
|
#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
|
2000-02-16 08:54:53 +01:00
|
|
|
|
if (regno == HARD_FRAME_POINTER_REGNUM
|
1999-05-31 10:43:04 +02:00
|
|
|
|
&& (! reload_completed || frame_pointer_needed))
|
2000-02-16 08:54:53 +01:00
|
|
|
|
return 0;
|
1993-09-24 21:40:36 +02:00
|
|
|
|
#endif
|
2000-02-16 08:54:53 +01:00
|
|
|
|
|
1992-02-11 23:35:04 +01:00
|
|
|
|
#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
|
|
|
|
|
/* Make sure insns to set arg pointer are never deleted
|
2000-02-16 08:54:53 +01:00
|
|
|
|
(if the arg pointer isn't fixed, there will be a USE
|
|
|
|
|
for it, so we can treat it normally). */
|
|
|
|
|
if (regno == ARG_POINTER_REGNUM && fixed_regs[regno])
|
|
|
|
|
return 0;
|
1992-02-11 23:35:04 +01:00
|
|
|
|
#endif
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-02-16 08:54:53 +01:00
|
|
|
|
/* Otherwise, the set is dead. */
|
|
|
|
|
return 1;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1998-04-04 15:32:39 +02:00
|
|
|
|
|
2000-02-16 08:54:53 +01:00
|
|
|
|
/* If performing several activities, insn is dead if each activity
|
|
|
|
|
is individually dead. Also, CLOBBERs and USEs can be ignored; a
|
|
|
|
|
CLOBBER or USE that's inside a PARALLEL doesn't make the insn
|
|
|
|
|
worth keeping. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
else if (code == PARALLEL)
|
|
|
|
|
{
|
1998-04-04 15:32:39 +02:00
|
|
|
|
int i = XVECLEN (x, 0);
|
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
for (i--; i >= 0; i--)
|
1998-04-04 15:32:39 +02:00
|
|
|
|
if (GET_CODE (XVECEXP (x, 0, i)) != CLOBBER
|
|
|
|
|
&& GET_CODE (XVECEXP (x, 0, i)) != USE
|
2000-04-08 01:33:47 +02:00
|
|
|
|
&& ! insn_dead_p (pbi, XVECEXP (x, 0, i), call_ok, NULL_RTX))
|
1998-04-04 15:32:39 +02:00
|
|
|
|
return 0;
|
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
1998-04-04 15:32:39 +02:00
|
|
|
|
|
|
|
|
|
/* A CLOBBER of a pseudo-register that is dead serves no purpose. That
|
|
|
|
|
is not necessarily true for hard registers. */
|
|
|
|
|
else if (code == CLOBBER && GET_CODE (XEXP (x, 0)) == REG
|
|
|
|
|
&& REGNO (XEXP (x, 0)) >= FIRST_PSEUDO_REGISTER
|
2000-04-08 01:33:47 +02:00
|
|
|
|
&& ! REGNO_REG_SET_P (pbi->reg_live, REGNO (XEXP (x, 0))))
|
1998-04-04 15:32:39 +02:00
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
/* We do not check other CLOBBER or USE here. An insn consisting of just
|
|
|
|
|
a CLOBBER or just a USE should not be deleted. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2000-07-17 12:16:18 +02:00
|
|
|
|
/* If INSN is the last insn in a libcall, and assuming INSN is dead,
|
1992-01-15 22:33:30 +01:00
|
|
|
|
return 1 if the entire library call is dead.
|
2000-07-17 12:16:18 +02:00
|
|
|
|
This is true if INSN copies a register (hard or pseudo)
|
|
|
|
|
and if the hard return reg of the call insn is dead.
|
|
|
|
|
(The caller should have tested the destination of the SET inside
|
|
|
|
|
INSN already for death.)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
If this insn doesn't just copy a register, then we don't
|
|
|
|
|
have an ordinary libcall. In that case, cse could not have
|
|
|
|
|
managed to substitute the source for the dest later on,
|
|
|
|
|
so we can assume the libcall is dead.
|
|
|
|
|
|
2000-07-17 12:16:18 +02:00
|
|
|
|
PBI is the block info giving pseudoregs live before this insn.
|
|
|
|
|
NOTE is the REG_RETVAL note of the insn. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
static int
|
2000-07-17 12:16:18 +02:00
|
|
|
|
libcall_dead_p (pbi, note, insn)
|
2000-04-08 01:33:47 +02:00
|
|
|
|
struct propagate_block_info *pbi;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
rtx note;
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
2000-07-17 12:16:18 +02:00
|
|
|
|
rtx x = single_set (insn);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-07-17 12:16:18 +02:00
|
|
|
|
if (x)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
|
|
|
|
register rtx r = SET_SRC (x);
|
|
|
|
|
if (GET_CODE (r) == REG)
|
|
|
|
|
{
|
|
|
|
|
rtx call = XEXP (note, 0);
|
1998-11-17 10:14:33 +01:00
|
|
|
|
rtx call_pat;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
register int i;
|
|
|
|
|
|
|
|
|
|
/* Find the call insn. */
|
|
|
|
|
while (call != insn && GET_CODE (call) != CALL_INSN)
|
|
|
|
|
call = NEXT_INSN (call);
|
|
|
|
|
|
|
|
|
|
/* If there is none, do nothing special,
|
|
|
|
|
since ordinary death handling can understand these insns. */
|
|
|
|
|
if (call == insn)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/* See if the hard reg holding the value is dead.
|
|
|
|
|
If this is a PARALLEL, find the call within it. */
|
1998-11-17 10:14:33 +01:00
|
|
|
|
call_pat = PATTERN (call);
|
|
|
|
|
if (GET_CODE (call_pat) == PARALLEL)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
1998-11-17 10:14:33 +01:00
|
|
|
|
for (i = XVECLEN (call_pat, 0) - 1; i >= 0; i--)
|
|
|
|
|
if (GET_CODE (XVECEXP (call_pat, 0, i)) == SET
|
|
|
|
|
&& GET_CODE (SET_SRC (XVECEXP (call_pat, 0, i))) == CALL)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
break;
|
|
|
|
|
|
1994-03-11 20:50:38 +01:00
|
|
|
|
/* This may be a library call that is returning a value
|
|
|
|
|
via invisible pointer. Do nothing special, since
|
|
|
|
|
ordinary death handling can understand these insns. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
if (i < 0)
|
1994-03-11 20:50:38 +01:00
|
|
|
|
return 0;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1998-11-17 10:14:33 +01:00
|
|
|
|
call_pat = XVECEXP (call_pat, 0, i);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
return insn_dead_p (pbi, call_pat, 1, REG_NOTES (call));
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
1998-07-21 10:54:29 +02:00
|
|
|
|
/* Return 1 if register REGNO was used before it was set, i.e. if it is
|
|
|
|
|
live at function entry. Don't count global register variables, variables
|
|
|
|
|
in registers that can be used for function arg passing, or variables in
|
|
|
|
|
fixed hard registers. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
regno_uninitialized (regno)
|
|
|
|
|
int regno;
|
|
|
|
|
{
|
1993-02-19 20:09:39 +01:00
|
|
|
|
if (n_basic_blocks == 0
|
1997-01-29 22:00:25 +01:00
|
|
|
|
|| (regno < FIRST_PSEUDO_REGISTER
|
1998-07-21 10:54:29 +02:00
|
|
|
|
&& (global_regs[regno]
|
|
|
|
|
|| fixed_regs[regno]
|
|
|
|
|
|| FUNCTION_ARG_REGNO_P (regno))))
|
1992-01-15 22:33:30 +01:00
|
|
|
|
return 0;
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
return REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, regno);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 1 if register REGNO was alive at a place where `setjmp' was called
|
|
|
|
|
and was set more than once or is an argument.
|
|
|
|
|
Such regs may be clobbered by `longjmp'. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
regno_clobbered_at_setjmp (regno)
|
|
|
|
|
int regno;
|
|
|
|
|
{
|
|
|
|
|
if (n_basic_blocks == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
1997-05-30 20:19:19 +02:00
|
|
|
|
return ((REG_N_SETS (regno) > 1
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|| REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, regno))
|
1997-06-05 12:24:03 +02:00
|
|
|
|
&& REGNO_REG_SET_P (regs_live_at_setjmp, regno));
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
|
1999-01-20 03:02:20 +01:00
|
|
|
|
/* INSN references memory, possibly using autoincrement addressing modes.
|
|
|
|
|
Find any entries on the mem_set_list that need to be invalidated due
|
|
|
|
|
to an address change. */
|
2000-05-07 00:59:08 +02:00
|
|
|
|
|
1999-01-20 03:02:20 +01:00
|
|
|
|
static void
|
2000-04-08 01:33:47 +02:00
|
|
|
|
invalidate_mems_from_autoinc (pbi, insn)
|
|
|
|
|
struct propagate_block_info *pbi;
|
1999-01-20 03:02:20 +01:00
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
rtx note = REG_NOTES (insn);
|
|
|
|
|
for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
|
|
|
|
|
{
|
|
|
|
|
if (REG_NOTE_KIND (note) == REG_INC)
|
2000-08-11 14:45:05 +02:00
|
|
|
|
{
|
|
|
|
|
rtx temp = pbi->mem_set_list;
|
|
|
|
|
rtx prev = NULL_RTX;
|
1999-10-15 01:31:25 +02:00
|
|
|
|
rtx next;
|
1999-01-20 03:02:20 +01:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
while (temp)
|
1999-01-20 03:02:20 +01:00
|
|
|
|
{
|
1999-10-15 01:31:25 +02:00
|
|
|
|
next = XEXP (temp, 1);
|
1999-01-20 03:02:20 +01:00
|
|
|
|
if (reg_overlap_mentioned_p (XEXP (note, 0), XEXP (temp, 0)))
|
2000-08-11 14:45:05 +02:00
|
|
|
|
{
|
|
|
|
|
/* Splice temp out of list. */
|
|
|
|
|
if (prev)
|
|
|
|
|
XEXP (prev, 1) = next;
|
|
|
|
|
else
|
|
|
|
|
pbi->mem_set_list = next;
|
1999-10-15 01:31:25 +02:00
|
|
|
|
free_EXPR_LIST_node (temp);
|
2001-01-16 14:57:17 +01:00
|
|
|
|
pbi->mem_set_list_len--;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
}
|
1999-01-20 03:02:20 +01:00
|
|
|
|
else
|
2000-08-11 14:45:05 +02:00
|
|
|
|
prev = temp;
|
|
|
|
|
temp = next;
|
1999-01-20 03:02:20 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-11-10 03:03:28 +01:00
|
|
|
|
/* EXP is either a MEM or a REG. Remove any dependant entries
|
|
|
|
|
from pbi->mem_set_list. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
invalidate_mems_from_set (pbi, exp)
|
|
|
|
|
struct propagate_block_info *pbi;
|
|
|
|
|
rtx exp;
|
|
|
|
|
{
|
|
|
|
|
rtx temp = pbi->mem_set_list;
|
|
|
|
|
rtx prev = NULL_RTX;
|
|
|
|
|
rtx next;
|
|
|
|
|
|
|
|
|
|
while (temp)
|
|
|
|
|
{
|
|
|
|
|
next = XEXP (temp, 1);
|
|
|
|
|
if ((GET_CODE (exp) == MEM
|
|
|
|
|
&& output_dependence (XEXP (temp, 0), exp))
|
|
|
|
|
|| (GET_CODE (exp) == REG
|
|
|
|
|
&& reg_overlap_mentioned_p (exp, XEXP (temp, 0))))
|
|
|
|
|
{
|
|
|
|
|
/* Splice this entry out of the list. */
|
|
|
|
|
if (prev)
|
|
|
|
|
XEXP (prev, 1) = next;
|
|
|
|
|
else
|
|
|
|
|
pbi->mem_set_list = next;
|
|
|
|
|
free_EXPR_LIST_node (temp);
|
2001-01-16 14:57:17 +01:00
|
|
|
|
pbi->mem_set_list_len--;
|
2000-11-10 03:03:28 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
prev = temp;
|
|
|
|
|
temp = next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
/* Process the registers that are set within X. Their bits are set to
|
|
|
|
|
1 in the regset DEAD, because they are dead prior to this insn.
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
If INSN is nonzero, it is the insn being processed.
|
|
|
|
|
|
|
|
|
|
FLAGS is the set of operations to perform. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
static void
|
2000-04-12 03:38:15 +02:00
|
|
|
|
mark_set_regs (pbi, x, insn)
|
2000-04-08 01:33:47 +02:00
|
|
|
|
struct propagate_block_info *pbi;
|
|
|
|
|
rtx x, insn;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
2000-04-08 01:33:47 +02:00
|
|
|
|
rtx cond = NULL_RTX;
|
2000-06-20 00:31:47 +02:00
|
|
|
|
rtx link;
|
2000-04-27 07:42:25 +02:00
|
|
|
|
enum rtx_code code;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-06-20 00:31:47 +02:00
|
|
|
|
if (insn)
|
|
|
|
|
for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
|
|
|
|
|
{
|
|
|
|
|
if (REG_NOTE_KIND (link) == REG_INC)
|
|
|
|
|
mark_set_1 (pbi, SET, XEXP (link, 0),
|
|
|
|
|
(GET_CODE (x) == COND_EXEC
|
|
|
|
|
? COND_EXEC_TEST (x) : NULL_RTX),
|
|
|
|
|
insn, pbi->flags);
|
|
|
|
|
}
|
2000-04-08 01:33:47 +02:00
|
|
|
|
retry:
|
2000-04-27 07:42:25 +02:00
|
|
|
|
switch (code = GET_CODE (x))
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
2000-04-08 01:33:47 +02:00
|
|
|
|
case SET:
|
|
|
|
|
case CLOBBER:
|
2000-04-27 07:42:25 +02:00
|
|
|
|
mark_set_1 (pbi, code, SET_DEST (x), cond, insn, pbi->flags);
|
2000-04-08 01:33:47 +02:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case COND_EXEC:
|
|
|
|
|
cond = COND_EXEC_TEST (x);
|
|
|
|
|
x = COND_EXEC_CODE (x);
|
|
|
|
|
goto retry;
|
|
|
|
|
|
|
|
|
|
case PARALLEL:
|
|
|
|
|
{
|
|
|
|
|
register int i;
|
|
|
|
|
for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
rtx sub = XVECEXP (x, 0, i);
|
2000-04-27 07:42:25 +02:00
|
|
|
|
switch (code = GET_CODE (sub))
|
2000-04-08 01:33:47 +02:00
|
|
|
|
{
|
|
|
|
|
case COND_EXEC:
|
|
|
|
|
if (cond != NULL_RTX)
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
cond = COND_EXEC_TEST (sub);
|
|
|
|
|
sub = COND_EXEC_CODE (sub);
|
|
|
|
|
if (GET_CODE (sub) != SET && GET_CODE (sub) != CLOBBER)
|
|
|
|
|
break;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Fall through. */
|
2000-04-08 01:33:47 +02:00
|
|
|
|
|
|
|
|
|
case SET:
|
|
|
|
|
case CLOBBER:
|
2000-04-27 07:42:25 +02:00
|
|
|
|
mark_set_1 (pbi, code, SET_DEST (sub), cond, insn, pbi->flags);
|
2000-04-08 01:33:47 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Process a single SET rtx, X. */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-04-27 07:42:25 +02:00
|
|
|
|
mark_set_1 (pbi, code, reg, cond, insn, flags)
|
2000-04-08 01:33:47 +02:00
|
|
|
|
struct propagate_block_info *pbi;
|
2000-04-27 07:42:25 +02:00
|
|
|
|
enum rtx_code code;
|
2000-04-08 01:33:47 +02:00
|
|
|
|
rtx reg, cond, insn;
|
2000-04-27 07:42:25 +02:00
|
|
|
|
int flags;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
2000-04-27 07:42:25 +02:00
|
|
|
|
int regno_first = -1, regno_last = -1;
|
2000-04-27 13:17:04 +02:00
|
|
|
|
int not_dead = 0;
|
2000-04-27 07:42:25 +02:00
|
|
|
|
int i;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-04-12 03:38:15 +02:00
|
|
|
|
/* Modifying just one hardware register of a multi-reg value or just a
|
|
|
|
|
byte field of a register does not mean the value from before this insn
|
2000-04-27 13:17:04 +02:00
|
|
|
|
is now dead. Of course, if it was dead after it's unused now. */
|
2000-04-12 03:38:15 +02:00
|
|
|
|
|
2000-04-27 13:17:04 +02:00
|
|
|
|
switch (GET_CODE (reg))
|
|
|
|
|
{
|
2001-01-18 14:14:34 +01:00
|
|
|
|
case PARALLEL:
|
|
|
|
|
/* Some targets place small structures in registers for return values of
|
|
|
|
|
functions. We have to detect this case specially here to get correct
|
2001-01-19 19:28:58 +01:00
|
|
|
|
flow information. */
|
2001-01-18 14:14:34 +01:00
|
|
|
|
for (i = XVECLEN (reg, 0) - 1; i >= 0; i--)
|
2001-01-19 19:28:58 +01:00
|
|
|
|
if (XEXP (XVECEXP (reg, 0, i), 0) != 0)
|
|
|
|
|
mark_set_1 (pbi, code, XEXP (XVECEXP (reg, 0, i), 0), cond, insn,
|
|
|
|
|
flags);
|
2001-01-18 14:14:34 +01:00
|
|
|
|
return;
|
|
|
|
|
|
2000-04-27 13:17:04 +02:00
|
|
|
|
case ZERO_EXTRACT:
|
|
|
|
|
case SIGN_EXTRACT:
|
|
|
|
|
case STRICT_LOW_PART:
|
|
|
|
|
/* ??? Assumes STRICT_LOW_PART not used on multi-word registers. */
|
|
|
|
|
do
|
|
|
|
|
reg = XEXP (reg, 0);
|
|
|
|
|
while (GET_CODE (reg) == SUBREG
|
|
|
|
|
|| GET_CODE (reg) == ZERO_EXTRACT
|
|
|
|
|
|| GET_CODE (reg) == SIGN_EXTRACT
|
|
|
|
|
|| GET_CODE (reg) == STRICT_LOW_PART);
|
2000-04-27 17:34:16 +02:00
|
|
|
|
if (GET_CODE (reg) == MEM)
|
|
|
|
|
break;
|
2000-04-27 13:17:04 +02:00
|
|
|
|
not_dead = REGNO_REG_SET_P (pbi->reg_live, REGNO (reg));
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Fall through. */
|
2000-04-27 13:17:04 +02:00
|
|
|
|
|
|
|
|
|
case REG:
|
|
|
|
|
regno_last = regno_first = REGNO (reg);
|
|
|
|
|
if (regno_first < FIRST_PSEUDO_REGISTER)
|
|
|
|
|
regno_last += HARD_REGNO_NREGS (regno_first, GET_MODE (reg)) - 1;
|
|
|
|
|
break;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-04-27 13:17:04 +02:00
|
|
|
|
case SUBREG:
|
|
|
|
|
if (GET_CODE (SUBREG_REG (reg)) == REG)
|
|
|
|
|
{
|
|
|
|
|
enum machine_mode outer_mode = GET_MODE (reg);
|
|
|
|
|
enum machine_mode inner_mode = GET_MODE (SUBREG_REG (reg));
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-04-27 13:17:04 +02:00
|
|
|
|
/* Identify the range of registers affected. This is moderately
|
|
|
|
|
tricky for hard registers. See alter_subreg. */
|
|
|
|
|
|
|
|
|
|
regno_last = regno_first = REGNO (SUBREG_REG (reg));
|
|
|
|
|
if (regno_first < FIRST_PSEUDO_REGISTER)
|
|
|
|
|
{
|
|
|
|
|
#ifdef ALTER_HARD_SUBREG
|
|
|
|
|
regno_first = ALTER_HARD_SUBREG (outer_mode, SUBREG_WORD (reg),
|
|
|
|
|
inner_mode, regno_first);
|
|
|
|
|
#else
|
|
|
|
|
regno_first += SUBREG_WORD (reg);
|
|
|
|
|
#endif
|
|
|
|
|
regno_last = (regno_first
|
|
|
|
|
+ HARD_REGNO_NREGS (regno_first, outer_mode) - 1);
|
|
|
|
|
|
|
|
|
|
/* Since we've just adjusted the register number ranges, make
|
|
|
|
|
sure REG matches. Otherwise some_was_live will be clear
|
|
|
|
|
when it shouldn't have been, and we'll create incorrect
|
|
|
|
|
REG_UNUSED notes. */
|
|
|
|
|
reg = gen_rtx_REG (outer_mode, regno_first);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* If the number of words in the subreg is less than the number
|
|
|
|
|
of words in the full register, we have a well-defined partial
|
|
|
|
|
set. Otherwise the high bits are undefined.
|
|
|
|
|
|
|
|
|
|
This is only really applicable to pseudos, since we just took
|
|
|
|
|
care of multi-word hard registers. */
|
|
|
|
|
if (((GET_MODE_SIZE (outer_mode)
|
|
|
|
|
+ UNITS_PER_WORD - 1) / UNITS_PER_WORD)
|
|
|
|
|
< ((GET_MODE_SIZE (inner_mode)
|
|
|
|
|
+ UNITS_PER_WORD - 1) / UNITS_PER_WORD))
|
|
|
|
|
not_dead = REGNO_REG_SET_P (pbi->reg_live, regno_first);
|
|
|
|
|
|
|
|
|
|
reg = SUBREG_REG (reg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
reg = SUBREG_REG (reg);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* If this set is a MEM, then it kills any aliased writes.
|
1999-01-18 04:01:26 +01:00
|
|
|
|
If this set is a REG, then it kills any MEMs which use the reg. */
|
2000-08-08 21:46:51 +02:00
|
|
|
|
if (optimize && (flags & PROP_SCAN_DEAD_CODE))
|
1999-01-18 04:01:26 +01:00
|
|
|
|
{
|
2000-04-08 01:33:47 +02:00
|
|
|
|
if (GET_CODE (reg) == MEM || GET_CODE (reg) == REG)
|
2000-11-10 03:03:28 +01:00
|
|
|
|
invalidate_mems_from_set (pbi, reg);
|
1999-01-20 03:02:20 +01:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
/* If the memory reference had embedded side effects (autoincrement
|
|
|
|
|
address modes. Then we may need to kill some entries on the
|
|
|
|
|
memory set list. */
|
|
|
|
|
if (insn && GET_CODE (reg) == MEM)
|
2000-04-08 01:33:47 +02:00
|
|
|
|
invalidate_mems_from_autoinc (pbi, insn);
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
2001-01-16 14:57:17 +01:00
|
|
|
|
if (pbi->mem_set_list_len < MAX_MEM_SET_LIST_LEN
|
|
|
|
|
&& GET_CODE (reg) == MEM && ! side_effects_p (reg)
|
2000-05-26 01:19:35 +02:00
|
|
|
|
/* ??? With more effort we could track conditional memory life. */
|
|
|
|
|
&& ! cond
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
/* We do not know the size of a BLKmode store, so we do not track
|
|
|
|
|
them for redundant store elimination. */
|
|
|
|
|
&& GET_MODE (reg) != BLKmode
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* There are no REG_INC notes for SP, so we can't assume we'll see
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
everything that invalidates it. To be safe, don't eliminate any
|
|
|
|
|
stores though SP; none of them should be redundant anyway. */
|
|
|
|
|
&& ! reg_mentioned_p (stack_pointer_rtx, reg))
|
2000-11-09 01:26:34 +01:00
|
|
|
|
{
|
|
|
|
|
#ifdef AUTO_INC_DEC
|
|
|
|
|
/* Store a copy of mem, otherwise the address may be
|
|
|
|
|
scrogged by find_auto_inc. */
|
|
|
|
|
if (flags & PROP_AUTOINC)
|
|
|
|
|
reg = shallow_copy_rtx (reg);
|
|
|
|
|
#endif
|
|
|
|
|
pbi->mem_set_list = alloc_EXPR_LIST (0, reg, pbi->mem_set_list);
|
2001-01-16 14:57:17 +01:00
|
|
|
|
pbi->mem_set_list_len++;
|
2000-11-09 01:26:34 +01:00
|
|
|
|
}
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
}
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
if (GET_CODE (reg) == REG
|
2000-04-27 13:17:04 +02:00
|
|
|
|
&& ! (regno_first == FRAME_POINTER_REGNUM
|
|
|
|
|
&& (! reload_completed || frame_pointer_needed))
|
1993-09-24 21:40:36 +02:00
|
|
|
|
#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
|
2000-04-27 07:42:25 +02:00
|
|
|
|
&& ! (regno_first == HARD_FRAME_POINTER_REGNUM
|
1999-05-31 10:43:04 +02:00
|
|
|
|
&& (! reload_completed || frame_pointer_needed))
|
1993-09-24 21:40:36 +02:00
|
|
|
|
#endif
|
1992-02-11 23:35:04 +01:00
|
|
|
|
#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
|
2000-04-27 07:42:25 +02:00
|
|
|
|
&& ! (regno_first == ARG_POINTER_REGNUM && fixed_regs[regno_first])
|
1992-02-11 23:35:04 +01:00
|
|
|
|
#endif
|
2000-04-08 01:33:47 +02:00
|
|
|
|
)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
2000-04-27 07:42:25 +02:00
|
|
|
|
int some_was_live = 0, some_was_dead = 0;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-04-27 07:42:25 +02:00
|
|
|
|
for (i = regno_first; i <= regno_last; ++i)
|
|
|
|
|
{
|
|
|
|
|
int needed_regno = REGNO_REG_SET_P (pbi->reg_live, i);
|
|
|
|
|
if (pbi->local_set)
|
2000-11-27 18:50:11 +01:00
|
|
|
|
{
|
|
|
|
|
/* Order of the set operation matters here since both
|
|
|
|
|
sets may be the same. */
|
|
|
|
|
CLEAR_REGNO_REG_SET (pbi->cond_local_set, i);
|
|
|
|
|
if (cond != NULL_RTX
|
|
|
|
|
&& ! REGNO_REG_SET_P (pbi->local_set, i))
|
|
|
|
|
SET_REGNO_REG_SET (pbi->cond_local_set, i);
|
|
|
|
|
else
|
|
|
|
|
SET_REGNO_REG_SET (pbi->local_set, i);
|
|
|
|
|
}
|
2000-04-27 13:17:04 +02:00
|
|
|
|
if (code != CLOBBER)
|
|
|
|
|
SET_REGNO_REG_SET (pbi->new_set, i);
|
2000-04-27 07:42:25 +02:00
|
|
|
|
|
|
|
|
|
some_was_live |= needed_regno;
|
|
|
|
|
some_was_dead |= ! needed_regno;
|
|
|
|
|
}
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
2000-04-30 12:37:57 +02:00
|
|
|
|
#ifdef HAVE_conditional_execution
|
|
|
|
|
/* Consider conditional death in deciding that the register needs
|
|
|
|
|
a death note. */
|
2000-05-07 02:38:26 +02:00
|
|
|
|
if (some_was_live && ! not_dead
|
2000-04-30 12:37:57 +02:00
|
|
|
|
/* The stack pointer is never dead. Well, not strictly true,
|
|
|
|
|
but it's very difficult to tell from here. Hopefully
|
|
|
|
|
combine_stack_adjustments will fix up the most egregious
|
|
|
|
|
errors. */
|
|
|
|
|
&& regno_first != STACK_POINTER_REGNUM)
|
|
|
|
|
{
|
|
|
|
|
for (i = regno_first; i <= regno_last; ++i)
|
|
|
|
|
if (! mark_regno_cond_dead (pbi, i, cond))
|
|
|
|
|
not_dead = 1;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
/* Additional data to record if this is the final pass. */
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
if (flags & (PROP_LOG_LINKS | PROP_REG_INFO
|
2001-01-11 18:02:44 +01:00
|
|
|
|
| PROP_DEATH_NOTES | PROP_AUTOINC))
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
register rtx y;
|
2000-04-08 01:33:47 +02:00
|
|
|
|
register int blocknum = pbi->bb->index;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
y = NULL_RTX;
|
|
|
|
|
if (flags & (PROP_LOG_LINKS | PROP_AUTOINC))
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
2000-04-27 07:42:25 +02:00
|
|
|
|
y = pbi->reg_next_use[regno_first];
|
1994-12-20 02:53:11 +01:00
|
|
|
|
|
2000-04-27 07:42:25 +02:00
|
|
|
|
/* The next use is no longer next, since a store intervenes. */
|
|
|
|
|
for (i = regno_first; i <= regno_last; ++i)
|
|
|
|
|
pbi->reg_next_use[i] = 0;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
1994-12-20 02:53:11 +01:00
|
|
|
|
|
2000-04-27 07:42:25 +02:00
|
|
|
|
if (flags & PROP_REG_INFO)
|
|
|
|
|
{
|
|
|
|
|
for (i = regno_first; i <= regno_last; ++i)
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
{
|
2000-04-27 07:42:25 +02:00
|
|
|
|
/* Count (weighted) references, stores, etc. This counts a
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
register twice if it is modified, but that is correct. */
|
2000-04-27 07:42:25 +02:00
|
|
|
|
REG_N_SETS (i) += 1;
|
|
|
|
|
REG_N_REFS (i) += (optimize_size ? 1
|
|
|
|
|
: pbi->bb->loop_depth + 1);
|
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
/* The insns where a reg is live are normally counted
|
|
|
|
|
elsewhere, but we want the count to include the insn
|
|
|
|
|
where the reg is set, and the normal counting mechanism
|
|
|
|
|
would not count it. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
REG_LIVE_LENGTH (i) += 1;
|
2000-04-27 07:42:25 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If this is a hard reg, record this function uses the reg. */
|
|
|
|
|
if (regno_first < FIRST_PSEUDO_REGISTER)
|
|
|
|
|
{
|
|
|
|
|
for (i = regno_first; i <= regno_last; i++)
|
|
|
|
|
regs_ever_live[i] = 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Keep track of which basic blocks each reg appears in. */
|
|
|
|
|
if (REG_BASIC_BLOCK (regno_first) == REG_BLOCK_UNKNOWN)
|
|
|
|
|
REG_BASIC_BLOCK (regno_first) = blocknum;
|
|
|
|
|
else if (REG_BASIC_BLOCK (regno_first) != blocknum)
|
|
|
|
|
REG_BASIC_BLOCK (regno_first) = REG_BLOCK_GLOBAL;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
}
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
if (! some_was_dead)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
if (flags & PROP_LOG_LINKS)
|
|
|
|
|
{
|
|
|
|
|
/* Make a logical link from the next following insn
|
|
|
|
|
that uses this register, back to this insn.
|
|
|
|
|
The following insns have already been processed.
|
|
|
|
|
|
|
|
|
|
We don't build a LOG_LINK for hard registers containing
|
|
|
|
|
in ASM_OPERANDs. If these registers get replaced,
|
|
|
|
|
we might wind up changing the semantics of the insn,
|
|
|
|
|
even if reload can make what appear to be valid
|
|
|
|
|
assignments later. */
|
|
|
|
|
if (y && (BLOCK_NUM (y) == blocknum)
|
2000-04-27 07:42:25 +02:00
|
|
|
|
&& (regno_first >= FIRST_PSEUDO_REGISTER
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|| asm_noperands (PATTERN (y)) < 0))
|
|
|
|
|
LOG_LINKS (y) = alloc_INSN_LIST (insn, LOG_LINKS (y));
|
|
|
|
|
}
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
2000-04-27 13:17:04 +02:00
|
|
|
|
else if (not_dead)
|
|
|
|
|
;
|
2000-04-08 01:33:47 +02:00
|
|
|
|
else if (! some_was_live)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
if (flags & PROP_REG_INFO)
|
2000-04-27 07:42:25 +02:00
|
|
|
|
REG_N_DEATHS (regno_first) += 1;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
|
|
|
|
if (flags & PROP_DEATH_NOTES)
|
|
|
|
|
{
|
|
|
|
|
/* Note that dead stores have already been deleted
|
|
|
|
|
when possible. If we get here, we have found a
|
|
|
|
|
dead store that cannot be eliminated (because the
|
|
|
|
|
same insn does something useful). Indicate this
|
|
|
|
|
by marking the reg being set as dying here. */
|
|
|
|
|
REG_NOTES (insn)
|
|
|
|
|
= alloc_EXPR_LIST (REG_UNUSED, reg, REG_NOTES (insn));
|
|
|
|
|
}
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
if (flags & PROP_DEATH_NOTES)
|
|
|
|
|
{
|
|
|
|
|
/* This is a case where we have a multi-word hard register
|
|
|
|
|
and some, but not all, of the words of the register are
|
|
|
|
|
needed in subsequent insns. Write REG_UNUSED notes
|
|
|
|
|
for those parts that were not needed. This case should
|
|
|
|
|
be rare. */
|
|
|
|
|
|
2000-04-27 07:42:25 +02:00
|
|
|
|
for (i = regno_first; i <= regno_last; ++i)
|
|
|
|
|
if (! REGNO_REG_SET_P (pbi->reg_live, i))
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
REG_NOTES (insn)
|
2000-04-27 07:42:25 +02:00
|
|
|
|
= alloc_EXPR_LIST (REG_UNUSED,
|
|
|
|
|
gen_rtx_REG (reg_raw_mode[i], i),
|
|
|
|
|
REG_NOTES (insn));
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
}
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-04-27 07:42:25 +02:00
|
|
|
|
|
|
|
|
|
/* Mark the register as being dead. */
|
|
|
|
|
if (some_was_live
|
2000-05-06 23:36:35 +02:00
|
|
|
|
&& ! not_dead
|
2000-04-27 07:42:25 +02:00
|
|
|
|
/* The stack pointer is never dead. Well, not strictly true,
|
|
|
|
|
but it's very difficult to tell from here. Hopefully
|
|
|
|
|
combine_stack_adjustments will fix up the most egregious
|
|
|
|
|
errors. */
|
|
|
|
|
&& regno_first != STACK_POINTER_REGNUM)
|
|
|
|
|
{
|
|
|
|
|
for (i = regno_first; i <= regno_last; ++i)
|
2000-04-27 13:17:04 +02:00
|
|
|
|
CLEAR_REGNO_REG_SET (pbi->reg_live, i);
|
2000-04-27 07:42:25 +02:00
|
|
|
|
}
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
1993-04-08 00:13:16 +02:00
|
|
|
|
else if (GET_CODE (reg) == REG)
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
{
|
|
|
|
|
if (flags & (PROP_LOG_LINKS | PROP_AUTOINC))
|
2000-04-27 07:42:25 +02:00
|
|
|
|
pbi->reg_next_use[regno_first] = 0;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
}
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
/* If this is the last pass and this is a SCRATCH, show it will be dying
|
|
|
|
|
here and count it. */
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
else if (GET_CODE (reg) == SCRATCH)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
if (flags & PROP_DEATH_NOTES)
|
|
|
|
|
REG_NOTES (insn)
|
|
|
|
|
= alloc_EXPR_LIST (REG_UNUSED, reg, REG_NOTES (insn));
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-04-30 12:37:57 +02:00
|
|
|
|
#ifdef HAVE_conditional_execution
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Mark REGNO conditionally dead.
|
|
|
|
|
Return true if the register is now unconditionally dead. */
|
2000-04-30 12:37:57 +02:00
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
mark_regno_cond_dead (pbi, regno, cond)
|
|
|
|
|
struct propagate_block_info *pbi;
|
|
|
|
|
int regno;
|
|
|
|
|
rtx cond;
|
|
|
|
|
{
|
|
|
|
|
/* If this is a store to a predicate register, the value of the
|
|
|
|
|
predicate is changing, we don't know that the predicate as seen
|
2000-07-23 01:29:14 +02:00
|
|
|
|
before is the same as that seen after. Flush all dependent
|
2000-04-30 12:37:57 +02:00
|
|
|
|
conditions from reg_cond_dead. This will make all such
|
|
|
|
|
conditionally live registers unconditionally live. */
|
|
|
|
|
if (REGNO_REG_SET_P (pbi->reg_cond_reg, regno))
|
|
|
|
|
flush_reg_cond_reg (pbi, regno);
|
|
|
|
|
|
|
|
|
|
/* If this is an unconditional store, remove any conditional
|
|
|
|
|
life that may have existed. */
|
|
|
|
|
if (cond == NULL_RTX)
|
|
|
|
|
splay_tree_remove (pbi->reg_cond_dead, regno);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
splay_tree_node node;
|
|
|
|
|
struct reg_cond_life_info *rcli;
|
|
|
|
|
rtx ncond;
|
|
|
|
|
|
|
|
|
|
/* Otherwise this is a conditional set. Record that fact.
|
|
|
|
|
It may have been conditionally used, or there may be a
|
|
|
|
|
subsequent set with a complimentary condition. */
|
|
|
|
|
|
|
|
|
|
node = splay_tree_lookup (pbi->reg_cond_dead, regno);
|
|
|
|
|
if (node == NULL)
|
|
|
|
|
{
|
|
|
|
|
/* The register was unconditionally live previously.
|
|
|
|
|
Record the current condition as the condition under
|
|
|
|
|
which it is dead. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
rcli = (struct reg_cond_life_info *) xmalloc (sizeof (*rcli));
|
2000-12-19 17:52:23 +01:00
|
|
|
|
rcli->condition = cond;
|
2000-04-30 12:37:57 +02:00
|
|
|
|
splay_tree_insert (pbi->reg_cond_dead, regno,
|
|
|
|
|
(splay_tree_value) rcli);
|
|
|
|
|
|
2000-08-15 19:31:29 +02:00
|
|
|
|
SET_REGNO_REG_SET (pbi->reg_cond_reg, REGNO (XEXP (cond, 0)));
|
2000-04-30 12:37:57 +02:00
|
|
|
|
|
|
|
|
|
/* Not unconditionaly dead. */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* The register was conditionally live previously.
|
2000-04-30 12:37:57 +02:00
|
|
|
|
Add the new condition to the old. */
|
|
|
|
|
rcli = (struct reg_cond_life_info *) node->value;
|
|
|
|
|
ncond = rcli->condition;
|
2000-12-19 17:52:23 +01:00
|
|
|
|
ncond = ior_reg_cond (ncond, cond, 1);
|
2000-04-30 12:37:57 +02:00
|
|
|
|
|
|
|
|
|
/* If the register is now unconditionally dead,
|
|
|
|
|
remove the entry in the splay_tree. */
|
|
|
|
|
if (ncond == const1_rtx)
|
|
|
|
|
splay_tree_remove (pbi->reg_cond_dead, regno);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
rcli->condition = ncond;
|
|
|
|
|
|
2000-08-15 19:31:29 +02:00
|
|
|
|
SET_REGNO_REG_SET (pbi->reg_cond_reg, REGNO (XEXP (cond, 0)));
|
2000-04-30 12:37:57 +02:00
|
|
|
|
|
|
|
|
|
/* Not unconditionaly dead. */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Called from splay_tree_delete for pbi->reg_cond_life. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
free_reg_cond_life_info (value)
|
|
|
|
|
splay_tree_value value;
|
|
|
|
|
{
|
|
|
|
|
struct reg_cond_life_info *rcli = (struct reg_cond_life_info *) value;
|
|
|
|
|
free (rcli);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Helper function for flush_reg_cond_reg. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
flush_reg_cond_reg_1 (node, data)
|
|
|
|
|
splay_tree_node node;
|
|
|
|
|
void *data;
|
|
|
|
|
{
|
|
|
|
|
struct reg_cond_life_info *rcli;
|
|
|
|
|
int *xdata = (int *) data;
|
|
|
|
|
unsigned int regno = xdata[0];
|
|
|
|
|
|
|
|
|
|
/* Don't need to search if last flushed value was farther on in
|
|
|
|
|
the in-order traversal. */
|
|
|
|
|
if (xdata[1] >= (int) node->key)
|
|
|
|
|
return 0;
|
2001-01-02 08:00:49 +01:00
|
|
|
|
|
2000-04-30 12:37:57 +02:00
|
|
|
|
/* Splice out portions of the expression that refer to regno. */
|
|
|
|
|
rcli = (struct reg_cond_life_info *) node->value;
|
2000-12-19 17:52:23 +01:00
|
|
|
|
rcli->condition = elim_reg_cond (rcli->condition, regno);
|
2000-04-30 12:37:57 +02:00
|
|
|
|
|
2000-12-19 17:52:23 +01:00
|
|
|
|
/* If the entire condition is now false, signal the node to be removed. */
|
|
|
|
|
if (rcli->condition == const0_rtx)
|
2000-04-30 12:37:57 +02:00
|
|
|
|
{
|
|
|
|
|
xdata[1] = node->key;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2000-12-19 17:52:23 +01:00
|
|
|
|
else if (rcli->condition == const1_rtx)
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
return 0;
|
2000-04-30 12:37:57 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Flush all (sub) expressions referring to REGNO from REG_COND_LIVE. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
flush_reg_cond_reg (pbi, regno)
|
|
|
|
|
struct propagate_block_info *pbi;
|
|
|
|
|
int regno;
|
|
|
|
|
{
|
|
|
|
|
int pair[2];
|
|
|
|
|
|
|
|
|
|
pair[0] = regno;
|
|
|
|
|
pair[1] = -1;
|
|
|
|
|
while (splay_tree_foreach (pbi->reg_cond_dead,
|
|
|
|
|
flush_reg_cond_reg_1, pair) == -1)
|
|
|
|
|
splay_tree_remove (pbi->reg_cond_dead, pair[1]);
|
|
|
|
|
|
|
|
|
|
CLEAR_REGNO_REG_SET (pbi->reg_cond_reg, regno);
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-19 17:52:23 +01:00
|
|
|
|
/* Logical arithmetic on predicate conditions. IOR, NOT and AND.
|
|
|
|
|
For ior/and, the ADD flag determines whether we want to add the new
|
|
|
|
|
condition X to the old one unconditionally. If it is zero, we will
|
|
|
|
|
only return a new expression if X allows us to simplify part of
|
|
|
|
|
OLD, otherwise we return OLD unchanged to the caller.
|
|
|
|
|
If ADD is nonzero, we will return a new condition in all cases. The
|
|
|
|
|
toplevel caller of one of these functions should always pass 1 for
|
|
|
|
|
ADD. */
|
2000-04-30 12:37:57 +02:00
|
|
|
|
|
|
|
|
|
static rtx
|
2000-12-19 17:52:23 +01:00
|
|
|
|
ior_reg_cond (old, x, add)
|
2000-04-30 12:37:57 +02:00
|
|
|
|
rtx old, x;
|
2000-12-19 17:52:23 +01:00
|
|
|
|
int add;
|
2000-04-30 12:37:57 +02:00
|
|
|
|
{
|
2000-12-19 17:52:23 +01:00
|
|
|
|
rtx op0, op1;
|
2000-04-30 12:37:57 +02:00
|
|
|
|
|
2000-12-20 16:48:26 +01:00
|
|
|
|
if (GET_RTX_CLASS (GET_CODE (old)) == '<')
|
|
|
|
|
{
|
|
|
|
|
if (GET_RTX_CLASS (GET_CODE (x)) == '<'
|
|
|
|
|
&& GET_CODE (x) == reverse_condition (GET_CODE (old))
|
|
|
|
|
&& REGNO (XEXP (x, 0)) == REGNO (XEXP (old, 0)))
|
|
|
|
|
return const1_rtx;
|
|
|
|
|
if (GET_CODE (x) == GET_CODE (old)
|
|
|
|
|
&& REGNO (XEXP (x, 0)) == REGNO (XEXP (old, 0)))
|
|
|
|
|
return old;
|
|
|
|
|
if (! add)
|
|
|
|
|
return old;
|
|
|
|
|
return gen_rtx_IOR (0, old, x);
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-19 17:52:23 +01:00
|
|
|
|
switch (GET_CODE (old))
|
2000-04-30 12:37:57 +02:00
|
|
|
|
{
|
2000-12-19 17:52:23 +01:00
|
|
|
|
case IOR:
|
|
|
|
|
op0 = ior_reg_cond (XEXP (old, 0), x, 0);
|
|
|
|
|
op1 = ior_reg_cond (XEXP (old, 1), x, 0);
|
|
|
|
|
if (op0 != XEXP (old, 0) || op1 != XEXP (old, 1))
|
2000-04-30 12:37:57 +02:00
|
|
|
|
{
|
2000-12-19 17:52:23 +01:00
|
|
|
|
if (op0 == const0_rtx)
|
|
|
|
|
return op1;
|
|
|
|
|
if (op1 == const0_rtx)
|
|
|
|
|
return op0;
|
|
|
|
|
if (op0 == const1_rtx || op1 == const1_rtx)
|
2000-04-30 12:37:57 +02:00
|
|
|
|
return const1_rtx;
|
2000-12-19 17:52:23 +01:00
|
|
|
|
if (op0 == XEXP (old, 0))
|
|
|
|
|
op0 = gen_rtx_IOR (0, op0, x);
|
|
|
|
|
else
|
|
|
|
|
op1 = gen_rtx_IOR (0, op1, x);
|
|
|
|
|
return gen_rtx_IOR (0, op0, op1);
|
2000-04-30 12:37:57 +02:00
|
|
|
|
}
|
2000-12-19 17:52:23 +01:00
|
|
|
|
if (! add)
|
|
|
|
|
return old;
|
|
|
|
|
return gen_rtx_IOR (0, old, x);
|
|
|
|
|
|
|
|
|
|
case AND:
|
|
|
|
|
op0 = ior_reg_cond (XEXP (old, 0), x, 0);
|
|
|
|
|
op1 = ior_reg_cond (XEXP (old, 1), x, 0);
|
|
|
|
|
if (op0 != XEXP (old, 0) || op1 != XEXP (old, 1))
|
|
|
|
|
{
|
|
|
|
|
if (op0 == const1_rtx)
|
|
|
|
|
return op1;
|
|
|
|
|
if (op1 == const1_rtx)
|
|
|
|
|
return op0;
|
|
|
|
|
if (op0 == const0_rtx || op1 == const0_rtx)
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
if (op0 == XEXP (old, 0))
|
|
|
|
|
op0 = gen_rtx_IOR (0, op0, x);
|
|
|
|
|
else
|
|
|
|
|
op1 = gen_rtx_IOR (0, op1, x);
|
|
|
|
|
return gen_rtx_AND (0, op0, op1);
|
|
|
|
|
}
|
|
|
|
|
if (! add)
|
|
|
|
|
return old;
|
|
|
|
|
return gen_rtx_IOR (0, old, x);
|
|
|
|
|
|
|
|
|
|
case NOT:
|
|
|
|
|
op0 = and_reg_cond (XEXP (old, 0), not_reg_cond (x), 0);
|
|
|
|
|
if (op0 != XEXP (old, 0))
|
|
|
|
|
return not_reg_cond (op0);
|
|
|
|
|
if (! add)
|
|
|
|
|
return old;
|
|
|
|
|
return gen_rtx_IOR (0, old, x);
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
2000-04-30 12:37:57 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static rtx
|
|
|
|
|
not_reg_cond (x)
|
|
|
|
|
rtx x;
|
|
|
|
|
{
|
|
|
|
|
enum rtx_code x_code;
|
|
|
|
|
|
2000-12-19 17:52:23 +01:00
|
|
|
|
if (x == const0_rtx)
|
|
|
|
|
return const1_rtx;
|
|
|
|
|
else if (x == const1_rtx)
|
|
|
|
|
return const0_rtx;
|
2000-04-30 12:37:57 +02:00
|
|
|
|
x_code = GET_CODE (x);
|
2000-12-19 17:52:23 +01:00
|
|
|
|
if (x_code == NOT)
|
|
|
|
|
return XEXP (x, 0);
|
|
|
|
|
if (GET_RTX_CLASS (x_code) == '<'
|
|
|
|
|
&& GET_CODE (XEXP (x, 0)) == REG)
|
|
|
|
|
{
|
|
|
|
|
if (XEXP (x, 1) != const0_rtx)
|
|
|
|
|
abort ();
|
2000-04-30 12:37:57 +02:00
|
|
|
|
|
2000-12-19 17:52:23 +01:00
|
|
|
|
return gen_rtx_fmt_ee (reverse_condition (x_code),
|
|
|
|
|
VOIDmode, XEXP (x, 0), const0_rtx);
|
|
|
|
|
}
|
|
|
|
|
return gen_rtx_NOT (0, x);
|
2000-04-30 12:37:57 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static rtx
|
2000-12-19 17:52:23 +01:00
|
|
|
|
and_reg_cond (old, x, add)
|
2000-04-30 12:37:57 +02:00
|
|
|
|
rtx old, x;
|
2000-12-19 17:52:23 +01:00
|
|
|
|
int add;
|
2000-04-30 12:37:57 +02:00
|
|
|
|
{
|
2000-12-19 17:52:23 +01:00
|
|
|
|
rtx op0, op1;
|
2000-04-30 12:37:57 +02:00
|
|
|
|
|
2000-12-20 16:48:26 +01:00
|
|
|
|
if (GET_RTX_CLASS (GET_CODE (old)) == '<')
|
|
|
|
|
{
|
|
|
|
|
if (GET_RTX_CLASS (GET_CODE (x)) == '<'
|
|
|
|
|
&& GET_CODE (x) == reverse_condition (GET_CODE (old))
|
|
|
|
|
&& REGNO (XEXP (x, 0)) == REGNO (XEXP (old, 0)))
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
if (GET_CODE (x) == GET_CODE (old)
|
|
|
|
|
&& REGNO (XEXP (x, 0)) == REGNO (XEXP (old, 0)))
|
|
|
|
|
return old;
|
|
|
|
|
if (! add)
|
|
|
|
|
return old;
|
|
|
|
|
return gen_rtx_AND (0, old, x);
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-19 17:52:23 +01:00
|
|
|
|
switch (GET_CODE (old))
|
2000-04-30 12:37:57 +02:00
|
|
|
|
{
|
2000-12-19 17:52:23 +01:00
|
|
|
|
case IOR:
|
|
|
|
|
op0 = and_reg_cond (XEXP (old, 0), x, 0);
|
|
|
|
|
op1 = and_reg_cond (XEXP (old, 1), x, 0);
|
|
|
|
|
if (op0 != XEXP (old, 0) || op1 != XEXP (old, 1))
|
2000-04-30 12:37:57 +02:00
|
|
|
|
{
|
2000-12-19 17:52:23 +01:00
|
|
|
|
if (op0 == const0_rtx)
|
|
|
|
|
return op1;
|
|
|
|
|
if (op1 == const0_rtx)
|
|
|
|
|
return op0;
|
|
|
|
|
if (op0 == const1_rtx || op1 == const1_rtx)
|
|
|
|
|
return const1_rtx;
|
|
|
|
|
if (op0 == XEXP (old, 0))
|
|
|
|
|
op0 = gen_rtx_AND (0, op0, x);
|
|
|
|
|
else
|
|
|
|
|
op1 = gen_rtx_AND (0, op1, x);
|
|
|
|
|
return gen_rtx_IOR (0, op0, op1);
|
2000-04-30 12:37:57 +02:00
|
|
|
|
}
|
2000-12-19 17:52:23 +01:00
|
|
|
|
if (! add)
|
|
|
|
|
return old;
|
|
|
|
|
return gen_rtx_AND (0, old, x);
|
|
|
|
|
|
|
|
|
|
case AND:
|
|
|
|
|
op0 = and_reg_cond (XEXP (old, 0), x, 0);
|
|
|
|
|
op1 = and_reg_cond (XEXP (old, 1), x, 0);
|
|
|
|
|
if (op0 != XEXP (old, 0) || op1 != XEXP (old, 1))
|
|
|
|
|
{
|
|
|
|
|
if (op0 == const1_rtx)
|
|
|
|
|
return op1;
|
|
|
|
|
if (op1 == const1_rtx)
|
|
|
|
|
return op0;
|
|
|
|
|
if (op0 == const0_rtx || op1 == const0_rtx)
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
if (op0 == XEXP (old, 0))
|
|
|
|
|
op0 = gen_rtx_AND (0, op0, x);
|
|
|
|
|
else
|
|
|
|
|
op1 = gen_rtx_AND (0, op1, x);
|
|
|
|
|
return gen_rtx_AND (0, op0, op1);
|
|
|
|
|
}
|
|
|
|
|
if (! add)
|
|
|
|
|
return old;
|
|
|
|
|
return gen_rtx_AND (0, old, x);
|
|
|
|
|
|
|
|
|
|
case NOT:
|
|
|
|
|
op0 = ior_reg_cond (XEXP (old, 0), not_reg_cond (x), 0);
|
|
|
|
|
if (op0 != XEXP (old, 0))
|
|
|
|
|
return not_reg_cond (op0);
|
|
|
|
|
if (! add)
|
|
|
|
|
return old;
|
|
|
|
|
return gen_rtx_AND (0, old, x);
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
abort ();
|
2000-04-30 12:37:57 +02:00
|
|
|
|
}
|
2000-12-19 17:52:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Given a condition X, remove references to reg REGNO and return the
|
|
|
|
|
new condition. The removal will be done so that all conditions
|
|
|
|
|
involving REGNO are considered to evaluate to false. This function
|
|
|
|
|
is used when the value of REGNO changes. */
|
2000-04-30 12:37:57 +02:00
|
|
|
|
|
2000-12-19 17:52:23 +01:00
|
|
|
|
static rtx
|
|
|
|
|
elim_reg_cond (x, regno)
|
|
|
|
|
rtx x;
|
|
|
|
|
unsigned int regno;
|
|
|
|
|
{
|
|
|
|
|
rtx op0, op1;
|
2000-12-20 16:48:26 +01:00
|
|
|
|
|
|
|
|
|
if (GET_RTX_CLASS (GET_CODE (x)) == '<')
|
|
|
|
|
{
|
|
|
|
|
if (REGNO (XEXP (x, 0)) == regno)
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
return x;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-19 17:52:23 +01:00
|
|
|
|
switch (GET_CODE (x))
|
|
|
|
|
{
|
|
|
|
|
case AND:
|
|
|
|
|
op0 = elim_reg_cond (XEXP (x, 0), regno);
|
|
|
|
|
op1 = elim_reg_cond (XEXP (x, 1), regno);
|
|
|
|
|
if (op0 == const0_rtx || op1 == const0_rtx)
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
if (op0 == const1_rtx)
|
|
|
|
|
return op1;
|
|
|
|
|
if (op1 == const1_rtx)
|
|
|
|
|
return op0;
|
|
|
|
|
if (op0 == XEXP (x, 0) && op1 == XEXP (x, 1))
|
|
|
|
|
return x;
|
|
|
|
|
return gen_rtx_AND (0, op0, op1);
|
|
|
|
|
|
|
|
|
|
case IOR:
|
|
|
|
|
op0 = elim_reg_cond (XEXP (x, 0), regno);
|
|
|
|
|
op1 = elim_reg_cond (XEXP (x, 1), regno);
|
|
|
|
|
if (op0 == const1_rtx || op1 == const1_rtx)
|
|
|
|
|
return const1_rtx;
|
|
|
|
|
if (op0 == const0_rtx)
|
|
|
|
|
return op1;
|
|
|
|
|
if (op1 == const0_rtx)
|
|
|
|
|
return op0;
|
|
|
|
|
if (op0 == XEXP (x, 0) && op1 == XEXP (x, 1))
|
|
|
|
|
return x;
|
|
|
|
|
return gen_rtx_IOR (0, op0, op1);
|
|
|
|
|
|
|
|
|
|
case NOT:
|
|
|
|
|
op0 = elim_reg_cond (XEXP (x, 0), regno);
|
|
|
|
|
if (op0 == const0_rtx)
|
|
|
|
|
return const1_rtx;
|
|
|
|
|
if (op0 == const1_rtx)
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
if (op0 != XEXP (x, 0))
|
|
|
|
|
return not_reg_cond (op0);
|
|
|
|
|
return x;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
2000-04-30 12:37:57 +02:00
|
|
|
|
}
|
|
|
|
|
#endif /* HAVE_conditional_execution */
|
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
#ifdef AUTO_INC_DEC
|
|
|
|
|
|
2000-07-28 19:46:18 +02:00
|
|
|
|
/* Try to substitute the auto-inc expression INC as the address inside
|
|
|
|
|
MEM which occurs in INSN. Currently, the address of MEM is an expression
|
|
|
|
|
involving INCR_REG, and INCR is the next use of INCR_REG; it is an insn
|
|
|
|
|
that has a single set whose source is a PLUS of INCR_REG and something
|
|
|
|
|
else. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
attempt_auto_inc (pbi, inc, insn, mem, incr, incr_reg)
|
|
|
|
|
struct propagate_block_info *pbi;
|
|
|
|
|
rtx inc, insn, mem, incr, incr_reg;
|
|
|
|
|
{
|
|
|
|
|
int regno = REGNO (incr_reg);
|
|
|
|
|
rtx set = single_set (incr);
|
|
|
|
|
rtx q = SET_DEST (set);
|
|
|
|
|
rtx y = SET_SRC (set);
|
|
|
|
|
int opnum = XEXP (y, 0) == incr_reg ? 0 : 1;
|
|
|
|
|
|
|
|
|
|
/* Make sure this reg appears only once in this insn. */
|
|
|
|
|
if (count_occurrences (PATTERN (insn), incr_reg, 1) != 1)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (dead_or_set_p (incr, incr_reg)
|
|
|
|
|
/* Mustn't autoinc an eliminable register. */
|
|
|
|
|
&& (regno >= FIRST_PSEUDO_REGISTER
|
|
|
|
|
|| ! TEST_HARD_REG_BIT (elim_reg_set, regno)))
|
|
|
|
|
{
|
|
|
|
|
/* This is the simple case. Try to make the auto-inc. If
|
|
|
|
|
we can't, we are done. Otherwise, we will do any
|
|
|
|
|
needed updates below. */
|
|
|
|
|
if (! validate_change (insn, &XEXP (mem, 0), inc, 0))
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (GET_CODE (q) == REG
|
|
|
|
|
/* PREV_INSN used here to check the semi-open interval
|
|
|
|
|
[insn,incr). */
|
|
|
|
|
&& ! reg_used_between_p (q, PREV_INSN (insn), incr)
|
|
|
|
|
/* We must also check for sets of q as q may be
|
|
|
|
|
a call clobbered hard register and there may
|
|
|
|
|
be a call between PREV_INSN (insn) and incr. */
|
|
|
|
|
&& ! reg_set_between_p (q, PREV_INSN (insn), incr))
|
|
|
|
|
{
|
|
|
|
|
/* We have *p followed sometime later by q = p+size.
|
|
|
|
|
Both p and q must be live afterward,
|
|
|
|
|
and q is not used between INSN and its assignment.
|
|
|
|
|
Change it to q = p, ...*q..., q = q+size.
|
|
|
|
|
Then fall into the usual case. */
|
|
|
|
|
rtx insns, temp;
|
|
|
|
|
|
|
|
|
|
start_sequence ();
|
|
|
|
|
emit_move_insn (q, incr_reg);
|
|
|
|
|
insns = get_insns ();
|
|
|
|
|
end_sequence ();
|
|
|
|
|
|
|
|
|
|
if (basic_block_for_insn)
|
|
|
|
|
for (temp = insns; temp; temp = NEXT_INSN (temp))
|
|
|
|
|
set_block_for_insn (temp, pbi->bb);
|
|
|
|
|
|
|
|
|
|
/* If we can't make the auto-inc, or can't make the
|
|
|
|
|
replacement into Y, exit. There's no point in making
|
|
|
|
|
the change below if we can't do the auto-inc and doing
|
|
|
|
|
so is not correct in the pre-inc case. */
|
|
|
|
|
|
|
|
|
|
XEXP (inc, 0) = q;
|
|
|
|
|
validate_change (insn, &XEXP (mem, 0), inc, 1);
|
|
|
|
|
validate_change (incr, &XEXP (y, opnum), q, 1);
|
|
|
|
|
if (! apply_change_group ())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* We now know we'll be doing this change, so emit the
|
|
|
|
|
new insn(s) and do the updates. */
|
|
|
|
|
emit_insns_before (insns, insn);
|
|
|
|
|
|
|
|
|
|
if (pbi->bb->head == insn)
|
|
|
|
|
pbi->bb->head = insns;
|
|
|
|
|
|
|
|
|
|
/* INCR will become a NOTE and INSN won't contain a
|
|
|
|
|
use of INCR_REG. If a use of INCR_REG was just placed in
|
2000-08-11 14:45:05 +02:00
|
|
|
|
the insn before INSN, make that the next use.
|
2000-07-28 19:46:18 +02:00
|
|
|
|
Otherwise, invalidate it. */
|
|
|
|
|
if (GET_CODE (PREV_INSN (insn)) == INSN
|
|
|
|
|
&& GET_CODE (PATTERN (PREV_INSN (insn))) == SET
|
|
|
|
|
&& SET_SRC (PATTERN (PREV_INSN (insn))) == incr_reg)
|
|
|
|
|
pbi->reg_next_use[regno] = PREV_INSN (insn);
|
|
|
|
|
else
|
|
|
|
|
pbi->reg_next_use[regno] = 0;
|
|
|
|
|
|
|
|
|
|
incr_reg = q;
|
|
|
|
|
regno = REGNO (q);
|
|
|
|
|
|
|
|
|
|
/* REGNO is now used in INCR which is below INSN, but
|
|
|
|
|
it previously wasn't live here. If we don't mark
|
|
|
|
|
it as live, we'll put a REG_DEAD note for it
|
|
|
|
|
on this insn, which is incorrect. */
|
|
|
|
|
SET_REGNO_REG_SET (pbi->reg_live, regno);
|
|
|
|
|
|
|
|
|
|
/* If there are any calls between INSN and INCR, show
|
|
|
|
|
that REGNO now crosses them. */
|
|
|
|
|
for (temp = insn; temp != incr; temp = NEXT_INSN (temp))
|
|
|
|
|
if (GET_CODE (temp) == CALL_INSN)
|
|
|
|
|
REG_N_CALLS_CROSSED (regno)++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* If we haven't returned, it means we were able to make the
|
|
|
|
|
auto-inc, so update the status. First, record that this insn
|
|
|
|
|
has an implicit side effect. */
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
REG_NOTES (insn) = alloc_EXPR_LIST (REG_INC, incr_reg, REG_NOTES (insn));
|
2000-07-28 19:46:18 +02:00
|
|
|
|
|
|
|
|
|
/* Modify the old increment-insn to simply copy
|
|
|
|
|
the already-incremented value of our register. */
|
|
|
|
|
if (! validate_change (incr, &SET_SRC (set), incr_reg, 0))
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
/* If that makes it a no-op (copying the register into itself) delete
|
|
|
|
|
it so it won't appear to be a "use" and a "set" of this
|
|
|
|
|
register. */
|
|
|
|
|
if (REGNO (SET_DEST (set)) == REGNO (incr_reg))
|
|
|
|
|
{
|
|
|
|
|
/* If the original source was dead, it's dead now. */
|
|
|
|
|
rtx note;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-08-14 07:59:50 +02:00
|
|
|
|
while ((note = find_reg_note (incr, REG_DEAD, NULL_RTX)) != NULL_RTX)
|
2000-07-28 19:46:18 +02:00
|
|
|
|
{
|
|
|
|
|
remove_note (incr, note);
|
|
|
|
|
if (XEXP (note, 0) != incr_reg)
|
|
|
|
|
CLEAR_REGNO_REG_SET (pbi->reg_live, REGNO (XEXP (note, 0)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PUT_CODE (incr, NOTE);
|
|
|
|
|
NOTE_LINE_NUMBER (incr) = NOTE_INSN_DELETED;
|
|
|
|
|
NOTE_SOURCE_FILE (incr) = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (regno >= FIRST_PSEUDO_REGISTER)
|
|
|
|
|
{
|
|
|
|
|
/* Count an extra reference to the reg. When a reg is
|
|
|
|
|
incremented, spilling it is worse, so we want to make
|
|
|
|
|
that less likely. */
|
|
|
|
|
REG_N_REFS (regno) += (optimize_size ? 1 : pbi->bb->loop_depth + 1);
|
|
|
|
|
|
|
|
|
|
/* Count the increment as a setting of the register,
|
|
|
|
|
even though it isn't a SET in rtl. */
|
|
|
|
|
REG_N_SETS (regno)++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
/* X is a MEM found in INSN. See if we can convert it into an auto-increment
|
|
|
|
|
reference. */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-04-08 01:33:47 +02:00
|
|
|
|
find_auto_inc (pbi, x, insn)
|
|
|
|
|
struct propagate_block_info *pbi;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
rtx x;
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
rtx addr = XEXP (x, 0);
|
1994-02-03 21:27:23 +01:00
|
|
|
|
HOST_WIDE_INT offset = 0;
|
2000-07-28 19:46:18 +02:00
|
|
|
|
rtx set, y, incr, inc_val;
|
|
|
|
|
int regno;
|
|
|
|
|
int size = GET_MODE_SIZE (GET_MODE (x));
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (insn) == JUMP_INSN)
|
|
|
|
|
return;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
/* Here we detect use of an index register which might be good for
|
|
|
|
|
postincrement, postdecrement, preincrement, or predecrement. */
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (addr) == PLUS && GET_CODE (XEXP (addr, 1)) == CONST_INT)
|
|
|
|
|
offset = INTVAL (XEXP (addr, 1)), addr = XEXP (addr, 0);
|
|
|
|
|
|
2000-07-28 19:46:18 +02:00
|
|
|
|
if (GET_CODE (addr) != REG)
|
|
|
|
|
return;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-07-28 19:46:18 +02:00
|
|
|
|
regno = REGNO (addr);
|
1994-08-11 19:13:20 +02:00
|
|
|
|
|
2000-07-28 19:46:18 +02:00
|
|
|
|
/* Is the next use an increment that might make auto-increment? */
|
|
|
|
|
incr = pbi->reg_next_use[regno];
|
|
|
|
|
if (incr == 0 || BLOCK_NUM (incr) != BLOCK_NUM (insn))
|
|
|
|
|
return;
|
|
|
|
|
set = single_set (incr);
|
|
|
|
|
if (set == 0 || GET_CODE (set) != SET)
|
|
|
|
|
return;
|
|
|
|
|
y = SET_SRC (set);
|
1994-08-11 19:13:20 +02:00
|
|
|
|
|
2000-07-28 19:46:18 +02:00
|
|
|
|
if (GET_CODE (y) != PLUS)
|
|
|
|
|
return;
|
1994-08-11 19:13:20 +02:00
|
|
|
|
|
2000-08-03 09:16:39 +02:00
|
|
|
|
if (REG_P (XEXP (y, 0)) && REGNO (XEXP (y, 0)) == REGNO (addr))
|
2000-07-28 19:46:18 +02:00
|
|
|
|
inc_val = XEXP (y, 1);
|
2000-08-03 09:16:39 +02:00
|
|
|
|
else if (REG_P (XEXP (y, 1)) && REGNO (XEXP (y, 1)) == REGNO (addr))
|
2000-07-28 19:46:18 +02:00
|
|
|
|
inc_val = XEXP (y, 0);
|
|
|
|
|
else
|
2000-08-03 09:16:39 +02:00
|
|
|
|
return;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-07-28 19:46:18 +02:00
|
|
|
|
if (GET_CODE (inc_val) == CONST_INT)
|
|
|
|
|
{
|
|
|
|
|
if (HAVE_POST_INCREMENT
|
|
|
|
|
&& (INTVAL (inc_val) == size && offset == 0))
|
|
|
|
|
attempt_auto_inc (pbi, gen_rtx_POST_INC (Pmode, addr), insn, x,
|
|
|
|
|
incr, addr);
|
|
|
|
|
else if (HAVE_POST_DECREMENT
|
2000-08-11 14:45:05 +02:00
|
|
|
|
&& (INTVAL (inc_val) == -size && offset == 0))
|
2000-07-28 19:46:18 +02:00
|
|
|
|
attempt_auto_inc (pbi, gen_rtx_POST_DEC (Pmode, addr), insn, x,
|
|
|
|
|
incr, addr);
|
|
|
|
|
else if (HAVE_PRE_INCREMENT
|
|
|
|
|
&& (INTVAL (inc_val) == size && offset == size))
|
|
|
|
|
attempt_auto_inc (pbi, gen_rtx_PRE_INC (Pmode, addr), insn, x,
|
|
|
|
|
incr, addr);
|
|
|
|
|
else if (HAVE_PRE_DECREMENT
|
2000-08-11 14:45:05 +02:00
|
|
|
|
&& (INTVAL (inc_val) == -size && offset == -size))
|
2000-07-28 19:46:18 +02:00
|
|
|
|
attempt_auto_inc (pbi, gen_rtx_PRE_DEC (Pmode, addr), insn, x,
|
|
|
|
|
incr, addr);
|
|
|
|
|
else if (HAVE_POST_MODIFY_DISP && offset == 0)
|
|
|
|
|
attempt_auto_inc (pbi, gen_rtx_POST_MODIFY (Pmode, addr,
|
|
|
|
|
gen_rtx_PLUS (Pmode,
|
|
|
|
|
addr,
|
|
|
|
|
inc_val)),
|
|
|
|
|
insn, x, incr, addr);
|
|
|
|
|
}
|
|
|
|
|
else if (GET_CODE (inc_val) == REG
|
|
|
|
|
&& ! reg_set_between_p (inc_val, PREV_INSN (insn),
|
|
|
|
|
NEXT_INSN (incr)))
|
1994-08-11 19:13:20 +02:00
|
|
|
|
|
2000-07-28 19:46:18 +02:00
|
|
|
|
{
|
|
|
|
|
if (HAVE_POST_MODIFY_REG && offset == 0)
|
|
|
|
|
attempt_auto_inc (pbi, gen_rtx_POST_MODIFY (Pmode, addr,
|
|
|
|
|
gen_rtx_PLUS (Pmode,
|
|
|
|
|
addr,
|
|
|
|
|
inc_val)),
|
|
|
|
|
insn, x, incr, addr);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-07-28 19:46:18 +02:00
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
#endif /* AUTO_INC_DEC */
|
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
static void
|
2000-04-12 03:38:15 +02:00
|
|
|
|
mark_used_reg (pbi, reg, cond, insn)
|
2000-04-08 01:33:47 +02:00
|
|
|
|
struct propagate_block_info *pbi;
|
|
|
|
|
rtx reg;
|
|
|
|
|
rtx cond ATTRIBUTE_UNUSED;
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
int regno = REGNO (reg);
|
|
|
|
|
int some_was_live = REGNO_REG_SET_P (pbi->reg_live, regno);
|
|
|
|
|
int some_was_dead = ! some_was_live;
|
2000-04-27 13:17:04 +02:00
|
|
|
|
int some_not_set;
|
|
|
|
|
int n;
|
2000-04-08 01:33:47 +02:00
|
|
|
|
|
|
|
|
|
/* A hard reg in a wide mode may really be multiple registers.
|
|
|
|
|
If so, mark all of them just like the first. */
|
|
|
|
|
if (regno < FIRST_PSEUDO_REGISTER)
|
|
|
|
|
{
|
2000-04-27 13:17:04 +02:00
|
|
|
|
n = HARD_REGNO_NREGS (regno, GET_MODE (reg));
|
2000-04-08 01:33:47 +02:00
|
|
|
|
while (--n > 0)
|
|
|
|
|
{
|
2000-04-27 13:17:04 +02:00
|
|
|
|
int needed_regno = REGNO_REG_SET_P (pbi->reg_live, regno + n);
|
2000-04-08 01:33:47 +02:00
|
|
|
|
some_was_live |= needed_regno;
|
|
|
|
|
some_was_dead |= ! needed_regno;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pbi->flags & (PROP_LOG_LINKS | PROP_AUTOINC))
|
|
|
|
|
{
|
|
|
|
|
/* Record where each reg is used, so when the reg is set we know
|
|
|
|
|
the next insn that uses it. */
|
|
|
|
|
pbi->reg_next_use[regno] = insn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pbi->flags & PROP_REG_INFO)
|
|
|
|
|
{
|
|
|
|
|
if (regno < FIRST_PSEUDO_REGISTER)
|
|
|
|
|
{
|
|
|
|
|
/* If this is a register we are going to try to eliminate,
|
|
|
|
|
don't mark it live here. If we are successful in
|
|
|
|
|
eliminating it, it need not be live unless it is used for
|
|
|
|
|
pseudos, in which case it will have been set live when it
|
|
|
|
|
was allocated to the pseudos. If the register will not
|
|
|
|
|
be eliminated, reload will set it live at that point.
|
|
|
|
|
|
|
|
|
|
Otherwise, record that this function uses this register. */
|
2000-04-22 20:47:52 +02:00
|
|
|
|
/* ??? The PPC backend tries to "eliminate" on the pic
|
|
|
|
|
register to itself. This should be fixed. In the mean
|
|
|
|
|
time, hack around it. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-04-22 20:47:52 +02:00
|
|
|
|
if (! (TEST_HARD_REG_BIT (elim_reg_set, regno)
|
|
|
|
|
&& (regno == FRAME_POINTER_REGNUM
|
|
|
|
|
|| regno == ARG_POINTER_REGNUM)))
|
2000-04-08 01:33:47 +02:00
|
|
|
|
{
|
|
|
|
|
int n = HARD_REGNO_NREGS (regno, GET_MODE (reg));
|
|
|
|
|
do
|
|
|
|
|
regs_ever_live[regno + --n] = 1;
|
|
|
|
|
while (n > 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Keep track of which basic block each reg appears in. */
|
|
|
|
|
|
|
|
|
|
register int blocknum = pbi->bb->index;
|
|
|
|
|
if (REG_BASIC_BLOCK (regno) == REG_BLOCK_UNKNOWN)
|
|
|
|
|
REG_BASIC_BLOCK (regno) = blocknum;
|
|
|
|
|
else if (REG_BASIC_BLOCK (regno) != blocknum)
|
|
|
|
|
REG_BASIC_BLOCK (regno) = REG_BLOCK_GLOBAL;
|
|
|
|
|
|
|
|
|
|
/* Count (weighted) number of uses of each reg. */
|
2000-05-11 00:29:27 +02:00
|
|
|
|
REG_N_REFS (regno) += (optimize_size ? 1
|
|
|
|
|
: pbi->bb->loop_depth + 1);
|
2000-04-08 01:33:47 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
2000-04-27 13:17:04 +02:00
|
|
|
|
/* Find out if any of the register was set this insn. */
|
|
|
|
|
some_not_set = ! REGNO_REG_SET_P (pbi->new_set, regno);
|
|
|
|
|
if (regno < FIRST_PSEUDO_REGISTER)
|
|
|
|
|
{
|
|
|
|
|
n = HARD_REGNO_NREGS (regno, GET_MODE (reg));
|
|
|
|
|
while (--n > 0)
|
|
|
|
|
some_not_set |= ! REGNO_REG_SET_P (pbi->new_set, regno + n);
|
|
|
|
|
}
|
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
/* Record and count the insns in which a reg dies. If it is used in
|
|
|
|
|
this insn and was dead below the insn then it dies in this insn.
|
|
|
|
|
If it was set in this insn, we do not make a REG_DEAD note;
|
2000-04-27 13:17:04 +02:00
|
|
|
|
likewise if we already made such a note. */
|
|
|
|
|
if ((pbi->flags & (PROP_DEATH_NOTES | PROP_REG_INFO))
|
2000-04-08 01:33:47 +02:00
|
|
|
|
&& some_was_dead
|
2000-04-27 13:17:04 +02:00
|
|
|
|
&& some_not_set)
|
2000-04-08 01:33:47 +02:00
|
|
|
|
{
|
|
|
|
|
/* Check for the case where the register dying partially
|
|
|
|
|
overlaps the register set by this insn. */
|
|
|
|
|
if (regno < FIRST_PSEUDO_REGISTER
|
|
|
|
|
&& HARD_REGNO_NREGS (regno, GET_MODE (reg)) > 1)
|
|
|
|
|
{
|
|
|
|
|
n = HARD_REGNO_NREGS (regno, GET_MODE (reg));
|
|
|
|
|
while (--n >= 0)
|
2000-04-27 13:17:04 +02:00
|
|
|
|
some_was_live |= REGNO_REG_SET_P (pbi->new_set, regno + n);
|
2000-04-08 01:33:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If none of the words in X is needed, make a REG_DEAD note.
|
|
|
|
|
Otherwise, we must make partial REG_DEAD notes. */
|
|
|
|
|
if (! some_was_live)
|
|
|
|
|
{
|
2000-04-27 13:17:04 +02:00
|
|
|
|
if ((pbi->flags & PROP_DEATH_NOTES)
|
|
|
|
|
&& ! find_regno_note (insn, REG_DEAD, regno))
|
|
|
|
|
REG_NOTES (insn)
|
|
|
|
|
= alloc_EXPR_LIST (REG_DEAD, reg, REG_NOTES (insn));
|
|
|
|
|
|
|
|
|
|
if (pbi->flags & PROP_REG_INFO)
|
|
|
|
|
REG_N_DEATHS (regno)++;
|
2000-04-08 01:33:47 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Don't make a REG_DEAD note for a part of a register
|
|
|
|
|
that is set in the insn. */
|
|
|
|
|
|
|
|
|
|
n = regno + HARD_REGNO_NREGS (regno, GET_MODE (reg)) - 1;
|
|
|
|
|
for (; n >= regno; n--)
|
2000-04-27 13:17:04 +02:00
|
|
|
|
if (! REGNO_REG_SET_P (pbi->reg_live, n)
|
2000-04-08 01:33:47 +02:00
|
|
|
|
&& ! dead_or_set_regno_p (insn, n))
|
|
|
|
|
REG_NOTES (insn)
|
|
|
|
|
= alloc_EXPR_LIST (REG_DEAD,
|
|
|
|
|
gen_rtx_REG (reg_raw_mode[n], n),
|
|
|
|
|
REG_NOTES (insn));
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-04-27 13:17:04 +02:00
|
|
|
|
|
|
|
|
|
SET_REGNO_REG_SET (pbi->reg_live, regno);
|
|
|
|
|
if (regno < FIRST_PSEUDO_REGISTER)
|
|
|
|
|
{
|
|
|
|
|
n = HARD_REGNO_NREGS (regno, GET_MODE (reg));
|
|
|
|
|
while (--n > 0)
|
|
|
|
|
SET_REGNO_REG_SET (pbi->reg_live, regno + n);
|
|
|
|
|
}
|
2000-04-30 12:37:57 +02:00
|
|
|
|
|
|
|
|
|
#ifdef HAVE_conditional_execution
|
|
|
|
|
/* If this is a conditional use, record that fact. If it is later
|
|
|
|
|
conditionally set, we'll know to kill the register. */
|
|
|
|
|
if (cond != NULL_RTX)
|
|
|
|
|
{
|
|
|
|
|
splay_tree_node node;
|
|
|
|
|
struct reg_cond_life_info *rcli;
|
|
|
|
|
rtx ncond;
|
|
|
|
|
|
|
|
|
|
if (some_was_live)
|
|
|
|
|
{
|
|
|
|
|
node = splay_tree_lookup (pbi->reg_cond_dead, regno);
|
|
|
|
|
if (node == NULL)
|
|
|
|
|
{
|
|
|
|
|
/* The register was unconditionally live previously.
|
|
|
|
|
No need to do anything. */
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* The register was conditionally live previously.
|
2000-04-30 12:37:57 +02:00
|
|
|
|
Subtract the new life cond from the old death cond. */
|
|
|
|
|
rcli = (struct reg_cond_life_info *) node->value;
|
|
|
|
|
ncond = rcli->condition;
|
2000-12-19 17:52:23 +01:00
|
|
|
|
ncond = and_reg_cond (ncond, not_reg_cond (cond), 1);
|
2000-04-30 12:37:57 +02:00
|
|
|
|
|
|
|
|
|
/* If the register is now unconditionally live, remove the
|
|
|
|
|
entry in the splay_tree. */
|
|
|
|
|
if (ncond == const0_rtx)
|
|
|
|
|
{
|
|
|
|
|
rcli->condition = NULL_RTX;
|
|
|
|
|
splay_tree_remove (pbi->reg_cond_dead, regno);
|
|
|
|
|
}
|
|
|
|
|
else
|
2000-08-15 19:31:29 +02:00
|
|
|
|
{
|
|
|
|
|
rcli->condition = ncond;
|
|
|
|
|
SET_REGNO_REG_SET (pbi->reg_cond_reg, REGNO (XEXP (cond, 0)));
|
|
|
|
|
}
|
2000-04-30 12:37:57 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* The register was not previously live at all. Record
|
|
|
|
|
the condition under which it is still dead. */
|
|
|
|
|
rcli = (struct reg_cond_life_info *) xmalloc (sizeof (*rcli));
|
|
|
|
|
rcli->condition = not_reg_cond (cond);
|
|
|
|
|
splay_tree_insert (pbi->reg_cond_dead, regno,
|
|
|
|
|
(splay_tree_value) rcli);
|
2000-08-15 19:31:29 +02:00
|
|
|
|
|
|
|
|
|
SET_REGNO_REG_SET (pbi->reg_cond_reg, REGNO (XEXP (cond, 0)));
|
2000-04-30 12:37:57 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-05-30 00:37:37 +02:00
|
|
|
|
else if (some_was_live)
|
|
|
|
|
{
|
|
|
|
|
splay_tree_node node;
|
|
|
|
|
struct reg_cond_life_info *rcli;
|
|
|
|
|
|
|
|
|
|
node = splay_tree_lookup (pbi->reg_cond_dead, regno);
|
|
|
|
|
if (node != NULL)
|
|
|
|
|
{
|
|
|
|
|
/* The register was conditionally live previously, but is now
|
|
|
|
|
unconditionally so. Remove it from the conditionally dead
|
|
|
|
|
list, so that a conditional set won't cause us to think
|
|
|
|
|
it dead. */
|
|
|
|
|
rcli = (struct reg_cond_life_info *) node->value;
|
|
|
|
|
rcli->condition = NULL_RTX;
|
|
|
|
|
splay_tree_remove (pbi->reg_cond_dead, regno);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-04-30 12:37:57 +02:00
|
|
|
|
#endif
|
2000-04-08 01:33:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Scan expression X and store a 1-bit in NEW_LIVE for each reg it uses.
|
|
|
|
|
This is done assuming the registers needed from X are those that
|
|
|
|
|
have 1-bits in PBI->REG_LIVE.
|
|
|
|
|
|
|
|
|
|
INSN is the containing instruction. If INSN is dead, this function
|
|
|
|
|
is not called. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
static void
|
2000-04-12 03:38:15 +02:00
|
|
|
|
mark_used_regs (pbi, x, cond, insn)
|
2000-04-08 01:33:47 +02:00
|
|
|
|
struct propagate_block_info *pbi;
|
|
|
|
|
rtx x, cond, insn;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
|
|
|
|
register RTX_CODE code;
|
|
|
|
|
register int regno;
|
2000-04-08 01:33:47 +02:00
|
|
|
|
int flags = pbi->flags;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
retry:
|
|
|
|
|
code = GET_CODE (x);
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case LABEL_REF:
|
|
|
|
|
case SYMBOL_REF:
|
|
|
|
|
case CONST_INT:
|
|
|
|
|
case CONST:
|
|
|
|
|
case CONST_DOUBLE:
|
|
|
|
|
case PC:
|
|
|
|
|
case ADDR_VEC:
|
|
|
|
|
case ADDR_DIFF_VEC:
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_cc0
|
|
|
|
|
case CC0:
|
2000-04-08 01:33:47 +02:00
|
|
|
|
pbi->cc0_live = 1;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
return;
|
|
|
|
|
#endif
|
|
|
|
|
|
1993-12-08 12:17:15 +01:00
|
|
|
|
case CLOBBER:
|
|
|
|
|
/* If we are clobbering a MEM, mark any registers inside the address
|
|
|
|
|
as being used. */
|
|
|
|
|
if (GET_CODE (XEXP (x, 0)) == MEM)
|
2000-04-12 03:38:15 +02:00
|
|
|
|
mark_used_regs (pbi, XEXP (XEXP (x, 0), 0), cond, insn);
|
1993-12-08 12:17:15 +01:00
|
|
|
|
return;
|
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
case MEM:
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Don't bother watching stores to mems if this is not the
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
final pass. We'll not be deleting dead stores this round. */
|
2000-08-08 21:46:51 +02:00
|
|
|
|
if (optimize && (flags & PROP_SCAN_DEAD_CODE))
|
1999-01-18 04:01:26 +01:00
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Invalidate the data for the last MEM stored, but only if MEM is
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
something that can be stored into. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
if (GET_CODE (XEXP (x, 0)) == SYMBOL_REF
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
&& CONSTANT_POOL_ADDRESS_P (XEXP (x, 0)))
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Needn't clear the memory set list. */
|
|
|
|
|
;
|
|
|
|
|
else
|
1999-01-18 04:01:26 +01:00
|
|
|
|
{
|
2000-04-08 01:33:47 +02:00
|
|
|
|
rtx temp = pbi->mem_set_list;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
rtx prev = NULL_RTX;
|
1999-10-15 01:31:25 +02:00
|
|
|
|
rtx next;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
|
|
|
|
while (temp)
|
1999-01-18 04:01:26 +01:00
|
|
|
|
{
|
1999-10-15 01:31:25 +02:00
|
|
|
|
next = XEXP (temp, 1);
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
if (anti_dependence (XEXP (temp, 0), x))
|
|
|
|
|
{
|
|
|
|
|
/* Splice temp out of the list. */
|
|
|
|
|
if (prev)
|
1999-10-15 01:31:25 +02:00
|
|
|
|
XEXP (prev, 1) = next;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
else
|
2000-04-08 01:33:47 +02:00
|
|
|
|
pbi->mem_set_list = next;
|
1999-10-15 01:31:25 +02:00
|
|
|
|
free_EXPR_LIST_node (temp);
|
2001-01-16 14:57:17 +01:00
|
|
|
|
pbi->mem_set_list_len--;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
}
|
1999-01-18 04:01:26 +01:00
|
|
|
|
else
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
prev = temp;
|
1999-10-15 01:31:25 +02:00
|
|
|
|
temp = next;
|
1999-01-18 04:01:26 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
/* If the memory reference had embedded side effects (autoincrement
|
|
|
|
|
address modes. Then we may need to kill some entries on the
|
|
|
|
|
memory set list. */
|
|
|
|
|
if (insn)
|
2000-04-08 01:33:47 +02:00
|
|
|
|
invalidate_mems_from_autoinc (pbi, insn);
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
}
|
1999-01-20 03:02:20 +01:00
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
#ifdef AUTO_INC_DEC
|
2000-06-12 16:40:24 +02:00
|
|
|
|
if (flags & PROP_AUTOINC)
|
2000-04-08 01:33:47 +02:00
|
|
|
|
find_auto_inc (pbi, x, insn);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
|
1994-08-07 14:51:03 +02:00
|
|
|
|
case SUBREG:
|
2000-06-13 23:47:44 +02:00
|
|
|
|
#ifdef CLASS_CANNOT_CHANGE_MODE
|
1994-08-07 14:51:03 +02:00
|
|
|
|
if (GET_CODE (SUBREG_REG (x)) == REG
|
|
|
|
|
&& REGNO (SUBREG_REG (x)) >= FIRST_PSEUDO_REGISTER
|
2000-06-13 23:47:44 +02:00
|
|
|
|
&& CLASS_CANNOT_CHANGE_MODE_P (GET_MODE (x),
|
|
|
|
|
GET_MODE (SUBREG_REG (x))))
|
|
|
|
|
REG_CHANGES_MODE (REGNO (SUBREG_REG (x))) = 1;
|
|
|
|
|
#endif
|
1994-08-07 14:51:03 +02:00
|
|
|
|
|
|
|
|
|
/* While we're here, optimize this case. */
|
|
|
|
|
x = SUBREG_REG (x);
|
1995-03-30 00:34:41 +02:00
|
|
|
|
if (GET_CODE (x) != REG)
|
2000-04-08 01:33:47 +02:00
|
|
|
|
goto retry;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Fall through. */
|
1994-08-07 14:51:03 +02:00
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
case REG:
|
2000-04-08 01:33:47 +02:00
|
|
|
|
/* See a register other than being set => mark it as needed. */
|
2000-04-12 03:38:15 +02:00
|
|
|
|
mark_used_reg (pbi, x, cond, insn);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case SET:
|
|
|
|
|
{
|
|
|
|
|
register rtx testreg = SET_DEST (x);
|
|
|
|
|
int mark_dest = 0;
|
|
|
|
|
|
|
|
|
|
/* If storing into MEM, don't show it as being used. But do
|
|
|
|
|
show the address as being used. */
|
|
|
|
|
if (GET_CODE (testreg) == MEM)
|
|
|
|
|
{
|
|
|
|
|
#ifdef AUTO_INC_DEC
|
2000-06-12 16:40:24 +02:00
|
|
|
|
if (flags & PROP_AUTOINC)
|
2000-04-08 01:33:47 +02:00
|
|
|
|
find_auto_inc (pbi, testreg, insn);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
#endif
|
2000-04-12 03:38:15 +02:00
|
|
|
|
mark_used_regs (pbi, XEXP (testreg, 0), cond, insn);
|
|
|
|
|
mark_used_regs (pbi, SET_SRC (x), cond, insn);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
/* Storing in STRICT_LOW_PART is like storing in a reg
|
|
|
|
|
in that this SET might be dead, so ignore it in TESTREG.
|
|
|
|
|
but in some other ways it is like using the reg.
|
|
|
|
|
|
|
|
|
|
Storing in a SUBREG or a bit field is like storing the entire
|
|
|
|
|
register in that if the register's value is not used
|
|
|
|
|
then this SET is not needed. */
|
|
|
|
|
while (GET_CODE (testreg) == STRICT_LOW_PART
|
|
|
|
|
|| GET_CODE (testreg) == ZERO_EXTRACT
|
|
|
|
|
|| GET_CODE (testreg) == SIGN_EXTRACT
|
|
|
|
|
|| GET_CODE (testreg) == SUBREG)
|
|
|
|
|
{
|
2000-06-13 23:47:44 +02:00
|
|
|
|
#ifdef CLASS_CANNOT_CHANGE_MODE
|
1995-03-18 22:57:23 +01:00
|
|
|
|
if (GET_CODE (testreg) == SUBREG
|
|
|
|
|
&& GET_CODE (SUBREG_REG (testreg)) == REG
|
|
|
|
|
&& REGNO (SUBREG_REG (testreg)) >= FIRST_PSEUDO_REGISTER
|
2000-06-13 23:47:44 +02:00
|
|
|
|
&& CLASS_CANNOT_CHANGE_MODE_P (GET_MODE (SUBREG_REG (testreg)),
|
|
|
|
|
GET_MODE (testreg)))
|
|
|
|
|
REG_CHANGES_MODE (REGNO (SUBREG_REG (testreg))) = 1;
|
|
|
|
|
#endif
|
1995-03-18 22:57:23 +01:00
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
/* Modifying a single register in an alternate mode
|
|
|
|
|
does not use any of the old value. But these other
|
|
|
|
|
ways of storing in a register do use the old value. */
|
|
|
|
|
if (GET_CODE (testreg) == SUBREG
|
|
|
|
|
&& !(REG_SIZE (SUBREG_REG (testreg)) > REG_SIZE (testreg)))
|
|
|
|
|
;
|
|
|
|
|
else
|
|
|
|
|
mark_dest = 1;
|
|
|
|
|
|
|
|
|
|
testreg = XEXP (testreg, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2001-01-18 14:14:34 +01:00
|
|
|
|
/* If this is a store into a register or group of registers,
|
|
|
|
|
recursively scan the value being stored. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
1998-09-12 03:03:36 +02:00
|
|
|
|
if ((GET_CODE (testreg) == PARALLEL
|
|
|
|
|
&& GET_MODE (testreg) == BLKmode)
|
|
|
|
|
|| (GET_CODE (testreg) == REG
|
2000-04-08 01:33:47 +02:00
|
|
|
|
&& (regno = REGNO (testreg),
|
|
|
|
|
! (regno == FRAME_POINTER_REGNUM
|
|
|
|
|
&& (! reload_completed || frame_pointer_needed)))
|
1993-09-24 21:40:36 +02:00
|
|
|
|
#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
|
1999-05-31 10:43:04 +02:00
|
|
|
|
&& ! (regno == HARD_FRAME_POINTER_REGNUM
|
|
|
|
|
&& (! reload_completed || frame_pointer_needed))
|
1993-09-24 21:40:36 +02:00
|
|
|
|
#endif
|
1992-02-11 23:35:04 +01:00
|
|
|
|
#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
|
1998-09-12 03:03:36 +02:00
|
|
|
|
&& ! (regno == ARG_POINTER_REGNUM && fixed_regs[regno])
|
1992-02-11 23:35:04 +01:00
|
|
|
|
#endif
|
1998-09-12 03:03:36 +02:00
|
|
|
|
))
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
|
|
|
|
if (mark_dest)
|
2000-04-12 03:38:15 +02:00
|
|
|
|
mark_used_regs (pbi, SET_DEST (x), cond, insn);
|
|
|
|
|
mark_used_regs (pbi, SET_SRC (x), cond, insn);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
1999-03-27 16:18:32 +01:00
|
|
|
|
case ASM_OPERANDS:
|
|
|
|
|
case UNSPEC_VOLATILE:
|
|
|
|
|
case TRAP_IF:
|
|
|
|
|
case ASM_INPUT:
|
|
|
|
|
{
|
|
|
|
|
/* Traditional and volatile asm instructions must be considered to use
|
|
|
|
|
and clobber all hard registers, all pseudo-registers and all of
|
|
|
|
|
memory. So must TRAP_IF and UNSPEC_VOLATILE operations.
|
|
|
|
|
|
|
|
|
|
Consider for instance a volatile asm that changes the fpu rounding
|
|
|
|
|
mode. An insn should not be moved across this even if it only uses
|
2000-08-11 14:45:05 +02:00
|
|
|
|
pseudo-regs because it might give an incorrectly rounded result.
|
1999-03-27 16:18:32 +01:00
|
|
|
|
|
|
|
|
|
?!? Unfortunately, marking all hard registers as live causes massive
|
|
|
|
|
problems for the register allocator and marking all pseudos as live
|
|
|
|
|
creates mountains of uninitialized variable warnings.
|
|
|
|
|
|
|
|
|
|
So for now, just clear the memory set list and mark any regs
|
|
|
|
|
we can find in ASM_OPERANDS as used. */
|
|
|
|
|
if (code != ASM_OPERANDS || MEM_VOLATILE_P (x))
|
2001-01-16 14:57:17 +01:00
|
|
|
|
{
|
|
|
|
|
free_EXPR_LIST_list (&pbi->mem_set_list);
|
|
|
|
|
pbi->mem_set_list_len = 0;
|
|
|
|
|
}
|
1999-03-27 16:18:32 +01:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* For all ASM_OPERANDS, we must traverse the vector of input operands.
|
1999-03-27 16:18:32 +01:00
|
|
|
|
We can not just fall through here since then we would be confused
|
|
|
|
|
by the ASM_INPUT rtx inside ASM_OPERANDS, which do not indicate
|
|
|
|
|
traditional asms unlike their normal usage. */
|
|
|
|
|
if (code == ASM_OPERANDS)
|
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < ASM_OPERANDS_INPUT_LENGTH (x); j++)
|
2000-04-12 03:38:15 +02:00
|
|
|
|
mark_used_regs (pbi, ASM_OPERANDS_INPUT (x, j), cond, insn);
|
1999-03-27 16:18:32 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2000-04-08 01:33:47 +02:00
|
|
|
|
case COND_EXEC:
|
|
|
|
|
if (cond != NULL_RTX)
|
|
|
|
|
abort ();
|
|
|
|
|
|
2000-04-12 03:38:15 +02:00
|
|
|
|
mark_used_regs (pbi, COND_EXEC_TEST (x), NULL_RTX, insn);
|
2000-04-08 01:33:47 +02:00
|
|
|
|
|
|
|
|
|
cond = COND_EXEC_TEST (x);
|
|
|
|
|
x = COND_EXEC_CODE (x);
|
|
|
|
|
goto retry;
|
|
|
|
|
|
2000-04-06 23:22:49 +02:00
|
|
|
|
case PHI:
|
|
|
|
|
/* We _do_not_ want to scan operands of phi nodes. Operands of
|
|
|
|
|
a phi function are evaluated only when control reaches this
|
|
|
|
|
block along a particular edge. Therefore, regs that appear
|
|
|
|
|
as arguments to phi should not be added to the global live at
|
|
|
|
|
start. */
|
|
|
|
|
return;
|
1999-03-27 16:18:32 +01:00
|
|
|
|
|
1997-11-02 22:19:36 +01:00
|
|
|
|
default:
|
|
|
|
|
break;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Recursively scan the operands of this expression. */
|
|
|
|
|
|
|
|
|
|
{
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
register const char *fmt = GET_RTX_FORMAT (code);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
register int i;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e')
|
|
|
|
|
{
|
|
|
|
|
/* Tail recursive case: save a function call level. */
|
|
|
|
|
if (i == 0)
|
|
|
|
|
{
|
|
|
|
|
x = XEXP (x, 0);
|
|
|
|
|
goto retry;
|
|
|
|
|
}
|
2000-04-12 03:38:15 +02:00
|
|
|
|
mark_used_regs (pbi, XEXP (x, i), cond, insn);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
else if (fmt[i] == 'E')
|
|
|
|
|
{
|
|
|
|
|
register int j;
|
|
|
|
|
for (j = 0; j < XVECLEN (x, i); j++)
|
2000-04-12 03:38:15 +02:00
|
|
|
|
mark_used_regs (pbi, XVECEXP (x, i, j), cond, insn);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef AUTO_INC_DEC
|
|
|
|
|
|
|
|
|
|
static int
|
2000-04-08 01:33:47 +02:00
|
|
|
|
try_pre_increment_1 (pbi, insn)
|
|
|
|
|
struct propagate_block_info *pbi;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
/* Find the next use of this reg. If in same basic block,
|
|
|
|
|
make it do pre-increment or pre-decrement if appropriate. */
|
1997-12-07 01:31:01 +01:00
|
|
|
|
rtx x = single_set (insn);
|
1992-07-06 22:04:00 +02:00
|
|
|
|
HOST_WIDE_INT amount = ((GET_CODE (SET_SRC (x)) == PLUS ? 1 : -1)
|
2000-08-11 14:45:05 +02:00
|
|
|
|
* INTVAL (XEXP (SET_SRC (x), 1)));
|
1992-01-15 22:33:30 +01:00
|
|
|
|
int regno = REGNO (SET_DEST (x));
|
2000-04-08 01:33:47 +02:00
|
|
|
|
rtx y = pbi->reg_next_use[regno];
|
1992-01-15 22:33:30 +01:00
|
|
|
|
if (y != 0
|
2000-09-12 19:54:19 +02:00
|
|
|
|
&& SET_DEST (x) != stack_pointer_rtx
|
1992-01-15 22:33:30 +01:00
|
|
|
|
&& BLOCK_NUM (y) == BLOCK_NUM (insn)
|
1994-05-16 22:21:39 +02:00
|
|
|
|
/* Don't do this if the reg dies, or gets set in y; a standard addressing
|
1996-07-04 00:07:53 +02:00
|
|
|
|
mode would be better. */
|
1994-05-16 22:21:39 +02:00
|
|
|
|
&& ! dead_or_set_p (y, SET_DEST (x))
|
1997-12-07 01:31:01 +01:00
|
|
|
|
&& try_pre_increment (y, SET_DEST (x), amount))
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
2000-11-10 03:03:28 +01:00
|
|
|
|
/* We have found a suitable auto-increment and already changed
|
|
|
|
|
insn Y to do it. So flush this increment instruction. */
|
|
|
|
|
propagate_block_delete_insn (pbi->bb, insn);
|
|
|
|
|
|
|
|
|
|
/* Count a reference to this reg for the increment insn we are
|
|
|
|
|
deleting. When a reg is incremented, spilling it is worse,
|
|
|
|
|
so we want to make that less likely. */
|
1992-01-15 22:33:30 +01:00
|
|
|
|
if (regno >= FIRST_PSEUDO_REGISTER)
|
|
|
|
|
{
|
2000-05-11 00:29:27 +02:00
|
|
|
|
REG_N_REFS (regno) += (optimize_size ? 1
|
|
|
|
|
: pbi->bb->loop_depth + 1);
|
1997-05-30 20:19:19 +02:00
|
|
|
|
REG_N_SETS (regno)++;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
2000-11-10 03:03:28 +01:00
|
|
|
|
|
|
|
|
|
/* Flush any remembered memories depending on the value of
|
|
|
|
|
the incremented register. */
|
|
|
|
|
invalidate_mems_from_set (pbi, SET_DEST (x));
|
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Try to change INSN so that it does pre-increment or pre-decrement
|
|
|
|
|
addressing on register REG in order to add AMOUNT to REG.
|
|
|
|
|
AMOUNT is negative for pre-decrement.
|
|
|
|
|
Returns 1 if the change could be made.
|
|
|
|
|
This checks all about the validity of the result of modifying INSN. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
try_pre_increment (insn, reg, amount)
|
|
|
|
|
rtx insn, reg;
|
1992-07-06 22:04:00 +02:00
|
|
|
|
HOST_WIDE_INT amount;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
|
|
|
|
register rtx use;
|
|
|
|
|
|
|
|
|
|
/* Nonzero if we can try to make a pre-increment or pre-decrement.
|
|
|
|
|
For example, addl $4,r1; movl (r1),... can become movl +(r1),... */
|
|
|
|
|
int pre_ok = 0;
|
|
|
|
|
/* Nonzero if we can try to make a post-increment or post-decrement.
|
|
|
|
|
For example, addl $4,r1; movl -4(r1),... can become movl (r1)+,...
|
|
|
|
|
It is possible for both PRE_OK and POST_OK to be nonzero if the machine
|
|
|
|
|
supports both pre-inc and post-inc, or both pre-dec and post-dec. */
|
|
|
|
|
int post_ok = 0;
|
|
|
|
|
|
|
|
|
|
/* Nonzero if the opportunity actually requires post-inc or post-dec. */
|
|
|
|
|
int do_post = 0;
|
|
|
|
|
|
|
|
|
|
/* From the sign of increment, see which possibilities are conceivable
|
|
|
|
|
on this target machine. */
|
1998-11-25 00:15:19 +01:00
|
|
|
|
if (HAVE_PRE_INCREMENT && amount > 0)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
pre_ok = 1;
|
1998-11-25 00:15:19 +01:00
|
|
|
|
if (HAVE_POST_INCREMENT && amount > 0)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
post_ok = 1;
|
|
|
|
|
|
1998-11-25 00:15:19 +01:00
|
|
|
|
if (HAVE_PRE_DECREMENT && amount < 0)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
pre_ok = 1;
|
1998-11-25 00:15:19 +01:00
|
|
|
|
if (HAVE_POST_DECREMENT && amount < 0)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
post_ok = 1;
|
|
|
|
|
|
|
|
|
|
if (! (pre_ok || post_ok))
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/* It is not safe to add a side effect to a jump insn
|
|
|
|
|
because if the incremented register is spilled and must be reloaded
|
|
|
|
|
there would be no way to store the incremented value back in memory. */
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (insn) == JUMP_INSN)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
use = 0;
|
|
|
|
|
if (pre_ok)
|
|
|
|
|
use = find_use_as_address (PATTERN (insn), reg, 0);
|
|
|
|
|
if (post_ok && (use == 0 || use == (rtx) 1))
|
|
|
|
|
{
|
|
|
|
|
use = find_use_as_address (PATTERN (insn), reg, -amount);
|
|
|
|
|
do_post = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (use == 0 || use == (rtx) 1)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (GET_MODE_SIZE (GET_MODE (use)) != (amount > 0 ? amount : - amount))
|
|
|
|
|
return 0;
|
|
|
|
|
|
1994-04-20 07:55:28 +02:00
|
|
|
|
/* See if this combination of instruction and addressing mode exists. */
|
|
|
|
|
if (! validate_change (insn, &XEXP (use, 0),
|
alias.c: Change all uses of gen_rtx(FOO...) to gen_rtx_FOO...
* alias.c: Change all uses of gen_rtx(FOO...) to gen_rtx_FOO;
change gen_rtx(expr...) to gen_rtx_fmt_foo(expr...).
* caller-save.c, calls.c, combine.c, cse.c: Likewise.
* dwarf2out.c, except.c, explow.c, expmed.c, expr.c: Likewise.
* final.c, flow.c, function.c, genpeep.c, haifa-sched.c: Likewise.
* halfpic.c, integrate.c, jump.c, local-alloc.c, loop.c: Likewise.
* profile.c, recog.c, reg-stack.c, regclass.c, regmove.c: Likewise.
* reload.c, reload1.c, reorg.c, sched.c, stmt.c, stupid.c: Likewise.
* unroll.c, varasm.c: Likewise.
* config/alpha/alpha.c, config/alpha/alpha.md: Likewise.
From-SVN: r17357
1998-01-15 00:10:50 +01:00
|
|
|
|
gen_rtx_fmt_e (amount > 0
|
|
|
|
|
? (do_post ? POST_INC : PRE_INC)
|
|
|
|
|
: (do_post ? POST_DEC : PRE_DEC),
|
|
|
|
|
Pmode, reg), 0))
|
1994-04-20 07:55:28 +02:00
|
|
|
|
return 0;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
/* Record that this insn now has an implicit side effect on X. */
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
REG_NOTES (insn) = alloc_EXPR_LIST (REG_INC, reg, REG_NOTES (insn));
|
1992-01-15 22:33:30 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif /* AUTO_INC_DEC */
|
|
|
|
|
|
|
|
|
|
/* Find the place in the rtx X where REG is used as a memory address.
|
|
|
|
|
Return the MEM rtx that so uses it.
|
|
|
|
|
If PLUSCONST is nonzero, search instead for a memory address equivalent to
|
|
|
|
|
(plus REG (const_int PLUSCONST)).
|
|
|
|
|
|
|
|
|
|
If such an address does not appear, return 0.
|
|
|
|
|
If REG appears more than once, or is used other than in such an address,
|
|
|
|
|
return (rtx)1. */
|
|
|
|
|
|
1997-08-12 06:07:19 +02:00
|
|
|
|
rtx
|
1992-01-15 22:33:30 +01:00
|
|
|
|
find_use_as_address (x, reg, plusconst)
|
|
|
|
|
register rtx x;
|
|
|
|
|
rtx reg;
|
1994-02-03 21:27:23 +01:00
|
|
|
|
HOST_WIDE_INT plusconst;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
|
|
|
|
enum rtx_code code = GET_CODE (x);
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
const char *fmt = GET_RTX_FORMAT (code);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
register int i;
|
|
|
|
|
register rtx value = 0;
|
|
|
|
|
register rtx tem;
|
|
|
|
|
|
|
|
|
|
if (code == MEM && XEXP (x, 0) == reg && plusconst == 0)
|
|
|
|
|
return x;
|
|
|
|
|
|
|
|
|
|
if (code == MEM && GET_CODE (XEXP (x, 0)) == PLUS
|
|
|
|
|
&& XEXP (XEXP (x, 0), 0) == reg
|
|
|
|
|
&& GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
|
|
|
|
|
&& INTVAL (XEXP (XEXP (x, 0), 1)) == plusconst)
|
|
|
|
|
return x;
|
|
|
|
|
|
|
|
|
|
if (code == SIGN_EXTRACT || code == ZERO_EXTRACT)
|
|
|
|
|
{
|
|
|
|
|
/* If REG occurs inside a MEM used in a bit-field reference,
|
|
|
|
|
that is unacceptable. */
|
|
|
|
|
if (find_use_as_address (XEXP (x, 0), reg, 0) != 0)
|
1992-08-03 03:37:21 +02:00
|
|
|
|
return (rtx) (HOST_WIDE_INT) 1;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (x == reg)
|
1992-08-03 03:37:21 +02:00
|
|
|
|
return (rtx) (HOST_WIDE_INT) 1;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e')
|
|
|
|
|
{
|
|
|
|
|
tem = find_use_as_address (XEXP (x, i), reg, plusconst);
|
|
|
|
|
if (value == 0)
|
|
|
|
|
value = tem;
|
|
|
|
|
else if (tem != 0)
|
1992-08-03 03:37:21 +02:00
|
|
|
|
return (rtx) (HOST_WIDE_INT) 1;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
1999-12-28 00:01:12 +01:00
|
|
|
|
else if (fmt[i] == 'E')
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
|
|
|
|
register int j;
|
|
|
|
|
for (j = XVECLEN (x, i) - 1; j >= 0; j--)
|
|
|
|
|
{
|
|
|
|
|
tem = find_use_as_address (XVECEXP (x, i, j), reg, plusconst);
|
|
|
|
|
if (value == 0)
|
|
|
|
|
value = tem;
|
|
|
|
|
else if (tem != 0)
|
1992-08-03 03:37:21 +02:00
|
|
|
|
return (rtx) (HOST_WIDE_INT) 1;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Write information about registers and basic blocks into FILE.
|
|
|
|
|
This is part of making a debugging dump. */
|
|
|
|
|
|
2000-02-17 05:16:40 +01:00
|
|
|
|
void
|
|
|
|
|
dump_regset (r, outf)
|
|
|
|
|
regset r;
|
|
|
|
|
FILE *outf;
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
if (r == NULL)
|
|
|
|
|
{
|
|
|
|
|
fputs (" (nil)", outf);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EXECUTE_IF_SET_IN_REG_SET (r, 0, i,
|
|
|
|
|
{
|
|
|
|
|
fprintf (outf, " %d", i);
|
|
|
|
|
if (i < FIRST_PSEUDO_REGISTER)
|
|
|
|
|
fprintf (outf, " [%s]",
|
|
|
|
|
reg_names[i]);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
debug_regset (r)
|
|
|
|
|
regset r;
|
|
|
|
|
{
|
|
|
|
|
dump_regset (r, stderr);
|
|
|
|
|
putc ('\n', stderr);
|
|
|
|
|
}
|
|
|
|
|
|
1992-01-15 22:33:30 +01:00
|
|
|
|
void
|
|
|
|
|
dump_flow_info (file)
|
|
|
|
|
FILE *file;
|
|
|
|
|
{
|
|
|
|
|
register int i;
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
static const char * const reg_class_names[] = REG_CLASS_NAMES;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
|
|
|
|
|
fprintf (file, "%d registers.\n", max_regno);
|
|
|
|
|
for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
|
1997-05-30 20:19:19 +02:00
|
|
|
|
if (REG_N_REFS (i))
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
1992-06-27 19:49:28 +02:00
|
|
|
|
enum reg_class class, altclass;
|
1992-01-15 22:33:30 +01:00
|
|
|
|
fprintf (file, "\nRegister %d used %d times across %d insns",
|
1997-05-30 20:19:19 +02:00
|
|
|
|
i, REG_N_REFS (i), REG_LIVE_LENGTH (i));
|
|
|
|
|
if (REG_BASIC_BLOCK (i) >= 0)
|
|
|
|
|
fprintf (file, " in block %d", REG_BASIC_BLOCK (i));
|
1998-05-13 14:18:27 +02:00
|
|
|
|
if (REG_N_SETS (i))
|
2000-08-11 14:45:05 +02:00
|
|
|
|
fprintf (file, "; set %d time%s", REG_N_SETS (i),
|
|
|
|
|
(REG_N_SETS (i) == 1) ? "" : "s");
|
1998-05-13 14:18:27 +02:00
|
|
|
|
if (REG_USERVAR_P (regno_reg_rtx[i]))
|
2000-08-11 14:45:05 +02:00
|
|
|
|
fprintf (file, "; user var");
|
1997-05-30 20:19:19 +02:00
|
|
|
|
if (REG_N_DEATHS (i) != 1)
|
|
|
|
|
fprintf (file, "; dies in %d places", REG_N_DEATHS (i));
|
|
|
|
|
if (REG_N_CALLS_CROSSED (i) == 1)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
fprintf (file, "; crosses 1 call");
|
1997-05-30 20:19:19 +02:00
|
|
|
|
else if (REG_N_CALLS_CROSSED (i))
|
|
|
|
|
fprintf (file, "; crosses %d calls", REG_N_CALLS_CROSSED (i));
|
1992-01-15 22:33:30 +01:00
|
|
|
|
if (PSEUDO_REGNO_BYTES (i) != UNITS_PER_WORD)
|
|
|
|
|
fprintf (file, "; %d bytes", PSEUDO_REGNO_BYTES (i));
|
|
|
|
|
class = reg_preferred_class (i);
|
1992-06-27 19:49:28 +02:00
|
|
|
|
altclass = reg_alternate_class (i);
|
|
|
|
|
if (class != GENERAL_REGS || altclass != ALL_REGS)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
{
|
1992-06-27 19:49:28 +02:00
|
|
|
|
if (altclass == ALL_REGS || class == ALL_REGS)
|
|
|
|
|
fprintf (file, "; pref %s", reg_class_names[(int) class]);
|
|
|
|
|
else if (altclass == NO_REGS)
|
1992-01-15 22:33:30 +01:00
|
|
|
|
fprintf (file, "; %s or none", reg_class_names[(int) class]);
|
|
|
|
|
else
|
1992-06-27 19:49:28 +02:00
|
|
|
|
fprintf (file, "; pref %s, else %s",
|
|
|
|
|
reg_class_names[(int) class],
|
|
|
|
|
reg_class_names[(int) altclass]);
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
2000-11-30 07:31:19 +01:00
|
|
|
|
if (REG_POINTER (regno_reg_rtx[i]))
|
1992-01-15 22:33:30 +01:00
|
|
|
|
fprintf (file, "; pointer");
|
|
|
|
|
fprintf (file, ".\n");
|
|
|
|
|
}
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
fprintf (file, "\n%d basic blocks, %d edges.\n", n_basic_blocks, n_edges);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
for (i = 0; i < n_basic_blocks; i++)
|
|
|
|
|
{
|
|
|
|
|
register basic_block bb = BASIC_BLOCK (i);
|
|
|
|
|
register edge e;
|
|
|
|
|
|
basic-block.h (struct edge_def): New field "count".
* basic-block.h (struct edge_def): New field "count".
(struct basic_block_def): Likewise.
* flow.c (entry_exit_blocks): Add count fileds.
(split_edge): Keep count information up-to-date.
(dump_edge_info, dump_flow_info): Dump count fields.
* final.c (count_instrumented_edges): Rename to edge from arc.
(end_final): Update users.
* profile.c: Include expr.h, basic-block.h.
(struct adj_list, ARC_TARGET, ARC_SOURCE, ARC_COUNT): Kill.
(struct bb_info, label_to_bb, label_to_bb_size, bb_graph): Kill.
(ignore_next_note, return_label_execution_count): Kill.
(bbg_file_name, da_file_name): Kill.
(edge_info, bb_info): New structures.
(EDGE_INFO, BB_INFO, GCOV_INDEX_TO_BB, BB_TO_GCOV_INDEX): New macros.
(count_instrumented_edges, total_num_edges): Rename to edge from arc.
(total_num_edges_instrumented): Likewise.
(init_arc, expand_spanning_tree): Kill.
(fill_spanning_tree, tablejump_entry_p): Kill.
(instrument_edges): Rewrite from instrument_arcs to use
commit_edge_insertions infrastructure.
(compute_branch_probabilities): Remove arguments; rewrite for
CFG infrastructure; use rtl_dump_file directly.
(branch_prob, find_spanning_tree): Likewise.
(union_groups, find_group): New.
(init_branch_prob): Make bbg_file_name and da_file_name local.
(end_branch_prob): Use rtl_dump_file directly.
(init_edge_profiler): Rename to edge from arc.
(output_arc_profiler): Kill.
(gen_edge_profiler): New.
(output_func_start_profiler): Turn off profiling. Make the
constructor static when we can.
* rtl.h (branch_prob, end_branch_prob): Update prototypes.
* toplev.c (DFI_flow): Remove.
(DFI_cfg, DFI_life): New.
(dump_file): Update accordingly.
(compile_file): Call end_branch_prob if profile_arc_flag too.
(rest_of_compilation): Move flow1 cfg creation to DFI_cfg. Do edge
profiling after the CFG is built. Move flow1 life analysis to
DFI_life. Always estimate remaining probabilities.
Co-Authored-By: Richard Henderson <rth@cygnus.com>
From-SVN: r34037
2000-05-19 22:51:49 +02:00
|
|
|
|
fprintf (file, "\nBasic block %d: first insn %d, last %d, loop_depth %d, count %d.\n",
|
|
|
|
|
i, INSN_UID (bb->head), INSN_UID (bb->end), bb->loop_depth, bb->count);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
fprintf (file, "Predecessors: ");
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = bb->pred; e; e = e->pred_next)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
dump_edge_info (file, e, 0);
|
|
|
|
|
|
|
|
|
|
fprintf (file, "\nSuccessors: ");
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = bb->succ; e; e = e->succ_next)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
dump_edge_info (file, e, 1);
|
|
|
|
|
|
|
|
|
|
fprintf (file, "\nRegisters live at start:");
|
2000-02-17 05:16:40 +01:00
|
|
|
|
dump_regset (bb->global_live_at_start, file);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
fprintf (file, "\nRegisters live at end:");
|
2000-02-17 05:16:40 +01:00
|
|
|
|
dump_regset (bb->global_live_at_end, file);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
putc ('\n', file);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
putc ('\n', file);
|
1999-02-26 00:45:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
1999-10-27 05:24:24 +02:00
|
|
|
|
void
|
|
|
|
|
debug_flow_info ()
|
|
|
|
|
{
|
|
|
|
|
dump_flow_info (stderr);
|
|
|
|
|
}
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
static void
|
|
|
|
|
dump_edge_info (file, e, do_succ)
|
|
|
|
|
FILE *file;
|
|
|
|
|
edge e;
|
|
|
|
|
int do_succ;
|
|
|
|
|
{
|
|
|
|
|
basic_block side = (do_succ ? e->dest : e->src);
|
|
|
|
|
|
|
|
|
|
if (side == ENTRY_BLOCK_PTR)
|
|
|
|
|
fputs (" ENTRY", file);
|
|
|
|
|
else if (side == EXIT_BLOCK_PTR)
|
|
|
|
|
fputs (" EXIT", file);
|
|
|
|
|
else
|
|
|
|
|
fprintf (file, " %d", side->index);
|
|
|
|
|
|
basic-block.h (struct edge_def): New field "count".
* basic-block.h (struct edge_def): New field "count".
(struct basic_block_def): Likewise.
* flow.c (entry_exit_blocks): Add count fileds.
(split_edge): Keep count information up-to-date.
(dump_edge_info, dump_flow_info): Dump count fields.
* final.c (count_instrumented_edges): Rename to edge from arc.
(end_final): Update users.
* profile.c: Include expr.h, basic-block.h.
(struct adj_list, ARC_TARGET, ARC_SOURCE, ARC_COUNT): Kill.
(struct bb_info, label_to_bb, label_to_bb_size, bb_graph): Kill.
(ignore_next_note, return_label_execution_count): Kill.
(bbg_file_name, da_file_name): Kill.
(edge_info, bb_info): New structures.
(EDGE_INFO, BB_INFO, GCOV_INDEX_TO_BB, BB_TO_GCOV_INDEX): New macros.
(count_instrumented_edges, total_num_edges): Rename to edge from arc.
(total_num_edges_instrumented): Likewise.
(init_arc, expand_spanning_tree): Kill.
(fill_spanning_tree, tablejump_entry_p): Kill.
(instrument_edges): Rewrite from instrument_arcs to use
commit_edge_insertions infrastructure.
(compute_branch_probabilities): Remove arguments; rewrite for
CFG infrastructure; use rtl_dump_file directly.
(branch_prob, find_spanning_tree): Likewise.
(union_groups, find_group): New.
(init_branch_prob): Make bbg_file_name and da_file_name local.
(end_branch_prob): Use rtl_dump_file directly.
(init_edge_profiler): Rename to edge from arc.
(output_arc_profiler): Kill.
(gen_edge_profiler): New.
(output_func_start_profiler): Turn off profiling. Make the
constructor static when we can.
* rtl.h (branch_prob, end_branch_prob): Update prototypes.
* toplev.c (DFI_flow): Remove.
(DFI_cfg, DFI_life): New.
(dump_file): Update accordingly.
(compile_file): Call end_branch_prob if profile_arc_flag too.
(rest_of_compilation): Move flow1 cfg creation to DFI_cfg. Do edge
profiling after the CFG is built. Move flow1 life analysis to
DFI_life. Always estimate remaining probabilities.
Co-Authored-By: Richard Henderson <rth@cygnus.com>
From-SVN: r34037
2000-05-19 22:51:49 +02:00
|
|
|
|
if (e->count)
|
|
|
|
|
fprintf (file, " count:%d", e->count);
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if (e->flags)
|
|
|
|
|
{
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
static const char * const bitnames[] = {
|
1999-02-26 00:45:42 +01:00
|
|
|
|
"fallthru", "crit", "ab", "abcall", "eh", "fake"
|
|
|
|
|
};
|
|
|
|
|
int comma = 0;
|
|
|
|
|
int i, flags = e->flags;
|
|
|
|
|
|
|
|
|
|
fputc (' ', file);
|
|
|
|
|
fputc ('(', file);
|
|
|
|
|
for (i = 0; flags; i++)
|
|
|
|
|
if (flags & (1 << i))
|
|
|
|
|
{
|
|
|
|
|
flags &= ~(1 << i);
|
|
|
|
|
|
|
|
|
|
if (comma)
|
|
|
|
|
fputc (',', file);
|
2000-08-25 21:08:47 +02:00
|
|
|
|
if (i < (int) ARRAY_SIZE (bitnames))
|
1999-02-26 00:45:42 +01:00
|
|
|
|
fputs (bitnames[i], file);
|
|
|
|
|
else
|
|
|
|
|
fprintf (file, "%d", i);
|
|
|
|
|
comma = 1;
|
|
|
|
|
}
|
|
|
|
|
fputc (')', file);
|
|
|
|
|
}
|
1992-01-15 22:33:30 +01:00
|
|
|
|
}
|
1997-09-04 21:15:50 +02:00
|
|
|
|
|
2000-02-17 05:16:40 +01:00
|
|
|
|
/* Print out one basic block with live information at start and end. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-02-17 05:16:40 +01:00
|
|
|
|
void
|
|
|
|
|
dump_bb (bb, outf)
|
|
|
|
|
basic_block bb;
|
|
|
|
|
FILE *outf;
|
|
|
|
|
{
|
|
|
|
|
rtx insn;
|
|
|
|
|
rtx last;
|
|
|
|
|
edge e;
|
|
|
|
|
|
basic-block.h (struct edge_def): New field "count".
* basic-block.h (struct edge_def): New field "count".
(struct basic_block_def): Likewise.
* flow.c (entry_exit_blocks): Add count fileds.
(split_edge): Keep count information up-to-date.
(dump_edge_info, dump_flow_info): Dump count fields.
* final.c (count_instrumented_edges): Rename to edge from arc.
(end_final): Update users.
* profile.c: Include expr.h, basic-block.h.
(struct adj_list, ARC_TARGET, ARC_SOURCE, ARC_COUNT): Kill.
(struct bb_info, label_to_bb, label_to_bb_size, bb_graph): Kill.
(ignore_next_note, return_label_execution_count): Kill.
(bbg_file_name, da_file_name): Kill.
(edge_info, bb_info): New structures.
(EDGE_INFO, BB_INFO, GCOV_INDEX_TO_BB, BB_TO_GCOV_INDEX): New macros.
(count_instrumented_edges, total_num_edges): Rename to edge from arc.
(total_num_edges_instrumented): Likewise.
(init_arc, expand_spanning_tree): Kill.
(fill_spanning_tree, tablejump_entry_p): Kill.
(instrument_edges): Rewrite from instrument_arcs to use
commit_edge_insertions infrastructure.
(compute_branch_probabilities): Remove arguments; rewrite for
CFG infrastructure; use rtl_dump_file directly.
(branch_prob, find_spanning_tree): Likewise.
(union_groups, find_group): New.
(init_branch_prob): Make bbg_file_name and da_file_name local.
(end_branch_prob): Use rtl_dump_file directly.
(init_edge_profiler): Rename to edge from arc.
(output_arc_profiler): Kill.
(gen_edge_profiler): New.
(output_func_start_profiler): Turn off profiling. Make the
constructor static when we can.
* rtl.h (branch_prob, end_branch_prob): Update prototypes.
* toplev.c (DFI_flow): Remove.
(DFI_cfg, DFI_life): New.
(dump_file): Update accordingly.
(compile_file): Call end_branch_prob if profile_arc_flag too.
(rest_of_compilation): Move flow1 cfg creation to DFI_cfg. Do edge
profiling after the CFG is built. Move flow1 life analysis to
DFI_life. Always estimate remaining probabilities.
Co-Authored-By: Richard Henderson <rth@cygnus.com>
From-SVN: r34037
2000-05-19 22:51:49 +02:00
|
|
|
|
fprintf (outf, ";; Basic block %d, loop depth %d, count %d",
|
|
|
|
|
bb->index, bb->loop_depth, bb->count);
|
2000-02-17 05:16:40 +01:00
|
|
|
|
if (bb->eh_beg != -1 || bb->eh_end != -1)
|
|
|
|
|
fprintf (outf, ", eh regions %d/%d", bb->eh_beg, bb->eh_end);
|
|
|
|
|
putc ('\n', outf);
|
|
|
|
|
|
|
|
|
|
fputs (";; Predecessors: ", outf);
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = bb->pred; e; e = e->pred_next)
|
2000-02-17 05:16:40 +01:00
|
|
|
|
dump_edge_info (outf, e, 0);
|
|
|
|
|
putc ('\n', outf);
|
|
|
|
|
|
|
|
|
|
fputs (";; Registers live at start:", outf);
|
|
|
|
|
dump_regset (bb->global_live_at_start, outf);
|
|
|
|
|
putc ('\n', outf);
|
|
|
|
|
|
|
|
|
|
for (insn = bb->head, last = NEXT_INSN (bb->end);
|
|
|
|
|
insn != last;
|
|
|
|
|
insn = NEXT_INSN (insn))
|
|
|
|
|
print_rtl_single (outf, insn);
|
|
|
|
|
|
|
|
|
|
fputs (";; Registers live at end:", outf);
|
|
|
|
|
dump_regset (bb->global_live_at_end, outf);
|
|
|
|
|
putc ('\n', outf);
|
|
|
|
|
|
|
|
|
|
fputs (";; Successors: ", outf);
|
|
|
|
|
for (e = bb->succ; e; e = e->succ_next)
|
|
|
|
|
dump_edge_info (outf, e, 1);
|
|
|
|
|
putc ('\n', outf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
debug_bb (bb)
|
|
|
|
|
basic_block bb;
|
|
|
|
|
{
|
|
|
|
|
dump_bb (bb, stderr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
debug_bb_n (n)
|
|
|
|
|
int n;
|
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
dump_bb (BASIC_BLOCK (n), stderr);
|
2000-02-17 05:16:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
1997-09-04 21:15:50 +02:00
|
|
|
|
/* Like print_rtl, but also print out live information for the start of each
|
|
|
|
|
basic block. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
print_rtl_with_bb (outf, rtx_first)
|
|
|
|
|
FILE *outf;
|
|
|
|
|
rtx rtx_first;
|
|
|
|
|
{
|
|
|
|
|
register rtx tmp_rtx;
|
|
|
|
|
|
|
|
|
|
if (rtx_first == 0)
|
|
|
|
|
fprintf (outf, "(nil)\n");
|
|
|
|
|
else
|
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
int i;
|
1997-09-04 21:15:50 +02:00
|
|
|
|
enum bb_state { NOT_IN_BB, IN_ONE_BB, IN_MULTIPLE_BB };
|
|
|
|
|
int max_uid = get_max_uid ();
|
Warning fixes:
* c-lex.c (yylex): Remove unused variable `bytes'.
* flow.c (print_rtl_with_bb): Cast the return value of alloca.
* function.c (assign_parms): Wrap variable `varargs_setup' in
macro SETUP_INCOMING_VARARGS.
(thread_prologue_and_epilogue_insns): Mark parameter `f' with
ATTRIBUTE_UNUSED.
* local-alloc.c (no_equiv): Likewise for parameter `store'.
* sched.c (schedule_insns): Remove unused variables `insn' and `next'.
* tlink.c (symbol_hash_newfunc, symbol_hash_lookup,
file_hash_newfunc, file_hash_lookup, demangled_hash_newfunc,
demangled_hash_lookup, symbol_push, symbol_pop, file_push,
file_pop, tlink_init, tlink_execute, frob_extension,
obstack_fgets, tfgets, pfgets, freadsym, read_repo_file,
maybe_tweak, recompile_files, read_repo_files,
demangle_new_symbols, scan_linker_output): Add static prototype.
(symbol_hash_newfunc, file_hash_newfunc, demangled_hash_newfunc):
Make the third argument a `hash_table_key'.
* toplev.c (debug_start_source_file): Mark parameter `filename'
with ATTRIBUTE_UNUSED.
From-SVN: r25871
1999-03-20 20:21:31 +01:00
|
|
|
|
basic_block *start = (basic_block *)
|
1999-11-02 00:19:44 +01:00
|
|
|
|
xcalloc (max_uid, sizeof (basic_block));
|
Warning fixes:
* c-lex.c (yylex): Remove unused variable `bytes'.
* flow.c (print_rtl_with_bb): Cast the return value of alloca.
* function.c (assign_parms): Wrap variable `varargs_setup' in
macro SETUP_INCOMING_VARARGS.
(thread_prologue_and_epilogue_insns): Mark parameter `f' with
ATTRIBUTE_UNUSED.
* local-alloc.c (no_equiv): Likewise for parameter `store'.
* sched.c (schedule_insns): Remove unused variables `insn' and `next'.
* tlink.c (symbol_hash_newfunc, symbol_hash_lookup,
file_hash_newfunc, file_hash_lookup, demangled_hash_newfunc,
demangled_hash_lookup, symbol_push, symbol_pop, file_push,
file_pop, tlink_init, tlink_execute, frob_extension,
obstack_fgets, tfgets, pfgets, freadsym, read_repo_file,
maybe_tweak, recompile_files, read_repo_files,
demangle_new_symbols, scan_linker_output): Add static prototype.
(symbol_hash_newfunc, file_hash_newfunc, demangled_hash_newfunc):
Make the third argument a `hash_table_key'.
* toplev.c (debug_start_source_file): Mark parameter `filename'
with ATTRIBUTE_UNUSED.
From-SVN: r25871
1999-03-20 20:21:31 +01:00
|
|
|
|
basic_block *end = (basic_block *)
|
1999-11-02 00:19:44 +01:00
|
|
|
|
xcalloc (max_uid, sizeof (basic_block));
|
1998-10-09 18:08:51 +02:00
|
|
|
|
enum bb_state *in_bb_p = (enum bb_state *)
|
1999-11-02 00:19:44 +01:00
|
|
|
|
xcalloc (max_uid, sizeof (enum bb_state));
|
1997-09-04 21:15:50 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
for (i = n_basic_blocks - 1; i >= 0; i--)
|
1997-09-04 21:15:50 +02:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
basic_block bb = BASIC_BLOCK (i);
|
1997-09-04 21:15:50 +02:00
|
|
|
|
rtx x;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
start[INSN_UID (bb->head)] = bb;
|
|
|
|
|
end[INSN_UID (bb->end)] = bb;
|
|
|
|
|
for (x = bb->head; x != NULL_RTX; x = NEXT_INSN (x))
|
1997-09-04 21:15:50 +02:00
|
|
|
|
{
|
1999-02-26 00:45:42 +01:00
|
|
|
|
enum bb_state state = IN_MULTIPLE_BB;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
if (in_bb_p[INSN_UID (x)] == NOT_IN_BB)
|
1999-02-26 00:45:42 +01:00
|
|
|
|
state = IN_ONE_BB;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
in_bb_p[INSN_UID (x)] = state;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
|
|
|
|
if (x == bb->end)
|
1997-09-04 21:15:50 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (tmp_rtx = rtx_first; NULL != tmp_rtx; tmp_rtx = NEXT_INSN (tmp_rtx))
|
|
|
|
|
{
|
1998-10-06 11:03:38 +02:00
|
|
|
|
int did_output;
|
1999-02-26 00:45:42 +01:00
|
|
|
|
basic_block bb;
|
1998-10-06 11:03:38 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if ((bb = start[INSN_UID (tmp_rtx)]) != NULL)
|
1997-09-04 21:15:50 +02:00
|
|
|
|
{
|
|
|
|
|
fprintf (outf, ";; Start of basic block %d, registers live:",
|
1999-02-26 00:45:42 +01:00
|
|
|
|
bb->index);
|
2000-02-17 05:16:40 +01:00
|
|
|
|
dump_regset (bb->global_live_at_start, outf);
|
1997-09-04 21:15:50 +02:00
|
|
|
|
putc ('\n', outf);
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
if (in_bb_p[INSN_UID (tmp_rtx)] == NOT_IN_BB
|
1997-09-04 21:15:50 +02:00
|
|
|
|
&& GET_CODE (tmp_rtx) != NOTE
|
2000-01-19 10:42:11 +01:00
|
|
|
|
&& GET_CODE (tmp_rtx) != BARRIER)
|
1997-09-04 21:15:50 +02:00
|
|
|
|
fprintf (outf, ";; Insn is not within a basic block\n");
|
2000-08-11 14:45:05 +02:00
|
|
|
|
else if (in_bb_p[INSN_UID (tmp_rtx)] == IN_MULTIPLE_BB)
|
1997-09-04 21:15:50 +02:00
|
|
|
|
fprintf (outf, ";; Insn is in multiple basic blocks\n");
|
|
|
|
|
|
1998-10-06 11:03:38 +02:00
|
|
|
|
did_output = print_rtl_single (outf, tmp_rtx);
|
1997-09-04 21:15:50 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
if ((bb = end[INSN_UID (tmp_rtx)]) != NULL)
|
2000-04-08 01:33:47 +02:00
|
|
|
|
{
|
|
|
|
|
fprintf (outf, ";; End of basic block %d, registers live:\n",
|
|
|
|
|
bb->index);
|
|
|
|
|
dump_regset (bb->global_live_at_end, outf);
|
|
|
|
|
putc ('\n', outf);
|
|
|
|
|
}
|
1997-09-04 21:15:50 +02:00
|
|
|
|
|
1998-10-06 11:03:38 +02:00
|
|
|
|
if (did_output)
|
1998-06-29 23:40:49 +02:00
|
|
|
|
putc ('\n', outf);
|
1997-09-04 21:15:50 +02:00
|
|
|
|
}
|
1999-11-02 00:19:44 +01:00
|
|
|
|
|
|
|
|
|
free (start);
|
|
|
|
|
free (end);
|
|
|
|
|
free (in_bb_p);
|
1997-09-04 21:15:50 +02:00
|
|
|
|
}
|
1999-09-07 07:49:18 +02:00
|
|
|
|
|
|
|
|
|
if (current_function_epilogue_delay_list != 0)
|
|
|
|
|
{
|
|
|
|
|
fprintf (outf, "\n;; Insns in epilogue delay list:\n\n");
|
|
|
|
|
for (tmp_rtx = current_function_epilogue_delay_list; tmp_rtx != 0;
|
|
|
|
|
tmp_rtx = XEXP (tmp_rtx, 1))
|
|
|
|
|
print_rtl_single (outf, XEXP (tmp_rtx, 0));
|
|
|
|
|
}
|
1997-09-04 21:15:50 +02:00
|
|
|
|
}
|
1998-03-05 23:31:51 +01:00
|
|
|
|
|
2000-11-23 19:19:18 +01:00
|
|
|
|
/* Dump the rtl into the current debugging dump file, then abort. */
|
|
|
|
|
static void
|
2000-11-25 00:45:08 +01:00
|
|
|
|
print_rtl_and_abort ()
|
2000-11-23 19:19:18 +01:00
|
|
|
|
{
|
|
|
|
|
if (rtl_dump_file)
|
|
|
|
|
{
|
|
|
|
|
print_rtl_with_bb (rtl_dump_file, get_insns ());
|
|
|
|
|
fclose (rtl_dump_file);
|
|
|
|
|
}
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
|
|
|
|
|
1998-06-27 17:51:49 +02:00
|
|
|
|
/* Recompute register set/reference counts immediately prior to register
|
|
|
|
|
allocation.
|
|
|
|
|
|
|
|
|
|
This avoids problems with set/reference counts changing to/from values
|
|
|
|
|
which have special meanings to the register allocators.
|
|
|
|
|
|
|
|
|
|
Additionally, the reference counts are the primary component used by the
|
|
|
|
|
register allocators to prioritize pseudos for allocation to hard regs.
|
|
|
|
|
More accurate reference counts generally lead to better register allocation.
|
|
|
|
|
|
1998-12-13 01:59:38 +01:00
|
|
|
|
F is the first insn to be scanned.
|
2000-01-06 21:25:41 +01:00
|
|
|
|
|
1998-12-13 01:59:38 +01:00
|
|
|
|
LOOP_STEP denotes how much loop_depth should be incremented per
|
2000-01-06 21:25:41 +01:00
|
|
|
|
loop nesting level in order to increase the ref count more for
|
|
|
|
|
references in a loop.
|
1998-12-13 01:59:38 +01:00
|
|
|
|
|
1998-06-27 17:51:49 +02:00
|
|
|
|
It might be worthwhile to update REG_LIVE_LENGTH, REG_BASIC_BLOCK and
|
|
|
|
|
possibly other information which is used by the register allocators. */
|
|
|
|
|
|
1998-07-01 00:49:11 +02:00
|
|
|
|
void
|
1998-12-13 01:59:38 +01:00
|
|
|
|
recompute_reg_usage (f, loop_step)
|
Makefile.in (toplev.o): Depend on loop.h.
* Makefile.in (toplev.o): Depend on loop.h.
* dwarfout.c: Include tm_p.h.
* emit-rtl.c (restore_emit_status): Mark parameter with
ATTRIBUTE_UNUSED.
* final.c (final_scan_insn): Likewise.
* flow.c (flow_nodes_print, flow_exits_print, flow_loops_cfg_dump,
flow_loop_nested_p, flow_loop_exits_find, flow_loop_nodes_find,
flow_depth_first_order_compute, flow_loop_pre_header_find,
flow_loop_tree_node_add, flow_loops_tree_build,
flow_loop_level_compute, flow_loops_level_compute,
flow_loop_outside_edge_p): Add prototypes.
(recompute_reg_usage): Mark parameters with ATTRIBUTE_UNUSED.
* ggc-callbacks.c (lang_mark_tree, lang_mark_false_label_stack):
Mark with ATTRIBUTE_NORETURN.
* hash.c (hash_newfunc): Mark parameter with ATTRIBUTE_UNUSED.
* local-alloc.c (no_conflict_p): Likewise.
* loop.c (insert_bct): Hide definitions of variables with hidden
usage.
(note_reg_stored): Mark parameter with ATTRIBUTE_UNUSED.
* regclass.c (memory_move_secondary_cost): Mark variable `mem'
with ATTRIBUTE_UNUSED.
(record_reg_classes): Mark parameter with ATTRIBUTE_UNUSED.
(reg_scan): Likewise.
* reload.c (find_reloads): Remove unused variables `changed'.
* reload1.c (reload_reg_class_lower): Don't unnecessarily cast
away const-ness.
(allocate_reload_reg): Mark parameter with ATTRIBUTE_UNUSED.
Remove unused variable `insn'.
* toplev.c: Include loop.h.
(report_file_and_line): Remove unnecessary prototype.
* tree.c (build_block): Mark parameter with ATTRIBUTE_UNUSED.
* unroll.c (biv_total_increment): Likewise.
From-SVN: r31085
1999-12-24 15:04:54 +01:00
|
|
|
|
rtx f ATTRIBUTE_UNUSED;
|
|
|
|
|
int loop_step ATTRIBUTE_UNUSED;
|
1998-06-27 17:51:49 +02:00
|
|
|
|
{
|
2000-04-27 09:07:34 +02:00
|
|
|
|
allocate_reg_life_data ();
|
|
|
|
|
update_life_info (NULL, UPDATE_LIFE_LOCAL, PROP_REG_INFO);
|
1998-06-27 17:51:49 +02:00
|
|
|
|
}
|
1999-02-26 00:45:42 +01:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
/* Optionally removes all the REG_DEAD and REG_UNUSED notes from a set of
|
1999-10-29 23:45:05 +02:00
|
|
|
|
blocks. If BLOCKS is NULL, assume the universal set. Returns a count
|
|
|
|
|
of the number of registers that died. */
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
count_or_remove_death_notes (blocks, kill)
|
2000-08-11 14:45:05 +02:00
|
|
|
|
sbitmap blocks;
|
|
|
|
|
int kill;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
{
|
|
|
|
|
int i, count = 0;
|
|
|
|
|
|
|
|
|
|
for (i = n_basic_blocks - 1; i >= 0; --i)
|
|
|
|
|
{
|
|
|
|
|
basic_block bb;
|
|
|
|
|
rtx insn;
|
|
|
|
|
|
1999-10-29 23:45:05 +02:00
|
|
|
|
if (blocks && ! TEST_BIT (blocks, i))
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
bb = BASIC_BLOCK (i);
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (insn = bb->head;; insn = NEXT_INSN (insn))
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
{
|
2000-08-04 22:28:08 +02:00
|
|
|
|
if (INSN_P (insn))
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
{
|
|
|
|
|
rtx *pprev = ®_NOTES (insn);
|
|
|
|
|
rtx link = *pprev;
|
|
|
|
|
|
|
|
|
|
while (link)
|
|
|
|
|
{
|
|
|
|
|
switch (REG_NOTE_KIND (link))
|
|
|
|
|
{
|
|
|
|
|
case REG_DEAD:
|
|
|
|
|
if (GET_CODE (XEXP (link, 0)) == REG)
|
|
|
|
|
{
|
|
|
|
|
rtx reg = XEXP (link, 0);
|
|
|
|
|
int n;
|
|
|
|
|
|
|
|
|
|
if (REGNO (reg) >= FIRST_PSEUDO_REGISTER)
|
|
|
|
|
n = 1;
|
|
|
|
|
else
|
|
|
|
|
n = HARD_REGNO_NREGS (REGNO (reg), GET_MODE (reg));
|
|
|
|
|
count += n;
|
|
|
|
|
}
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Fall through. */
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
|
|
|
|
case REG_UNUSED:
|
|
|
|
|
if (kill)
|
|
|
|
|
{
|
|
|
|
|
rtx next = XEXP (link, 1);
|
|
|
|
|
free_EXPR_LIST_node (link);
|
2000-08-11 14:45:05 +02:00
|
|
|
|
*pprev = link = next;
|
|
|
|
|
break;
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
}
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Fall through. */
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
pprev = &XEXP (link, 1);
|
|
|
|
|
link = *pprev;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (insn == bb->end)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-11 23:39:33 +02:00
|
|
|
|
|
|
|
|
|
/* Update insns block within BB. */
|
|
|
|
|
|
2001-01-02 08:00:49 +01:00
|
|
|
|
void
|
2000-09-11 23:39:33 +02:00
|
|
|
|
update_bb_for_insn (bb)
|
|
|
|
|
basic_block bb;
|
|
|
|
|
{
|
|
|
|
|
rtx insn;
|
|
|
|
|
|
|
|
|
|
if (! basic_block_for_insn)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for (insn = bb->head; ; insn = NEXT_INSN (insn))
|
|
|
|
|
{
|
|
|
|
|
set_block_for_insn (insn, bb);
|
|
|
|
|
|
|
|
|
|
if (insn == bb->end)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Record INSN's block as BB. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
set_block_for_insn (insn, bb)
|
|
|
|
|
rtx insn;
|
|
|
|
|
basic_block bb;
|
|
|
|
|
{
|
|
|
|
|
size_t uid = INSN_UID (insn);
|
|
|
|
|
if (uid >= basic_block_for_insn->num_elements)
|
|
|
|
|
{
|
|
|
|
|
int new_size;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-02-26 00:45:42 +01:00
|
|
|
|
/* Add one-eighth the size so we don't keep calling xrealloc. */
|
|
|
|
|
new_size = uid + (uid + 7) / 8;
|
|
|
|
|
|
|
|
|
|
VARRAY_GROW (basic_block_for_insn, new_size);
|
|
|
|
|
}
|
|
|
|
|
VARRAY_BB (basic_block_for_insn, uid) = bb;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Record INSN's block number as BB. */
|
|
|
|
|
/* ??? This has got to go. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
set_block_num (insn, bb)
|
|
|
|
|
rtx insn;
|
|
|
|
|
int bb;
|
|
|
|
|
{
|
|
|
|
|
set_block_for_insn (insn, BASIC_BLOCK (bb));
|
|
|
|
|
}
|
1999-04-07 00:10:53 +02:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
/* Verify the CFG consistency. This function check some CFG invariants and
|
|
|
|
|
aborts when something is wrong. Hope that this function will help to
|
|
|
|
|
convert many optimization passes to preserve CFG consistent.
|
1999-08-25 00:35:55 +02:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
Currently it does following checks:
|
1999-08-25 00:35:55 +02:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
- test head/end pointers
|
|
|
|
|
- overlapping of basic blocks
|
|
|
|
|
- edge list corectness
|
|
|
|
|
- headers of basic blocks (the NOTE_INSN_BASIC_BLOCK note)
|
|
|
|
|
- tails of basic blocks (ensure that boundary is necesary)
|
|
|
|
|
- scans body of the basic block for JUMP_INSN, CODE_LABEL
|
|
|
|
|
and NOTE_INSN_BASIC_BLOCK
|
2000-08-11 14:45:05 +02:00
|
|
|
|
- check that all insns are in the basic blocks
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
(except the switch handling code, barriers and notes)
|
2000-03-14 22:21:18 +01:00
|
|
|
|
- check that all returns are followed by barriers
|
1999-08-25 00:35:55 +02:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
In future it can be extended check a lot of other stuff as well
|
|
|
|
|
(reachability of basic blocks, life information, etc. etc.). */
|
1999-08-25 00:35:55 +02:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
void
|
|
|
|
|
verify_flow_info ()
|
1999-08-25 00:35:55 +02:00
|
|
|
|
{
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
const int max_uid = get_max_uid ();
|
|
|
|
|
const rtx rtx_first = get_insns ();
|
2000-07-21 02:15:44 +02:00
|
|
|
|
rtx last_head = get_last_insn ();
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
basic_block *bb_info;
|
|
|
|
|
rtx x;
|
2000-05-03 18:39:55 +02:00
|
|
|
|
int i, last_bb_num_seen, num_bb_notes, err = 0;
|
1999-08-25 00:35:55 +02:00
|
|
|
|
|
1999-11-02 00:19:44 +01:00
|
|
|
|
bb_info = (basic_block *) xcalloc (max_uid, sizeof (basic_block));
|
1999-08-25 00:35:55 +02:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
for (i = n_basic_blocks - 1; i >= 0; i--)
|
1999-08-25 00:35:55 +02:00
|
|
|
|
{
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
basic_block bb = BASIC_BLOCK (i);
|
2000-07-21 02:15:44 +02:00
|
|
|
|
rtx head = bb->head;
|
|
|
|
|
rtx end = bb->end;
|
1999-08-25 00:35:55 +02:00
|
|
|
|
|
2000-07-21 02:15:44 +02:00
|
|
|
|
/* Verify the end of the basic block is in the INSN chain. */
|
|
|
|
|
for (x = last_head; x != NULL_RTX; x = PREV_INSN (x))
|
|
|
|
|
if (x == end)
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
break;
|
|
|
|
|
if (!x)
|
|
|
|
|
{
|
2000-07-21 02:15:44 +02:00
|
|
|
|
error ("End insn %d for block %d not found in the insn stream.",
|
|
|
|
|
INSN_UID (end), bb->index);
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
err = 1;
|
|
|
|
|
}
|
1999-08-25 00:35:55 +02:00
|
|
|
|
|
2000-07-21 02:15:44 +02:00
|
|
|
|
/* Work backwards from the end to the head of the basic block
|
|
|
|
|
to verify the head is in the RTL chain. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (; x != NULL_RTX; x = PREV_INSN (x))
|
1999-08-25 00:35:55 +02:00
|
|
|
|
{
|
2000-07-21 02:15:44 +02:00
|
|
|
|
/* While walking over the insn chain, verify insns appear
|
|
|
|
|
in only one basic block and initialize the BB_INFO array
|
|
|
|
|
used by other passes. */
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
if (bb_info[INSN_UID (x)] != NULL)
|
1999-08-25 00:35:55 +02:00
|
|
|
|
{
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
error ("Insn %d is in multiple basic blocks (%d and %d)",
|
|
|
|
|
INSN_UID (x), bb->index, bb_info[INSN_UID (x)]->index);
|
|
|
|
|
err = 1;
|
1999-08-25 00:35:55 +02:00
|
|
|
|
}
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
bb_info[INSN_UID (x)] = bb;
|
|
|
|
|
|
2000-07-21 02:15:44 +02:00
|
|
|
|
if (x == head)
|
1999-08-25 00:35:55 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
if (!x)
|
|
|
|
|
{
|
2000-07-21 02:15:44 +02:00
|
|
|
|
error ("Head insn %d for block %d not found in the insn stream.",
|
|
|
|
|
INSN_UID (head), bb->index);
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
err = 1;
|
|
|
|
|
}
|
2000-07-21 02:15:44 +02:00
|
|
|
|
|
|
|
|
|
last_head = x;
|
1999-08-25 00:35:55 +02:00
|
|
|
|
}
|
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
/* Now check the basic blocks (boundaries etc.) */
|
|
|
|
|
for (i = n_basic_blocks - 1; i >= 0; i--)
|
1999-08-25 00:35:55 +02:00
|
|
|
|
{
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
basic_block bb = BASIC_BLOCK (i);
|
|
|
|
|
/* Check corectness of edge lists */
|
|
|
|
|
edge e;
|
1999-08-25 00:35:55 +02:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
e = bb->succ;
|
|
|
|
|
while (e)
|
1999-08-25 00:35:55 +02:00
|
|
|
|
{
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
if (e->src != bb)
|
1999-08-25 00:35:55 +02:00
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
fprintf (stderr,
|
|
|
|
|
"verify_flow_info: Basic block %d succ edge is corrupted\n",
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
bb->index);
|
|
|
|
|
fprintf (stderr, "Predecessor: ");
|
|
|
|
|
dump_edge_info (stderr, e, 0);
|
|
|
|
|
fprintf (stderr, "\nSuccessor: ");
|
|
|
|
|
dump_edge_info (stderr, e, 1);
|
|
|
|
|
fflush (stderr);
|
|
|
|
|
err = 1;
|
1999-08-25 00:35:55 +02:00
|
|
|
|
}
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
if (e->dest != EXIT_BLOCK_PTR)
|
1999-08-25 00:35:55 +02:00
|
|
|
|
{
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
edge e2 = e->dest->pred;
|
|
|
|
|
while (e2 && e2 != e)
|
|
|
|
|
e2 = e2->pred_next;
|
|
|
|
|
if (!e2)
|
|
|
|
|
{
|
|
|
|
|
error ("Basic block %i edge lists are corrupted", bb->index);
|
|
|
|
|
err = 1;
|
|
|
|
|
}
|
1999-08-25 00:35:55 +02:00
|
|
|
|
}
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
e = e->succ_next;
|
1999-08-25 00:35:55 +02:00
|
|
|
|
}
|
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
e = bb->pred;
|
|
|
|
|
while (e)
|
1999-08-25 00:35:55 +02:00
|
|
|
|
{
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
if (e->dest != bb)
|
1999-08-25 00:35:55 +02:00
|
|
|
|
{
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
error ("Basic block %d pred edge is corrupted", bb->index);
|
|
|
|
|
fputs ("Predecessor: ", stderr);
|
|
|
|
|
dump_edge_info (stderr, e, 0);
|
|
|
|
|
fputs ("\nSuccessor: ", stderr);
|
|
|
|
|
dump_edge_info (stderr, e, 1);
|
|
|
|
|
fputc ('\n', stderr);
|
|
|
|
|
err = 1;
|
1999-04-07 00:10:53 +02:00
|
|
|
|
}
|
|
|
|
|
if (e->src != ENTRY_BLOCK_PTR)
|
|
|
|
|
{
|
|
|
|
|
edge e2 = e->src->succ;
|
|
|
|
|
while (e2 && e2 != e)
|
|
|
|
|
e2 = e2->succ_next;
|
|
|
|
|
if (!e2)
|
|
|
|
|
{
|
system.h: Don't redefine abort or trim_filename.
1999-08-25 22:10 -0700 Zack Weinberg <zack@bitmover.com>
* system.h: Don't redefine abort or trim_filename.
* rtl.h: Define abort to fancy_abort (__FILE__, __LINE__, 0)
or fancy_abort (__FILE__, __LINE__, __FUNCTION__) depending on
whether or not __FUNCTION__ is available.
* tree.h: Duplicate rtl.h's definition of abort, for files
that don't include rtl.h. Delete all code to perform type
checking with a compiler other than GCC.
* varray.h: Delete all code to perform type checking with a
compiler other than GCC. Make VARRAY_CHECK() always evaluate
its arguments exactly once, using a statement expression.
Adjust the VARRAY_<type> accessor macros to match.
* toplev.h (fatal_insn, fatal_insn_not_found): Kill.
(_fatal_insn, _fatal_insn_not_found): New fns, take info on
caller's location. Define fatal_insn and fatal_insn_not_found
as macros that use _fatal_insn and _fatal_insn_not_found.
(fancy_abort, trim_filename): Kill prototypes.
* rtl.c (trim_filename): Move here from toplev.c.
(fancy_abort): New function.
(DIR_SEPARATOR): Provide default definition.
* tree.c (tree_check_failed, tree_class_check_failed): Go
through fancy_abort.
(tree_check, tree_class_check, cst_or_constructor_check,
expr_check): Delete.
* varray.c (varray_check_failed): New function.
* toplev.c (fatal_insn, fatal_insn_not_found): Replace with
_fatal_insn and _fatal_insn_not_found. Go through
fancy_abort.
(trim_filename, fancy_abort): Delete.
* builtins.c (expand_builtin_args_info): Report ICE with abort.
* except.c (start_catch_handler): Report ICE with error/abort
combo.
* final.c (output_operand_lossage): Likewise.
* flow.c (verify_flow_info): Likewise.
* gcc.c: Prototype fatal.
* gengenrtl.c: Undef abort after including rtl.h not system.h.
* genattr.c, genattrtab.c, genemit.c, genextract.c,
genflags.c, genopinit.c, genoutput.c, genpeep.c, genrecog.c:
Don't define fancy_abort.
From-SVN: r28889
1999-08-26 07:18:44 +02:00
|
|
|
|
error ("Basic block %i edge lists are corrupted", bb->index);
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
err = 1;
|
1999-04-07 00:10:53 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
e = e->pred_next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* OK pointers are correct. Now check the header of basic
|
|
|
|
|
block. It ought to contain optional CODE_LABEL followed
|
|
|
|
|
by NOTE_BASIC_BLOCK. */
|
|
|
|
|
x = bb->head;
|
|
|
|
|
if (GET_CODE (x) == CODE_LABEL)
|
|
|
|
|
{
|
|
|
|
|
if (bb->end == x)
|
|
|
|
|
{
|
system.h: Don't redefine abort or trim_filename.
1999-08-25 22:10 -0700 Zack Weinberg <zack@bitmover.com>
* system.h: Don't redefine abort or trim_filename.
* rtl.h: Define abort to fancy_abort (__FILE__, __LINE__, 0)
or fancy_abort (__FILE__, __LINE__, __FUNCTION__) depending on
whether or not __FUNCTION__ is available.
* tree.h: Duplicate rtl.h's definition of abort, for files
that don't include rtl.h. Delete all code to perform type
checking with a compiler other than GCC.
* varray.h: Delete all code to perform type checking with a
compiler other than GCC. Make VARRAY_CHECK() always evaluate
its arguments exactly once, using a statement expression.
Adjust the VARRAY_<type> accessor macros to match.
* toplev.h (fatal_insn, fatal_insn_not_found): Kill.
(_fatal_insn, _fatal_insn_not_found): New fns, take info on
caller's location. Define fatal_insn and fatal_insn_not_found
as macros that use _fatal_insn and _fatal_insn_not_found.
(fancy_abort, trim_filename): Kill prototypes.
* rtl.c (trim_filename): Move here from toplev.c.
(fancy_abort): New function.
(DIR_SEPARATOR): Provide default definition.
* tree.c (tree_check_failed, tree_class_check_failed): Go
through fancy_abort.
(tree_check, tree_class_check, cst_or_constructor_check,
expr_check): Delete.
* varray.c (varray_check_failed): New function.
* toplev.c (fatal_insn, fatal_insn_not_found): Replace with
_fatal_insn and _fatal_insn_not_found. Go through
fancy_abort.
(trim_filename, fancy_abort): Delete.
* builtins.c (expand_builtin_args_info): Report ICE with abort.
* except.c (start_catch_handler): Report ICE with error/abort
combo.
* final.c (output_operand_lossage): Likewise.
* flow.c (verify_flow_info): Likewise.
* gcc.c: Prototype fatal.
* gengenrtl.c: Undef abort after including rtl.h not system.h.
* genattr.c, genattrtab.c, genemit.c, genextract.c,
genflags.c, genopinit.c, genoutput.c, genpeep.c, genrecog.c:
Don't define fancy_abort.
From-SVN: r28889
1999-08-26 07:18:44 +02:00
|
|
|
|
error ("NOTE_INSN_BASIC_BLOCK is missing for block %d",
|
|
|
|
|
bb->index);
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
err = 1;
|
1999-04-07 00:10:53 +02:00
|
|
|
|
}
|
|
|
|
|
x = NEXT_INSN (x);
|
|
|
|
|
}
|
2000-07-27 19:25:14 +02:00
|
|
|
|
if (!NOTE_INSN_BASIC_BLOCK_P (x) || NOTE_BASIC_BLOCK (x) != bb)
|
1999-04-07 00:10:53 +02:00
|
|
|
|
{
|
system.h: Don't redefine abort or trim_filename.
1999-08-25 22:10 -0700 Zack Weinberg <zack@bitmover.com>
* system.h: Don't redefine abort or trim_filename.
* rtl.h: Define abort to fancy_abort (__FILE__, __LINE__, 0)
or fancy_abort (__FILE__, __LINE__, __FUNCTION__) depending on
whether or not __FUNCTION__ is available.
* tree.h: Duplicate rtl.h's definition of abort, for files
that don't include rtl.h. Delete all code to perform type
checking with a compiler other than GCC.
* varray.h: Delete all code to perform type checking with a
compiler other than GCC. Make VARRAY_CHECK() always evaluate
its arguments exactly once, using a statement expression.
Adjust the VARRAY_<type> accessor macros to match.
* toplev.h (fatal_insn, fatal_insn_not_found): Kill.
(_fatal_insn, _fatal_insn_not_found): New fns, take info on
caller's location. Define fatal_insn and fatal_insn_not_found
as macros that use _fatal_insn and _fatal_insn_not_found.
(fancy_abort, trim_filename): Kill prototypes.
* rtl.c (trim_filename): Move here from toplev.c.
(fancy_abort): New function.
(DIR_SEPARATOR): Provide default definition.
* tree.c (tree_check_failed, tree_class_check_failed): Go
through fancy_abort.
(tree_check, tree_class_check, cst_or_constructor_check,
expr_check): Delete.
* varray.c (varray_check_failed): New function.
* toplev.c (fatal_insn, fatal_insn_not_found): Replace with
_fatal_insn and _fatal_insn_not_found. Go through
fancy_abort.
(trim_filename, fancy_abort): Delete.
* builtins.c (expand_builtin_args_info): Report ICE with abort.
* except.c (start_catch_handler): Report ICE with error/abort
combo.
* final.c (output_operand_lossage): Likewise.
* flow.c (verify_flow_info): Likewise.
* gcc.c: Prototype fatal.
* gengenrtl.c: Undef abort after including rtl.h not system.h.
* genattr.c, genattrtab.c, genemit.c, genextract.c,
genflags.c, genopinit.c, genoutput.c, genpeep.c, genrecog.c:
Don't define fancy_abort.
From-SVN: r28889
1999-08-26 07:18:44 +02:00
|
|
|
|
error ("NOTE_INSN_BASIC_BLOCK is missing for block %d\n",
|
1999-04-07 00:10:53 +02:00
|
|
|
|
bb->index);
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
err = 1;
|
1999-04-07 00:10:53 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bb->end == x)
|
|
|
|
|
{
|
|
|
|
|
/* Do checks for empty blocks here */
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
x = NEXT_INSN (x);
|
|
|
|
|
while (x)
|
|
|
|
|
{
|
2000-07-27 19:25:14 +02:00
|
|
|
|
if (NOTE_INSN_BASIC_BLOCK_P (x))
|
1999-04-07 00:10:53 +02:00
|
|
|
|
{
|
system.h: Don't redefine abort or trim_filename.
1999-08-25 22:10 -0700 Zack Weinberg <zack@bitmover.com>
* system.h: Don't redefine abort or trim_filename.
* rtl.h: Define abort to fancy_abort (__FILE__, __LINE__, 0)
or fancy_abort (__FILE__, __LINE__, __FUNCTION__) depending on
whether or not __FUNCTION__ is available.
* tree.h: Duplicate rtl.h's definition of abort, for files
that don't include rtl.h. Delete all code to perform type
checking with a compiler other than GCC.
* varray.h: Delete all code to perform type checking with a
compiler other than GCC. Make VARRAY_CHECK() always evaluate
its arguments exactly once, using a statement expression.
Adjust the VARRAY_<type> accessor macros to match.
* toplev.h (fatal_insn, fatal_insn_not_found): Kill.
(_fatal_insn, _fatal_insn_not_found): New fns, take info on
caller's location. Define fatal_insn and fatal_insn_not_found
as macros that use _fatal_insn and _fatal_insn_not_found.
(fancy_abort, trim_filename): Kill prototypes.
* rtl.c (trim_filename): Move here from toplev.c.
(fancy_abort): New function.
(DIR_SEPARATOR): Provide default definition.
* tree.c (tree_check_failed, tree_class_check_failed): Go
through fancy_abort.
(tree_check, tree_class_check, cst_or_constructor_check,
expr_check): Delete.
* varray.c (varray_check_failed): New function.
* toplev.c (fatal_insn, fatal_insn_not_found): Replace with
_fatal_insn and _fatal_insn_not_found. Go through
fancy_abort.
(trim_filename, fancy_abort): Delete.
* builtins.c (expand_builtin_args_info): Report ICE with abort.
* except.c (start_catch_handler): Report ICE with error/abort
combo.
* final.c (output_operand_lossage): Likewise.
* flow.c (verify_flow_info): Likewise.
* gcc.c: Prototype fatal.
* gengenrtl.c: Undef abort after including rtl.h not system.h.
* genattr.c, genattrtab.c, genemit.c, genextract.c,
genflags.c, genopinit.c, genoutput.c, genpeep.c, genrecog.c:
Don't define fancy_abort.
From-SVN: r28889
1999-08-26 07:18:44 +02:00
|
|
|
|
error ("NOTE_INSN_BASIC_BLOCK %d in the middle of basic block %d",
|
1999-04-07 00:10:53 +02:00
|
|
|
|
INSN_UID (x), bb->index);
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
err = 1;
|
1999-04-07 00:10:53 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (x == bb->end)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (x) == JUMP_INSN
|
|
|
|
|
|| GET_CODE (x) == CODE_LABEL
|
|
|
|
|
|| GET_CODE (x) == BARRIER)
|
|
|
|
|
{
|
system.h: Don't redefine abort or trim_filename.
1999-08-25 22:10 -0700 Zack Weinberg <zack@bitmover.com>
* system.h: Don't redefine abort or trim_filename.
* rtl.h: Define abort to fancy_abort (__FILE__, __LINE__, 0)
or fancy_abort (__FILE__, __LINE__, __FUNCTION__) depending on
whether or not __FUNCTION__ is available.
* tree.h: Duplicate rtl.h's definition of abort, for files
that don't include rtl.h. Delete all code to perform type
checking with a compiler other than GCC.
* varray.h: Delete all code to perform type checking with a
compiler other than GCC. Make VARRAY_CHECK() always evaluate
its arguments exactly once, using a statement expression.
Adjust the VARRAY_<type> accessor macros to match.
* toplev.h (fatal_insn, fatal_insn_not_found): Kill.
(_fatal_insn, _fatal_insn_not_found): New fns, take info on
caller's location. Define fatal_insn and fatal_insn_not_found
as macros that use _fatal_insn and _fatal_insn_not_found.
(fancy_abort, trim_filename): Kill prototypes.
* rtl.c (trim_filename): Move here from toplev.c.
(fancy_abort): New function.
(DIR_SEPARATOR): Provide default definition.
* tree.c (tree_check_failed, tree_class_check_failed): Go
through fancy_abort.
(tree_check, tree_class_check, cst_or_constructor_check,
expr_check): Delete.
* varray.c (varray_check_failed): New function.
* toplev.c (fatal_insn, fatal_insn_not_found): Replace with
_fatal_insn and _fatal_insn_not_found. Go through
fancy_abort.
(trim_filename, fancy_abort): Delete.
* builtins.c (expand_builtin_args_info): Report ICE with abort.
* except.c (start_catch_handler): Report ICE with error/abort
combo.
* final.c (output_operand_lossage): Likewise.
* flow.c (verify_flow_info): Likewise.
* gcc.c: Prototype fatal.
* gengenrtl.c: Undef abort after including rtl.h not system.h.
* genattr.c, genattrtab.c, genemit.c, genextract.c,
genflags.c, genopinit.c, genoutput.c, genpeep.c, genrecog.c:
Don't define fancy_abort.
From-SVN: r28889
1999-08-26 07:18:44 +02:00
|
|
|
|
error ("In basic block %d:", bb->index);
|
|
|
|
|
fatal_insn ("Flow control insn inside a basic block", x);
|
1999-04-07 00:10:53 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
x = NEXT_INSN (x);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-05-03 18:39:55 +02:00
|
|
|
|
last_bb_num_seen = -1;
|
|
|
|
|
num_bb_notes = 0;
|
1999-04-07 00:10:53 +02:00
|
|
|
|
x = rtx_first;
|
|
|
|
|
while (x)
|
|
|
|
|
{
|
2000-07-27 19:25:14 +02:00
|
|
|
|
if (NOTE_INSN_BASIC_BLOCK_P (x))
|
2000-05-03 18:39:55 +02:00
|
|
|
|
{
|
|
|
|
|
basic_block bb = NOTE_BASIC_BLOCK (x);
|
|
|
|
|
num_bb_notes++;
|
|
|
|
|
if (bb->index != last_bb_num_seen + 1)
|
diagnostic.h (set_internal_error_function): Renamed.
* diagnostic.h (set_internal_error_function): Renamed.
* toplev.h (internal_error): Renamed from fatal.
(pfatal_with_name): Deleted.
(fatal_io_error): Now has printf-style arguments.
* diagnostic.c (pfatal_with_name): Deleted.
(fatal_io_error): Rework to have args in printf-style.
(set_internal_error_function): Renamed from set_fatal_function.
(internal_error): Renamed from fatal.
(error_recursion, fancy_abort): Call internal_error instead of fatal.
* dwarf2out.c (get_cfa_from_loc_descr): Likewise.
* emit-rtl.c (gen_realpart, gen_imagpart): Likewise.
* expr.c (check_max_integer_computation_mode, expand_expr): Likewise.
* flow.c (verify_flow_info): Likewise.
* config/arm/arm.c (thumb_unexpanded_epilogue): Likewise.
* config/mips/mips.c (save_restore_insns): Likewise.
* cp/init.c (build_java_class_ref): Likewise.
(dsp16xx_reg_class_from_letter): Likewise.
(limit_reload_class, double_reg_to_memory): Likewise.
(print_operand_address, emit_1600_code_shift): Likewise.
(gen_tst_reg, gen_compare_reg): Likewise.
* config/m68hc11/m68hc11.c (m68hc11_emit_libcall): Likewise.
* cp/decl.c (pushdecl): Likewise.
* java/check-init.c (check_init): Likewise.
* java/expr.c (java_lang_expand_expr): Likewise.
* java/jcf-parse.c (get_constant): Likewise.
* java/mangle.c (java_mangle_decl): Likewise.
* java/parse.y (make_nested_class_name, java_complete_lhs): Likewise.
(operator_string): Likewise.
* except.c (duplicate_eh_handlers): Call abort instead of fatal.
* flow.c (verify_flow_info): Likewise.
* ch/convert.c (convert): Likewise.
* ch/except.c (pop_handler, chill_check_no_handlers): Likewise.
* ch/expr.c (chill_expand_expr): Likewise.
* ch/parse.c (peek_token_, pushback_token, require): Likewise.
* config/arm/arm.c (thumb_load_double_from_address): Likewise.
* config/avr/avr.c (pttreg_to_str, unique_section): Likewise.
(avr_normalize_condition): Likewise.
* config/c4x/c4x.c (c4x_emit_libcall, c4x_valid_operands): Likewise.
* config/dsp16xx/dsp16xx.c (dsp16xx_reg_class_from_letter): Likewise.
(limit_reload_class, double_reg_to_memory): Likewise.
(print_operand_address, emit_1600_code_shift): Likewise.
(gen_tst_reg, gen_compare_reg): Likewise.
* config/m68hc11/m68hc11.c (m68hc11_emit_libcall): Likewise.
* cp/decl.c (pushdecl): Likewise.
* java/check-init.c (check_init): Likewise.
* java/class.c (build_class_ref): Likewise.
* java/constants.c (write_constant_pool): Likewise.
* java/decl.c (start_java_method): Likewise.
* java/expr.c (push_type, java_stack_pop, java_stack_swap): Likewise.
(java_stack_dup, encode_newarray_type): Likewise.
(build_java_array_length_access): Likewise.
(build_java_check_indexed_type, expand_java_pushc): Likewise.
(build_java_soft_divmod, build_invokeinterface): Likewise.
* java/java-tree.h (INNER_CLASS_P): Likewise.
* java/jcf-parse.c (parse_signature, get_name_constant): Likewise.
(give_name_to_class, get_class_constant): Likewise.
* java/jcf-write.c (CHECK_PUT, CHECK_OP, get_access_flags): Likewise.
(find_constant_index, generate_bytecode_conditional): Likewise.
(generate_bytecode_insns, perform_relocations): Likewise.
* java/lex.c (java_unget_unicode, java_lex): Likewise.
* java/mangle.c (mangle_type, mangle_record_type): Likewise.
(mangle_pointer_type, mangle_array_type, init_mangling): Likewise.
(finish_mangling): Likewise.
* java/parse.h (MARK_FINAL_PARMS): Likewise.
* java/parse.y (pop_current_osb, unreachable_stmt_error): Likewise.
(obtain_incomplete_type, java_complete_class): Likewise.
(java_check_regular_methods, java_complete_expand_method): Likewise.
(cut_identifier_in_qualified, check_deprecation): Likewise.
(patch_invoke, find_applicable_accessible_methods_list): Likewise.
(java_complete_lhs, lookup_name_in_blocks): Likewise.
(check_final_variable_indirect_assignment, build_unaryop): Likewise.
* java/typeck.c (set_local_type, parse_signature_type): Likewise.
(parse_signature_string, build_java_signature): Likewise;
(set_java_signature): Likewise.
* java/verify.c (type_stack_dup, CHECK_PC_IN_RANGE): Likewise.
* c-parse.in (methoddef): Call fatal_error instead of fatal.
* objc/objc-act.c (build_ivar_chain): Likewise.
* cp/except.c (decl_is_java_type): Likewise.
* cp/init.c (build_java_class_ref): Likewise.
* cp/init.c (build_new_1): Likewise.
* f/com.c (ffecom_init_0): Likewise.
* java/class.c (add_method, build_static_field_ref): Likewise.
* java/expr.c (build_known_method_ref, expand_invoke): Likewise.
* java/jcf-parse.c (get_constant, jcf_parse): Likewise.
* java/lex.c (java_new_new_lexer): Likewise.
* java/jv-scan.c (main): Likewise.
(fatal_error): Renamed from fatal.
* dwarfout.c (dwarfout_init): Call fatal_io_error instead of
pfatal_with_name.
* graph.c (clean_graph_dump_file): Likewise.
* profile.c (init_branch_prob): Likewise.
* ch/grant.c (write_grant_file): Likewise.
* ch/lex.c (init_parse, same_file, yywrap): Likewise.
* f/com.c (init_parse): Likewise.
* java/jcf-parse.c (yyparse): Likewise.
* objc/objc-act.c (objc_init): Likewise.
* java/jcf-parse.c (jcf_parse_source): Call fatal_io_error, not fatal.
(yyparse): Likewise.
* java/jcf-write.c (make_class_file_name, write_classfile): Likewise.
* java/lex.c (java_get_line_col): Likewise.
* hash.c (hash_allocate): Don't check for failure returns from
obstack functions that can't fail.
(hash_table_init_n, hash_table_init): Likewise; also now return void.
* hash.h (hash_table_init_n, hash_table_init): Now return void.
* cp/decl.c (build_typename_type): hash_table_init now returns void.
* ch/lang.c (GNU_xref_begin, GNU_xref_end): Deleted.
* ch/lex.c (convert_bitstring): Delete check for alloca failure.
* config/dsp16xx/dsp16xx.c (dsp16xx_invalid_register_for_compare):
Deleted.
* config/dsp16xx/dsp16xx.md (unnamed cmphi): Call abort instead of it.
* f/com.c (ffecom_decode_include_option_): Make errors non-fatal.
* f/lex.c (ffelex_cfelex_, ffelex_get_directive_line_): Likewise.
(ffelex_hash_): Likewise.
* config/arm/arm.c (arm_override_options): Likewise.
* config/avr/avr.c (avr_override_options): Likewise.
* config/c4x/c4x.c (c4x_expand_prologue): Likewise.
* config/dsp16xx/dsp16xx.c (function_prologue): Likewise.
* config/h8300/h8300.c (h8300_init_once): Likewise.
* config/mips/mips.c (override_options): Likewise.
* config/i386/i386.c (override_options): Likewise, rework.
* config/m68k/m68k.c (override_options): Likewise.
* cp/decl.c (init_decl_processing): Likewise.
* java/jcf-parse.c (load_class): Likewise.
* config/dsp16xx/dsp16xx.c (print_operand): Call output_operand_lossage
instead of fatal.
* config/mips/mips.c (print_operand): Likewise.
* java/lex.c (byteswap_init, need_byteswap): Only #ifdef HAVE_ICONV.
* objc/objc_act.c (objc_check_decl): Remove unneeded fatal call.
(get_object_reference): Likewise.
From-SVN: r39443
2001-02-04 23:44:12 +01:00
|
|
|
|
/* Basic blocks not numbered consecutively. */
|
|
|
|
|
abort ();
|
|
|
|
|
|
2000-05-03 18:39:55 +02:00
|
|
|
|
last_bb_num_seen = bb->index;
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-07 00:10:53 +02:00
|
|
|
|
if (!bb_info[INSN_UID (x)])
|
|
|
|
|
{
|
|
|
|
|
switch (GET_CODE (x))
|
|
|
|
|
{
|
|
|
|
|
case BARRIER:
|
|
|
|
|
case NOTE:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case CODE_LABEL:
|
|
|
|
|
/* An addr_vec is placed outside any block block. */
|
|
|
|
|
if (NEXT_INSN (x)
|
|
|
|
|
&& GET_CODE (NEXT_INSN (x)) == JUMP_INSN
|
|
|
|
|
&& (GET_CODE (PATTERN (NEXT_INSN (x))) == ADDR_DIFF_VEC
|
|
|
|
|
|| GET_CODE (PATTERN (NEXT_INSN (x))) == ADDR_VEC))
|
|
|
|
|
{
|
|
|
|
|
x = NEXT_INSN (x);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* But in any case, non-deletable labels can appear anywhere. */
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
system.h: Don't redefine abort or trim_filename.
1999-08-25 22:10 -0700 Zack Weinberg <zack@bitmover.com>
* system.h: Don't redefine abort or trim_filename.
* rtl.h: Define abort to fancy_abort (__FILE__, __LINE__, 0)
or fancy_abort (__FILE__, __LINE__, __FUNCTION__) depending on
whether or not __FUNCTION__ is available.
* tree.h: Duplicate rtl.h's definition of abort, for files
that don't include rtl.h. Delete all code to perform type
checking with a compiler other than GCC.
* varray.h: Delete all code to perform type checking with a
compiler other than GCC. Make VARRAY_CHECK() always evaluate
its arguments exactly once, using a statement expression.
Adjust the VARRAY_<type> accessor macros to match.
* toplev.h (fatal_insn, fatal_insn_not_found): Kill.
(_fatal_insn, _fatal_insn_not_found): New fns, take info on
caller's location. Define fatal_insn and fatal_insn_not_found
as macros that use _fatal_insn and _fatal_insn_not_found.
(fancy_abort, trim_filename): Kill prototypes.
* rtl.c (trim_filename): Move here from toplev.c.
(fancy_abort): New function.
(DIR_SEPARATOR): Provide default definition.
* tree.c (tree_check_failed, tree_class_check_failed): Go
through fancy_abort.
(tree_check, tree_class_check, cst_or_constructor_check,
expr_check): Delete.
* varray.c (varray_check_failed): New function.
* toplev.c (fatal_insn, fatal_insn_not_found): Replace with
_fatal_insn and _fatal_insn_not_found. Go through
fancy_abort.
(trim_filename, fancy_abort): Delete.
* builtins.c (expand_builtin_args_info): Report ICE with abort.
* except.c (start_catch_handler): Report ICE with error/abort
combo.
* final.c (output_operand_lossage): Likewise.
* flow.c (verify_flow_info): Likewise.
* gcc.c: Prototype fatal.
* gengenrtl.c: Undef abort after including rtl.h not system.h.
* genattr.c, genattrtab.c, genemit.c, genextract.c,
genflags.c, genopinit.c, genoutput.c, genpeep.c, genrecog.c:
Don't define fancy_abort.
From-SVN: r28889
1999-08-26 07:18:44 +02:00
|
|
|
|
fatal_insn ("Insn outside basic block", x);
|
1999-04-07 00:10:53 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-04 22:28:08 +02:00
|
|
|
|
if (INSN_P (x)
|
2000-03-14 22:21:18 +01:00
|
|
|
|
&& GET_CODE (x) == JUMP_INSN
|
2000-03-15 21:24:35 +01:00
|
|
|
|
&& returnjump_p (x) && ! condjump_p (x)
|
2000-03-14 22:21:18 +01:00
|
|
|
|
&& ! (NEXT_INSN (x) && GET_CODE (NEXT_INSN (x)) == BARRIER))
|
|
|
|
|
fatal_insn ("Return not followed by barrier", x);
|
|
|
|
|
|
1999-04-07 00:10:53 +02:00
|
|
|
|
x = NEXT_INSN (x);
|
|
|
|
|
}
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
|
2000-05-03 18:39:55 +02:00
|
|
|
|
if (num_bb_notes != n_basic_blocks)
|
diagnostic.h (set_internal_error_function): Renamed.
* diagnostic.h (set_internal_error_function): Renamed.
* toplev.h (internal_error): Renamed from fatal.
(pfatal_with_name): Deleted.
(fatal_io_error): Now has printf-style arguments.
* diagnostic.c (pfatal_with_name): Deleted.
(fatal_io_error): Rework to have args in printf-style.
(set_internal_error_function): Renamed from set_fatal_function.
(internal_error): Renamed from fatal.
(error_recursion, fancy_abort): Call internal_error instead of fatal.
* dwarf2out.c (get_cfa_from_loc_descr): Likewise.
* emit-rtl.c (gen_realpart, gen_imagpart): Likewise.
* expr.c (check_max_integer_computation_mode, expand_expr): Likewise.
* flow.c (verify_flow_info): Likewise.
* config/arm/arm.c (thumb_unexpanded_epilogue): Likewise.
* config/mips/mips.c (save_restore_insns): Likewise.
* cp/init.c (build_java_class_ref): Likewise.
(dsp16xx_reg_class_from_letter): Likewise.
(limit_reload_class, double_reg_to_memory): Likewise.
(print_operand_address, emit_1600_code_shift): Likewise.
(gen_tst_reg, gen_compare_reg): Likewise.
* config/m68hc11/m68hc11.c (m68hc11_emit_libcall): Likewise.
* cp/decl.c (pushdecl): Likewise.
* java/check-init.c (check_init): Likewise.
* java/expr.c (java_lang_expand_expr): Likewise.
* java/jcf-parse.c (get_constant): Likewise.
* java/mangle.c (java_mangle_decl): Likewise.
* java/parse.y (make_nested_class_name, java_complete_lhs): Likewise.
(operator_string): Likewise.
* except.c (duplicate_eh_handlers): Call abort instead of fatal.
* flow.c (verify_flow_info): Likewise.
* ch/convert.c (convert): Likewise.
* ch/except.c (pop_handler, chill_check_no_handlers): Likewise.
* ch/expr.c (chill_expand_expr): Likewise.
* ch/parse.c (peek_token_, pushback_token, require): Likewise.
* config/arm/arm.c (thumb_load_double_from_address): Likewise.
* config/avr/avr.c (pttreg_to_str, unique_section): Likewise.
(avr_normalize_condition): Likewise.
* config/c4x/c4x.c (c4x_emit_libcall, c4x_valid_operands): Likewise.
* config/dsp16xx/dsp16xx.c (dsp16xx_reg_class_from_letter): Likewise.
(limit_reload_class, double_reg_to_memory): Likewise.
(print_operand_address, emit_1600_code_shift): Likewise.
(gen_tst_reg, gen_compare_reg): Likewise.
* config/m68hc11/m68hc11.c (m68hc11_emit_libcall): Likewise.
* cp/decl.c (pushdecl): Likewise.
* java/check-init.c (check_init): Likewise.
* java/class.c (build_class_ref): Likewise.
* java/constants.c (write_constant_pool): Likewise.
* java/decl.c (start_java_method): Likewise.
* java/expr.c (push_type, java_stack_pop, java_stack_swap): Likewise.
(java_stack_dup, encode_newarray_type): Likewise.
(build_java_array_length_access): Likewise.
(build_java_check_indexed_type, expand_java_pushc): Likewise.
(build_java_soft_divmod, build_invokeinterface): Likewise.
* java/java-tree.h (INNER_CLASS_P): Likewise.
* java/jcf-parse.c (parse_signature, get_name_constant): Likewise.
(give_name_to_class, get_class_constant): Likewise.
* java/jcf-write.c (CHECK_PUT, CHECK_OP, get_access_flags): Likewise.
(find_constant_index, generate_bytecode_conditional): Likewise.
(generate_bytecode_insns, perform_relocations): Likewise.
* java/lex.c (java_unget_unicode, java_lex): Likewise.
* java/mangle.c (mangle_type, mangle_record_type): Likewise.
(mangle_pointer_type, mangle_array_type, init_mangling): Likewise.
(finish_mangling): Likewise.
* java/parse.h (MARK_FINAL_PARMS): Likewise.
* java/parse.y (pop_current_osb, unreachable_stmt_error): Likewise.
(obtain_incomplete_type, java_complete_class): Likewise.
(java_check_regular_methods, java_complete_expand_method): Likewise.
(cut_identifier_in_qualified, check_deprecation): Likewise.
(patch_invoke, find_applicable_accessible_methods_list): Likewise.
(java_complete_lhs, lookup_name_in_blocks): Likewise.
(check_final_variable_indirect_assignment, build_unaryop): Likewise.
* java/typeck.c (set_local_type, parse_signature_type): Likewise.
(parse_signature_string, build_java_signature): Likewise;
(set_java_signature): Likewise.
* java/verify.c (type_stack_dup, CHECK_PC_IN_RANGE): Likewise.
* c-parse.in (methoddef): Call fatal_error instead of fatal.
* objc/objc-act.c (build_ivar_chain): Likewise.
* cp/except.c (decl_is_java_type): Likewise.
* cp/init.c (build_java_class_ref): Likewise.
* cp/init.c (build_new_1): Likewise.
* f/com.c (ffecom_init_0): Likewise.
* java/class.c (add_method, build_static_field_ref): Likewise.
* java/expr.c (build_known_method_ref, expand_invoke): Likewise.
* java/jcf-parse.c (get_constant, jcf_parse): Likewise.
* java/lex.c (java_new_new_lexer): Likewise.
* java/jv-scan.c (main): Likewise.
(fatal_error): Renamed from fatal.
* dwarfout.c (dwarfout_init): Call fatal_io_error instead of
pfatal_with_name.
* graph.c (clean_graph_dump_file): Likewise.
* profile.c (init_branch_prob): Likewise.
* ch/grant.c (write_grant_file): Likewise.
* ch/lex.c (init_parse, same_file, yywrap): Likewise.
* f/com.c (init_parse): Likewise.
* java/jcf-parse.c (yyparse): Likewise.
* objc/objc-act.c (objc_init): Likewise.
* java/jcf-parse.c (jcf_parse_source): Call fatal_io_error, not fatal.
(yyparse): Likewise.
* java/jcf-write.c (make_class_file_name, write_classfile): Likewise.
* java/lex.c (java_get_line_col): Likewise.
* hash.c (hash_allocate): Don't check for failure returns from
obstack functions that can't fail.
(hash_table_init_n, hash_table_init): Likewise; also now return void.
* hash.h (hash_table_init_n, hash_table_init): Now return void.
* cp/decl.c (build_typename_type): hash_table_init now returns void.
* ch/lang.c (GNU_xref_begin, GNU_xref_end): Deleted.
* ch/lex.c (convert_bitstring): Delete check for alloca failure.
* config/dsp16xx/dsp16xx.c (dsp16xx_invalid_register_for_compare):
Deleted.
* config/dsp16xx/dsp16xx.md (unnamed cmphi): Call abort instead of it.
* f/com.c (ffecom_decode_include_option_): Make errors non-fatal.
* f/lex.c (ffelex_cfelex_, ffelex_get_directive_line_): Likewise.
(ffelex_hash_): Likewise.
* config/arm/arm.c (arm_override_options): Likewise.
* config/avr/avr.c (avr_override_options): Likewise.
* config/c4x/c4x.c (c4x_expand_prologue): Likewise.
* config/dsp16xx/dsp16xx.c (function_prologue): Likewise.
* config/h8300/h8300.c (h8300_init_once): Likewise.
* config/mips/mips.c (override_options): Likewise.
* config/i386/i386.c (override_options): Likewise, rework.
* config/m68k/m68k.c (override_options): Likewise.
* cp/decl.c (init_decl_processing): Likewise.
* java/jcf-parse.c (load_class): Likewise.
* config/dsp16xx/dsp16xx.c (print_operand): Call output_operand_lossage
instead of fatal.
* config/mips/mips.c (print_operand): Likewise.
* java/lex.c (byteswap_init, need_byteswap): Only #ifdef HAVE_ICONV.
* objc/objc_act.c (objc_check_decl): Remove unneeded fatal call.
(get_object_reference): Likewise.
From-SVN: r39443
2001-02-04 23:44:12 +01:00
|
|
|
|
internal_error
|
|
|
|
|
("number of bb notes in insn chain (%d) != n_basic_blocks (%d)",
|
|
|
|
|
num_bb_notes, n_basic_blocks);
|
2000-05-03 18:39:55 +02:00
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
if (err)
|
|
|
|
|
abort ();
|
1999-11-02 00:19:44 +01:00
|
|
|
|
|
|
|
|
|
/* Clean up. */
|
|
|
|
|
free (bb_info);
|
1999-04-07 00:10:53 +02:00
|
|
|
|
}
|
1999-08-17 00:14:51 +02:00
|
|
|
|
|
|
|
|
|
/* Functions to access an edge list with a vector representation.
|
2000-08-11 14:45:05 +02:00
|
|
|
|
Enough data is kept such that given an index number, the
|
2000-07-23 01:29:14 +02:00
|
|
|
|
pred and succ that edge represents can be determined, or
|
|
|
|
|
given a pred and a succ, its index number can be returned.
|
2000-08-11 14:45:05 +02:00
|
|
|
|
This allows algorithms which consume a lot of memory to
|
1999-08-17 00:14:51 +02:00
|
|
|
|
represent the normally full matrix of edge (pred,succ) with a
|
|
|
|
|
single indexed vector, edge (EDGE_INDEX (pred, succ)), with no
|
|
|
|
|
wasted space in the client code due to sparse flow graphs. */
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* This functions initializes the edge list. Basically the entire
|
1999-08-17 00:14:51 +02:00
|
|
|
|
flowgraph is processed, and all edges are assigned a number,
|
2000-07-23 01:29:14 +02:00
|
|
|
|
and the data structure is filled in. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-08-17 00:14:51 +02:00
|
|
|
|
struct edge_list *
|
|
|
|
|
create_edge_list ()
|
|
|
|
|
{
|
|
|
|
|
struct edge_list *elist;
|
|
|
|
|
edge e;
|
|
|
|
|
int num_edges;
|
1999-09-02 19:29:25 +02:00
|
|
|
|
int x;
|
1999-08-17 00:14:51 +02:00
|
|
|
|
int block_count;
|
|
|
|
|
|
|
|
|
|
block_count = n_basic_blocks + 2; /* Include the entry and exit blocks. */
|
|
|
|
|
|
|
|
|
|
num_edges = 0;
|
|
|
|
|
|
|
|
|
|
/* Determine the number of edges in the flow graph by counting successor
|
|
|
|
|
edges on each basic block. */
|
|
|
|
|
for (x = 0; x < n_basic_blocks; x++)
|
|
|
|
|
{
|
|
|
|
|
basic_block bb = BASIC_BLOCK (x);
|
|
|
|
|
|
|
|
|
|
for (e = bb->succ; e; e = e->succ_next)
|
|
|
|
|
num_edges++;
|
|
|
|
|
}
|
|
|
|
|
/* Don't forget successors of the entry block. */
|
|
|
|
|
for (e = ENTRY_BLOCK_PTR->succ; e; e = e->succ_next)
|
|
|
|
|
num_edges++;
|
|
|
|
|
|
1999-12-13 08:55:53 +01:00
|
|
|
|
elist = (struct edge_list *) xmalloc (sizeof (struct edge_list));
|
1999-08-17 00:14:51 +02:00
|
|
|
|
elist->num_blocks = block_count;
|
|
|
|
|
elist->num_edges = num_edges;
|
1999-12-13 08:55:53 +01:00
|
|
|
|
elist->index_to_edge = (edge *) xmalloc (sizeof (edge) * num_edges);
|
1999-08-17 00:14:51 +02:00
|
|
|
|
|
|
|
|
|
num_edges = 0;
|
|
|
|
|
|
|
|
|
|
/* Follow successors of the entry block, and register these edges. */
|
|
|
|
|
for (e = ENTRY_BLOCK_PTR->succ; e; e = e->succ_next)
|
|
|
|
|
{
|
|
|
|
|
elist->index_to_edge[num_edges] = e;
|
|
|
|
|
num_edges++;
|
|
|
|
|
}
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-08-17 00:14:51 +02:00
|
|
|
|
for (x = 0; x < n_basic_blocks; x++)
|
|
|
|
|
{
|
|
|
|
|
basic_block bb = BASIC_BLOCK (x);
|
|
|
|
|
|
|
|
|
|
/* Follow all successors of blocks, and register these edges. */
|
|
|
|
|
for (e = bb->succ; e; e = e->succ_next)
|
|
|
|
|
{
|
|
|
|
|
elist->index_to_edge[num_edges] = e;
|
|
|
|
|
num_edges++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return elist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This function free's memory associated with an edge list. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-08-17 00:14:51 +02:00
|
|
|
|
void
|
|
|
|
|
free_edge_list (elist)
|
|
|
|
|
struct edge_list *elist;
|
|
|
|
|
{
|
|
|
|
|
if (elist)
|
|
|
|
|
{
|
|
|
|
|
free (elist->index_to_edge);
|
|
|
|
|
free (elist);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This function provides debug output showing an edge list. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
|
|
|
|
void
|
1999-08-17 00:14:51 +02:00
|
|
|
|
print_edge_list (f, elist)
|
|
|
|
|
FILE *f;
|
|
|
|
|
struct edge_list *elist;
|
|
|
|
|
{
|
|
|
|
|
int x;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
fprintf (f, "Compressed edge list, %d BBs + entry & exit, and %d edges\n",
|
|
|
|
|
elist->num_blocks - 2, elist->num_edges);
|
1999-08-17 00:14:51 +02:00
|
|
|
|
|
|
|
|
|
for (x = 0; x < elist->num_edges; x++)
|
|
|
|
|
{
|
|
|
|
|
fprintf (f, " %-4d - edge(", x);
|
|
|
|
|
if (INDEX_EDGE_PRED_BB (elist, x) == ENTRY_BLOCK_PTR)
|
2000-08-11 14:45:05 +02:00
|
|
|
|
fprintf (f, "entry,");
|
1999-08-17 00:14:51 +02:00
|
|
|
|
else
|
2000-08-11 14:45:05 +02:00
|
|
|
|
fprintf (f, "%d,", INDEX_EDGE_PRED_BB (elist, x)->index);
|
1999-08-17 00:14:51 +02:00
|
|
|
|
|
|
|
|
|
if (INDEX_EDGE_SUCC_BB (elist, x) == EXIT_BLOCK_PTR)
|
2000-08-11 14:45:05 +02:00
|
|
|
|
fprintf (f, "exit)\n");
|
1999-08-17 00:14:51 +02:00
|
|
|
|
else
|
2000-08-11 14:45:05 +02:00
|
|
|
|
fprintf (f, "%d)\n", INDEX_EDGE_SUCC_BB (elist, x)->index);
|
1999-08-17 00:14:51 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-07-23 01:29:14 +02:00
|
|
|
|
/* This function provides an internal consistency check of an edge list,
|
2000-08-11 14:45:05 +02:00
|
|
|
|
verifying that all edges are present, and that there are no
|
1999-08-17 00:14:51 +02:00
|
|
|
|
extra edges. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-08-17 00:14:51 +02:00
|
|
|
|
void
|
|
|
|
|
verify_edge_list (f, elist)
|
|
|
|
|
FILE *f;
|
|
|
|
|
struct edge_list *elist;
|
|
|
|
|
{
|
|
|
|
|
int x, pred, succ, index;
|
|
|
|
|
edge e;
|
|
|
|
|
|
|
|
|
|
for (x = 0; x < n_basic_blocks; x++)
|
|
|
|
|
{
|
|
|
|
|
basic_block bb = BASIC_BLOCK (x);
|
|
|
|
|
|
|
|
|
|
for (e = bb->succ; e; e = e->succ_next)
|
|
|
|
|
{
|
|
|
|
|
pred = e->src->index;
|
|
|
|
|
succ = e->dest->index;
|
1999-09-23 17:07:26 +02:00
|
|
|
|
index = EDGE_INDEX (elist, e->src, e->dest);
|
1999-08-17 00:14:51 +02:00
|
|
|
|
if (index == EDGE_INDEX_NO_EDGE)
|
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
fprintf (f, "*p* No index for edge from %d to %d\n", pred, succ);
|
1999-08-17 00:14:51 +02:00
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (INDEX_EDGE_PRED_BB (elist, index)->index != pred)
|
|
|
|
|
fprintf (f, "*p* Pred for index %d should be %d not %d\n",
|
|
|
|
|
index, pred, INDEX_EDGE_PRED_BB (elist, index)->index);
|
|
|
|
|
if (INDEX_EDGE_SUCC_BB (elist, index)->index != succ)
|
|
|
|
|
fprintf (f, "*p* Succ for index %d should be %d not %d\n",
|
|
|
|
|
index, succ, INDEX_EDGE_SUCC_BB (elist, index)->index);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (e = ENTRY_BLOCK_PTR->succ; e; e = e->succ_next)
|
|
|
|
|
{
|
|
|
|
|
pred = e->src->index;
|
|
|
|
|
succ = e->dest->index;
|
1999-09-23 17:07:26 +02:00
|
|
|
|
index = EDGE_INDEX (elist, e->src, e->dest);
|
1999-08-17 00:14:51 +02:00
|
|
|
|
if (index == EDGE_INDEX_NO_EDGE)
|
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
fprintf (f, "*p* No index for edge from %d to %d\n", pred, succ);
|
1999-08-17 00:14:51 +02:00
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (INDEX_EDGE_PRED_BB (elist, index)->index != pred)
|
|
|
|
|
fprintf (f, "*p* Pred for index %d should be %d not %d\n",
|
|
|
|
|
index, pred, INDEX_EDGE_PRED_BB (elist, index)->index);
|
|
|
|
|
if (INDEX_EDGE_SUCC_BB (elist, index)->index != succ)
|
|
|
|
|
fprintf (f, "*p* Succ for index %d should be %d not %d\n",
|
|
|
|
|
index, succ, INDEX_EDGE_SUCC_BB (elist, index)->index);
|
|
|
|
|
}
|
|
|
|
|
/* We've verified that all the edges are in the list, no lets make sure
|
|
|
|
|
there are no spurious edges in the list. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
|
|
|
|
for (pred = 0; pred < n_basic_blocks; pred++)
|
|
|
|
|
for (succ = 0; succ < n_basic_blocks; succ++)
|
1999-08-17 00:14:51 +02:00
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
basic_block p = BASIC_BLOCK (pred);
|
|
|
|
|
basic_block s = BASIC_BLOCK (succ);
|
1999-08-17 00:14:51 +02:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
int found_edge = 0;
|
1999-08-17 00:14:51 +02:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = p->succ; e; e = e->succ_next)
|
|
|
|
|
if (e->dest == s)
|
1999-08-17 00:14:51 +02:00
|
|
|
|
{
|
|
|
|
|
found_edge = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = s->pred; e; e = e->pred_next)
|
|
|
|
|
if (e->src == p)
|
1999-08-17 00:14:51 +02:00
|
|
|
|
{
|
|
|
|
|
found_edge = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2000-08-11 14:45:05 +02:00
|
|
|
|
if (EDGE_INDEX (elist, BASIC_BLOCK (pred), BASIC_BLOCK (succ))
|
1999-09-23 17:07:26 +02:00
|
|
|
|
== EDGE_INDEX_NO_EDGE && found_edge != 0)
|
1999-08-17 00:14:51 +02:00
|
|
|
|
fprintf (f, "*** Edge (%d, %d) appears to not have an index\n",
|
2000-08-11 14:45:05 +02:00
|
|
|
|
pred, succ);
|
|
|
|
|
if (EDGE_INDEX (elist, BASIC_BLOCK (pred), BASIC_BLOCK (succ))
|
1999-09-23 17:07:26 +02:00
|
|
|
|
!= EDGE_INDEX_NO_EDGE && found_edge == 0)
|
1999-08-17 00:14:51 +02:00
|
|
|
|
fprintf (f, "*** Edge (%d, %d) has index %d, but there is no edge\n",
|
2001-01-02 08:00:49 +01:00
|
|
|
|
pred, succ, EDGE_INDEX (elist, BASIC_BLOCK (pred),
|
1999-09-23 17:07:26 +02:00
|
|
|
|
BASIC_BLOCK (succ)));
|
1999-08-17 00:14:51 +02:00
|
|
|
|
}
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (succ = 0; succ < n_basic_blocks; succ++)
|
|
|
|
|
{
|
|
|
|
|
basic_block p = ENTRY_BLOCK_PTR;
|
|
|
|
|
basic_block s = BASIC_BLOCK (succ);
|
1999-08-17 00:14:51 +02:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
int found_edge = 0;
|
1999-08-17 00:14:51 +02:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = p->succ; e; e = e->succ_next)
|
|
|
|
|
if (e->dest == s)
|
|
|
|
|
{
|
|
|
|
|
found_edge = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
for (e = s->pred; e; e = e->pred_next)
|
|
|
|
|
if (e->src == p)
|
|
|
|
|
{
|
|
|
|
|
found_edge = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (EDGE_INDEX (elist, ENTRY_BLOCK_PTR, BASIC_BLOCK (succ))
|
|
|
|
|
== EDGE_INDEX_NO_EDGE && found_edge != 0)
|
|
|
|
|
fprintf (f, "*** Edge (entry, %d) appears to not have an index\n",
|
|
|
|
|
succ);
|
|
|
|
|
if (EDGE_INDEX (elist, ENTRY_BLOCK_PTR, BASIC_BLOCK (succ))
|
|
|
|
|
!= EDGE_INDEX_NO_EDGE && found_edge == 0)
|
|
|
|
|
fprintf (f, "*** Edge (entry, %d) has index %d, but no edge exists\n",
|
|
|
|
|
succ, EDGE_INDEX (elist, ENTRY_BLOCK_PTR,
|
|
|
|
|
BASIC_BLOCK (succ)));
|
|
|
|
|
}
|
|
|
|
|
for (pred = 0; pred < n_basic_blocks; pred++)
|
|
|
|
|
{
|
|
|
|
|
basic_block p = BASIC_BLOCK (pred);
|
|
|
|
|
basic_block s = EXIT_BLOCK_PTR;
|
1999-08-17 00:14:51 +02:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
int found_edge = 0;
|
1999-08-17 00:14:51 +02:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = p->succ; e; e = e->succ_next)
|
|
|
|
|
if (e->dest == s)
|
|
|
|
|
{
|
|
|
|
|
found_edge = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
for (e = s->pred; e; e = e->pred_next)
|
|
|
|
|
if (e->src == p)
|
|
|
|
|
{
|
|
|
|
|
found_edge = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (EDGE_INDEX (elist, BASIC_BLOCK (pred), EXIT_BLOCK_PTR)
|
|
|
|
|
== EDGE_INDEX_NO_EDGE && found_edge != 0)
|
|
|
|
|
fprintf (f, "*** Edge (%d, exit) appears to not have an index\n",
|
|
|
|
|
pred);
|
|
|
|
|
if (EDGE_INDEX (elist, BASIC_BLOCK (pred), EXIT_BLOCK_PTR)
|
|
|
|
|
!= EDGE_INDEX_NO_EDGE && found_edge == 0)
|
|
|
|
|
fprintf (f, "*** Edge (%d, exit) has index %d, but no edge exists\n",
|
|
|
|
|
pred, EDGE_INDEX (elist, BASIC_BLOCK (pred),
|
|
|
|
|
EXIT_BLOCK_PTR));
|
|
|
|
|
}
|
1999-08-17 00:14:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This routine will determine what, if any, edge there is between
|
|
|
|
|
a specified predecessor and successor. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-08-17 00:14:51 +02:00
|
|
|
|
int
|
|
|
|
|
find_edge_index (edge_list, pred, succ)
|
|
|
|
|
struct edge_list *edge_list;
|
1999-09-23 17:07:26 +02:00
|
|
|
|
basic_block pred, succ;
|
1999-08-17 00:14:51 +02:00
|
|
|
|
{
|
|
|
|
|
int x;
|
|
|
|
|
for (x = 0; x < NUM_EDGES (edge_list); x++)
|
|
|
|
|
{
|
1999-09-23 17:07:26 +02:00
|
|
|
|
if (INDEX_EDGE_PRED_BB (edge_list, x) == pred
|
|
|
|
|
&& INDEX_EDGE_SUCC_BB (edge_list, x) == succ)
|
1999-08-17 00:14:51 +02:00
|
|
|
|
return x;
|
|
|
|
|
}
|
|
|
|
|
return (EDGE_INDEX_NO_EDGE);
|
|
|
|
|
}
|
|
|
|
|
|
1999-09-21 20:54:34 +02:00
|
|
|
|
/* This function will remove an edge from the flow graph. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-02-06 14:01:03 +01:00
|
|
|
|
void
|
1999-09-21 20:54:34 +02:00
|
|
|
|
remove_edge (e)
|
|
|
|
|
edge e;
|
|
|
|
|
{
|
|
|
|
|
edge last_pred = NULL;
|
|
|
|
|
edge last_succ = NULL;
|
|
|
|
|
edge tmp;
|
|
|
|
|
basic_block src, dest;
|
|
|
|
|
src = e->src;
|
|
|
|
|
dest = e->dest;
|
|
|
|
|
for (tmp = src->succ; tmp && tmp != e; tmp = tmp->succ_next)
|
|
|
|
|
last_succ = tmp;
|
|
|
|
|
|
|
|
|
|
if (!tmp)
|
|
|
|
|
abort ();
|
|
|
|
|
if (last_succ)
|
|
|
|
|
last_succ->succ_next = e->succ_next;
|
|
|
|
|
else
|
|
|
|
|
src->succ = e->succ_next;
|
|
|
|
|
|
|
|
|
|
for (tmp = dest->pred; tmp && tmp != e; tmp = tmp->pred_next)
|
|
|
|
|
last_pred = tmp;
|
|
|
|
|
|
|
|
|
|
if (!tmp)
|
|
|
|
|
abort ();
|
|
|
|
|
if (last_pred)
|
|
|
|
|
last_pred->pred_next = e->pred_next;
|
|
|
|
|
else
|
|
|
|
|
dest->pred = e->pred_next;
|
|
|
|
|
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
n_edges--;
|
1999-09-21 20:54:34 +02:00
|
|
|
|
free (e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This routine will remove any fake successor edges for a basic block.
|
|
|
|
|
When the edge is removed, it is also removed from whatever predecessor
|
|
|
|
|
list it is in. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-09-21 20:54:34 +02:00
|
|
|
|
static void
|
|
|
|
|
remove_fake_successors (bb)
|
|
|
|
|
basic_block bb;
|
|
|
|
|
{
|
|
|
|
|
edge e;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (e = bb->succ; e;)
|
1999-09-21 20:54:34 +02:00
|
|
|
|
{
|
|
|
|
|
edge tmp = e;
|
|
|
|
|
e = e->succ_next;
|
|
|
|
|
if ((tmp->flags & EDGE_FAKE) == EDGE_FAKE)
|
|
|
|
|
remove_edge (tmp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This routine will remove all fake edges from the flow graph. If
|
|
|
|
|
we remove all fake successors, it will automatically remove all
|
|
|
|
|
fake predecessors. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-09-21 20:54:34 +02:00
|
|
|
|
void
|
|
|
|
|
remove_fake_edges ()
|
|
|
|
|
{
|
|
|
|
|
int x;
|
|
|
|
|
|
|
|
|
|
for (x = 0; x < n_basic_blocks; x++)
|
Makefile.in (flow.o): Depend on TREE_H.
* Makefile.in (flow.o): Depend on TREE_H.
* basic-block.h (REG_SET_EQUAL_P): New.
(XOR_REG_SET): New.
(n_edges): Declare.
(free_regset_vector): Remove declaration.
(flow_delete_insn_chain): Declare.
(enum update_life_extent): New.
(update_life_info, count_or_remove_death_notes): Declare.
* combine.c (distribute_notes) [REG_DEAD]: Stop search at bb->head.
Verify register live at bb->global_live_at_start before adding USE.
* flow.c (HAVE_epilogue, HAVE_prologue): Provide default.
(CLEAN_ALLOCA): New.
(n_edges): New.
(PROP_*): New flags.
(find_basic_blocks_1): Use alloc_EXPR_LIST.
(clear_edges): Zero n_edges.
(make_edge): Increment n_edges.
(split_edge): Don't allocate bb->local_set. Increment n_edges.
(flow_delete_insn_chain): Export.
(delete_block): Decrement n_edges.
(merge_blocks_nomove): Likewise.
(life_analysis): Give life_analysis_1 PROP flags.
(verify_wide_reg_1, verify_wide_reg): New.
(verify_local_live_at_start): New.
(update_life_info): Rewrite to call into propogate_block.
(mark_reg): New.
(mark_regs_live_at_end): After reload, if epilogue as rtl,
always mark stack pointer. Conditionally mark PIC register.
After reload, mark call-saved registers, return regsiters.
(life_analysis_1): Accept PROP flags not remove_dead_code.
Call mark_regs_live_at_end before zeroing regs_ever_live.
Use calculate_global_regs_live. Copy global_live_at_end before
calling final propagate_block. Zero reg_next_use on exit.
(calculate_global_regs_live): New.
(allocate_bb_life_data): Don't allocate bb->local_set.
(init_regset_vector, free_regset_vector): Remove.
(propagate_block): Accept FLAGS not FINAL or REMOVE_DEAD_CODE.
Test flags before every operation. Warn if prologue/epilogue insn
would have been deleted.
(mark_set_regs, mark_set_1): Accept and use FLAGS.
Use alloc_EXPR_LIST.
(mark_used_regs): Accept and use FLAGS, not FINAL.
Remove special handling for RETURN.
(try_pre_increment): Use alloc_EXPR_LIST.
(dump_flow_info): Dump n_edges.
(unlink_insn_chain, split_hard_reg_notes): Remove.
(maybe_add_dead_note, maybe_add_dead_note_use): Remove.
(find_insn_with_note, new_insn_dead_notes): Remove.
(update_n_sets, sets_reg_or_subreg_1, sets_reg_or_subreg): Remove.
(maybe_remove_dead_notes, prepend_reg_notes): Remove.
(replace_insns): Remove.
(count_or_remove_death_notes): New.
(verify_flow_info): Abort on error after all checks.
(remove_edge): Decrement n_edges.
(remove_fake_edges): Tweek format.
* haifa-sched.c (schedule_insns): Use split_all_insns.
* output.h (update_life_info): Remove declaration.
* recog.c (split_all_insns): From the corpse of split_block_insns,
do the whole function block by block. Use update_life_info.
(recog_last_allowed_insn): New.
(recog_next_insn): Mind it.
(peephole2_optimize): Set it. Walk backwards through blocks.
Use update_life_info.
* rtl.h (update_flow_info, replace_insns): Remove declarations.
(split_all_insns): Declare.
* toplev.c (rest_of_compilation): Thread prologue before flow2.
Use split_all_insns.
* i386.md (or -1 peep2s): Disable.
From-SVN: r29877
1999-10-09 21:47:18 +02:00
|
|
|
|
remove_fake_successors (BASIC_BLOCK (x));
|
|
|
|
|
|
1999-09-22 17:44:57 +02:00
|
|
|
|
/* We've handled all successors except the entry block's. */
|
1999-09-21 20:54:34 +02:00
|
|
|
|
remove_fake_successors (ENTRY_BLOCK_PTR);
|
|
|
|
|
}
|
|
|
|
|
|
2000-07-23 01:29:14 +02:00
|
|
|
|
/* This function will add a fake edge between any block which has no
|
1999-09-21 20:54:34 +02:00
|
|
|
|
successors, and the exit block. Some data flow equations require these
|
|
|
|
|
edges to exist. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
1999-09-21 20:54:34 +02:00
|
|
|
|
void
|
1999-09-22 17:44:57 +02:00
|
|
|
|
add_noreturn_fake_exit_edges ()
|
1999-09-21 20:54:34 +02:00
|
|
|
|
{
|
|
|
|
|
int x;
|
|
|
|
|
|
|
|
|
|
for (x = 0; x < n_basic_blocks; x++)
|
|
|
|
|
if (BASIC_BLOCK (x)->succ == NULL)
|
1999-10-05 21:01:01 +02:00
|
|
|
|
make_edge (NULL, BASIC_BLOCK (x), EXIT_BLOCK_PTR, EDGE_FAKE);
|
1999-09-21 20:54:34 +02:00
|
|
|
|
}
|
2000-05-26 05:34:33 +02:00
|
|
|
|
|
2000-08-02 06:21:27 +02:00
|
|
|
|
/* This function adds a fake edge between any infinite loops to the
|
|
|
|
|
exit block. Some optimizations require a path from each node to
|
|
|
|
|
the exit node.
|
2000-05-26 05:34:33 +02:00
|
|
|
|
|
2000-08-02 06:21:27 +02:00
|
|
|
|
See also Morgan, Figure 3.10, pp. 82-83.
|
|
|
|
|
|
|
|
|
|
The current implementation is ugly, not attempting to minimize the
|
|
|
|
|
number of inserted fake edges. To reduce the number of fake edges
|
|
|
|
|
to insert, add fake edges from _innermost_ loops containing only
|
2000-08-11 14:45:05 +02:00
|
|
|
|
nodes not reachable from the exit block. */
|
|
|
|
|
|
2000-08-02 06:21:27 +02:00
|
|
|
|
void
|
|
|
|
|
connect_infinite_loops_to_exit ()
|
|
|
|
|
{
|
|
|
|
|
basic_block unvisited_block;
|
|
|
|
|
|
|
|
|
|
/* Perform depth-first search in the reverse graph to find nodes
|
2000-08-11 14:45:05 +02:00
|
|
|
|
reachable from the exit block. */
|
2000-08-02 06:21:27 +02:00
|
|
|
|
struct depth_first_search_dsS dfs_ds;
|
|
|
|
|
|
|
|
|
|
flow_dfs_compute_reverse_init (&dfs_ds);
|
|
|
|
|
flow_dfs_compute_reverse_add_bb (&dfs_ds, EXIT_BLOCK_PTR);
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
|
|
|
|
/* Repeatedly add fake edges, updating the unreachable nodes. */
|
2000-08-02 06:21:27 +02:00
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
unvisited_block = flow_dfs_compute_reverse_execute (&dfs_ds);
|
|
|
|
|
if (!unvisited_block)
|
|
|
|
|
break;
|
|
|
|
|
make_edge (NULL, unvisited_block, EXIT_BLOCK_PTR, EDGE_FAKE);
|
|
|
|
|
flow_dfs_compute_reverse_add_bb (&dfs_ds, unvisited_block);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
flow_dfs_compute_reverse_finish (&dfs_ds);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Redirect an edge's successor from one block to another. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-05-26 05:34:33 +02:00
|
|
|
|
void
|
|
|
|
|
redirect_edge_succ (e, new_succ)
|
|
|
|
|
edge e;
|
|
|
|
|
basic_block new_succ;
|
|
|
|
|
{
|
|
|
|
|
edge *pe;
|
|
|
|
|
|
|
|
|
|
/* Disconnect the edge from the old successor block. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (pe = &e->dest->pred; *pe != e; pe = &(*pe)->pred_next)
|
2000-05-26 05:34:33 +02:00
|
|
|
|
continue;
|
|
|
|
|
*pe = (*pe)->pred_next;
|
|
|
|
|
|
|
|
|
|
/* Reconnect the edge to the new successor block. */
|
|
|
|
|
e->pred_next = new_succ->pred;
|
|
|
|
|
new_succ->pred = e;
|
|
|
|
|
e->dest = new_succ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Redirect an edge's predecessor from one block to another. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-05-26 05:34:33 +02:00
|
|
|
|
void
|
|
|
|
|
redirect_edge_pred (e, new_pred)
|
|
|
|
|
edge e;
|
|
|
|
|
basic_block new_pred;
|
|
|
|
|
{
|
|
|
|
|
edge *pe;
|
|
|
|
|
|
|
|
|
|
/* Disconnect the edge from the old predecessor block. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for (pe = &e->src->succ; *pe != e; pe = &(*pe)->succ_next)
|
2000-05-26 05:34:33 +02:00
|
|
|
|
continue;
|
|
|
|
|
*pe = (*pe)->succ_next;
|
|
|
|
|
|
|
|
|
|
/* Reconnect the edge to the new predecessor block. */
|
|
|
|
|
e->succ_next = new_pred->succ;
|
|
|
|
|
new_pred->succ = e;
|
|
|
|
|
e->src = new_pred;
|
|
|
|
|
}
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
|
|
|
|
|
/* Dump the list of basic blocks in the bitmap NODES. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2001-01-02 08:00:49 +01:00
|
|
|
|
static void
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
flow_nodes_print (str, nodes, file)
|
|
|
|
|
const char *str;
|
|
|
|
|
const sbitmap nodes;
|
|
|
|
|
FILE *file;
|
|
|
|
|
{
|
|
|
|
|
int node;
|
|
|
|
|
|
2000-08-25 12:20:22 +02:00
|
|
|
|
if (! nodes)
|
|
|
|
|
return;
|
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
fprintf (file, "%s { ", str);
|
|
|
|
|
EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, node, {fprintf (file, "%d ", node);});
|
|
|
|
|
fputs ("}\n", file);
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-08-25 12:20:22 +02:00
|
|
|
|
/* Dump the list of edges in the array EDGE_LIST. */
|
|
|
|
|
|
2001-01-02 08:00:49 +01:00
|
|
|
|
static void
|
2000-08-25 12:20:22 +02:00
|
|
|
|
flow_edge_list_print (str, edge_list, num_edges, file)
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
const char *str;
|
2000-08-25 12:20:22 +02:00
|
|
|
|
const edge *edge_list;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
int num_edges;
|
|
|
|
|
FILE *file;
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
2000-08-25 12:20:22 +02:00
|
|
|
|
if (! edge_list)
|
|
|
|
|
return;
|
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
fprintf (file, "%s { ", str);
|
|
|
|
|
for (i = 0; i < num_edges; i++)
|
2000-08-25 12:20:22 +02:00
|
|
|
|
fprintf (file, "%d->%d ", edge_list[i]->src->index,
|
|
|
|
|
edge_list[i]->dest->index);
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
fputs ("}\n", file);
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-25 12:20:22 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
/* Dump loop related CFG information. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
static void
|
|
|
|
|
flow_loops_cfg_dump (loops, file)
|
|
|
|
|
const struct loops *loops;
|
|
|
|
|
FILE *file;
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (! loops->num || ! file || ! loops->cfg.dom)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < n_basic_blocks; i++)
|
|
|
|
|
{
|
|
|
|
|
edge succ;
|
|
|
|
|
|
|
|
|
|
fprintf (file, ";; %d succs { ", i);
|
|
|
|
|
for (succ = BASIC_BLOCK (i)->succ; succ; succ = succ->succ_next)
|
|
|
|
|
fprintf (file, "%d ", succ->dest->index);
|
2000-08-11 14:45:05 +02:00
|
|
|
|
flow_nodes_print ("} dom", loops->cfg.dom[i], file);
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Dump the DFS node order. */
|
|
|
|
|
if (loops->cfg.dfs_order)
|
|
|
|
|
{
|
|
|
|
|
fputs (";; DFS order: ", file);
|
|
|
|
|
for (i = 0; i < n_basic_blocks; i++)
|
|
|
|
|
fprintf (file, "%d ", loops->cfg.dfs_order[i]);
|
|
|
|
|
fputs ("\n", file);
|
|
|
|
|
}
|
2000-07-30 12:35:03 +02:00
|
|
|
|
/* Dump the reverse completion node order. */
|
|
|
|
|
if (loops->cfg.rc_order)
|
|
|
|
|
{
|
|
|
|
|
fputs (";; RC order: ", file);
|
|
|
|
|
for (i = 0; i < n_basic_blocks; i++)
|
|
|
|
|
fprintf (file, "%d ", loops->cfg.rc_order[i]);
|
|
|
|
|
fputs ("\n", file);
|
|
|
|
|
}
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return non-zero if the nodes of LOOP are a subset of OUTER. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
Makefile.in (toplev.o): Depend on loop.h.
* Makefile.in (toplev.o): Depend on loop.h.
* dwarfout.c: Include tm_p.h.
* emit-rtl.c (restore_emit_status): Mark parameter with
ATTRIBUTE_UNUSED.
* final.c (final_scan_insn): Likewise.
* flow.c (flow_nodes_print, flow_exits_print, flow_loops_cfg_dump,
flow_loop_nested_p, flow_loop_exits_find, flow_loop_nodes_find,
flow_depth_first_order_compute, flow_loop_pre_header_find,
flow_loop_tree_node_add, flow_loops_tree_build,
flow_loop_level_compute, flow_loops_level_compute,
flow_loop_outside_edge_p): Add prototypes.
(recompute_reg_usage): Mark parameters with ATTRIBUTE_UNUSED.
* ggc-callbacks.c (lang_mark_tree, lang_mark_false_label_stack):
Mark with ATTRIBUTE_NORETURN.
* hash.c (hash_newfunc): Mark parameter with ATTRIBUTE_UNUSED.
* local-alloc.c (no_conflict_p): Likewise.
* loop.c (insert_bct): Hide definitions of variables with hidden
usage.
(note_reg_stored): Mark parameter with ATTRIBUTE_UNUSED.
* regclass.c (memory_move_secondary_cost): Mark variable `mem'
with ATTRIBUTE_UNUSED.
(record_reg_classes): Mark parameter with ATTRIBUTE_UNUSED.
(reg_scan): Likewise.
* reload.c (find_reloads): Remove unused variables `changed'.
* reload1.c (reload_reg_class_lower): Don't unnecessarily cast
away const-ness.
(allocate_reload_reg): Mark parameter with ATTRIBUTE_UNUSED.
Remove unused variable `insn'.
* toplev.c: Include loop.h.
(report_file_and_line): Remove unnecessary prototype.
* tree.c (build_block): Mark parameter with ATTRIBUTE_UNUSED.
* unroll.c (biv_total_increment): Likewise.
From-SVN: r31085
1999-12-24 15:04:54 +01:00
|
|
|
|
static int
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
flow_loop_nested_p (outer, loop)
|
|
|
|
|
struct loop *outer;
|
|
|
|
|
struct loop *loop;
|
|
|
|
|
{
|
|
|
|
|
return sbitmap_a_subset_b_p (loop->nodes, outer->nodes);
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-08-25 12:12:10 +02:00
|
|
|
|
/* Dump the loop information specified by LOOP to the stream FILE
|
|
|
|
|
using auxiliary dump callback function LOOP_DUMP_AUX if non null. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
void
|
2000-08-25 12:12:10 +02:00
|
|
|
|
flow_loop_dump (loop, file, loop_dump_aux, verbose)
|
|
|
|
|
const struct loop *loop;
|
|
|
|
|
FILE *file;
|
2000-09-18 08:59:23 +02:00
|
|
|
|
void (*loop_dump_aux) PARAMS((const struct loop *, FILE *, int));
|
2000-08-25 12:12:10 +02:00
|
|
|
|
int verbose;
|
|
|
|
|
{
|
|
|
|
|
if (! loop || ! loop->header)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
fprintf (file, ";;\n;; Loop %d (%d to %d):%s%s\n",
|
|
|
|
|
loop->num, INSN_UID (loop->first->head),
|
|
|
|
|
INSN_UID (loop->last->end),
|
|
|
|
|
loop->shared ? " shared" : "",
|
|
|
|
|
loop->invalid ? " invalid" : "");
|
|
|
|
|
fprintf (file, ";; header %d, latch %d, pre-header %d, first %d, last %d\n",
|
|
|
|
|
loop->header->index, loop->latch->index,
|
|
|
|
|
loop->pre_header ? loop->pre_header->index : -1,
|
|
|
|
|
loop->first->index, loop->last->index);
|
|
|
|
|
fprintf (file, ";; depth %d, level %d, outer %ld\n",
|
|
|
|
|
loop->depth, loop->level,
|
|
|
|
|
(long) (loop->outer ? loop->outer->num : -1));
|
|
|
|
|
|
2000-10-18 12:10:38 +02:00
|
|
|
|
if (loop->pre_header_edges)
|
|
|
|
|
flow_edge_list_print (";; pre-header edges", loop->pre_header_edges,
|
|
|
|
|
loop->num_pre_header_edges, file);
|
2000-09-11 23:42:07 +02:00
|
|
|
|
flow_edge_list_print (";; entry edges", loop->entry_edges,
|
2000-08-25 12:20:22 +02:00
|
|
|
|
loop->num_entries, file);
|
2000-08-25 12:12:10 +02:00
|
|
|
|
fprintf (file, ";; %d", loop->num_nodes);
|
|
|
|
|
flow_nodes_print (" nodes", loop->nodes, file);
|
2000-09-11 23:42:07 +02:00
|
|
|
|
flow_edge_list_print (";; exit edges", loop->exit_edges,
|
2000-08-25 12:20:22 +02:00
|
|
|
|
loop->num_exits, file);
|
2000-09-11 23:42:07 +02:00
|
|
|
|
if (loop->exits_doms)
|
|
|
|
|
flow_nodes_print (";; exit doms", loop->exits_doms, file);
|
2000-08-25 12:12:10 +02:00
|
|
|
|
if (loop_dump_aux)
|
|
|
|
|
loop_dump_aux (loop, file, verbose);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Dump the loop information specified by LOOPS to the stream FILE,
|
|
|
|
|
using auxiliary dump callback function LOOP_DUMP_AUX if non null. */
|
2001-01-02 08:00:49 +01:00
|
|
|
|
void
|
2000-08-25 12:12:10 +02:00
|
|
|
|
flow_loops_dump (loops, file, loop_dump_aux, verbose)
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
const struct loops *loops;
|
|
|
|
|
FILE *file;
|
2000-09-18 08:59:23 +02:00
|
|
|
|
void (*loop_dump_aux) PARAMS((const struct loop *, FILE *, int));
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
int verbose;
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
int num_loops;
|
|
|
|
|
|
|
|
|
|
num_loops = loops->num;
|
|
|
|
|
if (! num_loops || ! file)
|
|
|
|
|
return;
|
|
|
|
|
|
2001-01-02 08:00:49 +01:00
|
|
|
|
fprintf (file, ";; %d loops found, %d levels\n",
|
2000-01-24 00:10:09 +01:00
|
|
|
|
num_loops, loops->levels);
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < num_loops; i++)
|
|
|
|
|
{
|
|
|
|
|
struct loop *loop = &loops->array[i];
|
|
|
|
|
|
2000-08-25 12:12:10 +02:00
|
|
|
|
flow_loop_dump (loop, file, loop_dump_aux, verbose);
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
|
|
|
|
|
if (loop->shared)
|
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < i; j++)
|
|
|
|
|
{
|
|
|
|
|
struct loop *oloop = &loops->array[j];
|
|
|
|
|
|
|
|
|
|
if (loop->header == oloop->header)
|
|
|
|
|
{
|
|
|
|
|
int disjoint;
|
|
|
|
|
int smaller;
|
|
|
|
|
|
|
|
|
|
smaller = loop->num_nodes < oloop->num_nodes;
|
|
|
|
|
|
|
|
|
|
/* If the union of LOOP and OLOOP is different than
|
|
|
|
|
the larger of LOOP and OLOOP then LOOP and OLOOP
|
|
|
|
|
must be disjoint. */
|
1999-12-04 12:07:07 +01:00
|
|
|
|
disjoint = ! flow_loop_nested_p (smaller ? loop : oloop,
|
|
|
|
|
smaller ? oloop : loop);
|
2001-01-02 08:00:49 +01:00
|
|
|
|
fprintf (file,
|
2000-07-30 12:35:03 +02:00
|
|
|
|
";; loop header %d shared by loops %d, %d %s\n",
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
loop->header->index, i, j,
|
|
|
|
|
disjoint ? "disjoint" : "nested");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (verbose)
|
|
|
|
|
flow_loops_cfg_dump (loops, file);
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-25 12:12:10 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
/* Free all the memory allocated for LOOPS. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
|
|
|
|
void
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
flow_loops_free (loops)
|
2000-08-11 14:45:05 +02:00
|
|
|
|
struct loops *loops;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
{
|
|
|
|
|
if (loops->array)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (! loops->num)
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
/* Free the loop descriptors. */
|
|
|
|
|
for (i = 0; i < loops->num; i++)
|
|
|
|
|
{
|
|
|
|
|
struct loop *loop = &loops->array[i];
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-10-18 12:10:38 +02:00
|
|
|
|
if (loop->pre_header_edges)
|
|
|
|
|
free (loop->pre_header_edges);
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
if (loop->nodes)
|
|
|
|
|
sbitmap_free (loop->nodes);
|
2000-08-25 12:20:22 +02:00
|
|
|
|
if (loop->entry_edges)
|
|
|
|
|
free (loop->entry_edges);
|
|
|
|
|
if (loop->exit_edges)
|
|
|
|
|
free (loop->exit_edges);
|
2000-09-11 23:42:07 +02:00
|
|
|
|
if (loop->exits_doms)
|
|
|
|
|
sbitmap_free (loop->exits_doms);
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
}
|
|
|
|
|
free (loops->array);
|
|
|
|
|
loops->array = NULL;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
if (loops->cfg.dom)
|
|
|
|
|
sbitmap_vector_free (loops->cfg.dom);
|
|
|
|
|
if (loops->cfg.dfs_order)
|
|
|
|
|
free (loops->cfg.dfs_order);
|
|
|
|
|
|
2000-09-11 23:42:07 +02:00
|
|
|
|
if (loops->shared_headers)
|
|
|
|
|
sbitmap_free (loops->shared_headers);
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-25 12:12:10 +02:00
|
|
|
|
|
2000-08-25 12:20:22 +02:00
|
|
|
|
/* Find the entry edges into the loop with header HEADER and nodes
|
|
|
|
|
NODES and store in ENTRY_EDGES array. Return the number of entry
|
|
|
|
|
edges from the loop. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
flow_loop_entry_edges_find (header, nodes, entry_edges)
|
|
|
|
|
basic_block header;
|
|
|
|
|
const sbitmap nodes;
|
|
|
|
|
edge **entry_edges;
|
|
|
|
|
{
|
|
|
|
|
edge e;
|
|
|
|
|
int num_entries;
|
|
|
|
|
|
|
|
|
|
*entry_edges = NULL;
|
|
|
|
|
|
|
|
|
|
num_entries = 0;
|
|
|
|
|
for (e = header->pred; e; e = e->pred_next)
|
|
|
|
|
{
|
|
|
|
|
basic_block src = e->src;
|
2001-01-02 08:00:49 +01:00
|
|
|
|
|
2000-08-25 12:20:22 +02:00
|
|
|
|
if (src == ENTRY_BLOCK_PTR || ! TEST_BIT (nodes, src->index))
|
|
|
|
|
num_entries++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! num_entries)
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
*entry_edges = (edge *) xmalloc (num_entries * sizeof (edge *));
|
|
|
|
|
|
|
|
|
|
num_entries = 0;
|
|
|
|
|
for (e = header->pred; e; e = e->pred_next)
|
|
|
|
|
{
|
|
|
|
|
basic_block src = e->src;
|
2001-01-02 08:00:49 +01:00
|
|
|
|
|
2000-08-25 12:20:22 +02:00
|
|
|
|
if (src == ENTRY_BLOCK_PTR || ! TEST_BIT (nodes, src->index))
|
|
|
|
|
(*entry_edges)[num_entries++] = e;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return num_entries;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Find the exit edges from the loop using the bitmap of loop nodes
|
|
|
|
|
NODES and store in EXIT_EDGES array. Return the number of
|
|
|
|
|
exit edges from the loop. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
static int
|
2000-08-25 12:20:22 +02:00
|
|
|
|
flow_loop_exit_edges_find (nodes, exit_edges)
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
const sbitmap nodes;
|
2000-08-25 12:20:22 +02:00
|
|
|
|
edge **exit_edges;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
{
|
|
|
|
|
edge e;
|
|
|
|
|
int node;
|
|
|
|
|
int num_exits;
|
|
|
|
|
|
2000-08-25 12:20:22 +02:00
|
|
|
|
*exit_edges = NULL;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
|
|
|
|
|
/* Check all nodes within the loop to see if there are any
|
|
|
|
|
successors not in the loop. Note that a node may have multiple
|
2000-08-25 12:20:22 +02:00
|
|
|
|
exiting edges ????? A node can have one jumping edge and one fallthru
|
|
|
|
|
edge so only one of these can exit the loop. */
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
num_exits = 0;
|
|
|
|
|
EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, node, {
|
|
|
|
|
for (e = BASIC_BLOCK (node)->succ; e; e = e->succ_next)
|
|
|
|
|
{
|
2001-01-02 08:00:49 +01:00
|
|
|
|
basic_block dest = e->dest;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
|
|
|
|
|
if (dest == EXIT_BLOCK_PTR || ! TEST_BIT (nodes, dest->index))
|
|
|
|
|
num_exits++;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (! num_exits)
|
|
|
|
|
return 0;
|
|
|
|
|
|
2000-08-25 12:20:22 +02:00
|
|
|
|
*exit_edges = (edge *) xmalloc (num_exits * sizeof (edge *));
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
|
|
|
|
|
/* Store all exiting edges into an array. */
|
|
|
|
|
num_exits = 0;
|
|
|
|
|
EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, node, {
|
|
|
|
|
for (e = BASIC_BLOCK (node)->succ; e; e = e->succ_next)
|
|
|
|
|
{
|
2001-01-02 08:00:49 +01:00
|
|
|
|
basic_block dest = e->dest;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
|
|
|
|
|
if (dest == EXIT_BLOCK_PTR || ! TEST_BIT (nodes, dest->index))
|
2000-08-25 12:20:22 +02:00
|
|
|
|
(*exit_edges)[num_exits++] = e;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return num_exits;
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-25 12:20:22 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
/* Find the nodes contained within the loop with header HEADER and
|
|
|
|
|
latch LATCH and store in NODES. Return the number of nodes within
|
|
|
|
|
the loop. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
|
|
|
|
static int
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
flow_loop_nodes_find (header, latch, nodes)
|
|
|
|
|
basic_block header;
|
|
|
|
|
basic_block latch;
|
|
|
|
|
sbitmap nodes;
|
|
|
|
|
{
|
|
|
|
|
basic_block *stack;
|
|
|
|
|
int sp;
|
|
|
|
|
int num_nodes = 0;
|
|
|
|
|
|
|
|
|
|
stack = (basic_block *) xmalloc (n_basic_blocks * sizeof (basic_block));
|
|
|
|
|
sp = 0;
|
|
|
|
|
|
|
|
|
|
/* Start with only the loop header in the set of loop nodes. */
|
|
|
|
|
sbitmap_zero (nodes);
|
|
|
|
|
SET_BIT (nodes, header->index);
|
|
|
|
|
num_nodes++;
|
1999-12-15 15:09:52 +01:00
|
|
|
|
header->loop_depth++;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
|
|
|
|
|
/* Push the loop latch on to the stack. */
|
|
|
|
|
if (! TEST_BIT (nodes, latch->index))
|
|
|
|
|
{
|
|
|
|
|
SET_BIT (nodes, latch->index);
|
1999-12-15 15:09:52 +01:00
|
|
|
|
latch->loop_depth++;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
num_nodes++;
|
|
|
|
|
stack[sp++] = latch;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (sp)
|
|
|
|
|
{
|
|
|
|
|
basic_block node;
|
|
|
|
|
edge e;
|
|
|
|
|
|
|
|
|
|
node = stack[--sp];
|
|
|
|
|
for (e = node->pred; e; e = e->pred_next)
|
|
|
|
|
{
|
|
|
|
|
basic_block ancestor = e->src;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
/* If each ancestor not marked as part of loop, add to set of
|
|
|
|
|
loop nodes and push on to stack. */
|
|
|
|
|
if (ancestor != ENTRY_BLOCK_PTR
|
|
|
|
|
&& ! TEST_BIT (nodes, ancestor->index))
|
|
|
|
|
{
|
|
|
|
|
SET_BIT (nodes, ancestor->index);
|
1999-12-15 15:09:52 +01:00
|
|
|
|
ancestor->loop_depth++;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
num_nodes++;
|
|
|
|
|
stack[sp++] = ancestor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
free (stack);
|
|
|
|
|
return num_nodes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Compute the depth first search order and store in the array
|
2000-07-30 12:35:03 +02:00
|
|
|
|
DFS_ORDER if non-zero, marking the nodes visited in VISITED. If
|
|
|
|
|
RC_ORDER is non-zero, return the reverse completion number for each
|
|
|
|
|
node. Returns the number of nodes visited. A depth first search
|
|
|
|
|
tries to get as far away from the starting point as quickly as
|
|
|
|
|
possible. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
static int
|
2000-07-30 12:35:03 +02:00
|
|
|
|
flow_depth_first_order_compute (dfs_order, rc_order)
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
int *dfs_order;
|
2000-07-30 12:35:03 +02:00
|
|
|
|
int *rc_order;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
{
|
|
|
|
|
edge *stack;
|
|
|
|
|
int sp;
|
|
|
|
|
int dfsnum = 0;
|
2000-07-30 12:35:03 +02:00
|
|
|
|
int rcnum = n_basic_blocks - 1;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
sbitmap visited;
|
|
|
|
|
|
|
|
|
|
/* Allocate stack for back-tracking up CFG. */
|
2000-06-29 02:36:10 +02:00
|
|
|
|
stack = (edge *) xmalloc ((n_basic_blocks + 1) * sizeof (edge));
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
sp = 0;
|
|
|
|
|
|
|
|
|
|
/* Allocate bitmap to track nodes that have been visited. */
|
|
|
|
|
visited = sbitmap_alloc (n_basic_blocks);
|
|
|
|
|
|
|
|
|
|
/* None of the nodes in the CFG have been visited yet. */
|
|
|
|
|
sbitmap_zero (visited);
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-06-29 02:36:10 +02:00
|
|
|
|
/* Push the first edge on to the stack. */
|
|
|
|
|
stack[sp++] = ENTRY_BLOCK_PTR->succ;
|
|
|
|
|
|
|
|
|
|
while (sp)
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
{
|
2000-06-29 02:36:10 +02:00
|
|
|
|
edge e;
|
|
|
|
|
basic_block src;
|
|
|
|
|
basic_block dest;
|
|
|
|
|
|
|
|
|
|
/* Look at the edge on the top of the stack. */
|
|
|
|
|
e = stack[sp - 1];
|
|
|
|
|
src = e->src;
|
|
|
|
|
dest = e->dest;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-06-29 02:36:10 +02:00
|
|
|
|
/* Check if the edge destination has been visited yet. */
|
|
|
|
|
if (dest != EXIT_BLOCK_PTR && ! TEST_BIT (visited, dest->index))
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
{
|
2000-06-29 02:36:10 +02:00
|
|
|
|
/* Mark that we have visited the destination. */
|
|
|
|
|
SET_BIT (visited, dest->index);
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-07-30 12:35:03 +02:00
|
|
|
|
if (dfs_order)
|
|
|
|
|
dfs_order[dfsnum++] = dest->index;
|
2000-06-29 02:36:10 +02:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
if (dest->succ)
|
|
|
|
|
{
|
|
|
|
|
/* Since the DEST node has been visited for the first
|
|
|
|
|
time, check its successors. */
|
|
|
|
|
stack[sp++] = dest->succ;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* There are no successors for the DEST node so assign
|
|
|
|
|
its reverse completion number. */
|
2000-07-30 12:35:03 +02:00
|
|
|
|
if (rc_order)
|
|
|
|
|
rc_order[rcnum--] = dest->index;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
}
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2000-06-29 02:36:10 +02:00
|
|
|
|
if (! e->succ_next && src != ENTRY_BLOCK_PTR)
|
2000-08-11 14:45:05 +02:00
|
|
|
|
{
|
|
|
|
|
/* There are no more successors for the SRC node
|
|
|
|
|
so assign its reverse completion number. */
|
2000-07-30 12:35:03 +02:00
|
|
|
|
if (rc_order)
|
|
|
|
|
rc_order[rcnum--] = src->index;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-06-29 02:36:10 +02:00
|
|
|
|
if (e->succ_next)
|
|
|
|
|
stack[sp - 1] = e->succ_next;
|
|
|
|
|
else
|
|
|
|
|
sp--;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-06-29 02:36:10 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
free (stack);
|
|
|
|
|
sbitmap_free (visited);
|
|
|
|
|
|
|
|
|
|
/* The number of nodes visited should not be greater than
|
|
|
|
|
n_basic_blocks. */
|
|
|
|
|
if (dfsnum > n_basic_blocks)
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
/* There are some nodes left in the CFG that are unreachable. */
|
|
|
|
|
if (dfsnum < n_basic_blocks)
|
|
|
|
|
abort ();
|
|
|
|
|
return dfsnum;
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-02 06:21:27 +02:00
|
|
|
|
/* Compute the depth first search order on the _reverse_ graph and
|
|
|
|
|
store in the array DFS_ORDER, marking the nodes visited in VISITED.
|
|
|
|
|
Returns the number of nodes visited.
|
|
|
|
|
|
|
|
|
|
The computation is split into three pieces:
|
|
|
|
|
|
|
|
|
|
flow_dfs_compute_reverse_init () creates the necessary data
|
|
|
|
|
structures.
|
|
|
|
|
|
|
|
|
|
flow_dfs_compute_reverse_add_bb () adds a basic block to the data
|
|
|
|
|
structures. The block will start the search.
|
|
|
|
|
|
|
|
|
|
flow_dfs_compute_reverse_execute () continues (or starts) the
|
|
|
|
|
search using the block on the top of the stack, stopping when the
|
|
|
|
|
stack is empty.
|
|
|
|
|
|
|
|
|
|
flow_dfs_compute_reverse_finish () destroys the necessary data
|
|
|
|
|
structures.
|
|
|
|
|
|
|
|
|
|
Thus, the user will probably call ..._init(), call ..._add_bb() to
|
|
|
|
|
add a beginning basic block to the stack, call ..._execute(),
|
|
|
|
|
possibly add another bb to the stack and again call ..._execute(),
|
2000-08-11 14:45:05 +02:00
|
|
|
|
..., and finally call _finish(). */
|
2000-08-02 06:21:27 +02:00
|
|
|
|
|
|
|
|
|
/* Initialize the data structures used for depth-first search on the
|
|
|
|
|
reverse graph. If INITIALIZE_STACK is nonzero, the exit block is
|
|
|
|
|
added to the basic block stack. DATA is the current depth-first
|
|
|
|
|
search context. If INITIALIZE_STACK is non-zero, there is an
|
|
|
|
|
element on the stack. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
flow_dfs_compute_reverse_init (data)
|
|
|
|
|
depth_first_search_ds data;
|
|
|
|
|
{
|
|
|
|
|
/* Allocate stack for back-tracking up CFG. */
|
|
|
|
|
data->stack =
|
2000-08-11 14:45:05 +02:00
|
|
|
|
(basic_block *) xmalloc ((n_basic_blocks - (INVALID_BLOCK + 1))
|
2000-08-02 06:21:27 +02:00
|
|
|
|
* sizeof (basic_block));
|
|
|
|
|
data->sp = 0;
|
|
|
|
|
|
|
|
|
|
/* Allocate bitmap to track nodes that have been visited. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
data->visited_blocks = sbitmap_alloc (n_basic_blocks - (INVALID_BLOCK + 1));
|
2000-08-02 06:21:27 +02:00
|
|
|
|
|
|
|
|
|
/* None of the nodes in the CFG have been visited yet. */
|
|
|
|
|
sbitmap_zero (data->visited_blocks);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Add the specified basic block to the top of the dfs data
|
|
|
|
|
structures. When the search continues, it will start at the
|
2000-08-11 14:45:05 +02:00
|
|
|
|
block. */
|
2000-08-02 06:21:27 +02:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
flow_dfs_compute_reverse_add_bb (data, bb)
|
|
|
|
|
depth_first_search_ds data;
|
|
|
|
|
basic_block bb;
|
|
|
|
|
{
|
|
|
|
|
data->stack[data->sp++] = bb;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Continue the depth-first search through the reverse graph starting
|
|
|
|
|
with the block at the stack's top and ending when the stack is
|
|
|
|
|
empty. Visited nodes are marked. Returns an unvisited basic
|
|
|
|
|
block, or NULL if there is none available. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-08-02 06:21:27 +02:00
|
|
|
|
static basic_block
|
|
|
|
|
flow_dfs_compute_reverse_execute (data)
|
|
|
|
|
depth_first_search_ds data;
|
|
|
|
|
{
|
|
|
|
|
basic_block bb;
|
|
|
|
|
edge e;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
while (data->sp > 0)
|
|
|
|
|
{
|
|
|
|
|
bb = data->stack[--data->sp];
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Mark that we have visited this node. */
|
|
|
|
|
if (!TEST_BIT (data->visited_blocks, bb->index - (INVALID_BLOCK + 1)))
|
2000-08-02 06:21:27 +02:00
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
SET_BIT (data->visited_blocks, bb->index - (INVALID_BLOCK + 1));
|
2000-08-02 06:21:27 +02:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Perform depth-first search on adjacent vertices. */
|
2000-08-02 06:21:27 +02:00
|
|
|
|
for (e = bb->pred; e; e = e->pred_next)
|
|
|
|
|
flow_dfs_compute_reverse_add_bb (data, e->src);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Determine if there are unvisited basic blocks. */
|
|
|
|
|
for (i = n_basic_blocks - (INVALID_BLOCK + 1); --i >= 0;)
|
2000-08-02 06:21:27 +02:00
|
|
|
|
if (!TEST_BIT (data->visited_blocks, i))
|
2000-08-11 14:45:05 +02:00
|
|
|
|
return BASIC_BLOCK (i + (INVALID_BLOCK + 1));
|
2000-08-02 06:21:27 +02:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Destroy the data structures needed for depth-first search on the
|
2000-08-11 14:45:05 +02:00
|
|
|
|
reverse graph. */
|
2000-08-02 06:21:27 +02:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
flow_dfs_compute_reverse_finish (data)
|
|
|
|
|
depth_first_search_ds data;
|
|
|
|
|
{
|
|
|
|
|
free (data->stack);
|
|
|
|
|
sbitmap_free (data->visited_blocks);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-11 23:42:07 +02:00
|
|
|
|
|
|
|
|
|
/* Find the root node of the loop pre-header extended basic block and
|
2000-10-18 12:10:38 +02:00
|
|
|
|
the edges along the trace from the root node to the loop header. */
|
2000-09-11 23:42:07 +02:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
flow_loop_pre_header_scan (loop)
|
|
|
|
|
struct loop *loop;
|
|
|
|
|
{
|
2000-10-18 12:10:38 +02:00
|
|
|
|
int num = 0;
|
2000-09-11 23:42:07 +02:00
|
|
|
|
basic_block ebb;
|
|
|
|
|
|
2000-10-18 12:10:38 +02:00
|
|
|
|
loop->num_pre_header_edges = 0;
|
|
|
|
|
|
2000-09-11 23:42:07 +02:00
|
|
|
|
if (loop->num_entries != 1)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ebb = loop->entry_edges[0]->src;
|
2000-09-26 12:03:47 +02:00
|
|
|
|
|
|
|
|
|
if (ebb != ENTRY_BLOCK_PTR)
|
2000-09-11 23:42:07 +02:00
|
|
|
|
{
|
2000-10-18 12:10:38 +02:00
|
|
|
|
edge e;
|
|
|
|
|
|
|
|
|
|
/* Count number of edges along trace from loop header to
|
|
|
|
|
root of pre-header extended basic block. Usually this is
|
|
|
|
|
only one or two edges. */
|
|
|
|
|
num++;
|
|
|
|
|
while (ebb->pred->src != ENTRY_BLOCK_PTR && ! ebb->pred->pred_next)
|
2000-09-26 12:03:47 +02:00
|
|
|
|
{
|
|
|
|
|
ebb = ebb->pred->src;
|
2000-10-18 12:10:38 +02:00
|
|
|
|
num++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loop->pre_header_edges = (edge *) xmalloc (num * sizeof (edge *));
|
|
|
|
|
loop->num_pre_header_edges = num;
|
|
|
|
|
|
|
|
|
|
/* Store edges in order that they are followed. The source
|
|
|
|
|
of the first edge is the root node of the pre-header extended
|
|
|
|
|
basic block and the destination of the last last edge is
|
|
|
|
|
the loop header. */
|
|
|
|
|
for (e = loop->entry_edges[0]; num; e = e->src->pred)
|
|
|
|
|
{
|
|
|
|
|
loop->pre_header_edges[--num] = e;
|
2000-09-26 12:03:47 +02:00
|
|
|
|
}
|
2000-09-11 23:42:07 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
/* Return the block for the pre-header of the loop with header
|
|
|
|
|
HEADER where DOM specifies the dominator information. Return NULL if
|
|
|
|
|
there is no pre-header. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
static basic_block
|
|
|
|
|
flow_loop_pre_header_find (header, dom)
|
|
|
|
|
basic_block header;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
const sbitmap *dom;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
{
|
|
|
|
|
basic_block pre_header;
|
|
|
|
|
edge e;
|
|
|
|
|
|
|
|
|
|
/* If block p is a predecessor of the header and is the only block
|
|
|
|
|
that the header does not dominate, then it is the pre-header. */
|
|
|
|
|
pre_header = NULL;
|
|
|
|
|
for (e = header->pred; e; e = e->pred_next)
|
|
|
|
|
{
|
|
|
|
|
basic_block node = e->src;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
if (node != ENTRY_BLOCK_PTR
|
|
|
|
|
&& ! TEST_BIT (dom[node->index], header->index))
|
|
|
|
|
{
|
|
|
|
|
if (pre_header == NULL)
|
|
|
|
|
pre_header = node;
|
|
|
|
|
else
|
|
|
|
|
{
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* There are multiple edges into the header from outside
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
the loop so there is no pre-header block. */
|
|
|
|
|
pre_header = NULL;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return pre_header;
|
|
|
|
|
}
|
|
|
|
|
|
2000-02-12 22:15:15 +01:00
|
|
|
|
/* Add LOOP to the loop hierarchy tree where PREVLOOP was the loop
|
|
|
|
|
previously added. The insertion algorithm assumes that the loops
|
|
|
|
|
are added in the order found by a depth first search of the CFG. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
static void
|
2000-02-12 22:15:15 +01:00
|
|
|
|
flow_loop_tree_node_add (prevloop, loop)
|
|
|
|
|
struct loop *prevloop;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
struct loop *loop;
|
|
|
|
|
{
|
|
|
|
|
|
2000-02-12 22:15:15 +01:00
|
|
|
|
if (flow_loop_nested_p (prevloop, loop))
|
|
|
|
|
{
|
|
|
|
|
prevloop->inner = loop;
|
|
|
|
|
loop->outer = prevloop;
|
|
|
|
|
return;
|
|
|
|
|
}
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
|
2000-02-12 22:15:15 +01:00
|
|
|
|
while (prevloop->outer)
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
{
|
2000-02-12 22:15:15 +01:00
|
|
|
|
if (flow_loop_nested_p (prevloop->outer, loop))
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
{
|
2000-02-12 22:15:15 +01:00
|
|
|
|
prevloop->next = loop;
|
|
|
|
|
loop->outer = prevloop->outer;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
2000-02-12 22:15:15 +01:00
|
|
|
|
prevloop = prevloop->outer;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
}
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-02-12 22:15:15 +01:00
|
|
|
|
prevloop->next = loop;
|
|
|
|
|
loop->outer = NULL;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Build the loop hierarchy tree for LOOPS. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
static void
|
|
|
|
|
flow_loops_tree_build (loops)
|
2000-08-11 14:45:05 +02:00
|
|
|
|
struct loops *loops;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
int num_loops;
|
|
|
|
|
|
|
|
|
|
num_loops = loops->num;
|
|
|
|
|
if (! num_loops)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Root the loop hierarchy tree with the first loop found.
|
2000-08-11 14:45:05 +02:00
|
|
|
|
Since we used a depth first search this should be the
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
outermost loop. */
|
|
|
|
|
loops->tree = &loops->array[0];
|
|
|
|
|
loops->tree->outer = loops->tree->inner = loops->tree->next = NULL;
|
|
|
|
|
|
|
|
|
|
/* Add the remaining loops to the tree. */
|
|
|
|
|
for (i = 1; i < num_loops; i++)
|
2000-02-12 22:15:15 +01:00
|
|
|
|
flow_loop_tree_node_add (&loops->array[i - 1], &loops->array[i]);
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Helper function to compute loop nesting depth and enclosed loop level
|
2000-08-11 14:45:05 +02:00
|
|
|
|
for the natural loop specified by LOOP at the loop depth DEPTH.
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
Returns the loop level. */
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
static int
|
|
|
|
|
flow_loop_level_compute (loop, depth)
|
|
|
|
|
struct loop *loop;
|
|
|
|
|
int depth;
|
|
|
|
|
{
|
|
|
|
|
struct loop *inner;
|
2000-01-24 00:10:09 +01:00
|
|
|
|
int level = 1;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
|
|
|
|
|
if (! loop)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/* Traverse loop tree assigning depth and computing level as the
|
|
|
|
|
maximum level of all the inner loops of this loop. The loop
|
|
|
|
|
level is equivalent to the height of the loop in the loop tree
|
2000-01-24 00:10:09 +01:00
|
|
|
|
and corresponds to the number of enclosed loop levels (including
|
|
|
|
|
itself). */
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
for (inner = loop->inner; inner; inner = inner->next)
|
|
|
|
|
{
|
|
|
|
|
int ilevel;
|
|
|
|
|
|
|
|
|
|
ilevel = flow_loop_level_compute (inner, depth + 1) + 1;
|
|
|
|
|
|
|
|
|
|
if (ilevel > level)
|
|
|
|
|
level = ilevel;
|
|
|
|
|
}
|
|
|
|
|
loop->level = level;
|
|
|
|
|
loop->depth = depth;
|
|
|
|
|
return level;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Compute the loop nesting depth and enclosed loop level for the loop
|
|
|
|
|
hierarchy tree specfied by LOOPS. Return the maximum enclosed loop
|
|
|
|
|
level. */
|
1999-12-18 22:33:23 +01:00
|
|
|
|
|
2000-01-24 00:10:09 +01:00
|
|
|
|
static int
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
flow_loops_level_compute (loops)
|
|
|
|
|
struct loops *loops;
|
|
|
|
|
{
|
2000-01-24 00:10:09 +01:00
|
|
|
|
struct loop *loop;
|
|
|
|
|
int level;
|
|
|
|
|
int levels = 0;
|
|
|
|
|
|
|
|
|
|
/* Traverse all the outer level loops. */
|
|
|
|
|
for (loop = loops->tree; loop; loop = loop->next)
|
|
|
|
|
{
|
|
|
|
|
level = flow_loop_level_compute (loop, 1);
|
|
|
|
|
if (level > levels)
|
|
|
|
|
levels = level;
|
|
|
|
|
}
|
|
|
|
|
return levels;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-11 23:42:07 +02:00
|
|
|
|
|
2001-01-09 11:25:44 +01:00
|
|
|
|
/* Scan a single natural loop specified by LOOP collecting information
|
|
|
|
|
about it specified by FLAGS. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
flow_loop_scan (loops, loop, flags)
|
|
|
|
|
struct loops *loops;
|
|
|
|
|
struct loop *loop;
|
|
|
|
|
int flags;
|
|
|
|
|
{
|
|
|
|
|
/* Determine prerequisites. */
|
|
|
|
|
if ((flags & LOOP_EXITS_DOMS) && ! loop->exit_edges)
|
|
|
|
|
flags |= LOOP_EXIT_EDGES;
|
|
|
|
|
|
|
|
|
|
if (flags & LOOP_ENTRY_EDGES)
|
|
|
|
|
{
|
|
|
|
|
/* Find edges which enter the loop header.
|
|
|
|
|
Note that the entry edges should only
|
|
|
|
|
enter the header of a natural loop. */
|
|
|
|
|
loop->num_entries
|
|
|
|
|
= flow_loop_entry_edges_find (loop->header,
|
|
|
|
|
loop->nodes,
|
|
|
|
|
&loop->entry_edges);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (flags & LOOP_EXIT_EDGES)
|
|
|
|
|
{
|
|
|
|
|
/* Find edges which exit the loop. */
|
|
|
|
|
loop->num_exits
|
|
|
|
|
= flow_loop_exit_edges_find (loop->nodes,
|
|
|
|
|
&loop->exit_edges);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (flags & LOOP_EXITS_DOMS)
|
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
/* Determine which loop nodes dominate all the exits
|
|
|
|
|
of the loop. */
|
|
|
|
|
loop->exits_doms = sbitmap_alloc (n_basic_blocks);
|
|
|
|
|
sbitmap_copy (loop->exits_doms, loop->nodes);
|
|
|
|
|
for (j = 0; j < loop->num_exits; j++)
|
|
|
|
|
sbitmap_a_and_b (loop->exits_doms, loop->exits_doms,
|
|
|
|
|
loops->cfg.dom[loop->exit_edges[j]->src->index]);
|
|
|
|
|
|
|
|
|
|
/* The header of a natural loop must dominate
|
|
|
|
|
all exits. */
|
|
|
|
|
if (! TEST_BIT (loop->exits_doms, loop->header->index))
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (flags & LOOP_PRE_HEADER)
|
|
|
|
|
{
|
|
|
|
|
/* Look to see if the loop has a pre-header node. */
|
|
|
|
|
loop->pre_header
|
|
|
|
|
= flow_loop_pre_header_find (loop->header, loops->cfg.dom);
|
|
|
|
|
|
|
|
|
|
/* Find the blocks within the extended basic block of
|
|
|
|
|
the loop pre-header. */
|
|
|
|
|
flow_loop_pre_header_scan (loop);
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1999-12-15 15:09:52 +01:00
|
|
|
|
/* Find all the natural loops in the function and save in LOOPS structure
|
|
|
|
|
and recalculate loop_depth information in basic block structures.
|
2000-09-11 23:42:07 +02:00
|
|
|
|
FLAGS controls which loop information is collected.
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
Return the number of natural loops found. */
|
1999-12-18 22:33:23 +01:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
int
|
2000-09-11 23:42:07 +02:00
|
|
|
|
flow_loops_find (loops, flags)
|
2000-08-11 14:45:05 +02:00
|
|
|
|
struct loops *loops;
|
2000-09-11 23:42:07 +02:00
|
|
|
|
int flags;
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
int b;
|
|
|
|
|
int num_loops;
|
|
|
|
|
edge e;
|
|
|
|
|
sbitmap headers;
|
|
|
|
|
sbitmap *dom;
|
|
|
|
|
int *dfs_order;
|
2000-07-30 12:35:03 +02:00
|
|
|
|
int *rc_order;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-09-11 23:42:07 +02:00
|
|
|
|
/* This function cannot be repeatedly called with different
|
|
|
|
|
flags to build up the loop information. The loop tree
|
|
|
|
|
must always be built if this function is called. */
|
|
|
|
|
if (! (flags & LOOP_TREE))
|
|
|
|
|
abort ();
|
2001-01-02 08:00:49 +01:00
|
|
|
|
|
2000-09-11 23:42:07 +02:00
|
|
|
|
memset (loops, 0, sizeof (*loops));
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
|
|
|
|
|
/* Taking care of this degenerate case makes the rest of
|
|
|
|
|
this code simpler. */
|
|
|
|
|
if (n_basic_blocks == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
2000-09-11 23:42:07 +02:00
|
|
|
|
dfs_order = NULL;
|
|
|
|
|
rc_order = NULL;
|
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
/* Compute the dominators. */
|
|
|
|
|
dom = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
|
2000-11-14 10:58:40 +01:00
|
|
|
|
calculate_dominance_info (NULL, dom, CDI_DOMINATORS);
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
|
|
|
|
|
/* Count the number of loop edges (back edges). This should be the
|
2000-09-11 23:42:07 +02:00
|
|
|
|
same as the number of natural loops. */
|
1999-12-15 15:09:52 +01:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
num_loops = 0;
|
|
|
|
|
for (b = 0; b < n_basic_blocks; b++)
|
|
|
|
|
{
|
2000-09-11 23:42:07 +02:00
|
|
|
|
basic_block header;
|
|
|
|
|
|
|
|
|
|
header = BASIC_BLOCK (b);
|
|
|
|
|
header->loop_depth = 0;
|
|
|
|
|
|
|
|
|
|
for (e = header->pred; e; e = e->pred_next)
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
{
|
|
|
|
|
basic_block latch = e->src;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
/* Look for back edges where a predecessor is dominated
|
|
|
|
|
by this block. A natural loop has a single entry
|
|
|
|
|
node (header) that dominates all the nodes in the
|
|
|
|
|
loop. It also has single back edge to the header
|
|
|
|
|
from a latch node. Note that multiple natural loops
|
|
|
|
|
may share the same header. */
|
2000-09-11 23:42:07 +02:00
|
|
|
|
if (b != header->index)
|
|
|
|
|
abort ();
|
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
if (latch != ENTRY_BLOCK_PTR && TEST_BIT (dom[latch->index], b))
|
|
|
|
|
num_loops++;
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
if (num_loops)
|
|
|
|
|
{
|
|
|
|
|
/* Compute depth first search order of the CFG so that outer
|
|
|
|
|
natural loops will be found before inner natural loops. */
|
|
|
|
|
dfs_order = (int *) xmalloc (n_basic_blocks * sizeof (int));
|
2000-07-30 12:35:03 +02:00
|
|
|
|
rc_order = (int *) xmalloc (n_basic_blocks * sizeof (int));
|
|
|
|
|
flow_depth_first_order_compute (dfs_order, rc_order);
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
|
2001-01-09 11:25:44 +01:00
|
|
|
|
/* Save CFG derived information to avoid recomputing it. */
|
|
|
|
|
loops->cfg.dom = dom;
|
|
|
|
|
loops->cfg.dfs_order = dfs_order;
|
|
|
|
|
loops->cfg.rc_order = rc_order;
|
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
/* Allocate loop structures. */
|
1999-12-18 22:33:23 +01:00
|
|
|
|
loops->array
|
|
|
|
|
= (struct loop *) xcalloc (num_loops, sizeof (struct loop));
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
headers = sbitmap_alloc (n_basic_blocks);
|
|
|
|
|
sbitmap_zero (headers);
|
|
|
|
|
|
|
|
|
|
loops->shared_headers = sbitmap_alloc (n_basic_blocks);
|
|
|
|
|
sbitmap_zero (loops->shared_headers);
|
|
|
|
|
|
|
|
|
|
/* Find and record information about all the natural loops
|
|
|
|
|
in the CFG. */
|
|
|
|
|
num_loops = 0;
|
|
|
|
|
for (b = 0; b < n_basic_blocks; b++)
|
|
|
|
|
{
|
|
|
|
|
basic_block header;
|
|
|
|
|
|
2000-09-11 23:42:07 +02:00
|
|
|
|
/* Search the nodes of the CFG in reverse completion order
|
|
|
|
|
so that we can find outer loops first. */
|
2000-07-30 12:35:03 +02:00
|
|
|
|
header = BASIC_BLOCK (rc_order[b]);
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
/* Look for all the possible latch blocks for this header. */
|
|
|
|
|
for (e = header->pred; e; e = e->pred_next)
|
|
|
|
|
{
|
|
|
|
|
basic_block latch = e->src;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
/* Look for back edges where a predecessor is dominated
|
|
|
|
|
by this block. A natural loop has a single entry
|
|
|
|
|
node (header) that dominates all the nodes in the
|
|
|
|
|
loop. It also has single back edge to the header
|
|
|
|
|
from a latch node. Note that multiple natural loops
|
|
|
|
|
may share the same header. */
|
|
|
|
|
if (latch != ENTRY_BLOCK_PTR
|
|
|
|
|
&& TEST_BIT (dom[latch->index], header->index))
|
|
|
|
|
{
|
|
|
|
|
struct loop *loop;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
loop = loops->array + num_loops;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
loop->header = header;
|
|
|
|
|
loop->latch = latch;
|
2000-07-30 12:35:03 +02:00
|
|
|
|
loop->num = num_loops;
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
num_loops++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-11 14:45:05 +02:00
|
|
|
|
|
2000-09-11 23:42:07 +02:00
|
|
|
|
for (i = 0; i < num_loops; i++)
|
|
|
|
|
{
|
|
|
|
|
struct loop *loop = &loops->array[i];
|
|
|
|
|
|
|
|
|
|
/* Keep track of blocks that are loop headers so
|
|
|
|
|
that we can tell which loops should be merged. */
|
|
|
|
|
if (TEST_BIT (headers, loop->header->index))
|
|
|
|
|
SET_BIT (loops->shared_headers, loop->header->index);
|
|
|
|
|
SET_BIT (headers, loop->header->index);
|
|
|
|
|
|
|
|
|
|
/* Find nodes contained within the loop. */
|
|
|
|
|
loop->nodes = sbitmap_alloc (n_basic_blocks);
|
|
|
|
|
loop->num_nodes
|
|
|
|
|
= flow_loop_nodes_find (loop->header, loop->latch, loop->nodes);
|
2001-01-02 08:00:49 +01:00
|
|
|
|
|
2000-09-11 23:42:07 +02:00
|
|
|
|
/* Compute first and last blocks within the loop.
|
|
|
|
|
These are often the same as the loop header and
|
|
|
|
|
loop latch respectively, but this is not always
|
|
|
|
|
the case. */
|
|
|
|
|
loop->first
|
|
|
|
|
= BASIC_BLOCK (sbitmap_first_set_bit (loop->nodes));
|
|
|
|
|
loop->last
|
|
|
|
|
= BASIC_BLOCK (sbitmap_last_set_bit (loop->nodes));
|
2001-01-02 08:00:49 +01:00
|
|
|
|
|
2001-01-09 11:25:44 +01:00
|
|
|
|
flow_loop_scan (loops, loop, flags);
|
2000-09-11 23:42:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
/* Natural loops with shared headers may either be disjoint or
|
|
|
|
|
nested. Disjoint loops with shared headers cannot be inner
|
|
|
|
|
loops and should be merged. For now just mark loops that share
|
|
|
|
|
headers. */
|
|
|
|
|
for (i = 0; i < num_loops; i++)
|
|
|
|
|
if (TEST_BIT (loops->shared_headers, loops->array[i].header->index))
|
|
|
|
|
loops->array[i].shared = 1;
|
|
|
|
|
|
|
|
|
|
sbitmap_free (headers);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loops->num = num_loops;
|
|
|
|
|
|
|
|
|
|
/* Build the loop hierarchy tree. */
|
|
|
|
|
flow_loops_tree_build (loops);
|
|
|
|
|
|
|
|
|
|
/* Assign the loop nesting depth and enclosed loop level for each
|
|
|
|
|
loop. */
|
2000-01-24 00:10:09 +01:00
|
|
|
|
loops->levels = flow_loops_level_compute (loops);
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
|
|
|
|
|
return num_loops;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-11 23:42:07 +02:00
|
|
|
|
|
|
|
|
|
/* Update the information regarding the loops in the CFG
|
|
|
|
|
specified by LOOPS. */
|
|
|
|
|
int
|
|
|
|
|
flow_loops_update (loops, flags)
|
|
|
|
|
struct loops *loops;
|
|
|
|
|
int flags;
|
|
|
|
|
{
|
|
|
|
|
/* One day we may want to update the current loop data. For now
|
|
|
|
|
throw away the old stuff and rebuild what we need. */
|
|
|
|
|
if (loops->array)
|
|
|
|
|
flow_loops_free (loops);
|
2001-01-02 08:00:49 +01:00
|
|
|
|
|
2000-09-11 23:42:07 +02:00
|
|
|
|
return flow_loops_find (loops, flags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
/* Return non-zero if edge E enters header of LOOP from outside of LOOP. */
|
2000-05-20 00:27:28 +02:00
|
|
|
|
|
flow.c (flow_nodes_print, [...]): New functions.
* flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions.
(flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise.
(flow_loop_exits_find, flow_loop_nodes_find): Likewise.
(flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise.
(flow_loop_tree_node_add, flow_loops_tree_build): Likewise.
(flow_loop_level_compute, low_loops_level_compute): Likewise.
(flow_loops_find, flow_loop_outside_edge_p): Likewise.
* basic-block.h: Protect from multiple inclusion.
(flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes.
(struct loops, struct loop): Define structures.
* sbitmap.c (sbitmap_a_subset_b_p): New function.
* sbitmap.h: Protect from multiple inclusion.
(sbitmap_a_subset_b_p): Add prototype.
* Makefile.in (LOOP_H): New macro.
(stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H.
From-SVN: r30720
1999-11-30 11:42:29 +01:00
|
|
|
|
int
|
|
|
|
|
flow_loop_outside_edge_p (loop, e)
|
|
|
|
|
const struct loop *loop;
|
|
|
|
|
edge e;
|
|
|
|
|
{
|
|
|
|
|
if (e->dest != loop->header)
|
|
|
|
|
abort ();
|
|
|
|
|
return (e->src == ENTRY_BLOCK_PTR)
|
|
|
|
|
|| ! TEST_BIT (loop->nodes, e->src->index);
|
|
|
|
|
}
|
2000-02-14 20:34:06 +01:00
|
|
|
|
|
2000-08-11 14:45:05 +02:00
|
|
|
|
/* Clear LOG_LINKS fields of insns in a chain.
|
2000-08-01 03:27:45 +02:00
|
|
|
|
Also clear the global_live_at_{start,end} fields of the basic block
|
|
|
|
|
structures. */
|
2000-05-20 00:27:28 +02:00
|
|
|
|
|
2000-03-10 09:16:55 +01:00
|
|
|
|
void
|
|
|
|
|
clear_log_links (insns)
|
|
|
|
|
rtx insns;
|
|
|
|
|
{
|
|
|
|
|
rtx i;
|
2000-08-01 03:27:45 +02:00
|
|
|
|
int b;
|
|
|
|
|
|
2000-03-10 09:16:55 +01:00
|
|
|
|
for (i = insns; i; i = NEXT_INSN (i))
|
2000-08-04 22:28:08 +02:00
|
|
|
|
if (INSN_P (i))
|
2000-03-10 09:16:55 +01:00
|
|
|
|
LOG_LINKS (i) = 0;
|
2000-08-01 03:27:45 +02:00
|
|
|
|
|
|
|
|
|
for (b = 0; b < n_basic_blocks; b++)
|
|
|
|
|
{
|
2000-08-01 08:42:51 +02:00
|
|
|
|
basic_block bb = BASIC_BLOCK (b);
|
2000-08-01 03:27:45 +02:00
|
|
|
|
|
|
|
|
|
bb->global_live_at_start = NULL;
|
|
|
|
|
bb->global_live_at_end = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ENTRY_BLOCK_PTR->global_live_at_end = NULL;
|
|
|
|
|
EXIT_BLOCK_PTR->global_live_at_start = NULL;
|
2000-03-10 09:16:55 +01:00
|
|
|
|
}
|
2000-05-20 00:27:28 +02:00
|
|
|
|
|
|
|
|
|
/* Given a register bitmap, turn on the bits in a HARD_REG_SET that
|
|
|
|
|
correspond to the hard registers, if any, set in that map. This
|
|
|
|
|
could be done far more efficiently by having all sorts of special-cases
|
|
|
|
|
with moving single words, but probably isn't worth the trouble. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
reg_set_to_hard_reg_set (to, from)
|
|
|
|
|
HARD_REG_SET *to;
|
|
|
|
|
bitmap from;
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
EXECUTE_IF_SET_IN_BITMAP
|
|
|
|
|
(from, 0, i,
|
|
|
|
|
{
|
|
|
|
|
if (i >= FIRST_PSEUDO_REGISTER)
|
|
|
|
|
return;
|
|
|
|
|
SET_HARD_REG_BIT (*to, i);
|
|
|
|
|
});
|
|
|
|
|
}
|
2000-10-13 08:26:46 +02:00
|
|
|
|
|
|
|
|
|
/* Called once at intialization time. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
init_flow ()
|
|
|
|
|
{
|
|
|
|
|
static int initialized;
|
|
|
|
|
|
|
|
|
|
if (!initialized)
|
|
|
|
|
{
|
|
|
|
|
gcc_obstack_init (&flow_obstack);
|
|
|
|
|
flow_firstobj = (char *) obstack_alloc (&flow_obstack, 0);
|
|
|
|
|
initialized = 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
obstack_free (&flow_obstack, flow_firstobj);
|
|
|
|
|
flow_firstobj = (char *) obstack_alloc (&flow_obstack, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|