diff options
Diffstat (limited to 'lib/Bitcode/Writer/ValueEnumerator.h')
-rw-r--r-- | lib/Bitcode/Writer/ValueEnumerator.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/Bitcode/Writer/ValueEnumerator.h b/lib/Bitcode/Writer/ValueEnumerator.h index 2d3d570..0af6164 100644 --- a/lib/Bitcode/Writer/ValueEnumerator.h +++ b/lib/Bitcode/Writer/ValueEnumerator.h @@ -52,7 +52,11 @@ private: SmallVector<const MDNode *, 8> FunctionLocalMDs; ValueMapType MDValueMap; - typedef DenseMap<void*, unsigned> AttributeMapType; + typedef DenseMap<AttributeSet, unsigned> AttributeGroupMapType; + AttributeGroupMapType AttributeGroupMap; + std::vector<AttributeSet> AttributeGroups; + + typedef DenseMap<AttributeSet, unsigned> AttributeMapType; AttributeMapType AttributeMap; std::vector<AttributeSet> Attribute; @@ -98,13 +102,20 @@ public: unsigned getInstructionID(const Instruction *I) const; void setInstructionID(const Instruction *I); - unsigned getAttributeID(const AttributeSet &PAL) const { + unsigned getAttributeID(AttributeSet PAL) const { if (PAL.isEmpty()) return 0; // Null maps to zero. - AttributeMapType::const_iterator I = AttributeMap.find(PAL.getRawPointer()); + AttributeMapType::const_iterator I = AttributeMap.find(PAL); assert(I != AttributeMap.end() && "Attribute not in ValueEnumerator!"); return I->second; } + unsigned getAttributeGroupID(AttributeSet PAL) const { + if (PAL.isEmpty()) return 0; // Null maps to zero. + AttributeGroupMapType::const_iterator I = AttributeGroupMap.find(PAL); + assert(I != AttributeGroupMap.end() && "Attribute not in ValueEnumerator!"); + return I->second; + } + /// getFunctionConstantRange - Return the range of values that corresponds to /// function-local constants. void getFunctionConstantRange(unsigned &Start, unsigned &End) const { @@ -124,6 +135,9 @@ public: const std::vector<AttributeSet> &getAttributes() const { return Attribute; } + const std::vector<AttributeSet> &getAttributeGroups() const { + return AttributeGroups; + } /// getGlobalBasicBlockID - This returns the function-specific ID for the /// specified basic block. This is relatively expensive information, so it @@ -146,7 +160,7 @@ private: void EnumerateValue(const Value *V); void EnumerateType(Type *T); void EnumerateOperandType(const Value *V); - void EnumerateAttributes(const AttributeSet &PAL); + void EnumerateAttributes(AttributeSet PAL); void EnumerateValueSymbolTable(const ValueSymbolTable &ST); void EnumerateNamedMetadata(const Module *M); |