diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-11-07 09:06:08 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-11-07 09:06:08 +0000 |
commit | 4df60f5491ff35c8a48c2cf14e18a33c9793b3bb (patch) | |
tree | 97057d1e9ba1b772dde79b066801707d949da016 /lib/Target/ARM/ARMJITInfo.h | |
parent | 47c01a0099c10c031f8c544baf44b1c3a1de3fad (diff) | |
download | llvm-4df60f5491ff35c8a48c2cf14e18a33c9793b3bb.tar.gz llvm-4df60f5491ff35c8a48c2cf14e18a33c9793b3bb.tar.bz2 llvm-4df60f5491ff35c8a48c2cf14e18a33c9793b3bb.tar.xz |
Jump table JIT support. Work in progress.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58836 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMJITInfo.h')
-rw-r--r-- | lib/Target/ARM/ARMJITInfo.h | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/lib/Target/ARM/ARMJITInfo.h b/lib/Target/ARM/ARMJITInfo.h index 2a3a7f8f37..4b94f3ef79 100644 --- a/lib/Target/ARM/ARMJITInfo.h +++ b/lib/Target/ARM/ARMJITInfo.h @@ -16,6 +16,8 @@ #include "llvm/Target/TargetJITInfo.h" #include "llvm/CodeGen/MachineConstantPool.h" +#include "llvm/CodeGen/MachineFunction.h" +#include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" @@ -31,7 +33,11 @@ namespace llvm { // ConstPoolId2AddrMap - A map from constant pool ids to the corresponding // CONSTPOOL_ENTRY addresses. - SmallVector<intptr_t, 32> ConstPoolId2AddrMap; + SmallVector<intptr_t, 16> ConstPoolId2AddrMap; + + // JumpTableId2AddrMap - A map from inline jumptable ids to the + // corresponding inline jump table bases. + SmallVector<intptr_t, 16> JumpTableId2AddrMap; // PCLabelMap - A map from PC labels to addresses. DenseMap<unsigned, intptr_t> PCLabelMap; @@ -65,6 +71,10 @@ namespace llvm { /// pool address resolution is handled by the target. virtual bool hasCustomConstantPool() const { return true; } + /// hasCustomJumpTables - Allows a target to specify that jumptables + /// are emitted by the target. + virtual bool hasCustomJumpTables() const { return true; } + /// allocateSeparateGVMemory - If true, globals should be placed in /// separately allocated heap memory rather than in the same /// code memory allocated by MachineCodeEmitter. @@ -78,20 +88,21 @@ namespace llvm { /// Initialize - Initialize internal stage. Get the list of constant pool /// Resize constant pool ids to CONSTPOOL_ENTRY addresses map. - void Initialize(const std::vector<MachineConstantPoolEntry> *mcpes) { - MCPEs = mcpes; + void Initialize(const MachineFunction &MF) { + MCPEs = &MF.getConstantPool()->getConstants(); ConstPoolId2AddrMap.resize(MCPEs->size()); + JumpTableId2AddrMap.resize(MF.getJumpTableInfo()->getJumpTables().size()); } /// getConstantPoolEntryAddr - The ARM target puts all constant - /// pool entries into constant islands. Resolve the constant pool index - /// into the address where the constant is stored. + /// pool entries into constant islands. This returns the address of the + /// constant pool entry of the specified index. intptr_t getConstantPoolEntryAddr(unsigned CPI) const { assert(CPI < ConstPoolId2AddrMap.size()); return ConstPoolId2AddrMap[CPI]; } - /// addConstantPoolEntryAddr - Map a Constant Pool Index (CPI) to the address + /// addConstantPoolEntryAddr - Map a Constant Pool Index to the address /// where its associated value is stored. When relocations are processed, /// this value will be used to resolve references to the constant. void addConstantPoolEntryAddr(unsigned CPI, intptr_t Addr) { @@ -99,6 +110,23 @@ namespace llvm { ConstPoolId2AddrMap[CPI] = Addr; } + /// getJumpTableBaseAddr - The ARM target inline all jump tables within + /// text section of the function. This returns the address of the base of + /// the jump table of the specified index. + intptr_t getJumpTableBaseAddr(unsigned JTI) const { + assert(JTI < JumpTableId2AddrMap.size()); + return JumpTableId2AddrMap[JTI]; + } + + /// addJumpTableBaseAddr - Map a jump table index to the address where + /// the corresponding inline jump table is emitted. When relocations are + /// processed, this value will be used to resolve references to the + /// jump table. + void addJumpTableBaseAddr(unsigned JTI, intptr_t Addr) { + assert(JTI < JumpTableId2AddrMap.size()); + JumpTableId2AddrMap[JTI] = Addr; + } + /// getPCLabelAddr - Retrieve the address of the PC label of the specified id. intptr_t getPCLabelAddr(unsigned Id) const { DenseMap<unsigned, intptr_t>::const_iterator I = PCLabelMap.find(Id); @@ -112,10 +140,10 @@ namespace llvm { } private: - /// resolveRelocationAddr - Resolve the resulting address of the relocation + /// resolveRelocDestAddr - Resolve the resulting address of the relocation /// if it's not already solved. Constantpool entries must be resolved by /// ARM target. - intptr_t resolveRelocationAddr(MachineRelocation *MR) const; + intptr_t resolveRelocDestAddr(MachineRelocation *MR) const; }; } |