From 229aa352300d92a4cd3061d3fedd4b45a3052ca9 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Thu, 1 Jul 2004 23:31:49 -0700 Subject: [PATCH] alpha.c (struct machine_function): Add gp_save_rtx. * config/alpha/alpha.c (struct machine_function): Add gp_save_rtx. (alpha_gp_save_rtx): Use assign_stack_local instead of gen_mem_addressof. From-SVN: r84015 --- gcc/ChangeLog | 6 ++++++ gcc/config/alpha/alpha.c | 27 ++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 28db08a6a91..1987b5dec05 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-07-01 Richard Henderson + + * config/alpha/alpha.c (struct machine_function): Add gp_save_rtx. + (alpha_gp_save_rtx): Use assign_stack_local instead of + gen_mem_addressof. + 2004-07-01 Richard Henderson * config/alpha/alpha.c (struct alpha_rtx_cost_data): Add int_div. diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 66c8df184f7..23f35ebf4f1 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -5189,6 +5189,9 @@ struct machine_function GTY(()) /* For OSF. */ const char *some_ld_name; + + /* For TARGET_LD_BUGGY_LDGP. */ + struct rtx_def *gp_save_rtx; }; /* How to allocate a 'struct machine_function'. */ @@ -5213,16 +5216,30 @@ alpha_return_addr (int count, rtx frame ATTRIBUTE_UNUSED) return get_hard_reg_initial_val (Pmode, REG_RA); } -/* Return or create a pseudo containing the gp value for the current +/* Return or create a memory slot containing the gp value for the current function. Needed only if TARGET_LD_BUGGY_LDGP. */ rtx alpha_gp_save_rtx (void) { - rtx r = get_hard_reg_initial_val (DImode, 29); - if (GET_CODE (r) != MEM) - r = gen_mem_addressof (r, NULL_TREE, /*rescan=*/true); - return r; + rtx seq, m = cfun->machine->gp_save_rtx; + + if (m == NULL) + { + start_sequence (); + + m = assign_stack_local (DImode, UNITS_PER_WORD, BITS_PER_WORD); + m = validize_mem (m); + emit_move_insn (m, pic_offset_table_rtx); + + seq = get_insns (); + end_sequence (); + emit_insn_after (seq, entry_of_function ()); + + cfun->machine->gp_save_rtx = m; + } + + return m; } static int -- 2.30.2