summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-25 23:38:14 +0000
committerChris Lattner <sabre@nondot.org>2010-01-25 23:38:14 +0000
commit9c1efcd4f6f361ee0b3076e8f84c9c562fe3c258 (patch)
tree528b91e05a5b42dad692111346d54ced100d6795
parentc54353d9354c0499ef869dea0d685926b6f59af7 (diff)
downloadbcm5719-llvm-9c1efcd4f6f361ee0b3076e8f84c9c562fe3c258.tar.gz
bcm5719-llvm-9c1efcd4f6f361ee0b3076e8f84c9c562fe3c258.zip
in 32-bit pic mode for targets with a GOT, x86 emits jump table
entries with @GOTOFF whih is EK_GPRel32BlockAddress. llvm-svn: 94474
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp15
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 02582a044f1..aae17a8cf1b 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -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,
diff --git a/llvm/lib/Target/X86/X86ISelLowering.h b/llvm/lib/Target/X86/X86ISelLowering.h
index 11b52257f69..8fc4ec9b33d 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.h
+++ b/llvm/lib/Target/X86/X86ISelLowering.h
@@ -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,
OpenPOWER on IntegriCloud