- /// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const NamedMDNode *) { return true; }
- static bool classof(const Value *V) {
- return V->getValueID() == NamedMDNodeVal;
- }
+ /// getMD - Get the metadata of given kind attached to an Instruction.
+ /// If the metadata is not found then return 0.
+ MDNode *getMD(unsigned Kind, const Instruction *Inst);
+
+ /// getMDs - Get the metadata attached to an Instruction.
+ void getMDs(const Instruction *Inst,
+ SmallVectorImpl<std::pair<unsigned, TrackingVH<MDNode> > > &MDs) const;
+
+ /// addMD - Attach the metadata of given kind to an Instruction.
+ void addMD(unsigned Kind, MDNode *Node, Instruction *Inst);
+
+ /// removeMD - Remove metadata of given kind attached with an instuction.
+ void removeMD(unsigned Kind, Instruction *Inst);
+
+ /// removeAllMetadata - Remove all metadata attached with 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);
+
+ /// getHandlerNames - Populate client supplied smallvector using custom
+ /// metadata name and ID.
+ void getHandlerNames(SmallVectorImpl<std::pair<unsigned, StringRef> >&) const;
+
+ /// ValueIsDeleted - This handler is used to update metadata store
+ /// when a value is deleted.
+ void ValueIsDeleted(const Value *) {}
+ void ValueIsDeleted(Instruction *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);