1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

in 32-bit pic mode for targets with a GOT, x86 emits jump table

entries with @GOTOFF whih is EK_GPRel32BlockAddress.

llvm-svn: 94474
This commit is contained in:
Chris Lattner 2010-01-25 23:38:14 +00:00
parent aa82645068
commit 9e24c71bd4
2 changed files with 17 additions and 0 deletions

View File

@ -31,6 +31,7 @@
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/PseudoSourceValue.h"
@ -1090,6 +1091,20 @@ X86TargetLowering::getOptimalMemOpType(uint64_t Size, unsigned Align,
return MVT::i32;
}
/// getJumpTableEncoding - Return the entry encoding for a jump table in the
/// current function. The returned value is a member of the
/// MachineJumpTableInfo::JTEntryKind enum.
unsigned X86TargetLowering::getJumpTableEncoding() const {
// In GOT pic mode, each entry in the jump table is emitted as a @GOTOFF
// symbol.
if (getTargetMachine().getRelocationModel() == Reloc::PIC_ &&
Subtarget->isPICStyleGOT())
return MachineJumpTableInfo::EK_GPRel32BlockAddress;
// Otherwise, use the normal jump table encoding heuristics.
return TargetLowering::getJumpTableEncoding();
}
/// getPICJumpTableRelocaBase - Returns relocation base for the given PIC
/// jumptable.
SDValue X86TargetLowering::getPICJumpTableRelocBase(SDValue Table,

View File

@ -376,6 +376,8 @@ namespace llvm {
public:
explicit X86TargetLowering(X86TargetMachine &TM);
unsigned getJumpTableEncoding() const;
/// getPICJumpTableRelocaBase - Returns relocation base for the given PIC
/// jumptable.
SDValue getPICJumpTableRelocBase(SDValue Table,