diff options
author | Arthur Eubanks <aeubanks@google.com> | 2023-08-31 10:13:20 -0700 |
---|---|---|
committer | Arthur Eubanks <aeubanks@google.com> | 2023-08-31 14:13:38 -0700 |
commit | 2a2f02e19f7737966592f24aa4354286d9756bd9 (patch) | |
tree | 18f5cef77e5916e77edc80c00a9fb8f2c1e091c8 /llvm/lib/CodeGen/MachineFunction.cpp | |
parent | 8399f3735a8f443fc0a3b828345eaccd8db969b8 (diff) | |
download | llvm-2a2f02e19f7737966592f24aa4354286d9756bd9.zip llvm-2a2f02e19f7737966592f24aa4354286d9756bd9.tar.gz llvm-2a2f02e19f7737966592f24aa4354286d9756bd9.tar.bz2 |
[X86] Use 64-bit jump table entries for large code model PIC
With the large code model, the label difference may not fit into 32 bits.
Even if we assume that any individual function is no larger than 2^32
and use a difference from the function entry to the target destination,
things like BOLT can rearrange blocks (even if BOLT doesn't necessarily
work with the large code model right now).
set directives avoid static relocations in some 32-bit entry cases, but
don't worry about set directives for 64-bit jump table entries (we can
do that later if somebody really cares about it).
check-llvm in a bootstrapped clang with the large code model passes.
Fixes #62894
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D159297
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineFunction.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 88939e9..e1f9488 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -1244,6 +1244,7 @@ unsigned MachineJumpTableInfo::getEntrySize(const DataLayout &TD) const { case MachineJumpTableInfo::EK_BlockAddress: return TD.getPointerSize(); case MachineJumpTableInfo::EK_GPRel64BlockAddress: + case MachineJumpTableInfo::EK_LabelDifference64: return 8; case MachineJumpTableInfo::EK_GPRel32BlockAddress: case MachineJumpTableInfo::EK_LabelDifference32: @@ -1264,6 +1265,7 @@ unsigned MachineJumpTableInfo::getEntryAlignment(const DataLayout &TD) const { case MachineJumpTableInfo::EK_BlockAddress: return TD.getPointerABIAlignment(0).value(); case MachineJumpTableInfo::EK_GPRel64BlockAddress: + case MachineJumpTableInfo::EK_LabelDifference64: return TD.getABIIntegerTypeAlignment(64).value(); case MachineJumpTableInfo::EK_GPRel32BlockAddress: case MachineJumpTableInfo::EK_LabelDifference32: |