diff options
author | Alex Samuel <samuel@codesourcery.com> | 1999-09-18 18:16:44 +0000 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 1999-09-18 11:16:44 -0700 |
commit | 5da077de9b51b3d3ec09e3c1a8cc8359d39ba4dc (patch) | |
tree | e1d713ac042501080771e2019559c03759274d81 /gcc/emit-rtl.c | |
parent | 711b552c22af933cd3122dc0c9b5012e1cc1e705 (diff) | |
download | gcc-5da077de9b51b3d3ec09e3c1a8cc8359d39ba4dc.zip gcc-5da077de9b51b3d3ec09e3c1a8cc8359d39ba4dc.tar.gz gcc-5da077de9b51b3d3ec09e3c1a8cc8359d39ba4dc.tar.bz2 |
rtl.h (global_rtx_index): New enum.
* rtl.h (global_rtx_index): New enum.
(global_rtl): Change to array of rtx.
(pc_rtx, cc0_rtx): Redefine accordingly.
(cc0_rtx, stack_pointer_rtx, frame_pointer_rtx): Likewise.
(hard_frame_pointer_rtx, arg_pointer_rtx): Likewise.
(virtual_incoming_args_rtx, virtual_stack_vars_rtx): Likewise.
(virtual_outgoing_args_rtx, virtual_cfa): Likewise.
(const_int_rtx): Change to array of rtx.
(const0_rtx, const1_rtx, const2_rtx, constm1_rtx): Redefine
accordingly.
* emit-rtl.c (global_rtl): Change to array of rtx.
(const_int_rtx): Change to aray of rtx.
(gen_rtx_CONST_INT): Redefine accordingly.
(init_emit_once): Allocate and initialize global_rtl. Likewise
for const_int_rtx. Add both as GC roots.
* genattrtab.c (global_rtl): Update declaration.
From-SVN: r29500
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r-- | gcc/emit-rtl.c | 205 |
1 files changed, 91 insertions, 114 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 08f8c27..56886fb 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -84,28 +84,7 @@ static int no_line_numbers; All of these except perhaps the floating-point CONST_DOUBLEs are unique; no other rtx-object will be equal to any of these. */ -/* Avoid warnings by initializing the `fld' field. Since its a union, - bypass problems with KNR compilers by only doing so when __GNUC__. */ -#ifdef __GNUC__ -#define FLDI , {{0}} -#else -#define FLDI -#endif - -struct _global_rtl global_rtl = -{ - {PC, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* pc_rtx */ - {CC0, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* cc0_rtx */ - {REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* stack_pointer_rtx */ - {REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* frame_pointer_rtx */ - {REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* hard_frame_pointer_rtx */ - {REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* arg_pointer_rtx */ - {REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* virtual_incoming_args_rtx */ - {REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* virtual_stack_vars_rtx */ - {REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* virtual_stack_dynamic_rtx */ - {REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* virtual_outgoing_args_rtx */ - {REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* virtual_cfa_rtx */ -}; +rtx global_rtl[GR_MAX]; /* 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 @@ -153,7 +132,7 @@ rtx return_address_pointer_rtx; /* (REG:Pmode RETURN_ADDRESS_POINTER_REGNUM) */ to save space during the compilation and simplify comparisons of integers. */ -struct rtx_def const_int_rtx[MAX_SAVED_CONST_INT * 2 + 1]; +rtx const_int_rtx[MAX_SAVED_CONST_INT * 2 + 1]; /* start_sequence and gen_sequence can make a lot of rtx expressions which are shortly thrown away. We use two mechanisms to prevent this waste: @@ -197,7 +176,7 @@ gen_rtx_CONST_INT (mode, arg) HOST_WIDE_INT arg; { if (arg >= - MAX_SAVED_CONST_INT && arg <= MAX_SAVED_CONST_INT) - return &const_int_rtx[arg + MAX_SAVED_CONST_INT]; + return const_int_rtx[arg + MAX_SAVED_CONST_INT]; #if STORE_FLAG_VALUE != 1 && STORE_FLAG_VALUE != -1 if (const_true_rtx && arg == STORE_FLAG_VALUE) @@ -3515,6 +3494,89 @@ init_emit_once (line_numbers) no_line_numbers = ! line_numbers; + /* Assign register numbers to the globally defined register rtx. + This must be done at runtime because the register number field + is in a union and some compilers can't initialize unions. */ + + pc_rtx = gen_rtx (PC, VOIDmode); + cc0_rtx = gen_rtx (CC0, VOIDmode); + stack_pointer_rtx = gen_rtx_raw_REG (Pmode, STACK_POINTER_REGNUM); + frame_pointer_rtx = gen_rtx_raw_REG (Pmode, FRAME_POINTER_REGNUM); + if (hard_frame_pointer_rtx == 0) + hard_frame_pointer_rtx = gen_rtx_raw_REG (Pmode, + HARD_FRAME_POINTER_REGNUM); + if (arg_pointer_rtx == 0) + arg_pointer_rtx = gen_rtx_raw_REG (Pmode, ARG_POINTER_REGNUM); + virtual_incoming_args_rtx = + gen_rtx_raw_REG (Pmode, VIRTUAL_INCOMING_ARGS_REGNUM); + virtual_stack_vars_rtx = + gen_rtx_raw_REG (Pmode, VIRTUAL_STACK_VARS_REGNUM); + virtual_stack_dynamic_rtx = + gen_rtx_raw_REG (Pmode, VIRTUAL_STACK_DYNAMIC_REGNUM); + virtual_outgoing_args_rtx = + gen_rtx_raw_REG (Pmode, VIRTUAL_OUTGOING_ARGS_REGNUM); + virtual_cfa_rtx = gen_rtx_raw_REG (Pmode, VIRTUAL_CFA_REGNUM); + + /* These rtx must be roots if GC is enabled. */ + if (ggc_p) + ggc_add_rtx_root (global_rtl, GR_MAX); + +#ifdef RETURN_ADDRESS_POINTER_REGNUM + return_address_pointer_rtx + = gen_rtx_raw_REG (Pmode, RETURN_ADDRESS_POINTER_REGNUM); +#endif + +#ifdef STRUCT_VALUE + struct_value_rtx = STRUCT_VALUE; +#else + struct_value_rtx = gen_rtx_REG (Pmode, STRUCT_VALUE_REGNUM); +#endif + +#ifdef STRUCT_VALUE_INCOMING + struct_value_incoming_rtx = STRUCT_VALUE_INCOMING; +#else +#ifdef STRUCT_VALUE_INCOMING_REGNUM + struct_value_incoming_rtx + = gen_rtx_REG (Pmode, STRUCT_VALUE_INCOMING_REGNUM); +#else + struct_value_incoming_rtx = struct_value_rtx; +#endif +#endif + +#ifdef STATIC_CHAIN_REGNUM + static_chain_rtx = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM); + +#ifdef STATIC_CHAIN_INCOMING_REGNUM + if (STATIC_CHAIN_INCOMING_REGNUM != STATIC_CHAIN_REGNUM) + static_chain_incoming_rtx + = gen_rtx_REG (Pmode, STATIC_CHAIN_INCOMING_REGNUM); + else +#endif + static_chain_incoming_rtx = static_chain_rtx; +#endif + +#ifdef STATIC_CHAIN + static_chain_rtx = STATIC_CHAIN; + +#ifdef STATIC_CHAIN_INCOMING + static_chain_incoming_rtx = STATIC_CHAIN_INCOMING; +#else + static_chain_incoming_rtx = static_chain_rtx; +#endif +#endif + +#ifdef PIC_OFFSET_TABLE_REGNUM + pic_offset_table_rtx = gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM); +#endif + +#ifdef INIT_EXPANDERS + /* This is to initialize save_machine_status and restore_machine_status before + the first call to push_function_context_to. This is needed by the Chill + front end which calls push_function_context_to before the first cal to + init_function_start. */ + INIT_EXPANDERS; +#endif + /* Compute the word and byte modes. */ byte_mode = VOIDmode; @@ -3552,15 +3614,14 @@ init_emit_once (line_numbers) /* Don't use gen_rtx here since gen_rtx in this case tries to use these variables. */ for (i = - MAX_SAVED_CONST_INT; i <= MAX_SAVED_CONST_INT; i++) - { - PUT_CODE (&const_int_rtx[i + MAX_SAVED_CONST_INT], CONST_INT); - PUT_MODE (&const_int_rtx[i + MAX_SAVED_CONST_INT], VOIDmode); - INTVAL (&const_int_rtx[i + MAX_SAVED_CONST_INT]) = i; - } + const_int_rtx[i + MAX_SAVED_CONST_INT] = + gen_rtx_raw_CONST_INT (VOIDmode, i); + if (ggc_p) + ggc_add_rtx_root (const_int_rtx, 2 * MAX_SAVED_CONST_INT + 1); if (STORE_FLAG_VALUE >= - MAX_SAVED_CONST_INT && STORE_FLAG_VALUE <= MAX_SAVED_CONST_INT) - const_true_rtx = &const_int_rtx[STORE_FLAG_VALUE + MAX_SAVED_CONST_INT]; + const_true_rtx = const_int_rtx[STORE_FLAG_VALUE + MAX_SAVED_CONST_INT]; else const_true_rtx = gen_rtx_CONST_INT (VOIDmode, STORE_FLAG_VALUE); @@ -3603,90 +3664,6 @@ init_emit_once (line_numbers) if (GET_MODE_CLASS (mode) == MODE_CC) const_tiny_rtx[0][(int) mode] = const0_rtx; - /* Assign register numbers to the globally defined register rtx. - This must be done at runtime because the register number field - is in a union and some compilers can't initialize unions. */ - - REGNO (stack_pointer_rtx) = STACK_POINTER_REGNUM; - PUT_MODE (stack_pointer_rtx, Pmode); - REGNO (frame_pointer_rtx) = FRAME_POINTER_REGNUM; - PUT_MODE (frame_pointer_rtx, Pmode); -#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM - REGNO (hard_frame_pointer_rtx) = HARD_FRAME_POINTER_REGNUM; - PUT_MODE (hard_frame_pointer_rtx, Pmode); -#endif -#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM && HARD_FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM - REGNO (arg_pointer_rtx) = ARG_POINTER_REGNUM; - PUT_MODE (arg_pointer_rtx, Pmode); -#endif - - REGNO (virtual_incoming_args_rtx) = VIRTUAL_INCOMING_ARGS_REGNUM; - PUT_MODE (virtual_incoming_args_rtx, Pmode); - REGNO (virtual_stack_vars_rtx) = VIRTUAL_STACK_VARS_REGNUM; - PUT_MODE (virtual_stack_vars_rtx, Pmode); - REGNO (virtual_stack_dynamic_rtx) = VIRTUAL_STACK_DYNAMIC_REGNUM; - PUT_MODE (virtual_stack_dynamic_rtx, Pmode); - REGNO (virtual_outgoing_args_rtx) = VIRTUAL_OUTGOING_ARGS_REGNUM; - PUT_MODE (virtual_outgoing_args_rtx, Pmode); - REGNO (virtual_cfa_rtx) = VIRTUAL_CFA_REGNUM; - PUT_MODE (virtual_cfa_rtx, Pmode); - -#ifdef RETURN_ADDRESS_POINTER_REGNUM - return_address_pointer_rtx - = gen_rtx_raw_REG (Pmode, RETURN_ADDRESS_POINTER_REGNUM); -#endif - -#ifdef STRUCT_VALUE - struct_value_rtx = STRUCT_VALUE; -#else - struct_value_rtx = gen_rtx_REG (Pmode, STRUCT_VALUE_REGNUM); -#endif - -#ifdef STRUCT_VALUE_INCOMING - struct_value_incoming_rtx = STRUCT_VALUE_INCOMING; -#else -#ifdef STRUCT_VALUE_INCOMING_REGNUM - struct_value_incoming_rtx - = gen_rtx_REG (Pmode, STRUCT_VALUE_INCOMING_REGNUM); -#else - struct_value_incoming_rtx = struct_value_rtx; -#endif -#endif - -#ifdef STATIC_CHAIN_REGNUM - static_chain_rtx = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM); - -#ifdef STATIC_CHAIN_INCOMING_REGNUM - if (STATIC_CHAIN_INCOMING_REGNUM != STATIC_CHAIN_REGNUM) - static_chain_incoming_rtx - = gen_rtx_REG (Pmode, STATIC_CHAIN_INCOMING_REGNUM); - else -#endif - static_chain_incoming_rtx = static_chain_rtx; -#endif - -#ifdef STATIC_CHAIN - static_chain_rtx = STATIC_CHAIN; - -#ifdef STATIC_CHAIN_INCOMING - static_chain_incoming_rtx = STATIC_CHAIN_INCOMING; -#else - static_chain_incoming_rtx = static_chain_rtx; -#endif -#endif - -#ifdef PIC_OFFSET_TABLE_REGNUM - pic_offset_table_rtx = gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM); -#endif - -#ifdef INIT_EXPANDERS - /* This is to initialize save_machine_status and restore_machine_status before - the first call to push_function_context_to. This is needed by the Chill - front end which calls push_function_context_to before the first cal to - init_function_start. */ - INIT_EXPANDERS; -#endif - ggc_add_rtx_root (&const_tiny_rtx[0][0], sizeof(const_tiny_rtx)/sizeof(rtx)); ggc_add_rtx_root (&const_true_rtx, 1); |