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

@ -22,6 +22,7 @@ namespace llvm {
class Type;
class Value;
class Instruction;
class BasicBlock;
class Function;
class Module;
@ -47,11 +48,15 @@ private:
ValueList Values;
ValueList MDValues;
ValueMapType MDValueMap;
typedef DenseMap<void*, unsigned> AttributeMapType;
AttributeMapType AttributeMap;
std::vector<AttrListPtr> Attributes;
typedef DenseMap<const Instruction*, unsigned> InstructionMapType;
InstructionMapType InstructionMap;
unsigned InstructionCount;
/// BasicBlocks - This contains all the basic blocks for the currently
/// incorporated function. Their reverse mapping is stored in ValueMap.
std::vector<const BasicBlock*> BasicBlocks;
@ -74,7 +79,10 @@ public:
assert(I != TypeMap.end() && "Type not in ValueEnumerator!");
return I->second-1;
}
unsigned getInstructionID(const Instruction *I) const;
void setInstructionID(const Instruction *I);
unsigned getAttributeID(const AttrListPtr &PAL) const {
if (PAL.isEmpty()) return 0; // Null maps to zero.
AttributeMapType::const_iterator I = AttributeMap.find(PAL.getRawPointer());