Lines 7653-7678
Link Here
|
7653 |
|
7653 |
|
7654 |
;; Now define ways of moving data around. |
7654 |
;; Now define ways of moving data around. |
7655 |
|
7655 |
|
7656 |
;; Elf specific ways of loading addresses for non-PIC code. |
|
|
7657 |
;; The output of this could be r0, but we make a very strong |
7658 |
;; preference for a base register because it will usually |
7659 |
;; be needed there. |
7660 |
(define_insn "elf_high" |
7661 |
[(set (match_operand:SI 0 "gpc_reg_operand" "=b*r") |
7662 |
(high:SI (match_operand 1 "" "")))] |
7663 |
"TARGET_ELF && ! TARGET_64BIT" |
7664 |
"{liu|lis} %0,%1@ha") |
7665 |
|
7666 |
(define_insn "elf_low" |
7667 |
[(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
7668 |
(lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r") |
7669 |
(match_operand 2 "" "")))] |
7670 |
"TARGET_ELF && ! TARGET_64BIT" |
7671 |
"@ |
7672 |
{cal|la} %0,%2@l(%1) |
7673 |
{ai|addic} %0,%1,%K2") |
7674 |
|
7675 |
|
7676 |
;; Set up a register with a value from the GOT table |
7656 |
;; Set up a register with a value from the GOT table |
7677 |
|
7657 |
|
7678 |
(define_expand "movsi_got" |
7658 |
(define_expand "movsi_got" |
Lines 10133-10139
Link Here
|
10133 |
[(set (match_operand:SI 0 "register_operand" "=l") |
10111 |
[(set (match_operand:SI 0 "register_operand" "=l") |
10134 |
(match_operand:SI 1 "immediate_operand" "s")) |
10112 |
(match_operand:SI 1 "immediate_operand" "s")) |
10135 |
(use (unspec [(match_dup 1)] UNSPEC_TOC))] |
10113 |
(use (unspec [(match_dup 1)] UNSPEC_TOC))] |
10136 |
"TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2" |
10114 |
"TARGET_ELF && DEFAULT_ABI != ABI_AIX |
|
|
10115 |
&& (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))" |
10137 |
"bcl 20,31,%1\\n%1:" |
10116 |
"bcl 20,31,%1\\n%1:" |
10138 |
[(set_attr "type" "branch") |
10117 |
[(set_attr "type" "branch") |
10139 |
(set_attr "length" "4")]) |
10118 |
(set_attr "length" "4")]) |
Lines 10156-10161
Link Here
|
10156 |
"{l|lwz} %0,%2-%3(%1)" |
10135 |
"{l|lwz} %0,%2-%3(%1)" |
10157 |
[(set_attr "type" "load")]) |
10136 |
[(set_attr "type" "load")]) |
10158 |
|
10137 |
|
|
|
10138 |
(define_insn "load_toc_v4_PIC_3b" |
10139 |
[(set (match_operand:SI 0 "gpc_reg_operand" "=b") |
10140 |
(plus:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
10141 |
(high:SI |
10142 |
(minus:SI (match_operand:SI 2 "symbol_ref_operand" "s") |
10143 |
(match_operand:SI 3 "symbol_ref_operand" "s")))))] |
10144 |
"TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic" |
10145 |
"{cau|addis} %0,%1,%2-%3@ha") |
10146 |
|
10147 |
(define_insn "load_toc_v4_PIC_3c" |
10148 |
[(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
10149 |
(lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b") |
10150 |
(minus:SI (match_operand:SI 2 "symbol_ref_operand" "s") |
10151 |
(match_operand:SI 3 "symbol_ref_operand" "s"))))] |
10152 |
"TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic" |
10153 |
"{cal|addi} %0,%1,%2-%3@l") |
10154 |
|
10159 |
|
10155 |
|
10160 |
;; If the TOC is shared over a translation unit, as happens with all |
10156 |
;; If the TOC is shared over a translation unit, as happens with all |
10161 |
;; the kinds of PIC that we support, we need to restore the TOC |
10157 |
;; the kinds of PIC that we support, we need to restore the TOC |
Lines 10190-10195
Link Here
|
10190 |
rs6000_emit_load_toc_table (FALSE); |
10186 |
rs6000_emit_load_toc_table (FALSE); |
10191 |
DONE; |
10187 |
DONE; |
10192 |
}") |
10188 |
}") |
|
|
10189 |
|
10190 |
;; Elf specific ways of loading addresses for non-PIC code. |
10191 |
;; The output of this could be r0, but we make a very strong |
10192 |
;; preference for a base register because it will usually |
10193 |
;; be needed there. |
10194 |
(define_insn "elf_high" |
10195 |
[(set (match_operand:SI 0 "gpc_reg_operand" "=b*r") |
10196 |
(high:SI (match_operand 1 "" "")))] |
10197 |
"TARGET_ELF && ! TARGET_64BIT" |
10198 |
"{liu|lis} %0,%1@ha") |
10199 |
|
10200 |
(define_insn "elf_low" |
10201 |
[(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
10202 |
(lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r") |
10203 |
(match_operand 2 "" "")))] |
10204 |
"TARGET_ELF && ! TARGET_64BIT" |
10205 |
"@ |
10206 |
{cal|la} %0,%2@l(%1) |
10207 |
{ai|addic} %0,%1,%K2") |
10208 |
|
10193 |
|
10209 |
|
10194 |
;; A function pointer under AIX is a pointer to a data area whose first word |
10210 |
;; A function pointer under AIX is a pointer to a data area whose first word |
10195 |
;; contains the actual address of the function, whose second word contains a |
10211 |
;; contains the actual address of the function, whose second word contains a |
Lines 10306-10311
Link Here
|
10306 |
|
10322 |
|
10307 |
operands[0] = XEXP (operands[0], 0); |
10323 |
operands[0] = XEXP (operands[0], 0); |
10308 |
|
10324 |
|
|
|
10325 |
if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT |
10326 |
&& flag_pic |
10327 |
&& GET_CODE (operands[0]) == SYMBOL_REF |
10328 |
&& !SYMBOL_REF_LOCAL_P (operands[0])) |
10329 |
{ |
10330 |
rtx call; |
10331 |
rtvec tmp; |
10332 |
|
10333 |
tmp = gen_rtvec (3, |
10334 |
gen_rtx_CALL (VOIDmode, |
10335 |
gen_rtx_MEM (SImode, operands[0]), |
10336 |
operands[1]), |
10337 |
gen_rtx_USE (VOIDmode, operands[2]), |
10338 |
gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode))); |
10339 |
call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp)); |
10340 |
use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx); |
10341 |
DONE; |
10342 |
} |
10343 |
|
10309 |
if (GET_CODE (operands[0]) != SYMBOL_REF |
10344 |
if (GET_CODE (operands[0]) != SYMBOL_REF |
10310 |
|| (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0])) |
10345 |
|| (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0])) |
10311 |
|| (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0)) |
10346 |
|| (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0)) |
Lines 10354-10359
Link Here
|
10354 |
|
10389 |
|
10355 |
operands[1] = XEXP (operands[1], 0); |
10390 |
operands[1] = XEXP (operands[1], 0); |
10356 |
|
10391 |
|
|
|
10392 |
if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT |
10393 |
&& flag_pic |
10394 |
&& GET_CODE (operands[1]) == SYMBOL_REF |
10395 |
&& !SYMBOL_REF_LOCAL_P (operands[1])) |
10396 |
{ |
10397 |
rtx call; |
10398 |
rtvec tmp; |
10399 |
|
10400 |
tmp = gen_rtvec (3, |
10401 |
gen_rtx_SET (VOIDmode, |
10402 |
operands[0], |
10403 |
gen_rtx_CALL (VOIDmode, |
10404 |
gen_rtx_MEM (SImode, |
10405 |
operands[1]), |
10406 |
operands[2])), |
10407 |
gen_rtx_USE (VOIDmode, operands[3]), |
10408 |
gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode))); |
10409 |
call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp)); |
10410 |
use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx); |
10411 |
DONE; |
10412 |
} |
10413 |
|
10357 |
if (GET_CODE (operands[1]) != SYMBOL_REF |
10414 |
if (GET_CODE (operands[1]) != SYMBOL_REF |
10358 |
|| (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1])) |
10415 |
|| (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1])) |
10359 |
|| (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0)) |
10416 |
|| (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0)) |
Lines 10624-10630
Link Here
|
10624 |
#if TARGET_MACHO |
10681 |
#if TARGET_MACHO |
10625 |
return output_call(insn, operands, 0, 2); |
10682 |
return output_call(insn, operands, 0, 2); |
10626 |
#else |
10683 |
#else |
10627 |
return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z0@plt" : "bl %z0"; |
10684 |
if (DEFAULT_ABI == ABI_V4 && flag_pic) |
|
|
10685 |
{ |
10686 |
if (TARGET_SECURE_PLT && flag_pic == 2) |
10687 |
/* The magic 32768 offset here and in the other sysv call insns |
10688 |
corresponds to the offset of r30 in .got2, as given by LCTOC1. |
10689 |
See sysv4.h:toc_section. */ |
10690 |
return "bl %z0+32768@plt"; |
10691 |
else |
10692 |
return "bl %z0@plt"; |
10693 |
} |
10694 |
else |
10695 |
return "bl %z0"; |
10628 |
#endif |
10696 |
#endif |
10629 |
} |
10697 |
} |
10630 |
[(set_attr "type" "branch,branch") |
10698 |
[(set_attr "type" "branch,branch") |
Lines 10669-10675
Link Here
|
10669 |
#if TARGET_MACHO |
10737 |
#if TARGET_MACHO |
10670 |
return output_call(insn, operands, 1, 3); |
10738 |
return output_call(insn, operands, 1, 3); |
10671 |
#else |
10739 |
#else |
10672 |
return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z1@plt" : "bl %z1"; |
10740 |
if (DEFAULT_ABI == ABI_V4 && flag_pic) |
|
|
10741 |
{ |
10742 |
if (TARGET_SECURE_PLT && flag_pic == 2) |
10743 |
return "bl %z1+32768@plt"; |
10744 |
else |
10745 |
return "bl %z1@plt"; |
10746 |
} |
10747 |
else |
10748 |
return "bl %z1"; |
10673 |
#endif |
10749 |
#endif |
10674 |
} |
10750 |
} |
10675 |
[(set_attr "type" "branch,branch") |
10751 |
[(set_attr "type" "branch,branch") |
Lines 10884-10890
Link Here
|
10884 |
else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS) |
10960 |
else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS) |
10885 |
output_asm_insn (\"creqv 6,6,6\", operands); |
10961 |
output_asm_insn (\"creqv 6,6,6\", operands); |
10886 |
|
10962 |
|
10887 |
return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@plt\" : \"b %z0\"; |
10963 |
if (DEFAULT_ABI == ABI_V4 && flag_pic) |
|
|
10964 |
{ |
10965 |
if (TARGET_SECURE_PLT && flag_pic == 2) |
10966 |
return \"b %z0+32768@plt\"; |
10967 |
else |
10968 |
return \"b %z0@plt\"; |
10969 |
} |
10970 |
else |
10971 |
return \"b %z0\"; |
10888 |
}" |
10972 |
}" |
10889 |
[(set_attr "type" "branch,branch") |
10973 |
[(set_attr "type" "branch,branch") |
10890 |
(set_attr "length" "4,8")]) |
10974 |
(set_attr "length" "4,8")]) |
Lines 10930-10936
Link Here
|
10930 |
else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS) |
11014 |
else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS) |
10931 |
output_asm_insn (\"creqv 6,6,6\", operands); |
11015 |
output_asm_insn (\"creqv 6,6,6\", operands); |
10932 |
|
11016 |
|
10933 |
return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@plt\" : \"b %z1\"; |
11017 |
if (DEFAULT_ABI == ABI_V4 && flag_pic) |
|
|
11018 |
{ |
11019 |
if (TARGET_SECURE_PLT && flag_pic == 2) |
11020 |
return \"b %z1+32768@plt\"; |
11021 |
else |
11022 |
return \"b %z1@plt\"; |
11023 |
} |
11024 |
else |
11025 |
return \"b %z1\"; |
10934 |
}" |
11026 |
}" |
10935 |
[(set_attr "type" "branch,branch") |
11027 |
[(set_attr "type" "branch,branch") |
10936 |
(set_attr "length" "4,8")]) |
11028 |
(set_attr "length" "4,8")]) |