Skip to content

Commit 81423ac

Browse files
committed
Revert "[X86] Use 64-bit jump table entries for large code model PIC"
This reverts commit 2a2f02e.
1 parent 223a288 commit 81423ac

File tree

7 files changed

+4
-63
lines changed

7 files changed

+4
-63
lines changed

llvm/include/llvm/CodeGen/MIRYamlMapping.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ template <> struct ScalarEnumerationTraits<MachineJumpTableInfo::JTEntryKind> {
137137
MachineJumpTableInfo::EK_GPRel32BlockAddress);
138138
IO.enumCase(EntryKind, "label-difference32",
139139
MachineJumpTableInfo::EK_LabelDifference32);
140-
IO.enumCase(EntryKind, "label-difference64",
141-
MachineJumpTableInfo::EK_LabelDifference64);
142140
IO.enumCase(EntryKind, "inline", MachineJumpTableInfo::EK_Inline);
143141
IO.enumCase(EntryKind, "custom32", MachineJumpTableInfo::EK_Custom32);
144142
}

llvm/include/llvm/CodeGen/MachineJumpTableInfo.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@ class MachineJumpTableInfo {
6767
/// .word L4_5_set_123
6868
EK_LabelDifference32,
6969

70-
/// EK_LabelDifference64 - Each entry is the address of the block minus
71-
/// the address of the jump table. This is used for PIC jump tables where
72-
/// gprel64 is not supported. e.g.:
73-
/// .quad LBB123 - LJTI1_2
74-
EK_LabelDifference64,
75-
7670
/// EK_Inline - Jump table entries are emitted inline at their point of
7771
/// use. It is the responsibility of the target to emit the entries.
7872
EK_Inline,
@@ -81,7 +75,6 @@ class MachineJumpTableInfo {
8175
/// TargetLowering::LowerCustomJumpTableEntry hook.
8276
EK_Custom32
8377
};
84-
8578
private:
8679
JTEntryKind EntryKind;
8780
std::vector<MachineJumpTableEntry> JumpTables;

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2698,8 +2698,7 @@ void AsmPrinter::emitJumpTableInfo() {
26982698
const Function &F = MF->getFunction();
26992699
const TargetLoweringObjectFile &TLOF = getObjFileLowering();
27002700
bool JTInDiffSection = !TLOF.shouldPutJumpTableInFunctionSection(
2701-
MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32 ||
2702-
MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference64,
2701+
MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32,
27032702
F);
27042703
if (JTInDiffSection) {
27052704
// Drop it in the readonly section.
@@ -2797,17 +2796,15 @@ void AsmPrinter::emitJumpTableEntry(const MachineJumpTableInfo *MJTI,
27972796
return;
27982797
}
27992798

2800-
case MachineJumpTableInfo::EK_LabelDifference32:
2801-
case MachineJumpTableInfo::EK_LabelDifference64: {
2799+
case MachineJumpTableInfo::EK_LabelDifference32: {
28022800
// Each entry is the address of the block minus the address of the jump
28032801
// table. This is used for PIC jump tables where gprel32 is not supported.
28042802
// e.g.:
28052803
// .word LBB123 - LJTI1_2
28062804
// If the .set directive avoids relocations, this is emitted as:
28072805
// .set L4_5_set_123, LBB123 - LJTI1_2
28082806
// .word L4_5_set_123
2809-
if (MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32 &&
2810-
MAI->doesSetDirectiveSuppressReloc()) {
2807+
if (MAI->doesSetDirectiveSuppressReloc()) {
28112808
Value = MCSymbolRefExpr::create(GetJTSetSymbol(UID, MBB->getNumber()),
28122809
OutContext);
28132810
break;

llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3554,7 +3554,6 @@ void CodeViewDebug::collectDebugInfoForJumpTables(const MachineFunction *MF,
35543554
break;
35553555
case MachineJumpTableInfo::EK_Inline:
35563556
case MachineJumpTableInfo::EK_LabelDifference32:
3557-
case MachineJumpTableInfo::EK_LabelDifference64:
35583557
// Ask the AsmPrinter.
35593558
std::tie(Base, BaseOffset, Branch, EntrySize) =
35603559
Asm->getCodeViewJumpTableInfo(JumpTableIndex, &BranchMI, Branch);

llvm/lib/CodeGen/MachineFunction.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,6 @@ unsigned MachineJumpTableInfo::getEntrySize(const DataLayout &TD) const {
12521252
case MachineJumpTableInfo::EK_BlockAddress:
12531253
return TD.getPointerSize();
12541254
case MachineJumpTableInfo::EK_GPRel64BlockAddress:
1255-
case MachineJumpTableInfo::EK_LabelDifference64:
12561255
return 8;
12571256
case MachineJumpTableInfo::EK_GPRel32BlockAddress:
12581257
case MachineJumpTableInfo::EK_LabelDifference32:
@@ -1273,7 +1272,6 @@ unsigned MachineJumpTableInfo::getEntryAlignment(const DataLayout &TD) const {
12731272
case MachineJumpTableInfo::EK_BlockAddress:
12741273
return TD.getPointerABIAlignment(0).value();
12751274
case MachineJumpTableInfo::EK_GPRel64BlockAddress:
1276-
case MachineJumpTableInfo::EK_LabelDifference64:
12771275
return TD.getABIIntegerTypeAlignment(64).value();
12781276
case MachineJumpTableInfo::EK_GPRel32BlockAddress:
12791277
case MachineJumpTableInfo::EK_LabelDifference32:

llvm/lib/Target/X86/X86ISelLoweringCall.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,6 @@ unsigned X86TargetLowering::getJumpTableEncoding() const {
416416
// symbol.
417417
if (isPositionIndependent() && Subtarget.isPICStyleGOT())
418418
return MachineJumpTableInfo::EK_Custom32;
419-
if (isPositionIndependent() &&
420-
getTargetMachine().getCodeModel() == CodeModel::Large)
421-
return MachineJumpTableInfo::EK_LabelDifference64;
422419

423420
// Otherwise, use the normal jump table encoding heuristics.
424421
return TargetLowering::getJumpTableEncoding();
@@ -484,9 +481,7 @@ const MCExpr *X86TargetLowering::
484481
getPICJumpTableRelocBaseExpr(const MachineFunction *MF, unsigned JTI,
485482
MCContext &Ctx) const {
486483
// X86-64 uses RIP relative addressing based on the jump table label.
487-
if (Subtarget.isPICStyleRIPRel() ||
488-
(Subtarget.is64Bit() &&
489-
getTargetMachine().getCodeModel() == CodeModel::Large))
484+
if (Subtarget.isPICStyleRIPRel())
490485
return TargetLowering::getPICJumpTableRelocBaseExpr(MF, JTI, Ctx);
491486

492487
// Otherwise, the reference is relative to the PIC base.

llvm/test/CodeGen/X86/large-pic-jump-table.ll

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)