Write and read metadata attachments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82259 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2009-09-18 19:26:43 +00:00
parent 88d9839d07
commit e8e0213cc3
10 changed files with 256 additions and 19 deletions

View File

@ -311,13 +311,14 @@ public:
/// MDKindID - This id identifies metadata kind the metadata store. Valid
/// ID values are 1 or higher. This ID is set by RegisterMDKind.
typedef unsigned MDKindID;
class Metadata {
public:
typedef std::pair<MDKindID, WeakVH> MDPairTy;
typedef SmallVector<MDPairTy, 2> MDMapTy;
private:
typedef DenseMap<const Instruction *, MDMapTy> MDStoreTy;
friend class BitcodeReader;
private:
/// MetadataStore - Collection of metadata used in this context.
MDStoreTy MetadataStore;
@ -344,6 +345,10 @@ public:
/// setMD - Attach the metadata of given kind with an Instruction.
void setMD(MDKindID Kind, MDNode *Node, Instruction *Inst);
/// getHandlerNames - Get handler names. This is used by bitcode
/// writer.
const StringMap<unsigned> *getHandlerNames();
/// ValueIsDeleted - This handler is used to update metadata store
/// when a value is deleted.
void ValueIsDeleted(Value *V) {}