From f49b2e77f4ae607c97c98ea77b9213323935aba2 Mon Sep 17 00:00:00 2001 From: danglin Date: Mon, 24 Sep 2001 16:35:04 +0000 Subject: [PATCH] * pa.c (return_addr_rtx): Return NULL_RTX if count is not zero. Use initial value of return pointer register instead of value in frame-20. Revise comments. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45778 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/config/pa/pa.c | 51 ++++++++++++++++++++++++++------------------------- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 982fc5a95f9..dd18ed42ec6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2001-09-24 John David Anglin + * pa.c (return_addr_rtx): Return NULL_RTX if count is not zero. Use + initial value of return pointer register instead of value in frame-20. + Revise comments. + +2001-09-24 John David Anglin + * som.h (ASM_OUTPUT_EXTERNAL): Improve formatting. (ASM_OUTPUT_EXTERNAL_LIBCALL): Only generate a .IMPORT statement for the libcall if there isn't a referenced identifier for the symbol. diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 6ce61a8650c..dda9d973091 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -3461,7 +3461,10 @@ hppa_profile_hook (label_no) the current frame, after the prologue. FRAMEADDR is the frame pointer of the COUNT frame. - We want to ignore any export stub remnants here. + We want to ignore any export stub remnants here. To handle this, + we examine the code at the return address, and if it is an export + stub, we return a memory rtx for the stub return address stored + at frame-24. The value returned is used in two different ways: @@ -3476,42 +3479,36 @@ hppa_profile_hook (label_no) This function handles most instances of case 2; however, it will fail if we did not originally have stub code on the return path - but will need code on the new return path. This can happen if + but will need stub code on the new return path. This can happen if the caller & callee are both in the main program, but the new - return location is in a shared library. - - To handle this correctly we need to set the return pointer at - frame-20 to point to a return stub frame-24 to point to the - location we wish to return to. */ + return location is in a shared library. */ rtx return_addr_rtx (count, frameaddr) - int count ATTRIBUTE_UNUSED; + int count; rtx frameaddr; { rtx label; + rtx rp; rtx saved_rp; rtx ins; - if (TARGET_64BIT) - return gen_rtx_MEM (Pmode, plus_constant (frameaddr, -16)); + if (count != 0) + return NULL_RTX; - if (TARGET_NO_SPACE_REGS) - return gen_rtx_MEM (Pmode, plus_constant (frameaddr, -20)); + rp = get_hard_reg_initial_val (Pmode, 2); - /* First, we start off with the normal return address pointer from - -20[frameaddr]. */ + if (TARGET_64BIT || TARGET_NO_SPACE_REGS) + return rp; saved_rp = gen_reg_rtx (Pmode); - emit_move_insn (saved_rp, plus_constant (frameaddr, -20)); + emit_move_insn (saved_rp, rp); /* Get pointer to the instruction stream. We have to mask out the privilege level from the two low order bits of the return address pointer here so that ins will point to the start of the first instruction that would have been executed if we returned. */ - ins = copy_to_reg (gen_rtx_AND (Pmode, - copy_to_reg (gen_rtx_MEM (Pmode, saved_rp)), - MASK_RETURN_ADDR)); + ins = copy_to_reg (gen_rtx_AND (Pmode, rp, MASK_RETURN_ADDR)); label = gen_label_rtx (); /* Check the instruction stream at the normal return address for the @@ -3544,20 +3541,24 @@ return_addr_rtx (count, frameaddr) GEN_INT (0xe0400002), NE, NULL_RTX, SImode, 1, 0); - /* If there is no export stub then just use our initial guess of - -20[frameaddr]. */ + /* If there is no export stub then just use the value saved from + the return pointer register. */ emit_jump_insn (gen_bne (label)); - /* Here we know that our return address pointer points to an export + /* Here we know that our return address points to an export stub. We don't want to return the address of the export stub, - but rather the return address that leads back into user code. - That return address is stored at -24[frameaddr]. */ + but rather the return address of the export stub. That return + address is stored at -24[frameaddr]. */ - emit_move_insn (saved_rp, plus_constant (frameaddr, -24)); + emit_move_insn (saved_rp, + gen_rtx_MEM (Pmode, + memory_address (Pmode, + plus_constant (frameaddr, + -24)))); emit_label (label); - return gen_rtx_MEM (Pmode, memory_address (Pmode, saved_rp)); + return saved_rp; } /* This is only valid once reload has completed because it depends on -- 2.11.0