14 #ifndef LLVM_SUPPORT_REGISTRY_H 15 #define LLVM_SUPPORT_REGISTRY_H 30 std::unique_ptr<T> (*Ctor)();
34 : Name(N), Desc(D), Ctor(
C) {}
57 static node *Head, *Tail;
70 node(
const entry &V) : Next(nullptr), Val(V) {}
80 static void add_node(
node *N);
114 template <
typename V>
119 static std::unique_ptr<T> CtorFn() {
return make_unique<V>(); }
123 : Entry(Name, Desc, CtorFn), Node(Entry) {
138 #define LLVM_INSTANTIATE_REGISTRY(REGISTRY_CLASS) \ 140 template<typename T> typename Registry<T>::node *Registry<T>::Head = nullptr;\ 141 template<typename T> typename Registry<T>::node *Registry<T>::Tail = nullptr;\ 142 template<typename T> \ 143 void Registry<T>::add_node(typename Registry<T>::node *N) { \ 150 template<typename T> typename Registry<T>::iterator Registry<T>::begin() { \ 151 return iterator(Head); \ 153 template REGISTRY_CLASS::node *Registry<REGISTRY_CLASS::type>::Head; \ 154 template REGISTRY_CLASS::node *Registry<REGISTRY_CLASS::type>::Tail; \ 156 void Registry<REGISTRY_CLASS::type>::add_node(REGISTRY_CLASS::node*); \ 157 template REGISTRY_CLASS::iterator Registry<REGISTRY_CLASS::type>::begin(); \ 160 #endif // LLVM_SUPPORT_REGISTRY_H
const_iterator end(StringRef path)
Get end iterator over path.
bool operator==(const iterator &That) const
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
This class represents lattice values for constants.
std::unique_ptr< T > instantiate() const
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
A global registry used in conjunction with static constructors to make pluggable components (like tar...
A simple registry entry which provides only a name, description, and no-argument constructor.
bool operator!=(const iterator &That) const
static iterator_range< iterator > entries()
Node in linked list of entries.
const entry & operator*() const
SimpleRegistryEntry(StringRef N, StringRef D, std::unique_ptr< T >(*C)())
StringRef getName() const
SimpleRegistryEntry< T > entry
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
A range adaptor for a pair of iterators.
StringRef getDesc() const
Iterators for registry entries.
const entry * operator->() const
StringRef - Represent a constant reference to a string, i.e.
Add(StringRef Name, StringRef Desc)
A static registration template.