aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineFunction.cpp
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2006-12-14 19:17:33 +0000
committerJim Laskey <jlaskey@mac.com>2006-12-14 19:17:33 +0000
commitacd80ac7bb19f8bdfa55336d567c9ecbe695c8b8 (patch)
tree5d5f6c751aed7302797b4267adb0e5598a325428 /lib/CodeGen/MachineFunction.cpp
parent8897a7b02e6ccd50bbcb68133e55b54ec8a2e4e0 (diff)
1. Tidy up jump table info.
2. Allow the jit to handle PIC relocable jump tables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32581 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineFunction.cpp')
-rw-r--r--lib/CodeGen/MachineFunction.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp
index 5aaae6deb5..030e893f8f 100644
--- a/lib/CodeGen/MachineFunction.cpp
+++ b/lib/CodeGen/MachineFunction.cpp
@@ -21,6 +21,7 @@
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetFrameInfo.h"
#include "llvm/Function.h"
@@ -117,7 +118,14 @@ MachineFunction::MachineFunction(const Function *F,
MFInfo = 0;
FrameInfo = new MachineFrameInfo();
ConstantPool = new MachineConstantPool(TM.getTargetData());
- JumpTableInfo = new MachineJumpTableInfo(TM.getTargetData());
+
+ // Set up jump table.
+ const TargetData &TD = *TM.getTargetData();
+ bool IsPic = TM.getRelocationModel() == Reloc::PIC_;
+ unsigned EntrySize = IsPic ? 4 : TD.getPointerSize();
+ unsigned Alignment = IsPic ? TD.getIntAlignment() : TD.getPointerAlignment();
+ JumpTableInfo = new MachineJumpTableInfo(EntrySize, Alignment);
+
BasicBlocks.Parent = this;
}
@@ -380,14 +388,6 @@ void MachineJumpTableInfo::print(std::ostream &OS) const {
}
}
-unsigned MachineJumpTableInfo::getEntrySize() const {
- return TD->getPointerSize();
-}
-
-unsigned MachineJumpTableInfo::getAlignment() const {
- return TD->getPointerAlignment();
-}
-
void MachineJumpTableInfo::dump() const { print(*cerr.stream()); }