summaryrefslogtreecommitdiff
path: root/lib/Target/ARM/ARMJITInfo.h
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-10-31 19:55:13 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-10-31 19:55:13 +0000
commit938b9d8ef78e83926437f8a331dd1e7645e28e4e (patch)
treefe897f92daff0ad2f478e19a0ee1d768c52ca5a5 /lib/Target/ARM/ARMJITInfo.h
parentba44df60d66363ce7490e81b18a35231c3f4c04a (diff)
downloadllvm-938b9d8ef78e83926437f8a331dd1e7645e28e4e.tar.gz
llvm-938b9d8ef78e83926437f8a331dd1e7645e28e4e.tar.bz2
llvm-938b9d8ef78e83926437f8a331dd1e7645e28e4e.tar.xz
Use better data structure for ConstPoolId2AddrMap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58532 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMJITInfo.h')
-rw-r--r--lib/Target/ARM/ARMJITInfo.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/Target/ARM/ARMJITInfo.h b/lib/Target/ARM/ARMJITInfo.h
index f16e54205a..5f0ee8d9f2 100644
--- a/lib/Target/ARM/ARMJITInfo.h
+++ b/lib/Target/ARM/ARMJITInfo.h
@@ -15,7 +15,7 @@
#define ARMJITINFO_H
#include "llvm/Target/TargetJITInfo.h"
-#include <map>
+#include "llvm/ADT/SmallVector.h"
namespace llvm {
class ARMTargetMachine;
@@ -25,7 +25,7 @@ namespace llvm {
// ConstPoolId2AddrMap - A map from constant pool ids to the corresponding
// CONSTPOOL_ENTRY addresses.
- std::map<unsigned, intptr_t> ConstPoolId2AddrMap;
+ SmallVector<intptr_t, 32> ConstPoolId2AddrMap;
public:
explicit ARMJITInfo(ARMTargetMachine &tm) : TM(tm) { useGOT = false; }
@@ -56,21 +56,24 @@ namespace llvm {
/// pool address resolution is handled by the target.
virtual bool hasCustomConstantPool() const { return true; }
+ void ResizeConstPoolMap(unsigned Size) {
+ ConstPoolId2AddrMap.resize(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.
- virtual intptr_t getConstantPoolEntryAddr(unsigned CPID) const {
- std::map<unsigned, intptr_t>::const_iterator I
- = ConstPoolId2AddrMap.find(CPID);
- assert(I != ConstPoolId2AddrMap.end() && "Missing constpool_entry?");
- return I->second;
+ intptr_t getConstantPoolEntryAddr(unsigned CPI) const {
+ assert(CPI < ConstPoolId2AddrMap.size());
+ return ConstPoolId2AddrMap[CPI];
}
- /// addConstantPoolEntryAddr - Map a Constant Pool Index (CPID) to the address
+ /// addConstantPoolEntryAddr - Map a Constant Pool Index (CPI) 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 CPID, intptr_t Addr) {
- ConstPoolId2AddrMap[CPID] = Addr;
+ void addConstantPoolEntryAddr(unsigned CPI, intptr_t Addr) {
+ assert(CPI < ConstPoolId2AddrMap.size());
+ ConstPoolId2AddrMap[CPI] = Addr;
}
};
}