8 #ifndef RETDEC_LLVMIR2HLL_OPTIMIZER_OPTIMIZERS_DEREF_TO_ARRAY_INDEX_OPTIMIZER_H
9 #define RETDEC_LLVMIR2HLL_OPTIMIZER_OPTIMIZERS_DEREF_TO_ARRAY_INDEX_OPTIMIZER_H
56 virtual std::string
getId()
const override {
return "DerefToArrayIndex"; }
Optimizes pointer arithmetic on variables to array accesses.
Definition: deref_to_array_index_optimizer.h:52
std::optional< BaseAndIndex > getBaseAndIndexFromExprIfPossible(ShPtr< AddOpExpr > expr)
Try to get the base and index for new ArrayIndexOpExpr from expr.
Definition: deref_to_array_index_optimizer.cpp:80
virtual void doOptimization() override
Performs the optimization.
Definition: deref_to_array_index_optimizer.cpp:37
virtual std::string getId() const override
Returns the ID of the optimizer.
Definition: deref_to_array_index_optimizer.h:56
void replaceDerefWithArrayIndex(ShPtr< DerefOpExpr > oldExpr, const BaseAndIndex &baseAndIndex)
Replace oldExpr with ArrayIndexOpExpr which is created by base index.
Definition: deref_to_array_index_optimizer.cpp:116
virtual void visit(ShPtr< GlobalVarDef > varDef) override
Definition: ordered_all_visitor.cpp:95
DerefToArrayIndexOptimizer(ShPtr< Module > module)
Constructs a new optimizer.
Definition: deref_to_array_index_optimizer.cpp:32
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.
Definition: deref_to_array_index_optimizer.h:61
ShPtr< Expression > index
Index of ArrayIndexOpExpr.
Definition: deref_to_array_index_optimizer.h:63
ShPtr< Expression > base
Base of ArrayIndexOpExpr.
Definition: deref_to_array_index_optimizer.h:62