diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-10-06 00:39:23 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-10-06 00:39:23 +0000 |
commit | e94a59c6a8d87b7a0c71d7f734fb9d0de454b314 (patch) | |
tree | 8d139251935aba1755bfaa2510b2f95b82ebf53f /gcc/reload1.c | |
parent | 2b36dcef4b8fa870faf867952abd1beb520d9289 (diff) | |
download | gcc-e94a59c6a8d87b7a0c71d7f734fb9d0de454b314.tar.gz |
* Makefile.in (stupid.o): Update dependencies.
(global.o): Likewise.
* global.c: Include reload.h
(reg_becomes_live): New function.
(reg_dies): New function.
(build_insn_chain): New function.
(global_alloc): Call build_insn_chain before calling reload.
* reload.h (struct needs): New structure definition.
(struct insn_chain): Likewise.
(reload_insn_chain): Declare variable.
(new_insn_chain): Declare function.
* reload1.c (reload_startobj): New variable.
(reload_insn_chain): New variable.
(unused_insn_chains): New variable.
(new_insn_chain): New function.
(init_reload): Initialize reload_startobj, not reload_firstobj.
(reload): Initialize reload_firstobj.
Before returning, free everything on the reload_obstack.
* stupid.c: Include insn-config.h, reload.h and basic-block.h.
(reg_where_dead_chain, reg_where_born_exact, reg_where_born_clobber,
current_chain): New variables.
(reg_where_born): Delete variable.
(REG_WHERE_BORN): New macro.
(find_clobbered_regs): New function.
(stupid_life_analysis): Don't allocate/free reg_where_born.
Allocate and free reg_where_born_exact, reg_where_born_clobber,
reg_where_dead_chain.
Use REG_WHERE_BORN instead of reg_where_born.
While processing the insns, build the reload_insn_chain with
information about register lifetimes.
(stupid_reg_compare): Use REG_WHERE_BORN instead of reg_where_born.
(stupid_mark_refs): Replace arg INSN with arg CHAIN. All callers
changed.
Compute and information about birth and death of pseudo registers in
reg_where_dead_chain, reg_where_born_exact and reg_where_born_clobber.
Delete code to set elements of reg_where_born.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@22862 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/reload1.c')
-rw-r--r-- | gcc/reload1.c | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c index 6b11bb95646..8b15e0e8e8d 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -32,9 +32,9 @@ Boston, MA 02111-1307, USA. */ #include "flags.h" #include "expr.h" #include "regs.h" +#include "basic-block.h" #include "reload.h" #include "recog.h" -#include "basic-block.h" #include "output.h" #include "real.h" #include "toplev.h" @@ -279,6 +279,13 @@ enum insn_code reload_out_optab[NUM_MACHINE_MODES]; insn. */ struct obstack reload_obstack; + +/* Points to the beginning of the reload_obstack. All insn_chain structures + are allocated first. */ +char *reload_startobj; + +/* The point after all insn_chain structures. Used to quickly deallocate + memory used while processing one insn. */ char *reload_firstobj; #define obstack_chunk_alloc xmalloc @@ -286,6 +293,10 @@ char *reload_firstobj; /* List of labels that must never be deleted. */ extern rtx forced_labels; + +/* List of insn_chain instructions, one for every insn that reload needs to + examine. */ +struct insn_chain *reload_insn_chain; /* This structure is used to record information about register eliminations. Each array entry describes one possible way of eliminating a register @@ -461,7 +472,7 @@ init_reload () /* Initialize obstack for our rtl allocation. */ gcc_obstack_init (&reload_obstack); - reload_firstobj = (char *) obstack_alloc (&reload_obstack, 0); + reload_startobj = (char *) obstack_alloc (&reload_obstack, 0); /* Decide which register class should be used when reloading addresses. If we are using SMALL_REGISTER_CLASSES, and any @@ -522,6 +533,32 @@ init_reload () } } +/* List of insn chains that are currently unused. */ +static struct insn_chain *unused_insn_chains = 0; + +/* Allocate an empty insn_chain structure. */ +struct insn_chain * +new_insn_chain () +{ + struct insn_chain *c; + + if (unused_insn_chains == 0) + { + c = obstack_alloc (&reload_obstack, sizeof (struct insn_chain)); + c->live_before = OBSTACK_ALLOC_REG_SET (&reload_obstack); + c->live_after = OBSTACK_ALLOC_REG_SET (&reload_obstack); + } + else + { + c = unused_insn_chains; + unused_insn_chains = c->next; + } + c->is_caller_save_insn = 0; + c->need_reload = 0; + c->need_elim = 0; + return c; +} + /* Global variables used by reload and its subroutines. */ /* Set during calculate_needs if an insn needs reloading. */ @@ -605,6 +642,8 @@ reload (first, global, dumpfile) failure = 0; + reload_firstobj = (char *) obstack_alloc (&reload_obstack, 0); + /* Enable find_equiv_reg to distinguish insns made by reload. */ reload_first_uid = get_max_uid (); @@ -1217,7 +1256,9 @@ reload (first, global, dumpfile) if (size > STACK_CHECK_MAX_FRAME_SIZE) warning ("frame size too large for reliable stack checking"); } - + + obstack_free (&reload_obstack, reload_startobj); + /* Indicate that we no longer have known memory locations or constants. */ reg_equiv_constant = 0; reg_equiv_memory_loc = 0; |