+2004-07-06 Richard Henderson <rth@redhat.com>
+
+ * config/i386/i386.c (legitimize_pic_address): Make static.
+ (legitimize_address): Handle CONST with TLS operand.
+ (ix86_expand_move): Don't call legitimize_pic_address directly.
+ * config/i386/i386-protos.h (legitimize_pic_address): Remove.
+
2004-07-06 Roger Sayle <roger@eyesopen.com>
* ifcvt.c (struct noce_if_info): Add a Boolean b_unconditional field.
extern bool legitimate_pic_operand_p (rtx);
extern int legitimate_pic_address_disp_p (rtx);
extern int legitimate_address_p (enum machine_mode, rtx, int);
-extern rtx legitimize_pic_address (rtx, rtx);
extern rtx legitimize_address (rtx, rtx, enum machine_mode);
extern void print_reg (rtx, int, FILE*);
GO_IF_LEGITIMATE_ADDRESS rejects symbolic references unless the PIC
reg also appears in the address. */
-rtx
+static rtx
legitimize_pic_address (rtx orig, rtx reg)
{
rtx addr = orig;
log = tls_symbolic_operand (x, mode);
if (log)
return legitimize_tls_address (x, log, false);
+ if (GET_CODE (x) == CONST
+ && GET_CODE (XEXP (x, 0)) == PLUS
+ && (log = tls_symbolic_operand (XEXP (XEXP (x, 0), 0), Pmode)))
+ {
+ rtx t = legitimize_tls_address (XEXP (XEXP (x, 0), 0), log, false);
+ return gen_rtx_PLUS (Pmode, t, XEXP (XEXP (x, 0), 1));
+ }
if (flag_pic && SYMBOLIC_CONST (x))
return legitimize_pic_address (x, 0);
if (GET_CODE (op0) == MEM)
op1 = force_reg (Pmode, op1);
else
- {
- rtx temp = op0;
- if (GET_CODE (temp) != REG)
- temp = gen_reg_rtx (Pmode);
- temp = legitimize_pic_address (op1, temp);
- if (temp == op0)
- return;
- op1 = temp;
- }
+ op1 = legitimize_address (op1, op1, Pmode);
#endif /* TARGET_MACHO */
}
else