From 799b33a028830934ff135f121d7048e2e6336e08 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Tue, 8 Apr 2003 11:14:06 +0200 Subject: [PATCH] i386.c (legitimate_pic_address_disp_p): Do not accept PLUS in the GOTOFF operand. * i386.c (legitimate_pic_address_disp_p): Do not accept PLUS in the GOTOFF operand. (legitimize_pic_address): Move plus outside the unspec. * i386.c (legitimate_constant_p): Check (CONST (PLUS (UNSPEC ... for validity. From-SVN: r65367 --- gcc/ChangeLog | 8 ++++++++ gcc/config/i386/i386.c | 22 ++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3d2e8341499..63bac4b9f87 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +Tue Apr 8 11:12:07 CEST 2003 Jan Hubicka + + * i386.c (legitimate_pic_address_disp_p): Do not accept PLUS in the + GOTOFF operand. + (legitimize_pic_address): Move plus outside the unspec. + * i386.c (legitimate_constant_p): Check (CONST (PLUS (UNSPEC ... + for validity. + 2003-04-08 Nathan Sidwell * gcov-io.h (gcov_save_position): Remove __inline__ from diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index fab8d95bd56..b4c8fafd27b 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -5674,6 +5674,13 @@ legitimate_constant_p (x) && tls_symbolic_operand (XEXP (inner, 0), Pmode)) return false; + if (GET_CODE (inner) == PLUS) + { + if (GET_CODE (XEXP (inner, 1)) != CONST_INT) + return false; + inner = XEXP (inner, 0); + } + /* Only some unspecs are valid as "constants". */ if (GET_CODE (inner) == UNSPEC) switch (XINT (inner, 1)) @@ -5833,7 +5840,10 @@ legitimate_pic_address_disp_p (disp) return false; return GET_CODE (XVECEXP (disp, 0, 0)) == SYMBOL_REF; case UNSPEC_GOTOFF: - return local_symbolic_operand (XVECEXP (disp, 0, 0), Pmode); + if (GET_CODE (XVECEXP (disp, 0, 0)) == SYMBOL_REF + || GET_CODE (XVECEXP (disp, 0, 0)) == LABEL_REF) + return local_symbolic_operand (XVECEXP (disp, 0, 0), Pmode); + return false; case UNSPEC_GOTTPOFF: case UNSPEC_GOTNTPOFF: case UNSPEC_INDNTPOFF: @@ -6146,7 +6156,15 @@ legitimize_pic_address (orig, reg) if (reload_in_progress) regs_ever_live[PIC_OFFSET_TABLE_REGNUM] = 1; - new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOTOFF); + if (GET_CODE (addr) == CONST) + addr = XEXP (addr, 0); + if (GET_CODE (addr) == PLUS) + { + new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, XEXP (addr, 0)), UNSPEC_GOTOFF); + new = gen_rtx_PLUS (Pmode, new, XEXP (addr, 1)); + } + else + new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOTOFF); new = gen_rtx_CONST (Pmode, new); new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new); -- 2.30.2