summaryrefslogtreecommitdiff
path: root/lib/Target/ARM/ARMJITInfo.h
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2008-10-28 18:25:49 +0000
committerJim Grosbach <grosbach@apple.com>2008-10-28 18:25:49 +0000
commitbc6d876adf01b368c6bdd5984d9dac32589d356e (patch)
treee847d88829c437fff384f2e3bcba11fffc5eefce /lib/Target/ARM/ARMJITInfo.h
parent52790e5865202f3805cf9b1e9145ce19653c0add (diff)
downloadllvm-bc6d876adf01b368c6bdd5984d9dac32589d356e.tar.gz
llvm-bc6d876adf01b368c6bdd5984d9dac32589d356e.tar.bz2
llvm-bc6d876adf01b368c6bdd5984d9dac32589d356e.tar.xz
Support for constant islands in the ARM JIT.
Since the ARM constant pool handling supercedes the standard LLVM constant pool entirely, the JIT emitter does not allocate space for the constants, nor initialize the memory. The constant pool is considered part of the instruction stream. Likewise, when resolving relocations into the constant pool, a hook into the target back end is used to resolve from the constant ID# to the address where the constant is stored. For now, the support in the ARM emitter is limited to 32-bit integer. Future patches will expand this to the full range of constants necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58338 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMJITInfo.h')
-rw-r--r--lib/Target/ARM/ARMJITInfo.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/Target/ARM/ARMJITInfo.h b/lib/Target/ARM/ARMJITInfo.h
index de3ff08ad2..62b8303010 100644
--- a/lib/Target/ARM/ARMJITInfo.h
+++ b/lib/Target/ARM/ARMJITInfo.h
@@ -15,14 +15,16 @@
#define ARMJITINFO_H
#include "llvm/Target/TargetJITInfo.h"
+#include <map>
namespace llvm {
class ARMTargetMachine;
class ARMJITInfo : public TargetJITInfo {
ARMTargetMachine &TM;
+ std::map<unsigned, intptr_t> CPIDtoAddressMap;
public:
- explicit ARMJITInfo(ARMTargetMachine &tm) : TM(tm) {useGOT = 0;}
+ explicit ARMJITInfo(ARMTargetMachine &tm) : TM(tm) { useGOT = false; }
/// replaceMachineCodeForFunction - Make it so that calling the function
/// whose machine code is at OLD turns into a call to NEW, perhaps by
@@ -45,6 +47,27 @@ 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; }
+
+ /// getCustomConstantPoolEntryAddress - 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 getCustomConstantPoolEntryAddress(unsigned CPID) const
+ {
+ std::map<unsigned, intptr_t>::const_iterator elem;
+ elem = CPIDtoAddressMap.find(CPID);
+ assert (elem != CPIDtoAddressMap.end());
+ return elem->second;
+ }
+
+ /// mapCPIDtoAddress - Map a Constant Pool Index (CPID) 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 mapCPIDtoAddress(unsigned CPID, intptr_t address)
+ { CPIDtoAddressMap[CPID] = address; }
};
}