diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/libs/llvm12/include/llvm/IR/PassManager.h | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/include/llvm/IR/PassManager.h')
-rw-r--r-- | contrib/libs/llvm12/include/llvm/IR/PassManager.h | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/contrib/libs/llvm12/include/llvm/IR/PassManager.h b/contrib/libs/llvm12/include/llvm/IR/PassManager.h index 195b4c27fa..e942ba2110 100644 --- a/contrib/libs/llvm12/include/llvm/IR/PassManager.h +++ b/contrib/libs/llvm12/include/llvm/IR/PassManager.h @@ -45,7 +45,7 @@ #define LLVM_IR_PASSMANAGER_H #include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/TinyPtrVector.h" @@ -526,7 +526,7 @@ public: // Call onto PassInstrumentation's AfterPass callbacks immediately after // running the pass. - PI.runAfterPass<IRUnitT>(*P, IR, PassPA); + PI.runAfterPass<IRUnitT>(*P, IR, PassPA); // Update the analysis manager as each pass runs and potentially // invalidates analyses. @@ -555,9 +555,9 @@ public: return PA; } - template <typename PassT> - std::enable_if_t<!std::is_same<PassT, PassManager>::value> - addPass(PassT Pass) { + template <typename PassT> + std::enable_if_t<!std::is_same<PassT, PassManager>::value> + addPass(PassT Pass) { using PassModelT = detail::PassModel<IRUnitT, PassT, PreservedAnalyses, AnalysisManagerT, ExtraArgTs...>; @@ -565,24 +565,24 @@ public: Passes.emplace_back(new PassModelT(std::move(Pass))); } - /// When adding a pass manager pass that has the same type as this pass - /// manager, simply move the passes over. This is because we don't have use - /// cases rely on executing nested pass managers. Doing this could reduce - /// implementation complexity and avoid potential invalidation issues that may - /// happen with nested pass managers of the same type. - template <typename PassT> - std::enable_if_t<std::is_same<PassT, PassManager>::value> - addPass(PassT &&Pass) { - for (auto &P : Pass.Passes) - Passes.emplace_back(std::move(P)); - } - - /// Returns if the pass manager contains any passes. - bool isEmpty() const { return Passes.empty(); } - - static bool isRequired() { return true; } - -protected: + /// When adding a pass manager pass that has the same type as this pass + /// manager, simply move the passes over. This is because we don't have use + /// cases rely on executing nested pass managers. Doing this could reduce + /// implementation complexity and avoid potential invalidation issues that may + /// happen with nested pass managers of the same type. + template <typename PassT> + std::enable_if_t<std::is_same<PassT, PassManager>::value> + addPass(PassT &&Pass) { + for (auto &P : Pass.Passes) + Passes.emplace_back(std::move(P)); + } + + /// Returns if the pass manager contains any passes. + bool isEmpty() const { return Passes.empty(); } + + static bool isRequired() { return true; } + +protected: using PassConceptT = detail::PassConcept<IRUnitT, AnalysisManagerT, ExtraArgTs...>; @@ -672,7 +672,7 @@ public: /// when any of its embedded analysis results end up invalidated. We pass an /// \c Invalidator object as an argument to \c invalidate() in order to let /// the analysis results themselves define the dependency graph on the fly. - /// This lets us avoid building an explicit representation of the + /// This lets us avoid building an explicit representation of the /// dependencies between analysis results. class Invalidator { public: @@ -867,7 +867,7 @@ public: return true; } - /// Invalidate a specific analysis pass for an IR unit. + /// Invalidate a specific analysis pass for an IR unit. /// /// Note that the analysis result can disregard invalidation, if it determines /// it is in fact still valid. @@ -911,7 +911,7 @@ private: return RI == AnalysisResults.end() ? nullptr : &*RI->second->second; } - /// Invalidate a pass result for a IR unit. + /// Invalidate a pass result for a IR unit. void invalidateImpl(AnalysisKey *ID, IRUnitT &IR) { typename AnalysisResultMapT::iterator RI = AnalysisResults.find({ID, &IR}); @@ -925,20 +925,20 @@ private: AnalysisResults.erase(RI); } - /// Map type from analysis pass ID to pass concept pointer. + /// Map type from analysis pass ID to pass concept pointer. using AnalysisPassMapT = DenseMap<AnalysisKey *, std::unique_ptr<PassConceptT>>; - /// Collection of analysis passes, indexed by ID. + /// Collection of analysis passes, indexed by ID. AnalysisPassMapT AnalysisPasses; - /// Map from IR unit to a list of analysis results. + /// Map from IR unit to a list of analysis results. /// - /// Provides linear time removal of all analysis results for a IR unit and + /// Provides linear time removal of all analysis results for a IR unit and /// the ultimate storage for a particular cached analysis result. AnalysisResultListMapT AnalysisResultLists; - /// Map from an analysis ID and IR unit to a particular cached + /// Map from an analysis ID and IR unit to a particular cached /// analysis result. AnalysisResultMapT AnalysisResults; @@ -1082,16 +1082,16 @@ extern template class InnerAnalysisManagerProxy<FunctionAnalysisManager, /// /// This proxy only exposes the const interface of the outer analysis manager, /// to indicate that you cannot cause an outer analysis to run from within an -/// inner pass. Instead, you must rely on the \c getCachedResult API. This is -/// due to keeping potential future concurrency in mind. To give an example, -/// running a module analysis before any function passes may give a different -/// result than running it in a function pass. Both may be valid, but it would -/// produce non-deterministic results. GlobalsAA is a good analysis example, -/// because the cached information has the mod/ref info for all memory for each -/// function at the time the analysis was computed. The information is still -/// valid after a function transformation, but it may be *different* if -/// recomputed after that transform. GlobalsAA is never invalidated. - +/// inner pass. Instead, you must rely on the \c getCachedResult API. This is +/// due to keeping potential future concurrency in mind. To give an example, +/// running a module analysis before any function passes may give a different +/// result than running it in a function pass. Both may be valid, but it would +/// produce non-deterministic results. GlobalsAA is a good analysis example, +/// because the cached information has the mod/ref info for all memory for each +/// function at the time the analysis was computed. The information is still +/// valid after a function transformation, but it may be *different* if +/// recomputed after that transform. GlobalsAA is never invalidated. + /// /// This proxy doesn't manage invalidation in any way -- that is handled by the /// recursive return path of each layer of the pass manager. A consequence of @@ -1136,9 +1136,9 @@ public: for (auto &KeyValuePair : OuterAnalysisInvalidationMap) { AnalysisKey *OuterID = KeyValuePair.first; auto &InnerIDs = KeyValuePair.second; - llvm::erase_if(InnerIDs, [&](AnalysisKey *InnerID) { - return Inv.invalidate(InnerID, IRUnit, PA); - }); + llvm::erase_if(InnerIDs, [&](AnalysisKey *InnerID) { + return Inv.invalidate(InnerID, IRUnit, PA); + }); if (InnerIDs.empty()) DeadKeys.push_back(OuterID); } @@ -1162,7 +1162,7 @@ public: // analyses that all trigger invalidation on the same outer analysis, // this entire system should be changed to some other deterministic // data structure such as a `SetVector` of a pair of pointers. - if (!llvm::is_contained(InvalidatedIDList, InvalidatedID)) + if (!llvm::is_contained(InvalidatedIDList, InvalidatedID)) InvalidatedIDList.push_back(InvalidatedID); } @@ -1236,33 +1236,33 @@ using ModuleAnalysisManagerFunctionProxy = /// analyses are not invalidated while the function passes are running, so they /// may be stale. Function analyses will not be stale. class ModuleToFunctionPassAdaptor - : public PassInfoMixin<ModuleToFunctionPassAdaptor> { + : public PassInfoMixin<ModuleToFunctionPassAdaptor> { public: - using PassConceptT = detail::PassConcept<Function, FunctionAnalysisManager>; - - explicit ModuleToFunctionPassAdaptor(std::unique_ptr<PassConceptT> Pass) + using PassConceptT = detail::PassConcept<Function, FunctionAnalysisManager>; + + explicit ModuleToFunctionPassAdaptor(std::unique_ptr<PassConceptT> Pass) : Pass(std::move(Pass)) {} /// Runs the function pass across every function in the module. - PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); + PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); - static bool isRequired() { return true; } + static bool isRequired() { return true; } private: - std::unique_ptr<PassConceptT> Pass; + std::unique_ptr<PassConceptT> Pass; }; /// A function to deduce a function pass type and wrap it in the /// templated adaptor. template <typename FunctionPassT> -ModuleToFunctionPassAdaptor +ModuleToFunctionPassAdaptor createModuleToFunctionPassAdaptor(FunctionPassT Pass) { - using PassModelT = - detail::PassModel<Function, FunctionPassT, PreservedAnalyses, - FunctionAnalysisManager>; - - return ModuleToFunctionPassAdaptor( - std::make_unique<PassModelT>(std::move(Pass))); + using PassModelT = + detail::PassModel<Function, FunctionPassT, PreservedAnalyses, + FunctionAnalysisManager>; + + return ModuleToFunctionPassAdaptor( + std::make_unique<PassModelT>(std::move(Pass))); } /// A utility pass template to force an analysis result to be available. @@ -1293,7 +1293,7 @@ struct RequireAnalysisPass return PreservedAnalyses::all(); } - static bool isRequired() { return true; } + static bool isRequired() { return true; } }; /// A no-op pass template which simply forces a specific analysis result @@ -1354,9 +1354,9 @@ public: // false). if (!PI.runBeforePass<IRUnitT>(P, IR)) continue; - PreservedAnalyses IterPA = P.run(IR, AM, std::forward<Ts>(Args)...); - PA.intersect(IterPA); - PI.runAfterPass(P, IR, IterPA); + PreservedAnalyses IterPA = P.run(IR, AM, std::forward<Ts>(Args)...); + PA.intersect(IterPA); + PI.runAfterPass(P, IR, IterPA); } return PA; } |