Commit 6cde4876 by Jeff Law Committed by Jeff Law

emit-rtl.c (static_regno_reg_rtx): Define.

        * emit-rtl.c (static_regno_reg_rtx): Define.
        (init_emit_once): Initialize static_regno_reg_rtx.
        (init_emit): Copy static_regno_reg_rtx into regno_reg_rtx instead
        of building new hard reg objects once per function.
        (gen_rtx_REG): Try to share hard regs.
	* regclass.c (init_fake_stack_mems): New function broken out from
	init_regs.
	* rtl.h (init_fake_stack_mems): Declare.
	* toplev.c (lang_independent_init): Call init_regs before
	init_emit_once.  Call init_fake_stack_mems after init_emit_once.

From-SVN: r54588
parent dd3fbd93
...@@ -19,6 +19,17 @@ ...@@ -19,6 +19,17 @@
2002-06-13 Jeffrey Law <law@redhat.com> 2002-06-13 Jeffrey Law <law@redhat.com>
* emit-rtl.c (static_regno_reg_rtx): Define.
(init_emit_once): Initialize static_regno_reg_rtx.
(init_emit): Copy static_regno_reg_rtx into regno_reg_rtx instead
of building new hard reg objects once per function.
(gen_rtx_REG): Try to share hard regs.
* regclass.c (init_fake_stack_mems): New function broken out from
init_regs.
* rtl.h (init_fake_stack_mems): Declare.
* toplev.c (lang_independent_init): Call init_regs before
init_emit_once. Call init_fake_stack_mems after init_emit_once.
* i386.md (extenddfxf2, extenddftf2): Fix typo/thinko. * i386.md (extenddfxf2, extenddftf2): Fix typo/thinko.
* alias.c (argument_registers): Remove. * alias.c (argument_registers): Remove.
......
...@@ -92,6 +92,12 @@ static int no_line_numbers; ...@@ -92,6 +92,12 @@ static int no_line_numbers;
rtx global_rtl[GR_MAX]; rtx global_rtl[GR_MAX];
/* Commonly used RTL for hard registers. These objects are not necessarily
unique, so we allocate them separately from global_rtl. They are
initialized once per compilation unit, then copied into regno_reg_rtx
at the beginning of each function. */
static GTY(()) rtx static_regno_reg_rtx[FIRST_PSEUDO_REGISTER];
/* We record floating-point CONST_DOUBLEs in each floating-point mode for /* We record floating-point CONST_DOUBLEs in each floating-point mode for
the values of 0, 1, and 2. For the integer entries and VOIDmode, we the values of 0, 1, and 2. For the integer entries and VOIDmode, we
record a copy of const[012]_rtx. */ record a copy of const[012]_rtx. */
...@@ -527,6 +533,15 @@ gen_rtx_REG (mode, regno) ...@@ -527,6 +533,15 @@ gen_rtx_REG (mode, regno)
return stack_pointer_rtx; return stack_pointer_rtx;
} }
/* If the per-function register table has been set up, try to re-use
an existing entry in that table to avoid useless generation of RTL. */
if (cfun
&& cfun->emit
&& regno_reg_rtx
&& regno < FIRST_PSEUDO_REGISTER
&& reg_raw_mode[regno] == mode)
return regno_reg_rtx[regno];
return gen_raw_REG (mode, regno); return gen_raw_REG (mode, regno);
} }
...@@ -5067,7 +5082,6 @@ void ...@@ -5067,7 +5082,6 @@ void
init_emit () init_emit ()
{ {
struct function *f = cfun; struct function *f = cfun;
int i;
f->emit = (struct emit_status *) ggc_alloc (sizeof (struct emit_status)); f->emit = (struct emit_status *) ggc_alloc (sizeof (struct emit_status));
first_insn = NULL; first_insn = NULL;
...@@ -5098,13 +5112,13 @@ init_emit () ...@@ -5098,13 +5112,13 @@ init_emit ()
* sizeof (tree)); * sizeof (tree));
/* Put copies of all the hard registers into regno_reg_rtx. */ /* Put copies of all the hard registers into regno_reg_rtx. */
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) memcpy (regno_reg_rtx,
regno_reg_rtx[i] = gen_raw_REG (reg_raw_mode[i], i); static_regno_reg_rtx,
FIRST_PSEUDO_REGISTER * sizeof (rtx));
/* Put copies of all the virtual register rtx into regno_reg_rtx. */ /* Put copies of all the virtual register rtx into regno_reg_rtx. */
init_virtual_regs (f->emit); init_virtual_regs (f->emit);
/* Indicate that the virtual registers and stack locations are /* Indicate that the virtual registers and stack locations are
all pointers. */ all pointers. */
REG_POINTER (stack_pointer_rtx) = 1; REG_POINTER (stack_pointer_rtx) = 1;
...@@ -5238,6 +5252,11 @@ init_emit_once (line_numbers) ...@@ -5238,6 +5252,11 @@ init_emit_once (line_numbers)
gen_raw_REG (Pmode, VIRTUAL_OUTGOING_ARGS_REGNUM); gen_raw_REG (Pmode, VIRTUAL_OUTGOING_ARGS_REGNUM);
virtual_cfa_rtx = gen_raw_REG (Pmode, VIRTUAL_CFA_REGNUM); virtual_cfa_rtx = gen_raw_REG (Pmode, VIRTUAL_CFA_REGNUM);
/* Initialize RTL for commonly used hard registers. These are
copied into regno_reg_rtx as we begin to compile each function. */
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
static_regno_reg_rtx[i] = gen_raw_REG (reg_raw_mode[i], i);
#ifdef INIT_EXPANDERS #ifdef INIT_EXPANDERS
/* This is to initialize {init|mark|free}_machine_status before the first /* This is to initialize {init|mark|free}_machine_status before the first
call to push_function_context_to. This is needed by the Chill front call to push_function_context_to. This is needed by the Chill front
......
...@@ -601,11 +601,16 @@ init_regs () ...@@ -601,11 +601,16 @@ init_regs ()
init_reg_sets_1 (); init_reg_sets_1 ();
init_reg_modes (); init_reg_modes ();
}
/* Initialize some fake stack-frame MEM references for use in
memory_move_secondary_cost. */
void
init_fake_stack_mems ()
{
#ifdef HAVE_SECONDARY_RELOADS #ifdef HAVE_SECONDARY_RELOADS
{ {
/* Make some fake stack-frame MEM references for use in
memory_move_secondary_cost. */
int i; int i;
for (i = 0; i < MAX_MACHINE_MODE; i++) for (i = 0; i < MAX_MACHINE_MODE; i++)
......
...@@ -2026,6 +2026,7 @@ extern int reg_classes_intersect_p PARAMS ((enum reg_class, enum reg_class)); ...@@ -2026,6 +2026,7 @@ extern int reg_classes_intersect_p PARAMS ((enum reg_class, enum reg_class));
extern int reg_class_subset_p PARAMS ((enum reg_class, enum reg_class)); extern int reg_class_subset_p PARAMS ((enum reg_class, enum reg_class));
extern void globalize_reg PARAMS ((int)); extern void globalize_reg PARAMS ((int));
extern void init_regs PARAMS ((void)); extern void init_regs PARAMS ((void));
extern void init_fake_stack_mems PARAMS ((void));
extern void init_reg_sets PARAMS ((void)); extern void init_reg_sets PARAMS ((void));
extern void regset_release_memory PARAMS ((void)); extern void regset_release_memory PARAMS ((void));
extern void regclass_init PARAMS ((void)); extern void regclass_init PARAMS ((void));
......
...@@ -5035,6 +5035,9 @@ lang_independent_init () ...@@ -5035,6 +5035,9 @@ lang_independent_init ()
init_stringpool (); init_stringpool ();
init_obstacks (); init_obstacks ();
/* init_emit_once uses reg_raw_mode and therefore must be called
after init_regs which initialized reg_raw_mode. */
init_regs ();
init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
|| debug_info_level == DINFO_LEVEL_VERBOSE || debug_info_level == DINFO_LEVEL_VERBOSE
#ifdef VMS_DEBUGGING_INFO #ifdef VMS_DEBUGGING_INFO
...@@ -5043,7 +5046,7 @@ lang_independent_init () ...@@ -5043,7 +5046,7 @@ lang_independent_init ()
#endif #endif
|| flag_test_coverage || flag_test_coverage
|| warn_notreached); || warn_notreached);
init_regs (); init_fake_stack_mems ();
init_alias_once (); init_alias_once ();
init_loop (); init_loop ();
init_reload (); init_reload ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment