18 #ifndef LLVM_IR_PASSMANAGERINTERNAL_H 19 #define LLVM_IR_PASSMANAGERINTERNAL_H 28 template <
typename IRUnitT>
class AllAnalysesOn;
29 template <
typename IRUnitT,
typename... ExtraArgTs>
class AnalysisManager;
30 class PreservedAnalyses;
37 template <
typename IRUnitT,
typename AnalysisManagerT,
typename... ExtraArgTs>
48 ExtraArgTs... ExtraArgs) = 0;
59 template <
typename IRUnitT,
typename PassT,
typename PreservedAnalysesT,
60 typename AnalysisManagerT,
typename... ExtraArgTs>
78 PreservedAnalysesT
run(IRUnitT &
IR, AnalysisManagerT &AM,
79 ExtraArgTs... ExtraArgs)
override {
80 return Pass.run(IR, AM, ExtraArgs...);
92 template <
typename IRUnitT,
typename PreservedAnalysesT,
typename Inval
idatorT>
111 virtual bool invalidate(IRUnitT &
IR,
const PreservedAnalysesT &PA,
112 InvalidatorT &Inv) = 0;
119 struct DisabledType {
127 template <
typename T>
128 static typename Nonce<decltype(std::declval<T>().invalidate(
129 std::declval<IRUnitT &>(), std::declval<PreservedAnalyses>()))>::
Type 136 template <
typename T,
typename U>
static DisabledType NonceFunction(
T U::*);
137 struct CheckerBase {
int invalidate; };
138 template <
typename T>
struct Checker : CheckerBase,
T {};
139 template <
typename T>
140 static decltype(NonceFunction(&Checker<T>::invalidate)) check(
rank<1>);
144 template <
typename T>
157 template <
typename IRUnitT,
typename PassT,
typename ResultT,
158 typename PreservedAnalysesT,
typename InvalidatorT,
159 bool HasInvalidateHandler =
165 template <
typename IRUnitT,
typename PassT,
typename ResultT,
166 typename PreservedAnalysesT,
typename InvalidatorT>
175 : Result(
std::move(
Arg.Result)) {}
179 swap(LHS.Result, RHS.Result);
193 InvalidatorT &)
override {
194 auto PAC = PA.template getChecker<PassT>();
195 return !PAC.preserved() &&
196 !PAC.template preservedSet<AllAnalysesOn<IRUnitT>>();
204 template <
typename IRUnitT,
typename PassT,
typename ResultT,
205 typename PreservedAnalysesT,
typename InvalidatorT>
214 : Result(
std::move(
Arg.Result)) {}
218 swap(LHS.Result, RHS.Result);
228 InvalidatorT &Inv)
override {
229 return Result.invalidate(IR, PA, Inv);
239 template <
typename IRUnitT,
typename PreservedAnalysesT,
typename InvalidatorT,
240 typename... ExtraArgTs>
247 virtual std::unique_ptr<
250 ExtraArgTs... ExtraArgs) = 0;
261 template <
typename IRUnitT,
typename PassT,
typename PreservedAnalysesT,
262 typename InvalidatorT,
typename... ExtraArgTs>
264 InvalidatorT, ExtraArgTs...> {
284 PreservedAnalysesT, InvalidatorT>;
292 ExtraArgTs... ExtraArgs)
override {
293 return llvm::make_unique<ResultModelT>(
294 Pass.run(IR, AM, std::forward<ExtraArgTs>(ExtraArgs)...));
309 #endif // LLVM_IR_PASSMANAGERINTERNAL_H Pass interface - Implemented by all 'passes'.
Wrapper to model the analysis pass concept.
This class represents lattice values for constants.
friend void swap(AnalysisResultModel &LHS, AnalysisResultModel &RHS)
Template for the abstract base class used to dispatch polymorphically over pass objects.
AnalysisResultModel(const AnalysisResultModel &Arg)
block Block Frequency true
SFINAE metafunction for computing whether ResultT provides an invalidate member function.
Abstract concept of an analysis pass.
AnalysisResultModel(ResultT Result)
AnalysisResultModel(AnalysisResultModel &&Arg)
AnalysisResultModel(ResultT Result)
PassModel & operator=(PassModel RHS)
friend void swap(PassModel &LHS, PassModel &RHS)
bool invalidate(IRUnitT &IR, const PreservedAnalysesT &PA, InvalidatorT &Inv) override
The model delegates to the ResultT method.
virtual PreservedAnalyses run(IRUnitT &IR, AnalysisManagerT &AM, ExtraArgTs... ExtraArgs)=0
The polymorphic API which runs the pass over a given IR entity.
A set of analyses that are preserved following a run of a transformation pass.
The instances of the Type class are immutable: once they are created, they are never changed...
friend void swap(AnalysisPassModel &LHS, AnalysisPassModel &RHS)
Wrapper to model the analysis result concept.
AnalysisPassModel(const AnalysisPassModel &Arg)
virtual StringRef name() const =0
Polymorphic method to access the name of a pass.
virtual ~PassConcept()=default
AnalysisPassModel & operator=(AnalysisPassModel RHS)
AnalysisResultModel(AnalysisResultModel &&Arg)
A template wrapper used to implement the polymorphic API.
AnalysisResultModel & operator=(AnalysisResultModel RHS)
Abstract concept of an analysis result.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
friend void swap(AnalysisResultModel &LHS, AnalysisResultModel &RHS)
StringRef name() const override
Polymorphic method to access the name of a pass.
amdgpu Simplify well known AMD library false Value Value * Arg
AnalysisPassModel(PassT Pass)
std::unique_ptr< AnalysisResultConcept< IRUnitT, PreservedAnalysesT, InvalidatorT > > run(IRUnitT &IR, AnalysisManager< IRUnitT, ExtraArgTs... > &AM, ExtraArgTs... ExtraArgs) override
The model delegates to the PassT::run method.
PassModel(const PassModel &Arg)
AnalysisResultModel & operator=(AnalysisResultModel RHS)
bool invalidate(IRUnitT &, const PreservedAnalysesT &PA, InvalidatorT &) override
The model bases invalidation solely on being in the preserved set.
AnalysisResultModel(const AnalysisResultModel &Arg)
LLVM Value Representation.
PassModel(PassModel &&Arg)
AnalysisPassModel(AnalysisPassModel &&Arg)
StringRef - Represent a constant reference to a string, i.e.
A container for analyses that lazily runs them and caches their results.
PreservedAnalysesT run(IRUnitT &IR, AnalysisManagerT &AM, ExtraArgTs... ExtraArgs) override
The polymorphic API which runs the pass over a given IR entity.
Utility type to build an inheritance chain that makes it easy to rank overload candidates.
Statically lint checks LLVM IR
StringRef name() const override
The model delegates to a static PassT::name method.