summaryrefslogtreecommitdiff
path: root/lib/Bitcode/Writer/ValueEnumerator.h
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-02-10 23:06:02 +0000
committerBill Wendling <isanbard@gmail.com>2013-02-10 23:06:02 +0000
commit8c2e77f895301967bf37d04e905fb1f069ec91b2 (patch)
tree2d0ed3b3b0cd0777bf17cf4817479c70b3246722 /lib/Bitcode/Writer/ValueEnumerator.h
parenta311c526ed1da64c450bb8842630f6f80c691eca (diff)
downloadllvm-8c2e77f895301967bf37d04e905fb1f069ec91b2.tar.gz
llvm-8c2e77f895301967bf37d04e905fb1f069ec91b2.tar.bz2
llvm-8c2e77f895301967bf37d04e905fb1f069ec91b2.tar.xz
Add support for attribute groups in the value enumerator.
Attribute groups are essentially all AttributeSets which are used by the program. Enumerate them here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174844 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Writer/ValueEnumerator.h')
-rw-r--r--lib/Bitcode/Writer/ValueEnumerator.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Bitcode/Writer/ValueEnumerator.h b/lib/Bitcode/Writer/ValueEnumerator.h
index 2d3d570354..6e91d68fcb 100644
--- a/lib/Bitcode/Writer/ValueEnumerator.h
+++ b/lib/Bitcode/Writer/ValueEnumerator.h
@@ -52,6 +52,10 @@ private:
SmallVector<const MDNode *, 8> FunctionLocalMDs;
ValueMapType MDValueMap;
+ typedef DenseMap<AttributeSet, unsigned> AttributeSetMapType;
+ AttributeSetMapType AttributeSetMap;
+ std::vector<AttributeSet> AttributeSets;
+
typedef DenseMap<void*, unsigned> AttributeMapType;
AttributeMapType AttributeMap;
std::vector<AttributeSet> Attribute;
@@ -105,6 +109,13 @@ public:
return I->second;
}
+ unsigned getAttributeSetID(const AttributeSet &PAL) const {
+ if (PAL.isEmpty()) return 0; // Null maps to zero.
+ AttributeSetMapType::const_iterator I = AttributeSetMap.find(PAL);
+ assert(I != AttributeSetMap.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> &getAttributeSets() const {
+ return AttributeSets;
+ }
/// getGlobalBasicBlockID - This returns the function-specific ID for the
/// specified basic block. This is relatively expensive information, so it