aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-29 02:46:09 +0000
committerChris Lattner <sabre@nondot.org>2009-12-29 02:46:09 +0000
commitb2406d9895314cbc61183c2fb712cd1a2ddfe7e0 (patch)
tree4a9830bb70da08bd8e918784cc2864ab56c261ca /lib/VMCore
parentcafe9bba32aeed16e8e3db28b4cd4ff13160438f (diff)
downloadexternal_llvm-b2406d9895314cbc61183c2fb712cd1a2ddfe7e0.zip
external_llvm-b2406d9895314cbc61183c2fb712cd1a2ddfe7e0.tar.gz
external_llvm-b2406d9895314cbc61183c2fb712cd1a2ddfe7e0.tar.bz2
sink the Instruction::HasMetadata bit into SubclassData.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92240 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Instruction.cpp10
-rw-r--r--lib/VMCore/Instructions.cpp10
-rw-r--r--lib/VMCore/Metadata.cpp10
3 files changed, 14 insertions, 16 deletions
diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp
index f468c1b..85fd0e8 100644
--- a/lib/VMCore/Instruction.cpp
+++ b/lib/VMCore/Instruction.cpp
@@ -24,8 +24,7 @@ using namespace llvm;
Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps,
Instruction *InsertBefore)
- : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0),
- HasMetadata(false) {
+ : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) {
// Make sure that we get added to a basicblock
LeakDetector::addGarbageObject(this);
@@ -39,8 +38,7 @@ Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps,
Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps,
BasicBlock *InsertAtEnd)
- : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0),
- HasMetadata(false) {
+ : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) {
// Make sure that we get added to a basicblock
LeakDetector::addGarbageObject(this);
@@ -53,7 +51,7 @@ Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps,
// Out of line virtual method, so the vtable, etc has a home.
Instruction::~Instruction() {
assert(Parent == 0 && "Instruction still linked in the program!");
- if (HasMetadata)
+ if (hasMetadata())
getContext().pImpl->TheMetadata.ValueIsDeleted(this);
}
@@ -464,7 +462,7 @@ bool Instruction::isSafeToSpeculativelyExecute() const {
Instruction *Instruction::clone() const {
Instruction *New = clone_impl();
New->SubclassOptionalData = SubclassOptionalData;
- if (HasMetadata)
+ if (hasMetadata())
getContext().pImpl->TheMetadata.ValueIsCloned(this, New);
return New;
}
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index a0bb9f6..3e9950e 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -959,7 +959,7 @@ AllocaInst::~AllocaInst() {
void AllocaInst::setAlignment(unsigned Align) {
assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!");
- setValueSubclassData(Log2_32(Align) + 1);
+ setInstructionSubclassData(Log2_32(Align) + 1);
assert(getAlignment() == Align && "Alignment representation error!");
}
@@ -1094,8 +1094,8 @@ LoadInst::LoadInst(Value *Ptr, const char *Name, bool isVolatile,
void LoadInst::setAlignment(unsigned Align) {
assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!");
- setValueSubclassData((getSubclassDataFromValue() & 1) |
- ((Log2_32(Align)+1)<<1));
+ setInstructionSubclassData((getSubclassDataFromInstruction() & 1) |
+ ((Log2_32(Align)+1)<<1));
}
//===----------------------------------------------------------------------===//
@@ -1190,8 +1190,8 @@ StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile,
void StoreInst::setAlignment(unsigned Align) {
assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!");
- setValueSubclassData((getSubclassDataFromValue() & 1) |
- ((Log2_32(Align)+1) << 1));
+ setInstructionSubclassData((getSubclassDataFromInstruction() & 1) |
+ ((Log2_32(Align)+1) << 1));
}
//===----------------------------------------------------------------------===//
diff --git a/lib/VMCore/Metadata.cpp b/lib/VMCore/Metadata.cpp
index f7f5fbc..8181466 100644
--- a/lib/VMCore/Metadata.cpp
+++ b/lib/VMCore/Metadata.cpp
@@ -355,9 +355,9 @@ void MetadataContextImpl::setMetadata(Instruction *Inst, unsigned Kind,
// Handle the case when we're adding/updating metadata on an instruction.
if (Node) {
MDMapTy &Info = MetadataStore[Inst];
- assert(!Info.empty() == Inst->HasMetadata && "HasMetadata bit is wonked");
+ assert(!Info.empty() == Inst->hasMetadata() && "HasMetadata bit is wonked");
if (Info.empty()) {
- Inst->HasMetadata = true;
+ Inst->setHasMetadata(true);
} else {
// Handle replacement of an existing value.
for (unsigned i = 0, e = Info.size(); i != e; ++i)
@@ -373,14 +373,14 @@ void MetadataContextImpl::setMetadata(Instruction *Inst, unsigned Kind,
}
// Otherwise, we're removing metadata from an instruction.
- assert(Inst->HasMetadata && MetadataStore.count(Inst) &&
+ assert(Inst->hasMetadata() && MetadataStore.count(Inst) &&
"HasMetadata bit out of date!");
MDMapTy &Info = MetadataStore[Inst];
// Common case is removing the only entry.
if (Info.size() == 1 && Info[0].first == Kind) {
MetadataStore.erase(Inst);
- Inst->HasMetadata = false;
+ Inst->setHasMetadata(false);
return;
}
@@ -398,7 +398,7 @@ void MetadataContextImpl::setMetadata(Instruction *Inst, unsigned Kind,
/// removeAllMetadata - Remove all metadata attached with an instruction.
void MetadataContextImpl::removeAllMetadata(Instruction *Inst) {
MetadataStore.erase(Inst);
- Inst->HasMetadata = false;
+ Inst->setHasMetadata(false);
}