retdec
strict_arithm_expr_evaluator.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_LLVMIR2HLL_EVALUATOR_ARITHM_EXPR_EVALUATORS_STRICT_ARITHM_EXPR_EVALUATOR_H
8 #define RETDEC_LLVMIR2HLL_EVALUATOR_ARITHM_EXPR_EVALUATORS_STRICT_ARITHM_EXPR_EVALUATOR_H
9 
10 #include <string>
11 
13 
14 namespace retdec {
15 namespace llvmir2hll {
16 
25 public:
27 
28  virtual std::string getId() const override;
29 
30 private:
32 
33  // Resolve types.
34  virtual void resolveTypesBinaryOp(ConstPair &constPair) override;
35 
36  // Resolve operators specifications.
37  virtual void resolveOpSpecifications(ShPtr<DivOpExpr> expr,
38  ConstPair &constPair) override;
39  virtual void resolveOpSpecifications(ShPtr<ModOpExpr> expr,
40  ConstPair &constPair) override;
41  virtual void resolveOpSpecifications(ShPtr<NegOpExpr> expr,
42  ShPtr<Constant> &constant) override;
43 
44  // Resolve casts.
45  virtual void resolveCast(ShPtr<BitCastExpr> expr,
46  ShPtr<Constant> &constant) override;
47  virtual void resolveCast(ShPtr<ExtCastExpr> expr,
48  ShPtr<Constant> &constant) override;
50  &constant) override;
52  &constant) override;
53  virtual void resolveCast(ShPtr<TruncCastExpr> expr,
54  ShPtr<Constant> &constant) override;
55 
56  // Resolve overflow.
57  virtual void resolveOverflowForAPInt(bool overflow) override;
58  virtual void resolveOverflowForAPFloat(
59  llvm::APFloat::opStatus opStatus) override;
60 };
61 
62 } // namespace llvmir2hll
63 } // namespace retdec
64 
65 #endif
A base class for all evaluators.
A base class for all evaluators.
Definition: arithm_expr_evaluator.h:37
std::pair< ShPtr< Constant >, ShPtr< Constant > > ConstPair
Pair of constants.
Definition: arithm_expr_evaluator.h:55
Evaluates expressions with strict conditions.
Definition: strict_arithm_expr_evaluator.h:24
virtual void resolveTypesBinaryOp(ConstPair &constPair) override
Resolve types of operands in binary operations.
Definition: strict_arithm_expr_evaluator.cpp:39
virtual void resolveCast(ShPtr< BitCastExpr > expr, ShPtr< Constant > &constant) override
Definition: strict_arithm_expr_evaluator.cpp:98
static ShPtr< ArithmExprEvaluator > create()
Creates a new StrictArithmExprEvaluator.
Definition: strict_arithm_expr_evaluator.cpp:26
virtual std::string getId() const override
Returns the ID of the optimizer.
Definition: strict_arithm_expr_evaluator.cpp:30
virtual void resolveOverflowForAPFloat(llvm::APFloat::opStatus opStatus) override
Stop evaluation if overflow occurred.
Definition: strict_arithm_expr_evaluator.cpp:137
virtual void resolveOverflowForAPInt(bool overflow) override
Stop evaluation if overflow occurred.
Definition: strict_arithm_expr_evaluator.cpp:128
virtual void resolveOpSpecifications(ShPtr< DivOpExpr > expr, ConstPair &constPair) override
Definition: strict_arithm_expr_evaluator.cpp:55
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