summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorpk <pk@NetBSD.org>1994-03-03 10:35:50 +0000
committerpk <pk@NetBSD.org>1994-03-03 10:35:50 +0000
commitbae64c28016d0559c78eaebdea705ec8f91003fe (patch)
treed5a024361b8071f24a6a8054d744fa39309b8719 /gnu
parenta5d3e918bda2acec55291f8246aa39df54aa7e5a (diff)
Fix from <law@snake.cs.utah.edu> to save address register # 5 when used
for PIC addressing.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/gcc2/arch/m68k/aux-output.c23
-rw-r--r--gnu/usr.bin/gcc2/arch/m68k/m68k.h7
2 files changed, 10 insertions, 20 deletions
diff --git a/gnu/usr.bin/gcc2/arch/m68k/aux-output.c b/gnu/usr.bin/gcc2/arch/m68k/aux-output.c
index 7b724d08116..fdd8bb4a21b 100644
--- a/gnu/usr.bin/gcc2/arch/m68k/aux-output.c
+++ b/gnu/usr.bin/gcc2/arch/m68k/aux-output.c
@@ -18,7 +18,7 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef lint
-static char rcsid[] = "$Id: aux-output.c,v 1.1 1993/11/25 01:25:57 paulus Exp $";
+static char rcsid[] = "$Id: aux-output.c,v 1.2 1994/03/03 10:35:50 pk Exp $";
#endif /* not lint */
/* Some output-actions in m68k.md need these. */
@@ -55,19 +55,6 @@ static rtx find_addr_reg ();
rtx legitimize_pic_address ();
-/* Emit a (use pic_offset_table_rtx) if we used PIC relocation in the
- function at any time during the compilation process. In the future
- we should try and eliminate the USE if we can easily determine that
- all PIC references were deleted from the current function. That would
- save an address register */
-
-finalize_pic ()
-{
- if (flag_pic && current_function_uses_pic_offset_table)
- emit_insn (gen_rtx (USE, VOIDmode, pic_offset_table_rtx));
-}
-
-
/* This function generates the assembly code for function entry.
STREAM is a stdio stream to output the code to.
SIZE is an int: how many units of temporary storage to allocate.
@@ -809,7 +796,15 @@ legitimize_pic_address (orig, mode, reg)
pic_ref = gen_rtx (MEM, Pmode,
gen_rtx (PLUS, Pmode,
pic_offset_table_rtx, orig));
+
+ /* We could have a function which didn't use the GOT after RTL
+ generation, but because of some action from a later pass
+ (reload in particular) uses the GOT now. So emit both a USE
+ insn and set regs_ever_live for the GOT register. */
+
current_function_uses_pic_offset_table = 1;
+ emit_insn (gen_rtx (USE, VOIDmode, pic_offset_table_rtx));
+ regs_ever_live[REGNO (pic_offset_table_rtx)] = 1;
RTX_UNCHANGING_P (pic_ref) = 1;
emit_move_insn (reg, pic_ref);
return reg;
diff --git a/gnu/usr.bin/gcc2/arch/m68k/m68k.h b/gnu/usr.bin/gcc2/arch/m68k/m68k.h
index 9e82ddb32d6..716dcbdfffb 100644
--- a/gnu/usr.bin/gcc2/arch/m68k/m68k.h
+++ b/gnu/usr.bin/gcc2/arch/m68k/m68k.h
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: m68k.h,v 1.1 1993/11/25 01:26:21 paulus Exp $
+ $Id: m68k.h,v 1.2 1994/03/03 10:35:53 pk Exp $
*/
@@ -255,11 +255,6 @@ extern int target_flags;
/* This defines the register which is used to hold the offset table for PIC. */
#define PIC_OFFSET_TABLE_REGNUM 13
-/* Used to output a (use pic_offset_table_rtx) so that we
- always save/restore a5 in functions that use PIC relocation
- at *any* time during the compilation process. */
-#define FINALIZE_PIC finalize_pic()
-
#ifndef SUPPORT_SUN_FPA
/* 1 for registers that have pervasive standard uses