Jeff for Tege:
* pa.h (GO_IF_LEGITIMATE_ADDRESS): Allow (lo_sum (reg) (unspec (symref))). * pa.md (pic2_lo_sum): New pattern matching when -fPIC using UNSPEC. * pa.c (legitimize_pic_address): Generate an insn matching pic2_lo_sum when -fPIC. * pa.md (pic_highpart): Add missing mode for PLUS. (add_high_const): Likewise. * pa.md (matcher for plain lo_sum): Call abort if this happens when generating pic or PIC. From-SVN: r8423
This commit is contained in:
parent
279c9bde62
commit
a205e34b22
@ -491,8 +491,10 @@ legitimize_pic_address (orig, mode, reg)
|
||||
|
||||
if (flag_pic == 2)
|
||||
{
|
||||
emit_insn (gen_pic_highpart (reg, pic_offset_table_rtx, orig));
|
||||
pic_ref = (gen_rtx (MEM, Pmode, gen_rtx (LO_SUM, Pmode, reg, orig)));
|
||||
emit_insn (gen_pic2_highpart (reg, pic_offset_table_rtx, orig));
|
||||
pic_ref = gen_rtx (MEM, Pmode,
|
||||
gen_rtx (LO_SUM, Pmode, reg,
|
||||
gen_rtx (UNSPEC, SImode, gen_rtvec (1, orig), 0)));
|
||||
}
|
||||
else
|
||||
pic_ref = gen_rtx (MEM, Pmode,
|
||||
|
@ -1355,6 +1355,12 @@ extern union tree_node *current_function_decl;
|
||||
|| (GET_CODE (X) == CONST_INT \
|
||||
&& INT_5_BITS (X))) \
|
||||
goto ADDR; \
|
||||
/* Needed for -fPIC */ \
|
||||
else if (GET_CODE (X) == LO_SUM \
|
||||
&& GET_CODE (XEXP (X, 0)) == REG \
|
||||
&& REG_OK_FOR_BASE_P (XEXP (X, 0)) \
|
||||
&& GET_CODE (XEXP (X, 1)) == UNSPEC) \
|
||||
goto ADDR; \
|
||||
}
|
||||
|
||||
/* Try machine-dependent ways of modifying an illegitimate address
|
||||
|
@ -1166,10 +1166,10 @@
|
||||
[(set_attr "type" "multi")
|
||||
(set_attr "length" "16")]) ; 12 or 16
|
||||
|
||||
(define_insn "pic_highpart"
|
||||
(define_insn "pic2_highpart"
|
||||
[(set (match_operand:SI 0 "register_operand" "=a")
|
||||
(plus (match_operand:SI 1 "register_operand" "r")
|
||||
(high:SI (match_operand 2 "" ""))))]
|
||||
(plus:SI (match_operand:SI 1 "register_operand" "r")
|
||||
(high:SI (match_operand 2 "" ""))))]
|
||||
"symbolic_operand (operands[2], Pmode)
|
||||
&& ! function_label_operand (operands[2])
|
||||
&& ! read_only_operand (operands[2])
|
||||
@ -1178,6 +1178,22 @@
|
||||
[(set_attr "type" "binary")
|
||||
(set_attr "length" "4")])
|
||||
|
||||
; We need this to make sure CSE doesn't simplify a memory load with a
|
||||
; symbolic address, whose content it think it knows. For PIC, what CSE
|
||||
; think is the real value will be the address of that value.
|
||||
(define_insn "pic2_lo_sum"
|
||||
[(set (match_operand:SI 0 "register_operand" "=r")
|
||||
(mem:SI (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
|
||||
(unspec:SI [(match_operand:SI 2 "symbolic_operand" "")] 0))))]
|
||||
""
|
||||
"*
|
||||
{
|
||||
if (flag_pic != 2)
|
||||
abort ();
|
||||
return \"ldw RT'%G2(%1),%0\";
|
||||
}")
|
||||
|
||||
|
||||
;; Always use addil rather than ldil;add sequences. This allows the
|
||||
;; HP linker to eliminate the dp relocation if the symbolic operand
|
||||
;; lives in the TEXT space.
|
||||
@ -1267,9 +1283,7 @@
|
||||
"!is_function_label_plus_const (operands[2])"
|
||||
"*
|
||||
{
|
||||
if (flag_pic == 2 && symbolic_operand (operands[2], Pmode))
|
||||
return \"ldw RT'%G2(%1),%0\";
|
||||
else if (flag_pic == 1 && symbolic_operand (operands[2], Pmode))
|
||||
if (flag_pic && symbolic_operand (operands[2], Pmode))
|
||||
abort ();
|
||||
else
|
||||
return \"ldo R'%G2(%1),%0\";
|
||||
@ -1386,7 +1400,7 @@
|
||||
(define_insn ""
|
||||
[(set (match_operand:HI 0 "register_operand" "=r")
|
||||
(lo_sum:HI (match_operand:HI 1 "register_operand" "r")
|
||||
(match_operand 2 "const_int_operand" "i")))]
|
||||
(match_operand 2 "const_int_operand" "")))]
|
||||
""
|
||||
"ldo R'%G2(%1),%0"
|
||||
[(set_attr "length" "4")])
|
||||
|
Loading…
Reference in New Issue
Block a user