//
// The LLVM Compiler Infrastructure
//
-// This file was developed by Chris Lattner and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
#define VALUE_ENUMERATOR_H
#include "llvm/ADT/DenseMap.h"
+#include "llvm/Attributes.h"
#include <vector>
namespace llvm {
class BasicBlock;
class Function;
class Module;
-class ParamAttrsList;
+class AttrListPtr;
class TypeSymbolTable;
class ValueSymbolTable;
ValueMapType ValueMap;
ValueList Values;
- typedef DenseMap<const ParamAttrsList*, unsigned> ParamAttrMapType;
- ParamAttrMapType ParamAttrMap;
- std::vector<const ParamAttrsList*> ParamAttrs;
+ typedef DenseMap<void*, unsigned> AttributeMapType;
+ AttributeMapType AttributeMap;
+ std::vector<AttrListPtr> Attributes;
/// BasicBlocks - This contains all the basic blocks for the currently
/// incorporated function. Their reverse mapping is stored in ValueMap.
return I->second-1;
}
- unsigned getParamAttrID(const ParamAttrsList *PAL) const {
- if (PAL == 0) return 0; // Null maps to zero.
- ParamAttrMapType::const_iterator I = ParamAttrMap.find(PAL);
- assert(I != ParamAttrMap.end() && "ParamAttr not in ValueEnumerator!");
+ unsigned getAttributeID(const AttrListPtr &PAL) const {
+ if (PAL.isEmpty()) return 0; // Null maps to zero.
+ AttributeMapType::const_iterator I = AttributeMap.find(PAL.getRawPointer());
+ assert(I != AttributeMap.end() && "Attribute not in ValueEnumerator!");
return I->second;
}
const std::vector<const BasicBlock*> &getBasicBlocks() const {
return BasicBlocks;
}
- const std::vector<const ParamAttrsList*> &getParamAttrs() const {
- return ParamAttrs;
+ const std::vector<AttrListPtr> &getAttributes() const {
+ return Attributes;
}
- /// PurgeAggregateValues - If there are any aggregate values at the end of the
- /// value list, remove them and return the count of the remaining values. If
- /// there are none, return -1.
- int PurgeAggregateValues();
-
/// incorporateFunction/purgeFunction - If you'd like to deal with a function,
/// use these two methods to get its data into the ValueEnumerator!
///
void EnumerateValue(const Value *V);
void EnumerateType(const Type *T);
- void EnumerateParamAttrs(const ParamAttrsList *PAL);
+ void EnumerateOperandType(const Value *V);
+ void EnumerateAttributes(const AttrListPtr &PAL);
void EnumerateTypeSymbolTable(const TypeSymbolTable &ST);
void EnumerateValueSymbolTable(const ValueSymbolTable &ST);