remove some unneeded Metadata interfaces.
[oota-llvm.git] / lib / VMCore / Metadata.cpp
index f7f5fbc654da049607d6a9248b63f6789b7dd7c0..eb352896e8d7f07cbceedb7840fff6691cc144c1 100644 (file)
@@ -273,27 +273,12 @@ public:
 
   void setMetadata(Instruction *Inst, unsigned Kind, MDNode *Node);
 
-  /// removeAllMetadata - Remove all metadata attached with an instruction.
+  /// removeAllMetadata - Remove all metadata attached to an instruction.
   void removeAllMetadata(Instruction *Inst);
   
-  
-  
   /// copyMD - If metadata is attached with Instruction In1 then attach
   /// the same metadata to In2.
   void copyMD(Instruction *In1, Instruction *In2);
-  
-
-  /// ValueIsDeleted - This handler is used to update metadata store
-  /// when a value is deleted.
-  void ValueIsDeleted(const Value *) {}
-  void ValueIsDeleted(Instruction *Inst) {
-    removeAllMetadata(Inst);
-  }
-  void ValueIsRAUWd(Value *V1, Value *V2);
-
-  /// ValueIsCloned - This handler is used to update metadata store
-  /// when In1 is cloned to create In2.
-  void ValueIsCloned(const Instruction *In1, Instruction *In2);
 };
 }
 
@@ -355,9 +340,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 +358,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 +383,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);
 }
 
 
@@ -414,32 +399,6 @@ void MetadataContextImpl::copyMD(Instruction *In1, Instruction *In2) {
     In2->setMetadata(I->first, I->second);
 }
 
-/// ValueIsCloned - This handler is used to update metadata store
-/// when In1 is cloned to create In2.
-void MetadataContextImpl::ValueIsCloned(const Instruction *In1, 
-                                        Instruction *In2) {
-  // Find Metadata handles for In1.
-  MDStoreTy::iterator I = MetadataStore.find(In1);
-  assert(I != MetadataStore.end() && "Invalid custom metadata info!");
-
-  // FIXME: Give all metadata handlers a chance to adjust.
-  MDMapTy &In1Info = I->second;
-  for (MDMapTy::iterator I = In1Info.begin(), E = In1Info.end(); I != E; ++I)
-    In2->setMetadata(I->first, I->second);
-}
-
-/// ValueIsRAUWd - This handler is used when V1's all uses are replaced by
-/// V2.
-void MetadataContextImpl::ValueIsRAUWd(Value *V1, Value *V2) {
-  Instruction *I1 = dyn_cast<Instruction>(V1);
-  Instruction *I2 = dyn_cast<Instruction>(V2);
-  if (!I1 || !I2)
-    return;
-
-  // FIXME: Give custom handlers a chance to override this.
-  ValueIsCloned(I1, I2);
-}
-
 //===----------------------------------------------------------------------===//
 // MetadataContext implementation.
 //
@@ -479,21 +438,6 @@ void MetadataContext::getMDKindNames(SmallVectorImpl<StringRef> &N) const {
   pImpl->getMDKindNames(N);
 }
 
-/// ValueIsDeleted - This handler is used to update metadata store
-/// when a value is deleted.
-void MetadataContext::ValueIsDeleted(Instruction *Inst) {
-  pImpl->ValueIsDeleted(Inst);
-}
-void MetadataContext::ValueIsRAUWd(Value *V1, Value *V2) {
-  pImpl->ValueIsRAUWd(V1, V2);
-}
-
-/// ValueIsCloned - This handler is used to update metadata store
-/// when In1 is cloned to create In2.
-void MetadataContext::ValueIsCloned(const Instruction *In1, Instruction *In2) {
-  pImpl->ValueIsCloned(In1, In2);
-}
-
 //===----------------------------------------------------------------------===//
 // Instruction Metadata method implementations.
 //
@@ -525,3 +469,9 @@ void Instruction::getAllMetadataImpl(SmallVectorImpl<std::pair<unsigned,
   getContext().getMetadata().pImpl->getAllMetadata(this, Result);
 }
 
+/// removeAllMetadata - Remove all metadata from this instruction.
+void Instruction::removeAllMetadata() {
+  assert(hasMetadata() && "Caller should check");
+  getContext().getMetadata().pImpl->removeAllMetadata(this);
+}
+