From 5405d58e21402a8ba3aaaa580ca65155bee00443 Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Tue, 27 Sep 2011 20:59:33 +0000 Subject: Rename AddSelectionDAGCSEId() to addSelectionDAGCSEId(). Naming conventions consistency. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140636 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMConstantPoolValue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/Target/ARM/ARMConstantPoolValue.cpp') diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp index eb85aa3c72..476d59f988 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.cpp +++ b/lib/Target/ARM/ARMConstantPoolValue.cpp @@ -87,7 +87,7 @@ ARMConstantPoolValue::~ARMConstantPoolValue() { } void -ARMConstantPoolValue::AddSelectionDAGCSEId(FoldingSetNodeID &ID) { +ARMConstantPoolValue::addSelectionDAGCSEId(FoldingSetNodeID &ID) { ID.AddPointer(CVal); ID.AddPointer(S); ID.AddInteger(LabelId); -- cgit v1.2.3 From 4dd9b091cceaa62f72ed8370f8a946fbe474d8a2 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Thu, 29 Sep 2011 23:48:44 +0000 Subject: 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 --- lib/Target/ARM/ARMConstantPoolValue.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lib/Target/ARM/ARMConstantPoolValue.cpp') diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp index 476d59f988..dccdefbfe8 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 using namespace llvm; @@ -30,6 +31,17 @@ ARMConstantPoolValue::ARMConstantPoolValue(const Constant *cval, unsigned id, CVal(cval), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj), 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, @@ -53,6 +65,10 @@ const BlockAddress *ARMConstantPoolValue::getBlockAddress() const { return dyn_cast_or_null(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() << ")"; -- cgit v1.2.3 From d98f838284b7c539f274bb21820b2df3588a295e Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Fri, 30 Sep 2011 18:42:06 +0000 Subject: Constify 'isLSDA' and move a method out-of-line. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140868 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMConstantPoolValue.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/Target/ARM/ARMConstantPoolValue.cpp') diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp index dccdefbfe8..8dae56ab5e 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.cpp +++ b/lib/Target/ARM/ARMConstantPoolValue.cpp @@ -69,6 +69,20 @@ const MachineBasicBlock *ARMConstantPoolValue::getMBB() const { return MBB; } +const char *ARMConstantPoolValue::getModifierText() const { + switch (Modifier) { + default: llvm_unreachable("Unknown modifier!"); + // FIXME: Are these case sensitive? It'd be nice to lower-case all the + // strings if that's legal. + case ARMCP::no_modifier: return "none"; + case ARMCP::TLSGD: return "tlsgd"; + case ARMCP::GOT: return "GOT"; + case ARMCP::GOTOFF: return "GOTOFF"; + case ARMCP::GOTTPOFF: return "gottpoff"; + case ARMCP::TPOFF: return "tpoff"; + } +} + static bool CPV_streq(const char *S1, const char *S2) { if (S1 == S2) return true; -- cgit v1.2.3 From f2b76aae2beec4780c271984070ad15a07bd2d50 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sat, 1 Oct 2011 06:40:33 +0000 Subject: Refactoring: Separate out the ARM constant pool Constant from the ARM constant pool value. It's not used right now, but will be soon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140933 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMConstantPoolValue.cpp | 54 ++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) (limited to 'lib/Target/ARM/ARMConstantPoolValue.cpp') diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp index 8dae56ab5e..f65dc7c8ac 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.cpp +++ b/lib/Target/ARM/ARMConstantPoolValue.cpp @@ -22,6 +22,18 @@ #include using namespace llvm; +//===----------------------------------------------------------------------===// +// ARMConstantPoolValue +//===----------------------------------------------------------------------===// + +ARMConstantPoolValue::ARMConstantPoolValue(Type *Ty, unsigned id, + ARMCP::ARMCPKind kind, + unsigned char PCAdj, + ARMCP::ARMCPModifier modifier, + bool addCurrentAddress) + : MachineConstantPoolValue(Ty), LabelId(id), Kind(kind), PCAdjust(PCAdj), + Modifier(modifier), AddCurrentAddress(addCurrentAddress) {} + ARMConstantPoolValue::ARMConstantPoolValue(const Constant *cval, unsigned id, ARMCP::ARMCPKind K, unsigned char PCAdj, @@ -145,7 +157,6 @@ void ARMConstantPoolValue::dump() const { errs() << " " << *this; } - void ARMConstantPoolValue::print(raw_ostream &O) const { if (CVal) O << CVal->getName(); @@ -160,3 +171,44 @@ void ARMConstantPoolValue::print(raw_ostream &O) const { O << ")"; } } + +//===----------------------------------------------------------------------===// +// ARMConstantPoolConstant +//===----------------------------------------------------------------------===// + +ARMConstantPoolConstant::ARMConstantPoolConstant(const Constant *C, + unsigned ID, + ARMCP::ARMCPKind Kind, + unsigned char PCAdj, + ARMCP::ARMCPModifier Modifier, + bool AddCurrentAddress) + : ARMConstantPoolValue((Type*)C->getType(), ID, Kind, PCAdj, Modifier, + AddCurrentAddress), + CVal(C) {} + +ARMConstantPoolConstant * +ARMConstantPoolConstant::Create(const Constant *C, unsigned ID) { + return new ARMConstantPoolConstant(C, ID, ARMCP::CPValue, 0, + ARMCP::no_modifier, false); +} + +const GlobalValue *ARMConstantPoolConstant::getGV() const { + return dyn_cast(CVal); +} + +bool ARMConstantPoolConstant::hasSameValue(ARMConstantPoolValue *ACPV) { + const ARMConstantPoolConstant *ACPC = dyn_cast(ACPV); + + return (ACPC ? ACPC->CVal == CVal : true) && + ARMConstantPoolValue::hasSameValue(ACPV); +} + +void ARMConstantPoolConstant::addSelectionDAGCSEId(FoldingSetNodeID &ID) { + ID.AddPointer(CVal); + ARMConstantPoolValue::addSelectionDAGCSEId(ID); +} + +void ARMConstantPoolConstant::print(raw_ostream &O) const { + O << CVal->getName(); + ARMConstantPoolValue::print(O); +} -- cgit v1.2.3 From 029e93888d2ce07f4a81d2a927fd2e3cfe673afd Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sat, 1 Oct 2011 06:44:24 +0000 Subject: Add a Create method that accepts 'kind' and 'pcadj' arguments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140934 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMConstantPoolValue.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/Target/ARM/ARMConstantPoolValue.cpp') diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp index f65dc7c8ac..bca165b36e 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.cpp +++ b/lib/Target/ARM/ARMConstantPoolValue.cpp @@ -192,6 +192,13 @@ ARMConstantPoolConstant::Create(const Constant *C, unsigned ID) { ARMCP::no_modifier, false); } +ARMConstantPoolConstant * +ARMConstantPoolConstant::Create(const Constant *C, unsigned ID, + ARMCP::ARMCPKind Kind, unsigned char PCAdj) { + return new ARMConstantPoolConstant(C, ID, Kind, PCAdj, + ARMCP::no_modifier, false); +} + const GlobalValue *ARMConstantPoolConstant::getGV() const { return dyn_cast(CVal); } -- cgit v1.2.3 From 3e944e38ea2d7585d2ccbf1557746d6cf7132b23 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sat, 1 Oct 2011 07:52:37 +0000 Subject: Some more refactoring. * Add a couple of Create methods to the ARMConstantPoolConstant class, * Add its own version of getExistingMachineCPValue, and * Modify hasSameValue to return false if the object isn't an ARMConstantPoolConstant. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140935 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMConstantPoolValue.cpp | 66 ++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 6 deletions(-) (limited to 'lib/Target/ARM/ARMConstantPoolValue.cpp') diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp index bca165b36e..8a4e555367 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.cpp +++ b/lib/Target/ARM/ARMConstantPoolValue.cpp @@ -31,8 +31,9 @@ ARMConstantPoolValue::ARMConstantPoolValue(Type *Ty, unsigned id, unsigned char PCAdj, ARMCP::ARMCPModifier modifier, bool addCurrentAddress) - : MachineConstantPoolValue(Ty), LabelId(id), Kind(kind), PCAdjust(PCAdj), - Modifier(modifier), AddCurrentAddress(addCurrentAddress) {} + : MachineConstantPoolValue(Ty), S(NULL), LabelId(id), Kind(kind), + PCAdjust(PCAdj), Modifier(modifier), + AddCurrentAddress(addCurrentAddress) {} ARMConstantPoolValue::ARMConstantPoolValue(const Constant *cval, unsigned id, ARMCP::ARMCPKind K, @@ -176,6 +177,16 @@ void ARMConstantPoolValue::print(raw_ostream &O) const { // ARMConstantPoolConstant //===----------------------------------------------------------------------===// +ARMConstantPoolConstant::ARMConstantPoolConstant(Type *Ty, + const Constant *C, + unsigned ID, + ARMCP::ARMCPKind Kind, + unsigned char PCAdj, + ARMCP::ARMCPModifier Modifier, + bool AddCurrentAddress) + : ARMConstantPoolValue(Ty, ID, Kind, PCAdj, Modifier, AddCurrentAddress), + CVal(C) {} + ARMConstantPoolConstant::ARMConstantPoolConstant(const Constant *C, unsigned ID, ARMCP::ARMCPKind Kind, @@ -192,6 +203,14 @@ ARMConstantPoolConstant::Create(const Constant *C, unsigned ID) { ARMCP::no_modifier, false); } +ARMConstantPoolConstant * +ARMConstantPoolConstant::Create(const GlobalValue *GV, + ARMCP::ARMCPModifier Modifier) { + return new ARMConstantPoolConstant((Type*)Type::getInt32Ty(GV->getContext()), + GV, 0, ARMCP::CPValue, 0, + Modifier, false); +} + ARMConstantPoolConstant * ARMConstantPoolConstant::Create(const Constant *C, unsigned ID, ARMCP::ARMCPKind Kind, unsigned char PCAdj) { @@ -199,15 +218,50 @@ ARMConstantPoolConstant::Create(const Constant *C, unsigned ID, ARMCP::no_modifier, false); } +ARMConstantPoolConstant * +ARMConstantPoolConstant::Create(const Constant *C, unsigned ID, + ARMCP::ARMCPKind Kind, unsigned char PCAdj, + ARMCP::ARMCPModifier Modifier, + bool AddCurrentAddress) { + return new ARMConstantPoolConstant(C, ID, Kind, PCAdj, Modifier, + AddCurrentAddress); +} + const GlobalValue *ARMConstantPoolConstant::getGV() const { - return dyn_cast(CVal); + return dyn_cast_or_null(CVal); +} + +const BlockAddress *ARMConstantPoolConstant::getBlockAddress() const { + return dyn_cast_or_null(CVal); +} + +int ARMConstantPoolConstant::getExistingMachineCPValue(MachineConstantPool *CP, + unsigned Alignment) { + unsigned AlignMask = Alignment - 1; + const std::vector Constants = CP->getConstants(); + for (unsigned i = 0, e = Constants.size(); i != e; ++i) { + if (Constants[i].isMachineConstantPoolEntry() && + (Constants[i].getAlignment() & AlignMask) == 0) { + ARMConstantPoolValue *CPV = + (ARMConstantPoolValue *)Constants[i].Val.MachineCPVal; + ARMConstantPoolConstant *APC = dyn_cast(CPV); + if (!APC) continue; + + if (APC->getGV() == this->CVal && + APC->getLabelId() == this->getLabelId() && + APC->getPCAdjustment() == this->getPCAdjustment() && + CPV_streq(APC->getSymbol(), this->getSymbol()) && + APC->getModifier() == this->getModifier()) + return i; + } + } + + return -1; } bool ARMConstantPoolConstant::hasSameValue(ARMConstantPoolValue *ACPV) { const ARMConstantPoolConstant *ACPC = dyn_cast(ACPV); - - return (ACPC ? ACPC->CVal == CVal : true) && - ARMConstantPoolValue::hasSameValue(ACPV); + return ACPC && ACPC->CVal == CVal && ARMConstantPoolValue::hasSameValue(ACPV); } void ARMConstantPoolConstant::addSelectionDAGCSEId(FoldingSetNodeID &ID) { -- cgit v1.2.3 From 5bb779976a7d8e48408051ec2289fe69206dc072 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sat, 1 Oct 2011 08:00:54 +0000 Subject: Switch over to using ARMConstantPoolConstant for global variables, functions, and block addresses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140936 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMConstantPoolValue.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/Target/ARM/ARMConstantPoolValue.cpp') diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp index 8a4e555367..2d21e7fcf2 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.cpp +++ b/lib/Target/ARM/ARMConstantPoolValue.cpp @@ -31,7 +31,7 @@ ARMConstantPoolValue::ARMConstantPoolValue(Type *Ty, unsigned id, unsigned char PCAdj, ARMCP::ARMCPModifier modifier, bool addCurrentAddress) - : MachineConstantPoolValue(Ty), S(NULL), LabelId(id), Kind(kind), + : MachineConstantPoolValue(Ty), MBB(NULL), S(NULL), LabelId(id), Kind(kind), PCAdjust(PCAdj), Modifier(modifier), AddCurrentAddress(addCurrentAddress) {} @@ -113,8 +113,7 @@ int ARMConstantPoolValue::getExistingMachineCPValue(MachineConstantPool *CP, (Constants[i].getAlignment() & AlignMask) == 0) { ARMConstantPoolValue *CPV = (ARMConstantPoolValue *)Constants[i].Val.MachineCPVal; - if (CPV->CVal == CVal && - CPV->LabelId == LabelId && + if (CPV->LabelId == LabelId && CPV->PCAdjust == PCAdjust && CPV_streq(CPV->S, S) && CPV->Modifier == Modifier) @@ -131,7 +130,6 @@ ARMConstantPoolValue::~ARMConstantPoolValue() { void ARMConstantPoolValue::addSelectionDAGCSEId(FoldingSetNodeID &ID) { - ID.AddPointer(CVal); ID.AddPointer(S); ID.AddInteger(LabelId); ID.AddInteger(PCAdjust); @@ -140,7 +138,6 @@ ARMConstantPoolValue::addSelectionDAGCSEId(FoldingSetNodeID &ID) { bool ARMConstantPoolValue::hasSameValue(ARMConstantPoolValue *ACPV) { if (ACPV->Kind == Kind && - ACPV->CVal == CVal && ACPV->PCAdjust == PCAdjust && CPV_streq(ACPV->S, S) && ACPV->Modifier == Modifier) { -- cgit v1.2.3 From 3f4e4592c3da4d69478ca37d17cb1d6c7024ec50 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sat, 1 Oct 2011 08:02:05 +0000 Subject: Remove now dead methods and ivar from ARMConstantPoolValue. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140937 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMConstantPoolValue.cpp | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) (limited to 'lib/Target/ARM/ARMConstantPoolValue.cpp') diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp index 2d21e7fcf2..1061c6a0b2 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.cpp +++ b/lib/Target/ARM/ARMConstantPoolValue.cpp @@ -35,15 +35,6 @@ ARMConstantPoolValue::ARMConstantPoolValue(Type *Ty, unsigned id, PCAdjust(PCAdj), Modifier(modifier), AddCurrentAddress(addCurrentAddress) {} -ARMConstantPoolValue::ARMConstantPoolValue(const Constant *cval, unsigned id, - ARMCP::ARMCPKind K, - unsigned char PCAdj, - ARMCP::ARMCPModifier Modif, - bool AddCA) - : MachineConstantPoolValue((Type*)cval->getType()), - CVal(cval), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj), - Modifier(Modif), AddCurrentAddress(AddCA) {} - ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, const MachineBasicBlock *mbb, unsigned id, @@ -52,7 +43,7 @@ ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, ARMCP::ARMCPModifier Modif, bool AddCA) : MachineConstantPoolValue((Type*)Type::getInt8PtrTy(C)), - CVal(NULL), MBB(mbb), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj), + MBB(mbb), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj), Modifier(Modif), AddCurrentAddress(AddCA) {} ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, @@ -61,23 +52,9 @@ ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, ARMCP::ARMCPModifier Modif, bool AddCA) : MachineConstantPoolValue((Type*)Type::getInt32Ty(C)), - CVal(NULL), S(strdup(s)), LabelId(id), Kind(ARMCP::CPExtSymbol), + S(strdup(s)), LabelId(id), Kind(ARMCP::CPExtSymbol), PCAdjust(PCAdj), Modifier(Modif), AddCurrentAddress(AddCA) {} -ARMConstantPoolValue::ARMConstantPoolValue(const GlobalValue *gv, - ARMCP::ARMCPModifier Modif) - : MachineConstantPoolValue((Type*)Type::getInt32Ty(gv->getContext())), - CVal(gv), S(NULL), LabelId(0), Kind(ARMCP::CPValue), PCAdjust(0), - Modifier(Modif), AddCurrentAddress(false) {} - -const GlobalValue *ARMConstantPoolValue::getGV() const { - return dyn_cast_or_null(CVal); -} - -const BlockAddress *ARMConstantPoolValue::getBlockAddress() const { - return dyn_cast_or_null(CVal); -} - const MachineBasicBlock *ARMConstantPoolValue::getMBB() const { return MBB; } @@ -156,9 +133,7 @@ void ARMConstantPoolValue::dump() const { } void ARMConstantPoolValue::print(raw_ostream &O) const { - if (CVal) - O << CVal->getName(); - else if (MBB) + if (MBB) O << ""; else O << S; -- cgit v1.2.3 From ff4a8023ecf328047c8f98c7f42bf5e8b46b2f11 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sat, 1 Oct 2011 08:36:59 +0000 Subject: Add an ARMConstantPool class for external symbols. This will split out the support for external symbols from the base class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140938 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMConstantPoolValue.cpp | 82 +++++++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 4 deletions(-) (limited to 'lib/Target/ARM/ARMConstantPoolValue.cpp') diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp index 1061c6a0b2..2d2ab885fd 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.cpp +++ b/lib/Target/ARM/ARMConstantPoolValue.cpp @@ -35,6 +35,15 @@ ARMConstantPoolValue::ARMConstantPoolValue(Type *Ty, unsigned id, PCAdjust(PCAdj), Modifier(modifier), AddCurrentAddress(addCurrentAddress) {} +ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, unsigned id, + ARMCP::ARMCPKind kind, + unsigned char PCAdj, + ARMCP::ARMCPModifier modifier, + bool addCurrentAddress) + : MachineConstantPoolValue((Type*)Type::getInt32Ty(C)), + LabelId(id), Kind(kind), PCAdjust(PCAdj), Modifier(modifier), + AddCurrentAddress(addCurrentAddress) {} + ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, const MachineBasicBlock *mbb, unsigned id, @@ -55,6 +64,10 @@ ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, S(strdup(s)), LabelId(id), Kind(ARMCP::CPExtSymbol), PCAdjust(PCAdj), Modifier(Modif), AddCurrentAddress(AddCA) {} +ARMConstantPoolValue::~ARMConstantPoolValue() { + free((void*)S); +} + const MachineBasicBlock *ARMConstantPoolValue::getMBB() const { return MBB; } @@ -101,10 +114,6 @@ int ARMConstantPoolValue::getExistingMachineCPValue(MachineConstantPool *CP, return -1; } -ARMConstantPoolValue::~ARMConstantPoolValue() { - free((void*)S); -} - void ARMConstantPoolValue::addSelectionDAGCSEId(FoldingSetNodeID &ID) { ID.AddPointer(S); @@ -245,3 +254,68 @@ void ARMConstantPoolConstant::print(raw_ostream &O) const { O << CVal->getName(); ARMConstantPoolValue::print(O); } + +//===----------------------------------------------------------------------===// +// ARMConstantPoolSymbol +//===----------------------------------------------------------------------===// + +ARMConstantPoolSymbol::ARMConstantPoolSymbol(LLVMContext &C, const char *s, + unsigned id, + unsigned char PCAdj, + ARMCP::ARMCPModifier Modifier, + bool AddCurrentAddress) + : ARMConstantPoolValue(C, id, ARMCP::CPExtSymbol, PCAdj, Modifier, + AddCurrentAddress), + S(strdup(s)) {} + +ARMConstantPoolSymbol::~ARMConstantPoolSymbol() { + free((void*)S); +} + +ARMConstantPoolSymbol * +ARMConstantPoolSymbol::Create(LLVMContext &C, const char *s, + unsigned ID, unsigned char PCAdj, + ARMCP::ARMCPModifier Modifier, + bool AddCurrentAddress) { + return new ARMConstantPoolSymbol(C, s, ID, PCAdj, Modifier, + AddCurrentAddress); +} + +int ARMConstantPoolSymbol::getExistingMachineCPValue(MachineConstantPool *CP, + unsigned Alignment) { + unsigned AlignMask = Alignment - 1; + const std::vector Constants = CP->getConstants(); + for (unsigned i = 0, e = Constants.size(); i != e; ++i) { + if (Constants[i].isMachineConstantPoolEntry() && + (Constants[i].getAlignment() & AlignMask) == 0) { + ARMConstantPoolValue *CPV = + (ARMConstantPoolValue *)Constants[i].Val.MachineCPVal; + ARMConstantPoolSymbol *APS = dyn_cast(CPV); + if (!APS) continue; + + if (APS->getLabelId() == this->getLabelId() && + APS->getPCAdjustment() == this->getPCAdjustment() && + CPV_streq(APS->getSymbol(), this->getSymbol()) && + APS->getModifier() == this->getModifier()) + return i; + } + } + + return -1; +} + +bool ARMConstantPoolSymbol::hasSameValue(ARMConstantPoolValue *ACPV) { + const ARMConstantPoolSymbol *ACPS = dyn_cast(ACPV); + return ACPS && CPV_streq(ACPS->S, S) && + ARMConstantPoolValue::hasSameValue(ACPV); +} + +void ARMConstantPoolSymbol::addSelectionDAGCSEId(FoldingSetNodeID &ID) { + ID.AddPointer(S); + ARMConstantPoolValue::addSelectionDAGCSEId(ID); +} + +void ARMConstantPoolSymbol::print(raw_ostream &O) const { + O << S; + ARMConstantPoolValue::print(O); +} -- cgit v1.2.3 From fe31e673506ef9a1080eaa684b43b34178c6f447 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sat, 1 Oct 2011 08:58:29 +0000 Subject: Use the new ARMConstantPoolSymbol class to handle external symbols. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140939 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMConstantPoolValue.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/Target/ARM/ARMConstantPoolValue.cpp') diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp index 2d2ab885fd..63af738267 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.cpp +++ b/lib/Target/ARM/ARMConstantPoolValue.cpp @@ -41,7 +41,7 @@ ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, unsigned id, ARMCP::ARMCPModifier modifier, bool addCurrentAddress) : MachineConstantPoolValue((Type*)Type::getInt32Ty(C)), - LabelId(id), Kind(kind), PCAdjust(PCAdj), Modifier(modifier), + S(NULL), LabelId(id), Kind(kind), PCAdjust(PCAdj), Modifier(modifier), AddCurrentAddress(addCurrentAddress) {} ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, @@ -231,7 +231,6 @@ int ARMConstantPoolConstant::getExistingMachineCPValue(MachineConstantPool *CP, if (APC->getGV() == this->CVal && APC->getLabelId() == this->getLabelId() && APC->getPCAdjustment() == this->getPCAdjustment() && - CPV_streq(APC->getSymbol(), this->getSymbol()) && APC->getModifier() == this->getModifier()) return i; } @@ -272,6 +271,12 @@ ARMConstantPoolSymbol::~ARMConstantPoolSymbol() { free((void*)S); } +ARMConstantPoolSymbol * +ARMConstantPoolSymbol::Create(LLVMContext &C, const char *s, + unsigned ID, unsigned char PCAdj) { + return new ARMConstantPoolSymbol(C, s, ID, PCAdj, ARMCP::no_modifier, false); +} + ARMConstantPoolSymbol * ARMConstantPoolSymbol::Create(LLVMContext &C, const char *s, unsigned ID, unsigned char PCAdj, -- cgit v1.2.3 From 9aca75c4f8249abf8ba2e558bbd1ae7cdfc6b81f Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sat, 1 Oct 2011 09:04:18 +0000 Subject: Remove now dead methods and ivar. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140940 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMConstantPoolValue.cpp | 40 ++++++++++----------------------- 1 file changed, 12 insertions(+), 28 deletions(-) (limited to 'lib/Target/ARM/ARMConstantPoolValue.cpp') diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp index 63af738267..4d90e7e8f2 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.cpp +++ b/lib/Target/ARM/ARMConstantPoolValue.cpp @@ -31,7 +31,7 @@ ARMConstantPoolValue::ARMConstantPoolValue(Type *Ty, unsigned id, unsigned char PCAdj, ARMCP::ARMCPModifier modifier, bool addCurrentAddress) - : MachineConstantPoolValue(Ty), MBB(NULL), S(NULL), LabelId(id), Kind(kind), + : MachineConstantPoolValue(Ty), MBB(NULL), LabelId(id), Kind(kind), PCAdjust(PCAdj), Modifier(modifier), AddCurrentAddress(addCurrentAddress) {} @@ -41,7 +41,7 @@ ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, unsigned id, ARMCP::ARMCPModifier modifier, bool addCurrentAddress) : MachineConstantPoolValue((Type*)Type::getInt32Ty(C)), - S(NULL), LabelId(id), Kind(kind), PCAdjust(PCAdj), Modifier(modifier), + LabelId(id), Kind(kind), PCAdjust(PCAdj), Modifier(modifier), AddCurrentAddress(addCurrentAddress) {} ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, @@ -52,21 +52,10 @@ ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, ARMCP::ARMCPModifier Modif, bool AddCA) : MachineConstantPoolValue((Type*)Type::getInt8PtrTy(C)), - MBB(mbb), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj), + MBB(mbb), 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, - bool AddCA) - : MachineConstantPoolValue((Type*)Type::getInt32Ty(C)), - S(strdup(s)), LabelId(id), Kind(ARMCP::CPExtSymbol), - PCAdjust(PCAdj), Modifier(Modif), AddCurrentAddress(AddCA) {} - -ARMConstantPoolValue::~ARMConstantPoolValue() { - free((void*)S); -} +ARMConstantPoolValue::~ARMConstantPoolValue() {} const MachineBasicBlock *ARMConstantPoolValue::getMBB() const { return MBB; @@ -86,14 +75,6 @@ const char *ARMConstantPoolValue::getModifierText() const { } } -static bool CPV_streq(const char *S1, const char *S2) { - if (S1 == S2) - return true; - if (S1 && S2 && strcmp(S1, S2) == 0) - return true; - return false; -} - int ARMConstantPoolValue::getExistingMachineCPValue(MachineConstantPool *CP, unsigned Alignment) { unsigned AlignMask = Alignment - 1; @@ -105,7 +86,6 @@ int ARMConstantPoolValue::getExistingMachineCPValue(MachineConstantPool *CP, (ARMConstantPoolValue *)Constants[i].Val.MachineCPVal; if (CPV->LabelId == LabelId && CPV->PCAdjust == PCAdjust && - CPV_streq(CPV->S, S) && CPV->Modifier == Modifier) return i; } @@ -116,7 +96,6 @@ int ARMConstantPoolValue::getExistingMachineCPValue(MachineConstantPool *CP, void ARMConstantPoolValue::addSelectionDAGCSEId(FoldingSetNodeID &ID) { - ID.AddPointer(S); ID.AddInteger(LabelId); ID.AddInteger(PCAdjust); } @@ -125,7 +104,6 @@ bool ARMConstantPoolValue::hasSameValue(ARMConstantPoolValue *ACPV) { if (ACPV->Kind == Kind && ACPV->PCAdjust == PCAdjust && - CPV_streq(ACPV->S, S) && ACPV->Modifier == Modifier) { if (ACPV->LabelId == LabelId) return true; @@ -144,8 +122,6 @@ void ARMConstantPoolValue::dump() const { void ARMConstantPoolValue::print(raw_ostream &O) const { if (MBB) O << ""; - else - O << S; if (Modifier) O << "(" << getModifierText() << ")"; if (PCAdjust != 0) { O << "-(LPC" << LabelId << "+" << (unsigned)PCAdjust; @@ -286,6 +262,14 @@ ARMConstantPoolSymbol::Create(LLVMContext &C, const char *s, AddCurrentAddress); } +static bool CPV_streq(const char *S1, const char *S2) { + if (S1 == S2) + return true; + if (S1 && S2 && strcmp(S1, S2) == 0) + return true; + return false; +} + int ARMConstantPoolSymbol::getExistingMachineCPValue(MachineConstantPool *CP, unsigned Alignment) { unsigned AlignMask = Alignment - 1; -- cgit v1.2.3 From 14a1a6b018c87bcf75cf5b430623d573fbed8905 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sat, 1 Oct 2011 09:05:12 +0000 Subject: Remove dead code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140941 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMConstantPoolValue.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'lib/Target/ARM/ARMConstantPoolValue.cpp') diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp index 4d90e7e8f2..9224c039bd 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.cpp +++ b/lib/Target/ARM/ARMConstantPoolValue.cpp @@ -253,15 +253,6 @@ ARMConstantPoolSymbol::Create(LLVMContext &C, const char *s, return new ARMConstantPoolSymbol(C, s, ID, PCAdj, ARMCP::no_modifier, false); } -ARMConstantPoolSymbol * -ARMConstantPoolSymbol::Create(LLVMContext &C, const char *s, - unsigned ID, unsigned char PCAdj, - ARMCP::ARMCPModifier Modifier, - bool AddCurrentAddress) { - return new ARMConstantPoolSymbol(C, s, ID, PCAdj, Modifier, - AddCurrentAddress); -} - static bool CPV_streq(const char *S1, const char *S2) { if (S1 == S2) return true; -- cgit v1.2.3 From 9c18f51daaf89b9c706aa0557bede2cbb0debb69 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sat, 1 Oct 2011 09:19:10 +0000 Subject: Add ARMConstantPoolMBB to hold an MBB value in the constant pool. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140942 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMConstantPoolValue.cpp | 57 +++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'lib/Target/ARM/ARMConstantPoolValue.cpp') diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp index 9224c039bd..cdb747631d 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.cpp +++ b/lib/Target/ARM/ARMConstantPoolValue.cpp @@ -299,3 +299,60 @@ void ARMConstantPoolSymbol::print(raw_ostream &O) const { O << S; ARMConstantPoolValue::print(O); } + +//===----------------------------------------------------------------------===// +// ARMConstantPoolMBB +//===----------------------------------------------------------------------===// + +ARMConstantPoolMBB::ARMConstantPoolMBB(LLVMContext &C, MachineBasicBlock *mbb, + unsigned id, unsigned char PCAdj, + ARMCP::ARMCPModifier Modifier, + bool AddCurrentAddress) + : ARMConstantPoolValue(C, mbb, id, ARMCP::CPMachineBasicBlock, PCAdj, + Modifier, AddCurrentAddress), + MBB(mbb) {} + +ARMConstantPoolMBB *ARMConstantPoolMBB::Create(LLVMContext &C, + MachineBasicBlock *mbb, + unsigned ID, + unsigned char PCAdj) { + return new ARMConstantPoolMBB(C, mbb, ID, PCAdj, ARMCP::no_modifier, false); +} + +int ARMConstantPoolMBB::getExistingMachineCPValue(MachineConstantPool *CP, + unsigned Alignment) { + unsigned AlignMask = Alignment - 1; + const std::vector Constants = CP->getConstants(); + for (unsigned i = 0, e = Constants.size(); i != e; ++i) { + if (Constants[i].isMachineConstantPoolEntry() && + (Constants[i].getAlignment() & AlignMask) == 0) { + ARMConstantPoolValue *CPV = + (ARMConstantPoolValue *)Constants[i].Val.MachineCPVal; + ARMConstantPoolMBB *APMBB = dyn_cast(CPV); + if (!APMBB) continue; + + if (APMBB->getLabelId() == this->getLabelId() && + APMBB->getPCAdjustment() == this->getPCAdjustment() && + APMBB->getMBB() == this->getMBB() && + APMBB->getModifier() == this->getModifier()) + return i; + } + } + + return -1; +} + +bool ARMConstantPoolMBB::hasSameValue(ARMConstantPoolValue *ACPV) { + const ARMConstantPoolMBB *ACPMBB = dyn_cast(ACPV); + return ACPMBB && ACPMBB->MBB == MBB && + ARMConstantPoolValue::hasSameValue(ACPV); +} + +void ARMConstantPoolMBB::addSelectionDAGCSEId(FoldingSetNodeID &ID) { + ID.AddPointer(MBB); + ARMConstantPoolValue::addSelectionDAGCSEId(ID); +} + +void ARMConstantPoolMBB::print(raw_ostream &O) const { + ARMConstantPoolValue::print(O); +} -- cgit v1.2.3 From 3320f2a3bfd4daec23ba7ceb50525140cc6316da Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sat, 1 Oct 2011 09:30:42 +0000 Subject: Use the ARMConstantPoolMBB class to handle the MBB values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140943 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMConstantPoolValue.cpp | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'lib/Target/ARM/ARMConstantPoolValue.cpp') diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp index cdb747631d..2c200bdf2f 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.cpp +++ b/lib/Target/ARM/ARMConstantPoolValue.cpp @@ -31,7 +31,7 @@ ARMConstantPoolValue::ARMConstantPoolValue(Type *Ty, unsigned id, unsigned char PCAdj, ARMCP::ARMCPModifier modifier, bool addCurrentAddress) - : MachineConstantPoolValue(Ty), MBB(NULL), LabelId(id), Kind(kind), + : MachineConstantPoolValue(Ty), LabelId(id), Kind(kind), PCAdjust(PCAdj), Modifier(modifier), AddCurrentAddress(addCurrentAddress) {} @@ -44,23 +44,8 @@ ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, unsigned id, LabelId(id), Kind(kind), PCAdjust(PCAdj), Modifier(modifier), AddCurrentAddress(addCurrentAddress) {} -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)), - MBB(mbb), LabelId(id), Kind(K), PCAdjust(PCAdj), - Modifier(Modif), AddCurrentAddress(AddCA) {} - ARMConstantPoolValue::~ARMConstantPoolValue() {} -const MachineBasicBlock *ARMConstantPoolValue::getMBB() const { - return MBB; -} - const char *ARMConstantPoolValue::getModifierText() const { switch (Modifier) { default: llvm_unreachable("Unknown modifier!"); @@ -120,8 +105,6 @@ void ARMConstantPoolValue::dump() const { } void ARMConstantPoolValue::print(raw_ostream &O) const { - if (MBB) - O << ""; if (Modifier) O << "(" << getModifierText() << ")"; if (PCAdjust != 0) { O << "-(LPC" << LabelId << "+" << (unsigned)PCAdjust; @@ -304,16 +287,17 @@ void ARMConstantPoolSymbol::print(raw_ostream &O) const { // ARMConstantPoolMBB //===----------------------------------------------------------------------===// -ARMConstantPoolMBB::ARMConstantPoolMBB(LLVMContext &C, MachineBasicBlock *mbb, +ARMConstantPoolMBB::ARMConstantPoolMBB(LLVMContext &C, + const MachineBasicBlock *mbb, unsigned id, unsigned char PCAdj, ARMCP::ARMCPModifier Modifier, bool AddCurrentAddress) - : ARMConstantPoolValue(C, mbb, id, ARMCP::CPMachineBasicBlock, PCAdj, + : ARMConstantPoolValue(C, id, ARMCP::CPMachineBasicBlock, PCAdj, Modifier, AddCurrentAddress), MBB(mbb) {} ARMConstantPoolMBB *ARMConstantPoolMBB::Create(LLVMContext &C, - MachineBasicBlock *mbb, + const MachineBasicBlock *mbb, unsigned ID, unsigned char PCAdj) { return new ARMConstantPoolMBB(C, mbb, ID, PCAdj, ARMCP::no_modifier, false); -- cgit v1.2.3 From 405ca137a1bf5b08fbda3ba086fb013537ce8662 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sat, 1 Oct 2011 12:44:28 +0000 Subject: Add a convenience method to tell if two things are equal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140946 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMConstantPoolValue.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'lib/Target/ARM/ARMConstantPoolValue.cpp') diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp index 2c200bdf2f..729ecc6342 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.cpp +++ b/lib/Target/ARM/ARMConstantPoolValue.cpp @@ -69,9 +69,7 @@ int ARMConstantPoolValue::getExistingMachineCPValue(MachineConstantPool *CP, (Constants[i].getAlignment() & AlignMask) == 0) { ARMConstantPoolValue *CPV = (ARMConstantPoolValue *)Constants[i].Val.MachineCPVal; - if (CPV->LabelId == LabelId && - CPV->PCAdjust == PCAdjust && - CPV->Modifier == Modifier) + if (this->equals(CPV)) return i; } } @@ -186,11 +184,7 @@ int ARMConstantPoolConstant::getExistingMachineCPValue(MachineConstantPool *CP, (ARMConstantPoolValue *)Constants[i].Val.MachineCPVal; ARMConstantPoolConstant *APC = dyn_cast(CPV); if (!APC) continue; - - if (APC->getGV() == this->CVal && - APC->getLabelId() == this->getLabelId() && - APC->getPCAdjustment() == this->getPCAdjustment() && - APC->getModifier() == this->getModifier()) + if (APC->CVal == CVal && equals(APC)) return i; } } @@ -256,10 +250,7 @@ int ARMConstantPoolSymbol::getExistingMachineCPValue(MachineConstantPool *CP, ARMConstantPoolSymbol *APS = dyn_cast(CPV); if (!APS) continue; - if (APS->getLabelId() == this->getLabelId() && - APS->getPCAdjustment() == this->getPCAdjustment() && - CPV_streq(APS->getSymbol(), this->getSymbol()) && - APS->getModifier() == this->getModifier()) + if (CPV_streq(APS->S, S) && equals(APS)) return i; } } @@ -315,10 +306,7 @@ int ARMConstantPoolMBB::getExistingMachineCPValue(MachineConstantPool *CP, ARMConstantPoolMBB *APMBB = dyn_cast(CPV); if (!APMBB) continue; - if (APMBB->getLabelId() == this->getLabelId() && - APMBB->getPCAdjustment() == this->getPCAdjustment() && - APMBB->getMBB() == this->getMBB() && - APMBB->getModifier() == this->getModifier()) + if (APMBB->MBB == MBB && equals(APMBB)) return i; } } -- cgit v1.2.3 From 2e6b97bbf86d0825a060e190189fae7f884c79c9 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sat, 1 Oct 2011 12:47:34 +0000 Subject: No one should be using the method directly. Assert if they do. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140947 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMConstantPoolValue.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'lib/Target/ARM/ARMConstantPoolValue.cpp') diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp index 729ecc6342..aadfd4779d 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.cpp +++ b/lib/Target/ARM/ARMConstantPoolValue.cpp @@ -62,18 +62,7 @@ const char *ARMConstantPoolValue::getModifierText() const { int ARMConstantPoolValue::getExistingMachineCPValue(MachineConstantPool *CP, unsigned Alignment) { - unsigned AlignMask = Alignment - 1; - const std::vector Constants = CP->getConstants(); - for (unsigned i = 0, e = Constants.size(); i != e; ++i) { - if (Constants[i].isMachineConstantPoolEntry() && - (Constants[i].getAlignment() & AlignMask) == 0) { - ARMConstantPoolValue *CPV = - (ARMConstantPoolValue *)Constants[i].Val.MachineCPVal; - if (this->equals(CPV)) - return i; - } - } - + assert(false && "Shouldn't be calling this directly!"); return -1; } -- cgit v1.2.3