Attribute.push_back(PAL);
Entry = Attribute.size();
}
+
+ // Do lookups for all attribute groups.
+ for (unsigned i = 0, e = PAL.getNumSlots(); i != e; ++i) {
+ AttributeSet AS = PAL.getSlotAttributes(i);
+ unsigned &Entry = AttributeSetMap[AS];
+ if (Entry == 0) {
+ AttributeSets.push_back(AS);
+ Entry = AttributeSets.size();
+ }
+ }
}
void ValueEnumerator::incorporateFunction(const Function &F) {
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;
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 {
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