aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen/MachineConstantPool.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-21 23:34:23 +0000
committerChris Lattner <sabre@nondot.org>2009-07-21 23:34:23 +0000
commitcb4596364369ea36ff5675eb12fc62d0c6f1f0dd (patch)
tree5bd26e1b7a48d8a44712c5982038743158ad0bf1 /include/llvm/CodeGen/MachineConstantPool.h
parentce9fe9fae5f2ac1650fe2aa6ccf6dcabbb424f7c (diff)
downloadexternal_llvm-cb4596364369ea36ff5675eb12fc62d0c6f1f0dd.zip
external_llvm-cb4596364369ea36ff5675eb12fc62d0c6f1f0dd.tar.gz
external_llvm-cb4596364369ea36ff5675eb12fc62d0c6f1f0dd.tar.bz2
add an API so target-independent codegen can determine if a constant
pool entry will require relocations against it. I implemented this conservatively for ARM, someone who is knowledgable about it should see if this can be improved. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76678 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineConstantPool.h')
-rw-r--r--include/llvm/CodeGen/MachineConstantPool.h29
1 files changed, 28 insertions, 1 deletions
diff --git a/include/llvm/CodeGen/MachineConstantPool.h b/include/llvm/CodeGen/MachineConstantPool.h
index 99996cf..acbbc66 100644
--- a/include/llvm/CodeGen/MachineConstantPool.h
+++ b/include/llvm/CodeGen/MachineConstantPool.h
@@ -41,8 +41,22 @@ public:
/// getType - get type of this MachineConstantPoolValue.
///
- inline const Type *getType() const { return Ty; }
+ const Type *getType() const { return Ty; }
+
+ /// getRelocatationInfo - This method classifies the entry according to
+ /// whether or not it may generate a relocation entry. This must be
+ /// conservative, so if it might codegen to a relocatable entry, it should say
+ /// so. The return values are:
+ ///
+ /// 0: This constant pool entry is guaranteed to never have a relocation
+ /// applied to it (because it holds a simple constant like '4').
+ /// 1: This entry has relocations, but the entries are guaranteed to be
+ /// resolvable by the static linker, so the dynamic linker will never see
+ /// them.
+ /// 2: This entry may have arbitrary relocations.
+ virtual unsigned getRelocatationInfo() const = 0;
+
virtual int getExistingMachineCPValue(MachineConstantPool *CP,
unsigned Alignment) = 0;
@@ -94,6 +108,19 @@ public:
}
const Type *getType() const;
+
+ /// getRelocatationInfo - This method classifies the entry according to
+ /// whether or not it may generate a relocation entry. This must be
+ /// conservative, so if it might codegen to a relocatable entry, it should say
+ /// so. The return values are:
+ ///
+ /// 0: This constant pool entry is guaranteed to never have a relocation
+ /// applied to it (because it holds a simple constant like '4').
+ /// 1: This entry has relocations, but the entries are guaranteed to be
+ /// resolvable by the static linker, so the dynamic linker will never see
+ /// them.
+ /// 2: This entry may have arbitrary relocations.
+ unsigned getRelocatationInfo() const;
};
/// The MachineConstantPool class keeps track of constants referenced by a