10 #ifndef LLVM_ADT_UNIQUEVECTOR_H
11 #define LLVM_ADT_UNIQUEVECTOR_H
28 typedef typename VectorType::iterator
iterator;
33 std::map<T, unsigned> Map;
44 unsigned &Val = Map[Entry];
50 Val =
static_cast<unsigned>(Vector.size()) + 1;
53 Vector.push_back(Entry);
59 unsigned idFor(
const T &Entry)
const {
61 typename std::map<T, unsigned>::const_iterator
MI = Map.find(Entry);
64 if (MI != Map.end())
return MI->second;
73 assert(ID-1 <
size() &&
"ID is 0 or out of range!");
74 return Vector[ID - 1];
91 size_t size()
const {
return Vector.size(); }
95 bool empty()
const {
return Vector.empty(); }
107 #endif // LLVM_ADT_UNIQUEVECTOR_H
const T & operator[](unsigned ID) const
operator[] - Returns a reference to the entry with the specified ID.
const_iterator begin() const
Return an iterator to the start of the vector.
VectorType::iterator iterator
VectorType::const_iterator const_iterator
const_iterator end() const
Return an iterator to the end of the vector.
unsigned idFor(const T &Entry) const
idFor - return the ID for an existing entry.
std::vector< T > VectorType
bool empty() const
empty - Returns true if the vector is empty.
void reset()
reset - Clears all the entries.
iterator begin()
Return an iterator to the start of the vector.
iterator end()
Return an iterator to the end of the vector.
unsigned insert(const T &Entry)
insert - Append entry to the vector if it doesn't already exist.
size_t size() const
size - Returns the number of entries in the vector.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
UniqueVector - This class produces a sequential ID number (base 1) for each unique entry that is adde...