aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1995-05-23 14:59:19 -0700
committerJim Wilson <wilson@gcc.gnu.org>1995-05-23 14:59:19 -0700
commit40f8d046b8badc0674fb8c43de78217b7388f7d7 (patch)
tree5f7d61882e6f7bffed3ccfb015579afd48e8f828 /gcc
parent1d3534c0e71bac66e3ac1ec7d7a8071643c2bd1c (diff)
downloadgcc-40f8d046b8badc0674fb8c43de78217b7388f7d7.zip
gcc-40f8d046b8badc0674fb8c43de78217b7388f7d7.tar.gz
gcc-40f8d046b8badc0674fb8c43de78217b7388f7d7.tar.bz2
(embedded_pic_offset): Output RTL to initialize embedded_pic_fnaddr_rtx.
(embedded_pic_offset): Output RTL to initialize embedded_pic_fnaddr_rtx. (mips_finalize_pic): Delete. From-SVN: r9785
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/mips/mips.c52
1 files changed, 23 insertions, 29 deletions
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index c6c146a..d959a2e 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -868,7 +868,29 @@ embedded_pic_offset (x)
rtx x;
{
if (embedded_pic_fnaddr_rtx == NULL)
- embedded_pic_fnaddr_rtx = gen_reg_rtx (Pmode);
+ {
+ rtx seq;
+
+ embedded_pic_fnaddr_rtx = gen_reg_rtx (Pmode);
+
+ /* Output code at function start to initialize the psuedo-reg. */
+ /* ??? We used to do this in FINALIZE_PIC, but that does not work for
+ inline functions, because it is called after RTL for the function
+ has been copied. The pseudo-reg in embedded_pic_fnaddr_rtx however
+ does not get copied, and ends up not matching the rest of the RTL.
+ This solution works, but means that we get unnecessary code to
+ initialize this value everytime a function is inlined into another
+ function. */
+ start_sequence ();
+ emit_insn (gen_get_fnaddr (embedded_pic_fnaddr_rtx,
+ XEXP (DECL_RTL (current_function_decl), 0)));
+ seq = gen_sequence ();
+ end_sequence ();
+ push_topmost_sequence ();
+ emit_insn_after (seq, get_insns ());
+ pop_topmost_sequence ();
+ }
+
return gen_rtx (CONST, Pmode,
gen_rtx (MINUS, Pmode, x,
XEXP (DECL_RTL (current_function_decl), 0)));
@@ -4362,34 +4384,6 @@ epilogue_reg_mentioned_p (insn)
return 0;
}
-
-
-/* When generating embedded PIC code we may need to get the address of
- the current function. We will need it if we take the address of
- any symbol in the .text section. */
-
-void
-mips_finalize_pic ()
-{
- rtx seq;
-
- if (! TARGET_EMBEDDED_PIC)
- return;
- if (embedded_pic_fnaddr_rtx == NULL)
- return;
-
- start_sequence ();
-
- emit_insn (gen_get_fnaddr (embedded_pic_fnaddr_rtx,
- XEXP (DECL_RTL (current_function_decl), 0)));
-
- seq = gen_sequence ();
- end_sequence ();
- emit_insn_after (seq, get_insns ());
-
- embedded_pic_fnaddr_rtx = NULL;
-}
-
/* Return the bytes needed to compute the frame pointer from the current
stack pointer.