mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-09 03:56:28 +00:00
Have TargetLowering::getPICJumpTableRelocBase return a node that points to the
GOT if jump table uses 64-bit gp-relative relocation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154341 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7f35455708
commit
787c3fd385
@ -1079,8 +1079,12 @@ unsigned TargetLowering::getJumpTableEncoding() const {
|
|||||||
SDValue TargetLowering::getPICJumpTableRelocBase(SDValue Table,
|
SDValue TargetLowering::getPICJumpTableRelocBase(SDValue Table,
|
||||||
SelectionDAG &DAG) const {
|
SelectionDAG &DAG) const {
|
||||||
// If our PIC model is GP relative, use the global offset table as the base.
|
// If our PIC model is GP relative, use the global offset table as the base.
|
||||||
if (getJumpTableEncoding() == MachineJumpTableInfo::EK_GPRel32BlockAddress)
|
unsigned JTEncoding = getJumpTableEncoding();
|
||||||
|
|
||||||
|
if ((JTEncoding == MachineJumpTableInfo::EK_GPRel64BlockAddress) ||
|
||||||
|
(JTEncoding == MachineJumpTableInfo::EK_GPRel32BlockAddress))
|
||||||
return DAG.getGLOBAL_OFFSET_TABLE(getPointerTy());
|
return DAG.getGLOBAL_OFFSET_TABLE(getPointerTy());
|
||||||
|
|
||||||
return Table;
|
return Table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,9 +13,13 @@ entry:
|
|||||||
; PIC-O32: lw $[[R0:[0-9]+]], %got($JTI0_0)
|
; PIC-O32: lw $[[R0:[0-9]+]], %got($JTI0_0)
|
||||||
; PIC-O32: addiu ${{[0-9]+}}, $[[R0]], %lo($JTI0_0)
|
; PIC-O32: addiu ${{[0-9]+}}, $[[R0]], %lo($JTI0_0)
|
||||||
; PIC-O32: sll ${{[0-9]+}}, ${{[0-9]+}}, 2
|
; PIC-O32: sll ${{[0-9]+}}, ${{[0-9]+}}, 2
|
||||||
|
; PIC-O32: addu $[[R1:[0-9]+]], ${{[0-9]+}}, $gp
|
||||||
|
; PIC-O32: jr $[[R1]]
|
||||||
; PIC-N64: ld $[[R0:[0-9]+]], %got_page($JTI0_0)
|
; PIC-N64: ld $[[R0:[0-9]+]], %got_page($JTI0_0)
|
||||||
; PIC-N64: daddiu ${{[0-9]+}}, $[[R0]], %got_ofst($JTI0_0)
|
; PIC-N64: daddiu ${{[0-9]+}}, $[[R0]], %got_ofst($JTI0_0)
|
||||||
; PIC-N64: dsll ${{[0-9]+}}, ${{[0-9]+}}, 3
|
; PIC-N64: dsll ${{[0-9]+}}, ${{[0-9]+}}, 3
|
||||||
|
; PIC-N64: daddu $[[R1:[0-9]+]], ${{[0-9]+}}, $gp
|
||||||
|
; PIC-N64: jr $[[R1]]
|
||||||
switch i32 %0, label %bb4 [
|
switch i32 %0, label %bb4 [
|
||||||
i32 0, label %bb5
|
i32 0, label %bb5
|
||||||
i32 1, label %bb1
|
i32 1, label %bb1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user