9#ifndef LLVM_ADT_UNIQUEVECTOR_H
10#define LLVM_ADT_UNIQUEVECTOR_H
27 using iterator =
typename VectorType::iterator;
32 std::map<T, unsigned> Map;
42 unsigned &Val = Map[Entry];
48 Val =
static_cast<unsigned>(Vector.size()) + 1;
51 Vector.push_back(Entry);
57 unsigned idFor(
const T &Entry)
const {
59 typename std::map<T, unsigned>::const_iterator
MI = Map.find(Entry);
62 if (
MI != Map.end())
return MI->second;
71 return Vector[
ID - 1];
87 size_t size()
const {
return Vector.size(); }
90 bool empty()
const {
return Vector.empty(); }
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
UniqueVector - This class produces a sequential ID number (base 1) for each unique entry that is adde...
typename VectorType::const_iterator const_iterator
unsigned insert(const T &Entry)
insert - Append entry to the vector if it doesn't already exist.
const_iterator begin() const
Return an iterator to the start of the vector.
const T & operator[](unsigned ID) const
operator[] - Returns a reference to the entry with the specified ID.
typename std::vector< T > VectorType
size_t size() const
size - Returns the number of entries in the vector.
iterator end()
Return an iterator to the end of the vector.
typename VectorType::iterator iterator
bool empty() const
empty - Returns true if the vector is empty.
unsigned idFor(const T &Entry) const
idFor - return the ID for an existing entry.
void reset()
reset - Clears all the entries.
iterator begin()
Return an iterator to the start of the vector.
const_iterator end() const
Return an iterator to the end of the vector.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.