aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/ARM/ARMConstantPoolValue.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-09-29 23:48:44 +0000
committerBill Wendling <isanbard@gmail.com>2011-09-29 23:48:44 +0000
commit4dd9b091cceaa62f72ed8370f8a946fbe474d8a2 (patch)
tree3189e2d562986fdc01386b5454b912d84336ee55 /lib/Target/ARM/ARMConstantPoolValue.cpp
parent48105286cbbe046d82d1a7e36a07d656d8ba2faf (diff)
downloadexternal_llvm-4dd9b091cceaa62f72ed8370f8a946fbe474d8a2.zip
external_llvm-4dd9b091cceaa62f72ed8370f8a946fbe474d8a2.tar.gz
external_llvm-4dd9b091cceaa62f72ed8370f8a946fbe474d8a2.tar.bz2
Support creating a constant pool value for a machine basic block.
This is used when we want to take the address of a machine basic block, but it's not associated with a BB in LLVM IR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140823 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMConstantPoolValue.cpp')
-rw-r--r--lib/Target/ARM/ARMConstantPoolValue.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp
index 476d59f..dccdefb 100644
--- a/lib/Target/ARM/ARMConstantPoolValue.cpp
+++ b/lib/Target/ARM/ARMConstantPoolValue.cpp
@@ -17,6 +17,7 @@
#include "llvm/Constants.h"
#include "llvm/GlobalValue.h"
#include "llvm/Type.h"
+#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/Support/raw_ostream.h"
#include <cstdlib>
using namespace llvm;
@@ -31,6 +32,17 @@ ARMConstantPoolValue::ARMConstantPoolValue(const Constant *cval, unsigned id,
Modifier(Modif), AddCurrentAddress(AddCA) {}
ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C,
+ const MachineBasicBlock *mbb,
+ unsigned id,
+ ARMCP::ARMCPKind K,
+ unsigned char PCAdj,
+ ARMCP::ARMCPModifier Modif,
+ bool AddCA)
+ : MachineConstantPoolValue((Type*)Type::getInt8PtrTy(C)),
+ CVal(NULL), MBB(mbb), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj),
+ Modifier(Modif), AddCurrentAddress(AddCA) {}
+
+ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C,
const char *s, unsigned id,
unsigned char PCAdj,
ARMCP::ARMCPModifier Modif,
@@ -53,6 +65,10 @@ const BlockAddress *ARMConstantPoolValue::getBlockAddress() const {
return dyn_cast_or_null<BlockAddress>(CVal);
}
+const MachineBasicBlock *ARMConstantPoolValue::getMBB() const {
+ return MBB;
+}
+
static bool CPV_streq(const char *S1, const char *S2) {
if (S1 == S2)
return true;
@@ -119,6 +135,8 @@ void ARMConstantPoolValue::dump() const {
void ARMConstantPoolValue::print(raw_ostream &O) const {
if (CVal)
O << CVal->getName();
+ else if (MBB)
+ O << "";
else
O << S;
if (Modifier) O << "(" << getModifierText() << ")";