aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/ARM/ARMJITInfo.h
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-11-04 00:50:32 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-11-04 00:50:32 +0000
commit25e04788bfddc54dde7bed65302146b46089a166 (patch)
tree078176efdcd15d4eec35030cc86f27fa6abd71ed /lib/Target/ARM/ARMJITInfo.h
parentf6503a031e2459be63ebc688d32577d9f70da354 (diff)
downloadexternal_llvm-25e04788bfddc54dde7bed65302146b46089a166.zip
external_llvm-25e04788bfddc54dde7bed65302146b46089a166.tar.gz
external_llvm-25e04788bfddc54dde7bed65302146b46089a166.tar.bz2
Handle ARM machine constantpool entries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58671 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMJITInfo.h')
-rw-r--r--lib/Target/ARM/ARMJITInfo.h38
1 files changed, 33 insertions, 5 deletions
diff --git a/lib/Target/ARM/ARMJITInfo.h b/lib/Target/ARM/ARMJITInfo.h
index cdcd1ad..ba8768a 100644
--- a/lib/Target/ARM/ARMJITInfo.h
+++ b/lib/Target/ARM/ARMJITInfo.h
@@ -15,6 +15,8 @@
#define ARMJITINFO_H
#include "llvm/Target/TargetJITInfo.h"
+#include "llvm/CodeGen/MachineConstantPool.h"
+#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
namespace llvm {
@@ -23,10 +25,17 @@ namespace llvm {
class ARMJITInfo : public TargetJITInfo {
ARMTargetMachine &TM;
+ // MCPEs - List of the constant pool entries for the current machine
+ // function that's being processed.
+ const std::vector<MachineConstantPoolEntry> *MCPEs;
+
// ConstPoolId2AddrMap - A map from constant pool ids to the corresponding
// CONSTPOOL_ENTRY addresses.
SmallVector<intptr_t, 32> ConstPoolId2AddrMap;
+ // PCLabelMap - A map from PC labels to addresses.
+ DenseMap<unsigned, intptr_t> PCLabelMap;
+
public:
explicit ARMJITInfo(ARMTargetMachine &tm) : TM(tm) { useGOT = false; }
@@ -51,15 +60,16 @@ namespace llvm {
/// referenced global symbols.
virtual void relocate(void *Function, MachineRelocation *MR,
unsigned NumRelocs, unsigned char* GOTBase);
-
+
/// hasCustomConstantPool - Allows a target to specify that constant
/// pool address resolution is handled by the target.
virtual bool hasCustomConstantPool() const { return true; }
- /// ResizeConstPoolMap - Resize constant pool ids to CONSTPOOL_ENTRY
- /// addresses map.
- void ResizeConstPoolMap(unsigned Size) {
- ConstPoolId2AddrMap.resize(Size);
+ /// 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;
+ ConstPoolId2AddrMap.resize(MCPEs->size());
}
/// getConstantPoolEntryAddr - The ARM target puts all constant
@@ -77,6 +87,24 @@ namespace llvm {
assert(CPI < ConstPoolId2AddrMap.size());
ConstPoolId2AddrMap[CPI] = 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);
+ assert(I != PCLabelMap.end());
+ return I->second;
+ }
+
+ /// addPCLabelAddr - Remember the address of the specified PC label.
+ void addPCLabelAddr(unsigned Id, intptr_t Addr) {
+ PCLabelMap.insert(std::make_pair(Id, Addr));
+ }
+
+ private:
+ /// resolveRelocationAddr - 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;
};
}