retdec
c_arithm_expr_evaluator.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_LLVMIR2HLL_EVALUATOR_ARITHM_EXPR_EVALUATORS_C_ARITHM_EXPR_EVALUATOR_H
8 #define RETDEC_LLVMIR2HLL_EVALUATOR_ARITHM_EXPR_EVALUATORS_C_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:
31  CArithmExprEvaluator() = default;
32 
33  // Resolve types.
34  virtual void resolveTypesUnaryOp(ShPtr<Constant> &operand) override;
35  virtual void resolveTypesBinaryOp(ConstPair &constPair) override;
36 
37  // Resolve operators specifications.
38  virtual void resolveOpSpecifications(ShPtr<DivOpExpr> expr,
39  ConstPair &constPair) override;
40  virtual void resolveOpSpecifications(ShPtr<ModOpExpr> expr,
41  ConstPair &constPair) override;
42 
43  // Resolve casts.
44  virtual void resolveCast(ShPtr<BitCastExpr> expr,
45  ShPtr<Constant> &constant) override;
46  virtual void resolveCast(ShPtr<ExtCastExpr> expr,
47  ShPtr<Constant> &constant) override;
48  virtual void resolveCast(ShPtr<FPToIntCastExpr> expr,
49  ShPtr<Constant> &constant) override;
50  virtual void resolveCast(ShPtr<IntToFPCastExpr> expr,
51  ShPtr<Constant> &constant) override;
52  virtual void resolveCast(ShPtr<TruncCastExpr> expr,
53  ShPtr<Constant> &constant) override;
54 
55  // Resolve overflow.
56  virtual void resolveOverflowForAPFloat(
57  llvm::APFloat::opStatus opStatus) override;
58 };
59 
60 } // namespace llvmir2hll
61 } // namespace retdec
62 
63 #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 c language conditions.
Definition: c_arithm_expr_evaluator.h:24
virtual void resolveTypesUnaryOp(ShPtr< Constant > &operand) override
Resolve type of operand in unary operation.
Definition: c_arithm_expr_evaluator.cpp:201
virtual void resolveOverflowForAPFloat(llvm::APFloat::opStatus opStatus) override
Resolve overflow specifications for float and double.
Definition: c_arithm_expr_evaluator.cpp:427
virtual std::string getId() const override
Returns the ID of the optimizer.
Definition: c_arithm_expr_evaluator.cpp:192
virtual void resolveCast(ShPtr< BitCastExpr > expr, ShPtr< Constant > &constant) override
Definition: c_arithm_expr_evaluator.cpp:288
static ShPtr< ArithmExprEvaluator > create()
Creates a new CArithmExprEvaluator.
Definition: c_arithm_expr_evaluator.cpp:188
virtual void resolveOpSpecifications(ShPtr< DivOpExpr > expr, ConstPair &constPair) override
Definition: c_arithm_expr_evaluator.cpp:273
virtual void resolveTypesBinaryOp(ConstPair &constPair) override
Resolve types of operands in binary operations.
Definition: c_arithm_expr_evaluator.cpp:213
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