diff options
author | Jim Laskey <jlaskey@mac.com> | 2006-12-14 19:17:33 +0000 |
---|---|---|
committer | Jim Laskey <jlaskey@mac.com> | 2006-12-14 19:17:33 +0000 |
commit | 70323a81466271077aa5915afecc8949aee5e925 (patch) | |
tree | 24ab588d6058e30354945b6180a3674f3ef6d347 /llvm/lib/CodeGen/MachineFunction.cpp | |
parent | 3b7544e24c1db50ab4593eb2971164ee80714abb (diff) | |
download | llvm-70323a81466271077aa5915afecc8949aee5e925.zip llvm-70323a81466271077aa5915afecc8949aee5e925.tar.gz llvm-70323a81466271077aa5915afecc8949aee5e925.tar.bz2 |
1. Tidy up jump table info.
2. Allow the jit to handle PIC relocable jump tables.
llvm-svn: 32581
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineFunction.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 5aaae6d..030e893 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/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()); } |