aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-09-18 19:26:43 +0000
committerDevang Patel <dpatel@apple.com>2009-09-18 19:26:43 +0000
commite8e0213cc3daa2d0457c22e4c12e6973f21fc942 (patch)
tree011f5819548ed35e3c31b6abe45e271bf0eb1147 /include/llvm
parent88d9839d07a6b5a03484d664913de0f2b33d3bff (diff)
downloadexternal_llvm-e8e0213cc3daa2d0457c22e4c12e6973f21fc942.tar.gz
external_llvm-e8e0213cc3daa2d0457c22e4c12e6973f21fc942.tar.bz2
external_llvm-e8e0213cc3daa2d0457c22e4c12e6973f21fc942.zip
Write and read metadata attachments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82259 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Bitcode/LLVMBitCodes.h7
-rw-r--r--include/llvm/Metadata.h9
2 files changed, 12 insertions, 4 deletions
diff --git a/include/llvm/Bitcode/LLVMBitCodes.h b/include/llvm/Bitcode/LLVMBitCodes.h
index 2f967d6c9a..dccd8e035d 100644
--- a/include/llvm/Bitcode/LLVMBitCodes.h
+++ b/include/llvm/Bitcode/LLVMBitCodes.h
@@ -34,7 +34,8 @@ namespace bitc {
FUNCTION_BLOCK_ID,
TYPE_SYMTAB_BLOCK_ID,
VALUE_SYMTAB_BLOCK_ID,
- METADATA_BLOCK_ID
+ METADATA_BLOCK_ID,
+ METADATA_ATTACHMENT_ID
};
@@ -111,7 +112,9 @@ namespace bitc {
METADATA_STRING = 1, // MDSTRING: [values]
METADATA_NODE = 2, // MDNODE: [n x (type num, value num)]
METADATA_NAME = 3, // STRING: [values]
- METADATA_NAMED_NODE = 4 // NAMEDMDNODE: [n x mdnodes]
+ METADATA_NAMED_NODE = 4, // NAMEDMDNODE: [n x mdnodes]
+ METADATA_KIND = 5, // [n x [id, name]]
+ METADATA_ATTACHMENT = 6 // [m x [value, [n x [id, mdnode]]]
};
// The constants block (CONSTANTS_BLOCK_ID) describes emission for each
// constant and maintains an implicit current type value.
diff --git a/include/llvm/Metadata.h b/include/llvm/Metadata.h
index a2394beb40..21f907a371 100644
--- a/include/llvm/Metadata.h
+++ b/include/llvm/Metadata.h
@@ -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) {}