From 9e2f7ec7e5f627299087530e4a499cd609ee453c Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Fri, 22 Jun 2001 13:38:20 -0400 Subject: [PATCH] arm.h (struct machine_function): Remove ra_rtx. * config/arm/arm.h (struct machine_function): Remove ra_rtx. * config/arm/arm.c (arm_mark_machine_status): Remove ra_rtx. (arm_return_addr): Use get_hard_reg_initial_val et al. * config/d30v/d30v.h (struct machine_function): Remove ra_rtx. * config/d30v/d30v.c (d30v_mark_machine_status): Remove ra_rtx. (d30v_return_addr): Use get_hard_reg_initial_val et al. * config/rs6000/rs6000.h (struct machine_function): Remove ra_rtx. * config/rs6000/rs6000.c (rs6000_override_options): Don't set mark_machine_status. (rs6000_mark_machine_status): Remove. (rs6000_return_addr): Use get_hard_reg_initial_val. (rs6000_ra_ever_killed): Use has_hard_reg_initial_val. * config/v850/v850.h (INIT_EXPANDERS): Delete. * config/v850/v850.c (struct machine_function): Delete. (v850_init_machine_status): Delete. (v850_mark_machine_status): Delete. (v850_free_machine_status): Delete. (v850_return_addr): Use get_hard_reg_initial_val. (v850_init_expanders): Delete. From-SVN: r43507 --- gcc/ChangeLog | 22 +++++++++++++ gcc/config/arm/arm.c | 35 ++++----------------- gcc/config/arm/arm.h | 2 -- gcc/config/d30v/d30v.c | 19 +----------- gcc/config/d30v/d30v.h | 2 -- gcc/config/rs6000/rs6000.c | 33 ++------------------ gcc/config/rs6000/rs6000.h | 2 -- gcc/config/v850/v850.c | 63 +------------------------------------- gcc/config/v850/v850.h | 4 --- 9 files changed, 33 insertions(+), 149 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d6c7f33d04b..928491e896f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,25 @@ +2001-06-22 DJ Delorie + + * config/arm/arm.h (struct machine_function): Remove ra_rtx. + * config/arm/arm.c (arm_mark_machine_status): Remove ra_rtx. + (arm_return_addr): Use get_hard_reg_initial_val et al. + * config/d30v/d30v.h (struct machine_function): Remove ra_rtx. + * config/d30v/d30v.c (d30v_mark_machine_status): Remove ra_rtx. + (d30v_return_addr): Use get_hard_reg_initial_val et al. + * config/rs6000/rs6000.h (struct machine_function): Remove ra_rtx. + * config/rs6000/rs6000.c (rs6000_override_options): Don't set + mark_machine_status. + (rs6000_mark_machine_status): Remove. + (rs6000_return_addr): Use get_hard_reg_initial_val. + (rs6000_ra_ever_killed): Use has_hard_reg_initial_val. + * config/v850/v850.h (INIT_EXPANDERS): Delete. + * config/v850/v850.c (struct machine_function): Delete. + (v850_init_machine_status): Delete. + (v850_mark_machine_status): Delete. + (v850_free_machine_status): Delete. + (v850_return_addr): Use get_hard_reg_initial_val. + (v850_init_expanders): Delete. + Fri Jun 22 19:20:59 CEST 2001 Jan Hubicka * predict.c (estimate_bb_frequencies): Do not handle conditional diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index ed4a35bd30b..a1ce9c0f53c 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -9606,10 +9606,7 @@ arm_mark_machine_status (p) machine_function *machine = p->machine; if (machine) - { - ggc_mark_rtx (machine->ra_rtx); - ggc_mark_rtx (machine->eh_epilogue_sp_ofs); - } + ggc_mark_rtx (machine->eh_epilogue_sp_ofs); } static void @@ -9642,37 +9639,17 @@ arm_return_addr (count, frame) int count; rtx frame ATTRIBUTE_UNUSED; { - rtx reg; - if (count != 0) return NULL_RTX; - reg = cfun->machine->ra_rtx; - - if (reg == NULL) + if (TARGET_APCS_32) + return get_hard_reg_initial_val (Pmode, LR_REGNUM); + else { - rtx init; - - /* No rtx yet. Invent one, and initialize it for r14 (lr) in - the prologue. */ - reg = gen_reg_rtx (Pmode); - cfun->machine->ra_rtx = reg; - - if (!TARGET_APCS_32) - init = gen_rtx_AND (Pmode, gen_rtx_REG (Pmode, LR_REGNUM), + rtx lr = gen_rtx_AND (Pmode, gen_rtx_REG (Pmode, LR_REGNUM), GEN_INT (RETURN_ADDR_MASK26)); - else - init = gen_rtx_REG (Pmode, LR_REGNUM); - - init = gen_rtx_SET (VOIDmode, reg, init); - - /* Emit the insn to the prologue with the other argument copies. */ - push_topmost_sequence (); - emit_insn_after (init, get_insns ()); - pop_topmost_sequence (); + return get_func_hard_reg_initial_val (cfun, lr); } - - return reg; } /* Do anything needed before RTL is emitted for each function. */ diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 073672fb427..8cd8b93f448 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -1433,8 +1433,6 @@ enum reg_class This is added to the cfun structure. */ typedef struct machine_function { - /* Records __builtin_return address. */ - struct rtx_def *ra_rtx; /* Additionsl stack adjustment in __builtin_eh_throw. */ struct rtx_def *eh_epilogue_sp_ofs; /* Records if LR has to be saved for far jumps. */ diff --git a/gcc/config/d30v/d30v.c b/gcc/config/d30v/d30v.c index b8f30aa7c5f..8f8f6d20280 100644 --- a/gcc/config/d30v/d30v.c +++ b/gcc/config/d30v/d30v.c @@ -3617,7 +3617,6 @@ d30v_mark_machine_status (p) if (p->machine == NULL) return; - ggc_mark_rtx (p->machine->ra_rtx); ggc_mark_rtx (p->machine->eh_epilogue_sp_ofs); } @@ -3655,23 +3654,7 @@ d30v_init_expanders () rtx d30v_return_addr () { - rtx ret; - - ret = cfun->machine->ra_rtx; - - if (ret == NULL) - { - rtx init; - - cfun->machine->ra_rtx = ret = gen_reg_rtx (Pmode); - - init = gen_rtx (SET, VOIDmode, ret, gen_rtx (REG, Pmode, GPR_LINK)); - push_topmost_sequence (); - emit_insn_after (init, get_insns ()); - pop_topmost_sequence (); - } - - return ret; + return get_hard_reg_initial_val (Pmode, GPR_LINK); } /* Called to register all of our global variables with the garbage diff --git a/gcc/config/d30v/d30v.h b/gcc/config/d30v/d30v.h index 7ac16e654c1..ca015b6f4d1 100644 --- a/gcc/config/d30v/d30v.h +++ b/gcc/config/d30v/d30v.h @@ -2870,8 +2870,6 @@ typedef struct machine_function { /* Additionsl stack adjustment in __builtin_eh_throw. */ struct rtx_def * eh_epilogue_sp_ofs; - /* Records __builtin_return address. */ - struct rtx_def * ra_rtx; } machine_function; diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 3662fe88563..2267b06c333 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -122,7 +122,6 @@ static void toc_hash_mark_table PARAMS ((void *)); static int constant_pool_expr_1 PARAMS ((rtx, int *, int *)); static void rs6000_free_machine_status PARAMS ((struct function *)); static void rs6000_init_machine_status PARAMS ((struct function *)); -static void rs6000_mark_machine_status PARAMS ((struct function *)); static int rs6000_ra_ever_killed PARAMS ((void)); /* Default register names. */ @@ -404,7 +403,6 @@ rs6000_override_options (default_cpu) /* Arrange to save and restore machine status around nested functions. */ init_machine_status = rs6000_init_machine_status; - mark_machine_status = rs6000_mark_machine_status; free_machine_status = rs6000_free_machine_status; } @@ -3750,14 +3748,6 @@ rs6000_init_machine_status (p) p->machine = (machine_function *) xcalloc (1, sizeof (machine_function)); } -static void -rs6000_mark_machine_status (p) - struct function *p; -{ - if (p->machine) - ggc_mark_rtx (p->machine->ra_rtx); -} - static void rs6000_free_machine_status (p) struct function *p; @@ -5387,8 +5377,6 @@ rs6000_return_addr (count, frame) int count; rtx frame; { - rtx init, reg; - /* Currently we don't optimize very well between prolog and body code and for PIC code the code can be actually quite bad, so don't try to be too clever here. */ @@ -5406,23 +5394,7 @@ rs6000_return_addr (count, frame) RETURN_ADDRESS_OFFSET))); } - reg = cfun->machine->ra_rtx; - if (reg == NULL) - { - /* No rtx yet. Invent one, and initialize it from LR in - the prologue. */ - reg = gen_reg_rtx (Pmode); - cfun->machine->ra_rtx = reg; - init = gen_rtx_SET (VOIDmode, reg, - gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM)); - - /* Emit the insn to the prologue with the other argument copies. */ - push_topmost_sequence (); - emit_insn_after (init, get_insns ()); - pop_topmost_sequence (); - } - - return reg; + return get_hard_reg_initial_val (Pmode, LINK_REGISTER_REGNUM); } static int @@ -5434,7 +5406,8 @@ rs6000_ra_ever_killed () if (current_function_is_thunk) return 0; #endif - if (!cfun->machine->ra_rtx || cfun->machine->ra_needs_full_frame) + if (!has_hard_reg_initial_val (Pmode, LINK_REGISTER_REGNUM) + || cfun->machine->ra_needs_full_frame) return regs_ever_live[LINK_REGISTER_REGNUM]; push_topmost_sequence (); diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 1de9c7d2590..260262a1b3d 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -1394,8 +1394,6 @@ typedef struct machine_function { /* Whether a System V.4 varargs area was created. */ int sysv_varargs_p; - /* Set if a return address rtx for loading from LR was created. */ - struct rtx_def *ra_rtx; /* Flags if __builtin_return_address (n) with n >= 1 was used. */ int ra_needs_full_frame; } machine_function; diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index e97b76da57d..4883ab2daae 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -51,9 +51,6 @@ static int const_costs_int PARAMS ((HOST_WIDE_INT, int)); static void substitute_ep_register PARAMS ((rtx, rtx, int, int, rtx *, rtx *)); static int ep_memory_offset PARAMS ((enum machine_mode, int)); static void v850_set_data_area PARAMS ((tree, v850_data_area)); -static void v850_init_machine_status PARAMS ((struct function *)); -static void v850_mark_machine_status PARAMS ((struct function *)); -static void v850_free_machine_status PARAMS ((struct function *)); /* True if the current function has anonymous arguments. */ int current_function_anonymous_args; @@ -2786,36 +2783,6 @@ v850_va_arg (valist, type) return addr_rtx; } -/* Functions to save and restore machine-specific function data. */ -struct machine_function -{ - /* Records __builtin_return address. */ - struct rtx_def * ra_rtx; -}; - -static void -v850_init_machine_status (p) - struct function * p; -{ - p->machine = - (struct machine_function *) xcalloc (1, sizeof (struct machine_function)); -} - -static void -v850_mark_machine_status (p) - struct function * p; -{ - ggc_mark_rtx (p->machine->ra_rtx); -} - -static void -v850_free_machine_status (p) - struct function * p; -{ - free (p->machine); - p->machine = NULL; -} - /* Return an RTX indicating where the return address to the calling function can be found. */ @@ -2826,33 +2793,5 @@ v850_return_addr (count) if (count != 0) return const0_rtx; - if (cfun->machine->ra_rtx == NULL) - { - rtx init; - - /* No rtx yet. Invent one, and initialize it for r31 (lp) in - the prologue. */ - cfun->machine->ra_rtx = gen_reg_rtx (Pmode); - - init = gen_rtx_REG (Pmode, LINK_POINTER_REGNUM); - - init = gen_rtx_SET (VOIDmode, cfun->machine->ra_rtx, init); - - /* Emit the insn to the prologue with the other argument copies. */ - push_topmost_sequence (); - emit_insn_after (init, get_insns ()); - pop_topmost_sequence (); - } - - return cfun->machine->ra_rtx; -} - -/* Do anything needed before RTL is emitted for each function. */ - -void -v850_init_expanders () -{ - init_machine_status = v850_init_machine_status; - mark_machine_status = v850_mark_machine_status; - free_machine_status = v850_free_machine_status; + return get_hard_reg_initial_val (Pmode, LINK_POINTER_REGNUM); } diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h index 09632e7e5da..4c94e80e458 100644 --- a/gcc/config/v850/v850.h +++ b/gcc/config/v850/v850.h @@ -788,10 +788,6 @@ extern int current_function_anonymous_args; #define EXIT_IGNORE_STACK 1 -/* Initialize data used by insn expanders. This is called from insn_emit, - once for every function before code is generated. */ -#define INIT_EXPANDERS v850_init_expanders () - /* Output assembler code to FILE to increment profiler label # LABELNO for profiling a function entry. */ -- 2.30.2