retdec
optim_func_info_cfg_traversal.h
Go to the documentation of this file.
1 
9 #ifndef RETDEC_LLVMIR2HLL_GRAPHS_CFG_CFG_TRAVERSALS_OPTIM_FUNC_INFO_CFG_TRAVERSAL_H
10 #define RETDEC_LLVMIR2HLL_GRAPHS_CFG_CFG_TRAVERSALS_OPTIM_FUNC_INFO_CFG_TRAVERSAL_H
11 
16 
17 namespace retdec {
18 namespace llvmir2hll {
19 
20 class CG;
21 class Function;
22 class Module;
23 class Statement;
24 class Variable;
25 
35 public:
38  ShPtr<CFG> cfg);
39 
40 private:
42  using VarToVarMap = std::map<ShPtr<Variable>, ShPtr<Variable>>;
43 
44 private:
47 
52 
55 
58 
61 
64 
67 
70 
73 
78 
79 private:
82  ShPtr<CFG> cfg);
83 
88  virtual bool visitStmt(ShPtr<Statement> stmt) override;
89  virtual bool getEndRetVal() const override;
90  virtual bool combineRetVals(bool origRetVal, bool newRetVal) const override;
91 };
92 
93 } // namespace llvmir2hll
94 } // namespace retdec
95 
96 #endif
A representation of a control-flow graph (CFG).
A base class of all CFG traversals.
A base class of all CFG traversals.
Definition: cfg_traversal.h:28
A CFG traversal for computing OptimFuncInfos.
Definition: optim_func_info_cfg_traversal.h:34
ShPtr< OptimFuncInfo > performComputation()
Computes the FuncInfo and returns it.
Definition: optim_func_info_cfg_traversal.cpp:76
ShPtr< CG > cg
Call graph of the module.
Definition: optim_func_info_cfg_traversal.h:54
ShPtr< OptimFuncInfo > funcInfo
The currently computed FuncInfo.
Definition: optim_func_info_cfg_traversal.h:72
ShPtr< ValueAnalysis > va
Analysis of values.
Definition: optim_func_info_cfg_traversal.h:60
bool checkExitNodesPredecessor(ShPtr< CFG::Node > node)
Checks the selected predecessor of the exit node of cfg.
Definition: optim_func_info_cfg_traversal.cpp:313
std::map< ShPtr< Variable >, ShPtr< Variable > > VarToVarMap
A mapping of a variable into another variable.
Definition: optim_func_info_cfg_traversal.h:42
void updateFuncInfo(ShPtr< Statement > stmt)
Updates funcInfo by the information obtained from the given statement.
Definition: optim_func_info_cfg_traversal.cpp:259
virtual bool visitStmt(ShPtr< Statement > stmt) override
Visits the given statement stmt.
Definition: optim_func_info_cfg_traversal.cpp:382
ShPtr< OptimCallInfoObtainer > cio
The used call info obtainer.
Definition: optim_func_info_cfg_traversal.h:57
ShPtr< CFG > cfg
The CFG that is being traversed.
Definition: optim_func_info_cfg_traversal.h:63
VarSet globalVars
Definition: optim_func_info_cfg_traversal.h:51
OptimFuncInfoCFGTraversal(ShPtr< Module > module, ShPtr< OptimCallInfoObtainer > cio, ShPtr< ValueAnalysis > va, ShPtr< CFG > cfg)
Constructs a new traverser.
Definition: optim_func_info_cfg_traversal.cpp:35
ShPtr< CG::CalledFuncs > calledFuncs
Called functions from traversedFunc.
Definition: optim_func_info_cfg_traversal.h:69
static ShPtr< OptimFuncInfo > getOptimFuncInfo(ShPtr< Module > module, ShPtr< OptimCallInfoObtainer > cio, ShPtr< ValueAnalysis > va, ShPtr< CFG > cfg)
Computes OptimFuncInfo for the function specified by its CFG.
Definition: optim_func_info_cfg_traversal.cpp:59
ShPtr< Module > module
Module which contains the function specified by its CFG.
Definition: optim_func_info_cfg_traversal.h:46
virtual bool combineRetVals(bool origRetVal, bool newRetVal) const override
Computes a new return value from the original return value (origRetVal) and the new return value (new...
Definition: optim_func_info_cfg_traversal.cpp:391
VarToVarMap storedGlobalVars
Definition: optim_func_info_cfg_traversal.h:77
void precomputeAlwaysModifiedVarsBeforeRead()
Precomputes funcInfo->isAlwaysModifiedBeforeRead for traversedFunc.
Definition: optim_func_info_cfg_traversal.cpp:207
virtual bool getEndRetVal() const override
Returns the value that should be returned when an end of the traversal is reached.
Definition: optim_func_info_cfg_traversal.cpp:387
ShPtr< Function > traversedFunc
The function whose CFG is being traversed.
Definition: optim_func_info_cfg_traversal.h:66
A library providing API for working with back-end IR.
std::shared_ptr< T > ShPtr
An alias for a shared pointer.
Definition: smart_ptr.h:18
std::set< ShPtr< Variable > > VarSet
Set of variables.
Definition: types.h:57
Definition: archive_wrapper.h:19
Obtainer of information about functions and function calls that assumes it has access to complete inf...
Aliases for several useful types.