VapourSynth-llvmexpr
Loading...
Searching...
No Matches
analysis::AnalysisManager Class Reference

#include <llvmexpr/analysis/framework/AnalysisManager.hpp>

Public Member Functions

 AnalysisManager (const std::vector< Token > &tokens_in, bool mirror_boundary_in, int expected_final_depth_in=1)
template<typename PassT>
PassT::Result & getResult ()
template<typename PassT>
const PassT::Result & getResult () const
template<typename PassT>
bool hasResult () const
void invalidate (const PreservedAnalyses &pa)
const std::vector< Token > & getTokens () const
bool getMirrorBoundary () const
int getExpectedFinalDepth () const

Detailed Description

Definition at line 32 of file AnalysisManager.hpp.

Constructor & Destructor Documentation

◆ AnalysisManager()

analysis::AnalysisManager::AnalysisManager ( const std::vector< Token > & tokens_in,
bool mirror_boundary_in,
int expected_final_depth_in = 1 )

Definition at line 24 of file AnalysisManager.cpp.

27 : tokens(tokens_in), mirror_boundary(mirror_boundary_in),
28 expected_final_depth(expected_final_depth_in) {}

Member Function Documentation

◆ getExpectedFinalDepth()

int analysis::AnalysisManager::getExpectedFinalDepth ( ) const
inlinenodiscard

Definition at line 60 of file AnalysisManager.hpp.

60 {
61 return expected_final_depth;
62 }

Referenced by analysis::StackSafetyPass::run().

◆ getMirrorBoundary()

bool analysis::AnalysisManager::getMirrorBoundary ( ) const
inlinenodiscard

Definition at line 58 of file AnalysisManager.hpp.

58{ return mirror_boundary; }

Referenced by analysis::RelAccessAnalysisPass::run().

◆ getResult() [1/2]

template<typename PassT>
PassT::Result & analysis::AnalysisManager::getResult ( )
inline

Definition at line 37 of file AnalysisManager.hpp.

37 {
38 if (!results.template hasResult<PassT>()) {
39 PassT pass;
40 auto result = pass.run(tokens, *this);
41 results.template setResult<PassT>(std::move(result));
42 }
43 return results.template getResult<PassT>();
44 }

References getResult(), and hasResult().

Referenced by getResult(), getResult(), analysis::BlockAnalysisPass::run(), analysis::ConstPropPass::run(), analysis::DynamicArrayAllocOptPass::run(), analysis::StackSafetyPass::run(), analysis::StaticAllocReachabilityPass::run(), analysis::StaticArrayOptPass::run(), analysis::StructurizeCFGPass::run(), analysis::ValidationPass::run(), and analysis::VarInitPass::run().

◆ getResult() [2/2]

template<typename PassT>
const PassT::Result & analysis::AnalysisManager::getResult ( ) const
inline

Definition at line 46 of file AnalysisManager.hpp.

46 {
47 return results.template getResult<PassT>();
48 }

References getResult().

◆ getTokens()

const std::vector< Token > & analysis::AnalysisManager::getTokens ( ) const
inlinenodiscard

Definition at line 56 of file AnalysisManager.hpp.

56{ return tokens; }

◆ hasResult()

template<typename PassT>
bool analysis::AnalysisManager::hasResult ( ) const
inlinenodiscard

Definition at line 50 of file AnalysisManager.hpp.

50 {
51 return results.template hasResult<PassT>();
52 }

References hasResult().

Referenced by getResult(), and hasResult().

◆ invalidate()

void analysis::AnalysisManager::invalidate ( const PreservedAnalyses & pa)

Definition at line 30 of file AnalysisManager.cpp.

30 {
31 if (pa.preservedAll()) {
32 return;
33 }
34
35 std::vector<std::type_index> to_invalidate;
36
37 for (const auto& [pass_type, _] : results.getAll()) {
38 if (!pa.isPreserved(pass_type)) {
39 to_invalidate.push_back(pass_type);
40 }
41 }
42
43 for (const auto& pass_type : to_invalidate) {
44 results.invalidate(pass_type);
45 }
46}

References analysis::PreservedAnalyses::isPreserved(), and analysis::PreservedAnalyses::preservedAll().


The documentation for this class was generated from the following files: