retdec
if_structure_optimizer.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_LLVMIR2HLL_OPTIMIZER_OPTIMIZERS_IF_STRUCTURE_OPTIMIZER_H
8 #define RETDEC_LLVMIR2HLL_OPTIMIZER_OPTIMIZERS_IF_STRUCTURE_OPTIMIZER_H
9 
12 
13 namespace retdec {
14 namespace llvmir2hll {
15 
133 class IfStructureOptimizer final: public FuncOptimizer {
134 public:
136 
137  virtual std::string getId() const override { return "IfStructure"; }
138 
139 private:
143  virtual void visit(ShPtr<IfStmt> stmt) override;
145 
146  bool tryOptimization1(ShPtr<IfStmt> stmt);
147  bool tryOptimization2(ShPtr<IfStmt> stmt);
148  bool tryOptimization3(ShPtr<IfStmt> stmt);
149  bool tryOptimization4(ShPtr<IfStmt> stmt);
150  bool tryOptimization5(ShPtr<IfStmt> stmt);
151 };
152 
153 } // namespace llvmir2hll
154 } // namespace retdec
155 
156 #endif
A base class of all function optimizers.
Definition: func_optimizer.h:44
Optimizes the structure of if statements.
Definition: if_structure_optimizer.h:133
bool tryOptimization5(ShPtr< IfStmt > stmt)
Tries the optimization (5) from the class description on stmt.
Definition: if_structure_optimizer.cpp:238
bool tryOptimization4(ShPtr< IfStmt > stmt)
Tries the optimization (4) from the class description on stmt.
Definition: if_structure_optimizer.cpp:184
IfStructureOptimizer(ShPtr< Module > module)
Constructs a new optimizer.
Definition: if_structure_optimizer.cpp:40
bool tryOptimization1(ShPtr< IfStmt > stmt)
Tries the optimization (1) from the class description on stmt.
Definition: if_structure_optimizer.cpp:63
virtual void visit(ShPtr< GlobalVarDef > varDef) override
Definition: ordered_all_visitor.cpp:95
bool tryOptimization2(ShPtr< IfStmt > stmt)
Tries the optimization (2) from the class description on stmt.
Definition: if_structure_optimizer.cpp:94
virtual std::string getId() const override
Returns the ID of the optimizer.
Definition: if_structure_optimizer.h:137
bool tryOptimization3(ShPtr< IfStmt > stmt)
Tries the optimization (3) from the class description on stmt.
Definition: if_structure_optimizer.cpp:132
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 base class of all function optimizers.
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
Declarations, aliases, macros, etc. for the use of smart pointers.