VapourSynth-llvmexpr
Loading...
Searching...
No Matches
analysis::StaticAllocReachabilityAnalysis Class Reference
Inheritance diagram for analysis::StaticAllocReachabilityAnalysis:
Collaboration diagram for analysis::StaticAllocReachabilityAnalysis:

Public Member Functions

std::set< std::string > computeGenSet (size_t block_idx, const std::vector< Token > &tokens, const std::vector< CFGBlock > &cfg_blocks) override
std::set< std::string > meetOperation (const std::vector< std::set< std::string > > &inputs) override
std::set< std::string > transferFunction (const std::set< std::string > &in_value, const std::set< std::string > &gen_set) override
std::set< std::string > getBoundaryValue () override
Public Member Functions inherited from analysis::ForwardDataflowAnalysis< std::set< std::string > >
 ForwardDataflowAnalysis ()=default
virtual ~ForwardDataflowAnalysis ()=default
ForwardDataflowAnalysisoperator= (const ForwardDataflowAnalysis &)=default
virtual std::set< std::string > getInitialOutValue ()
std::pair< std::vector< std::set< std::string > >, std::vector< std::set< std::string > > > analyze (const std::vector< Token > &tokens, const std::vector< CFGBlock > &cfg_blocks)

Detailed Description

Definition at line 28 of file StaticAllocReachabilityPass.cpp.

Member Function Documentation

◆ computeGenSet()

std::set< std::string > analysis::StaticAllocReachabilityAnalysis::computeGenSet ( size_t block_idx,
const std::vector< Token > & tokens,
const std::vector< CFGBlock > & cfg_blocks )
inlineoverridevirtual

Implements analysis::ForwardDataflowAnalysis< std::set< std::string > >.

Definition at line 32 of file StaticAllocReachabilityPass.cpp.

33 {
34 std::set<std::string> gen_set;
35 const auto& block = cfg_blocks[block_idx];
36
37 for (int j = block.start_token_idx; j < block.end_token_idx; ++j) {
38 if (tokens[j].type == TokenType::ArrayAllocStatic) {
39 const auto& array_name =
40 std::get<TokenPayloadArrayOp>(tokens[j].payload).name;
41 gen_set.insert(var_naming::getArrayName(array_name));
42 }
43 }
44 return gen_set;
45 }
@ ArrayAllocStatic
Definition Tokenizer.hpp:51
std::string getArrayName(std::string_view base_name)
Definition VarNaming.hpp:30

References ArrayAllocStatic, and analysis::var_naming::getArrayName().

◆ getBoundaryValue()

std::set< std::string > analysis::StaticAllocReachabilityAnalysis::getBoundaryValue ( )
inlineoverridevirtual

Implements analysis::ForwardDataflowAnalysis< std::set< std::string > >.

Definition at line 66 of file StaticAllocReachabilityPass.cpp.

66 {
67 // Entry block starts with no statically allocated arrays
68 return std::set<std::string>{};
69 }

◆ meetOperation()

std::set< std::string > analysis::StaticAllocReachabilityAnalysis::meetOperation ( const std::vector< std::set< std::string > > & inputs)
inlineoverridevirtual

Implements analysis::ForwardDataflowAnalysis< std::set< std::string > >.

Definition at line 48 of file StaticAllocReachabilityPass.cpp.

48 {
49 // Union: an array is statically allocated if allocated on ANY path
50 std::set<std::string> result;
51 for (const auto& input : inputs) {
52 result.insert(input.begin(), input.end());
53 }
54 return result;
55 }

◆ transferFunction()

std::set< std::string > analysis::StaticAllocReachabilityAnalysis::transferFunction ( const std::set< std::string > & in_value,
const std::set< std::string > & gen_set )
inlineoverridevirtual

Implements analysis::ForwardDataflowAnalysis< std::set< std::string > >.

Definition at line 58 of file StaticAllocReachabilityPass.cpp.

59 {
60 // OUT = GEN U IN
61 std::set<std::string> out_value = gen_set;
62 out_value.insert(in_value.begin(), in_value.end());
63 return out_value;
64 }

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