003 File Manager
Current Path:
/usr/src/contrib/llvm-project/llvm/include/llvm/IR
usr
/
src
/
contrib
/
llvm-project
/
llvm
/
include
/
llvm
/
IR
/
📁
..
📄
AbstractCallSite.h
(9.5 KB)
📄
Argument.h
(5.03 KB)
📄
AssemblyAnnotationWriter.h
(2.2 KB)
📄
Attributes.h
(35.5 KB)
📄
Attributes.td
(8.96 KB)
📄
AutoUpgrade.h
(3.96 KB)
📄
BasicBlock.h
(21.91 KB)
📄
CFG.h
(13.84 KB)
📄
CallingConv.h
(9.27 KB)
📄
Comdat.h
(2.16 KB)
📄
Constant.h
(8.33 KB)
📄
ConstantFolder.h
(10.01 KB)
📄
ConstantRange.h
(21.6 KB)
📄
Constants.h
(53.03 KB)
📄
ConstrainedOps.def
(5.4 KB)
📄
DIBuilder.h
(44.36 KB)
📄
DataLayout.h
(24.11 KB)
📄
DebugInfo.h
(5.42 KB)
📄
DebugInfoFlags.def
(3.62 KB)
📄
DebugInfoMetadata.h
(132.91 KB)
📄
DebugLoc.h
(4.57 KB)
📄
DerivedTypes.h
(26.81 KB)
📄
DerivedUser.h
(1.32 KB)
📄
DiagnosticHandler.h
(2.89 KB)
📄
DiagnosticInfo.h
(41.02 KB)
📄
DiagnosticPrinter.h
(3.46 KB)
📄
Dominators.h
(9.94 KB)
📄
FPEnv.h
(1.97 KB)
📄
FixedMetadataKinds.def
(2.05 KB)
📄
Function.h
(31.39 KB)
📄
GVMaterializer.h
(1.45 KB)
📄
GetElementPtrTypeIterator.h
(5.54 KB)
📄
GlobalAlias.h
(3.16 KB)
📄
GlobalIFunc.h
(2.51 KB)
📄
GlobalIndirectSymbol.h
(3.11 KB)
📄
GlobalObject.h
(7.39 KB)
📄
GlobalValue.h
(21.2 KB)
📄
GlobalVariable.h
(9.6 KB)
📄
IRBuilder.h
(105.58 KB)
📄
IRBuilderFolder.h
(7.1 KB)
📄
IRPrintingPasses.h
(3.57 KB)
📄
InlineAsm.h
(15.84 KB)
📄
InstIterator.h
(5.06 KB)
📄
InstVisitor.h
(13.95 KB)
📄
InstrTypes.h
(86.25 KB)
📄
Instruction.def
(8.53 KB)
📄
Instruction.h
(30.74 KB)
📄
Instructions.h
(195.68 KB)
📄
IntrinsicInst.h
(29.03 KB)
📄
Intrinsics.h
(8.21 KB)
📄
Intrinsics.td
(78.88 KB)
📄
IntrinsicsAArch64.td
(100.59 KB)
📄
IntrinsicsAMDGPU.td
(80.43 KB)
📄
IntrinsicsARM.td
(65.15 KB)
📄
IntrinsicsBPF.td
(1.54 KB)
📄
IntrinsicsHexagon.td
(11.53 KB)
📄
IntrinsicsHexagonDep.td
(197.38 KB)
📄
IntrinsicsMips.td
(94.94 KB)
📄
IntrinsicsNVVM.td
(193.97 KB)
📄
IntrinsicsPowerPC.td
(68.23 KB)
📄
IntrinsicsRISCV.td
(3.24 KB)
📄
IntrinsicsSystemZ.td
(18.56 KB)
📄
IntrinsicsWebAssembly.td
(9.38 KB)
📄
IntrinsicsX86.td
(242.99 KB)
📄
IntrinsicsXCore.td
(6.83 KB)
📄
LLVMContext.h
(14.18 KB)
📄
LLVMRemarkStreamer.h
(3.36 KB)
📄
LegacyPassManager.h
(3.11 KB)
📄
LegacyPassManagers.h
(18.17 KB)
📄
LegacyPassNameParser.h
(3.73 KB)
📄
MDBuilder.h
(8.65 KB)
📄
Mangler.h
(2.06 KB)
📄
MatrixBuilder.h
(8.81 KB)
📄
Metadata.def
(5.07 KB)
📄
Metadata.h
(45.24 KB)
📄
Module.h
(34.6 KB)
📄
ModuleSlotTracker.h
(2.56 KB)
📄
ModuleSummaryIndex.h
(58.12 KB)
📄
ModuleSummaryIndexYAML.h
(10.93 KB)
📄
NoFolder.h
(11.32 KB)
📄
OperandTraits.h
(5.78 KB)
📄
Operator.h
(19.58 KB)
📄
OptBisect.h
(2.79 KB)
📄
PassInstrumentation.h
(8.05 KB)
📄
PassManager.h
(54.18 KB)
📄
PassManagerImpl.h
(5.76 KB)
📄
PassManagerInternal.h
(11.9 KB)
📄
PassTimingInfo.h
(3.65 KB)
📄
PatternMatch.h
(73.41 KB)
📄
PredIteratorCache.h
(2.59 KB)
📄
ProfileSummary.h
(4.34 KB)
📄
RuntimeLibcalls.def
(24.52 KB)
📄
SafepointIRVerifier.h
(1.63 KB)
📄
Statepoint.h
(13.61 KB)
📄
SymbolTableListTraits.h
(4.45 KB)
📄
TrackingMDRef.h
(4.5 KB)
📄
Type.h
(18.98 KB)
📄
TypeFinder.h
(2.57 KB)
📄
Use.h
(3.75 KB)
📄
UseListOrder.h
(1.18 KB)
📄
User.h
(11.75 KB)
📄
VPIntrinsics.def
(2.34 KB)
📄
Value.def
(3.62 KB)
📄
Value.h
(32.16 KB)
📄
ValueHandle.h
(18.11 KB)
📄
ValueMap.h
(14.09 KB)
📄
ValueSymbolTable.h
(4.22 KB)
📄
Verifier.h
(5.47 KB)
Editing: PassManagerInternal.h
//===- PassManager internal APIs and implementation details -----*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// \file /// /// This header provides internal APIs and implementation details used by the /// pass management interfaces exposed in PassManager.h. To understand more /// context of why these particular interfaces are needed, see that header /// file. None of these APIs should be used elsewhere. /// //===----------------------------------------------------------------------===// #ifndef LLVM_IR_PASSMANAGERINTERNAL_H #define LLVM_IR_PASSMANAGERINTERNAL_H #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" #include <memory> #include <utility> namespace llvm { template <typename IRUnitT> class AllAnalysesOn; template <typename IRUnitT, typename... ExtraArgTs> class AnalysisManager; class PreservedAnalyses; /// Implementation details of the pass manager interfaces. namespace detail { /// Template for the abstract base class used to dispatch /// polymorphically over pass objects. template <typename IRUnitT, typename AnalysisManagerT, typename... ExtraArgTs> struct PassConcept { // Boiler plate necessary for the container of derived classes. virtual ~PassConcept() = default; /// The polymorphic API which runs the pass over a given IR entity. /// /// Note that actual pass object can omit the analysis manager argument if /// desired. Also that the analysis manager may be null if there is no /// analysis manager in the pass pipeline. virtual PreservedAnalyses run(IRUnitT &IR, AnalysisManagerT &AM, ExtraArgTs... ExtraArgs) = 0; /// Polymorphic method to access the name of a pass. virtual StringRef name() const = 0; }; /// A template wrapper used to implement the polymorphic API. /// /// Can be instantiated for any object which provides a \c run method accepting /// an \c IRUnitT& and an \c AnalysisManager<IRUnit>&. It requires the pass to /// be a copyable object. template <typename IRUnitT, typename PassT, typename PreservedAnalysesT, typename AnalysisManagerT, typename... ExtraArgTs> struct PassModel : PassConcept<IRUnitT, AnalysisManagerT, ExtraArgTs...> { explicit PassModel(PassT Pass) : Pass(std::move(Pass)) {} // We have to explicitly define all the special member functions because MSVC // refuses to generate them. PassModel(const PassModel &Arg) : Pass(Arg.Pass) {} PassModel(PassModel &&Arg) : Pass(std::move(Arg.Pass)) {} friend void swap(PassModel &LHS, PassModel &RHS) { using std::swap; swap(LHS.Pass, RHS.Pass); } PassModel &operator=(PassModel RHS) { swap(*this, RHS); return *this; } PreservedAnalysesT run(IRUnitT &IR, AnalysisManagerT &AM, ExtraArgTs... ExtraArgs) override { return Pass.run(IR, AM, ExtraArgs...); } StringRef name() const override { return PassT::name(); } PassT Pass; }; /// Abstract concept of an analysis result. /// /// This concept is parameterized over the IR unit that this result pertains /// to. template <typename IRUnitT, typename PreservedAnalysesT, typename InvalidatorT> struct AnalysisResultConcept { virtual ~AnalysisResultConcept() = default; /// Method to try and mark a result as invalid. /// /// When the outer analysis manager detects a change in some underlying /// unit of the IR, it will call this method on all of the results cached. /// /// \p PA is a set of preserved analyses which can be used to avoid /// invalidation because the pass which changed the underlying IR took care /// to update or preserve the analysis result in some way. /// /// \p Inv is typically a \c AnalysisManager::Invalidator object that can be /// used by a particular analysis result to discover if other analyses /// results are also invalidated in the event that this result depends on /// them. See the documentation in the \c AnalysisManager for more details. /// /// \returns true if the result is indeed invalid (the default). virtual bool invalidate(IRUnitT &IR, const PreservedAnalysesT &PA, InvalidatorT &Inv) = 0; }; /// SFINAE metafunction for computing whether \c ResultT provides an /// \c invalidate member function. template <typename IRUnitT, typename ResultT> class ResultHasInvalidateMethod { using EnabledType = char; struct DisabledType { char a, b; }; // Purely to help out MSVC which fails to disable the below specialization, // explicitly enable using the result type's invalidate routine if we can // successfully call that routine. template <typename T> struct Nonce { using Type = EnabledType; }; template <typename T> static typename Nonce<decltype(std::declval<T>().invalidate( std::declval<IRUnitT &>(), std::declval<PreservedAnalyses>()))>::Type check(rank<2>); // First we define an overload that can only be taken if there is no // invalidate member. We do this by taking the address of an invalidate // member in an adjacent base class of a derived class. This would be // ambiguous if there were an invalidate member in the result type. template <typename T, typename U> static DisabledType NonceFunction(T U::*); struct CheckerBase { int invalidate; }; template <typename T> struct Checker : CheckerBase, T {}; template <typename T> static decltype(NonceFunction(&Checker<T>::invalidate)) check(rank<1>); // Now we have the fallback that will only be reached when there is an // invalidate member, and enables the trait. template <typename T> static EnabledType check(rank<0>); public: enum { Value = sizeof(check<ResultT>(rank<2>())) == sizeof(EnabledType) }; }; /// Wrapper to model the analysis result concept. /// /// By default, this will implement the invalidate method with a trivial /// implementation so that the actual analysis result doesn't need to provide /// an invalidation handler. It is only selected when the invalidation handler /// is not part of the ResultT's interface. template <typename IRUnitT, typename PassT, typename ResultT, typename PreservedAnalysesT, typename InvalidatorT, bool HasInvalidateHandler = ResultHasInvalidateMethod<IRUnitT, ResultT>::Value> struct AnalysisResultModel; /// Specialization of \c AnalysisResultModel which provides the default /// invalidate functionality. template <typename IRUnitT, typename PassT, typename ResultT, typename PreservedAnalysesT, typename InvalidatorT> struct AnalysisResultModel<IRUnitT, PassT, ResultT, PreservedAnalysesT, InvalidatorT, false> : AnalysisResultConcept<IRUnitT, PreservedAnalysesT, InvalidatorT> { explicit AnalysisResultModel(ResultT Result) : Result(std::move(Result)) {} // We have to explicitly define all the special member functions because MSVC // refuses to generate them. AnalysisResultModel(const AnalysisResultModel &Arg) : Result(Arg.Result) {} AnalysisResultModel(AnalysisResultModel &&Arg) : Result(std::move(Arg.Result)) {} friend void swap(AnalysisResultModel &LHS, AnalysisResultModel &RHS) { using std::swap; swap(LHS.Result, RHS.Result); } AnalysisResultModel &operator=(AnalysisResultModel RHS) { swap(*this, RHS); return *this; } /// The model bases invalidation solely on being in the preserved set. // // FIXME: We should actually use two different concepts for analysis results // rather than two different models, and avoid the indirect function call for // ones that use the trivial behavior. bool invalidate(IRUnitT &, const PreservedAnalysesT &PA, InvalidatorT &) override { auto PAC = PA.template getChecker<PassT>(); return !PAC.preserved() && !PAC.template preservedSet<AllAnalysesOn<IRUnitT>>(); } ResultT Result; }; /// Specialization of \c AnalysisResultModel which delegates invalidate /// handling to \c ResultT. template <typename IRUnitT, typename PassT, typename ResultT, typename PreservedAnalysesT, typename InvalidatorT> struct AnalysisResultModel<IRUnitT, PassT, ResultT, PreservedAnalysesT, InvalidatorT, true> : AnalysisResultConcept<IRUnitT, PreservedAnalysesT, InvalidatorT> { explicit AnalysisResultModel(ResultT Result) : Result(std::move(Result)) {} // We have to explicitly define all the special member functions because MSVC // refuses to generate them. AnalysisResultModel(const AnalysisResultModel &Arg) : Result(Arg.Result) {} AnalysisResultModel(AnalysisResultModel &&Arg) : Result(std::move(Arg.Result)) {} friend void swap(AnalysisResultModel &LHS, AnalysisResultModel &RHS) { using std::swap; swap(LHS.Result, RHS.Result); } AnalysisResultModel &operator=(AnalysisResultModel RHS) { swap(*this, RHS); return *this; } /// The model delegates to the \c ResultT method. bool invalidate(IRUnitT &IR, const PreservedAnalysesT &PA, InvalidatorT &Inv) override { return Result.invalidate(IR, PA, Inv); } ResultT Result; }; /// Abstract concept of an analysis pass. /// /// This concept is parameterized over the IR unit that it can run over and /// produce an analysis result. template <typename IRUnitT, typename PreservedAnalysesT, typename InvalidatorT, typename... ExtraArgTs> struct AnalysisPassConcept { virtual ~AnalysisPassConcept() = default; /// Method to run this analysis over a unit of IR. /// \returns A unique_ptr to the analysis result object to be queried by /// users. virtual std::unique_ptr< AnalysisResultConcept<IRUnitT, PreservedAnalysesT, InvalidatorT>> run(IRUnitT &IR, AnalysisManager<IRUnitT, ExtraArgTs...> &AM, ExtraArgTs... ExtraArgs) = 0; /// Polymorphic method to access the name of a pass. virtual StringRef name() const = 0; }; /// Wrapper to model the analysis pass concept. /// /// Can wrap any type which implements a suitable \c run method. The method /// must accept an \c IRUnitT& and an \c AnalysisManager<IRUnitT>& as arguments /// and produce an object which can be wrapped in a \c AnalysisResultModel. template <typename IRUnitT, typename PassT, typename PreservedAnalysesT, typename InvalidatorT, typename... ExtraArgTs> struct AnalysisPassModel : AnalysisPassConcept<IRUnitT, PreservedAnalysesT, InvalidatorT, ExtraArgTs...> { explicit AnalysisPassModel(PassT Pass) : Pass(std::move(Pass)) {} // We have to explicitly define all the special member functions because MSVC // refuses to generate them. AnalysisPassModel(const AnalysisPassModel &Arg) : Pass(Arg.Pass) {} AnalysisPassModel(AnalysisPassModel &&Arg) : Pass(std::move(Arg.Pass)) {} friend void swap(AnalysisPassModel &LHS, AnalysisPassModel &RHS) { using std::swap; swap(LHS.Pass, RHS.Pass); } AnalysisPassModel &operator=(AnalysisPassModel RHS) { swap(*this, RHS); return *this; } // FIXME: Replace PassT::Result with type traits when we use C++11. using ResultModelT = AnalysisResultModel<IRUnitT, PassT, typename PassT::Result, PreservedAnalysesT, InvalidatorT>; /// The model delegates to the \c PassT::run method. /// /// The return is wrapped in an \c AnalysisResultModel. std::unique_ptr< AnalysisResultConcept<IRUnitT, PreservedAnalysesT, InvalidatorT>> run(IRUnitT &IR, AnalysisManager<IRUnitT, ExtraArgTs...> &AM, ExtraArgTs... ExtraArgs) override { return std::make_unique<ResultModelT>( Pass.run(IR, AM, std::forward<ExtraArgTs>(ExtraArgs)...)); } /// The model delegates to a static \c PassT::name method. /// /// The returned string ref must point to constant immutable data! StringRef name() const override { return PassT::name(); } PassT Pass; }; } // end namespace detail } // end namespace llvm #endif // LLVM_IR_PASSMANAGERINTERNAL_H
Upload File
Create Folder