retdec
|
Evaluates expressions with strict conditions. More...
#include <strict_arithm_expr_evaluator.h>
Public Member Functions | |
virtual std::string | getId () const override |
Returns the ID of the optimizer. More... | |
![]() | |
virtual std::optional< bool > | toBool (ShPtr< Expression > expr, VarConstMap varValues=VarConstMap()) |
Evaluate expr and return if result is bool . More... | |
ShPtr< Constant > | evaluate (ShPtr< Expression > expr) |
Evaluate an expr. More... | |
ShPtr< Constant > | evaluate (ShPtr< Expression > expr, const VarConstMap &varValues) |
Evaluate an expr. More... | |
Static Public Member Functions | |
static ShPtr< ArithmExprEvaluator > | create () |
Creates a new StrictArithmExprEvaluator. More... | |
![]() | |
template<typename ConstType > | |
static std::optional< std::pair< ShPtr< ConstType >, ShPtr< ConstType > > > | castConstPair (const ConstPair &constPair) |
Casts the constants in constPair to the given type. More... | |
Private Member Functions | |
StrictArithmExprEvaluator ()=default | |
virtual void | resolveTypesBinaryOp (ConstPair &constPair) override |
Resolve types of operands in binary operations. More... | |
virtual void | resolveOpSpecifications (ShPtr< DivOpExpr > expr, ConstPair &constPair) override |
virtual void | resolveOpSpecifications (ShPtr< ModOpExpr > expr, ConstPair &constPair) override |
virtual void | resolveOpSpecifications (ShPtr< NegOpExpr > expr, ShPtr< Constant > &constant) override |
virtual void | resolveCast (ShPtr< BitCastExpr > expr, ShPtr< Constant > &constant) override |
virtual void | resolveCast (ShPtr< ExtCastExpr > expr, ShPtr< Constant > &constant) override |
virtual void | resolveCast (ShPtr< FPToIntCastExpr > expr, ShPtr< Constant > &constant) override |
virtual void | resolveCast (ShPtr< IntToFPCastExpr > expr, ShPtr< Constant > &constant) override |
virtual void | resolveCast (ShPtr< TruncCastExpr > expr, ShPtr< Constant > &constant) override |
virtual void | resolveOverflowForAPInt (bool overflow) override |
Stop evaluation if overflow occurred. More... | |
virtual void | resolveOverflowForAPFloat (llvm::APFloat::opStatus opStatus) override |
Stop evaluation if overflow occurred. More... | |
Additional Inherited Members | |
![]() | |
using | APSIntPair = std::pair< llvm::APSInt, llvm::APSInt > |
Pair of llvm::APSInt . More... | |
using | APFloatPair = std::pair< llvm::APFloat, llvm::APFloat > |
Pair of llvm::APFloat . More... | |
using | ConstIntPair = std::pair< ShPtr< ConstInt >, ShPtr< ConstInt > > |
Pair of integer constants. More... | |
using | ConstFloatPair = std::pair< ShPtr< ConstFloat >, ShPtr< ConstFloat > > |
Pair of float constants. More... | |
using | ConstBoolPair = std::pair< ShPtr< ConstBool >, ShPtr< ConstBool > > |
Pair of bool constants. More... | |
using | ConstPair = std::pair< ShPtr< Constant >, ShPtr< Constant > > |
Pair of constants. More... | |
using | ConstStack = std::stack< ShPtr< Constant > > |
Stack of constats. More... | |
using | VarConstMap = std::map< ShPtr< Variable >, ShPtr< Constant > > |
Mapping of variables to constants. More... | |
![]() | |
ArithmExprEvaluator ()=default | |
![]() | |
static APSIntPair | getAPSIntsFromConstants (const std::optional< ConstIntPair > &constIntPair) |
Create APSIntPair from constIntPair and return it. More... | |
static APFloatPair | getAPFloatsFromConstants (const std::optional< ConstFloatPair > &ConstFloatPair) |
Create APFloatPair from constFloatPair and return it. More... | |
static bool | isConstantZero (ShPtr< Constant > constant) |
Return if constant is a ConstInt or a ConstFloat zero. More... | |
![]() | |
bool | canBeEvaluated = true |
Signalizes if evaluation can go on. More... | |
Evaluates expressions with strict conditions.
Instances of this class have reference object semantics.
This is a concrete sub-evaluator which should not be subclassed.
|
privatedefault |
|
static |
Creates a new StrictArithmExprEvaluator.
|
overridevirtual |
Returns the ID of the optimizer.
Implements retdec::llvmir2hll::ArithmExprEvaluator.
|
overrideprivatevirtual |
Reimplemented from retdec::llvmir2hll::ArithmExprEvaluator.
|
overrideprivatevirtual |
Reimplemented from retdec::llvmir2hll::ArithmExprEvaluator.
|
overrideprivatevirtual |
Reimplemented from retdec::llvmir2hll::ArithmExprEvaluator.
|
overrideprivatevirtual |
Reimplemented from retdec::llvmir2hll::ArithmExprEvaluator.
|
overrideprivatevirtual |
Reimplemented from retdec::llvmir2hll::ArithmExprEvaluator.
|
overrideprivatevirtual |
Reimplemented from retdec::llvmir2hll::ArithmExprEvaluator.
|
overrideprivatevirtual |
Reimplemented from retdec::llvmir2hll::ArithmExprEvaluator.
|
overrideprivatevirtual |
Reimplemented from retdec::llvmir2hll::ArithmExprEvaluator.
|
overrideprivatevirtual |
Stop evaluation if overflow occurred.
[in] | opStatus | Status. |
Reimplemented from retdec::llvmir2hll::ArithmExprEvaluator.
|
overrideprivatevirtual |
Stop evaluation if overflow occurred.
[in] | overflow | Overflow. |
Reimplemented from retdec::llvmir2hll::ArithmExprEvaluator.
|
overrideprivatevirtual |
Resolve types of operands in binary operations.
[in,out] | constPair | Pair of constants on which is resolved types. |
Reimplemented from retdec::llvmir2hll::ArithmExprEvaluator.