retdec
func_optimizer.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_LLVMIR2HLL_OPTIMIZER_FUNC_OPTIMIZER_H
8 #define RETDEC_LLVMIR2HLL_OPTIMIZER_FUNC_OPTIMIZER_H
9 
12 
13 namespace retdec {
14 namespace llvmir2hll {
15 
16 class Function;
17 class Module;
18 
44 class FuncOptimizer: public Optimizer {
45 protected:
47 
48  virtual void doOptimization() override;
49  virtual void runOnFunction(ShPtr<Function> func);
50 
63  template<typename T>
65  // The qualification is needed to prevent infinite recursion when this
66  // function is called from a subclass (typical usage).
68  }
69 
70 protected:
73 };
74 
75 } // namespace llvmir2hll
76 } // namespace retdec
77 
78 #endif
A base class of all function optimizers.
Definition: func_optimizer.h:44
FuncOptimizer(ShPtr< Module > module)
Constructs a new function optimizer.
Definition: func_optimizer.cpp:23
virtual void doOptimization() override
Performs the optimization on all functions in the module.
Definition: func_optimizer.cpp:36
void visitNestedAndSuccessorStatements(ShPtr< T > stmt)
Visits the given statement, its nested statements, and successor statements (depending on the setting...
Definition: func_optimizer.h:64
ShPtr< Function > currFunc
Function that is currently being optimized.
Definition: func_optimizer.h:72
virtual void runOnFunction(ShPtr< Function > func)
Performs all optimizations on the given function.
Definition: func_optimizer.cpp:50
A base class of all optimizers.
Definition: optimizer.h:43
ShPtr< Module > module
The module that is being optimized.
Definition: optimizer.h:79
virtual void visit(ShPtr< GlobalVarDef > varDef) override
Definition: ordered_all_visitor.cpp:95
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
Definition: archive_wrapper.h:19
A base class of all optimizers.
Declarations, aliases, macros, etc. for the use of smart pointers.