13 #ifndef LLVM_SUPPORT_REGISTRY_H 14 #define LLVM_SUPPORT_REGISTRY_H 29 std::unique_ptr<T> (*Ctor)();
33 : Name(N), Desc(D), Ctor(
C) {}
69 node(
const entry &V) : Next(nullptr), Val(V) {}
79 static void add_node(
node *N);
113 template <
typename V>
118 static std::unique_ptr<T> CtorFn() {
return std::make_unique<V>(); }
122 : Entry(Name, Desc, CtorFn), Node(Entry) {
137 #define LLVM_INSTANTIATE_REGISTRY(REGISTRY_CLASS) \ 139 template<typename T> typename Registry<T>::node *Registry<T>::Head = nullptr;\ 140 template<typename T> typename Registry<T>::node *Registry<T>::Tail = nullptr;\ 141 template<typename T> \ 142 void Registry<T>::add_node(typename Registry<T>::node *N) { \ 149 template<typename T> typename Registry<T>::iterator Registry<T>::begin() { \ 150 return iterator(Head); \ 152 template REGISTRY_CLASS::node *Registry<REGISTRY_CLASS::type>::Head; \ 153 template REGISTRY_CLASS::node *Registry<REGISTRY_CLASS::type>::Tail; \ 155 void Registry<REGISTRY_CLASS::type>::add_node(REGISTRY_CLASS::node*); \ 156 template REGISTRY_CLASS::iterator Registry<REGISTRY_CLASS::type>::begin(); \ 159 #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.
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
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
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.
Tail - This calling convention attemps to make calls as fast as possible while guaranteeing that tail...
StringRef - Represent a constant reference to a string, i.e.
Add(StringRef Name, StringRef Desc)
A static registration template.