retdec
mod_op_expr.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_LLVMIR2HLL_IR_MOD_OP_EXPR_H
8 #define RETDEC_LLVMIR2HLL_IR_MOD_OP_EXPR_H
9 
12 
13 namespace retdec {
14 namespace llvmir2hll {
15 
16 class Expression;
17 class Visitor;
18 
27 class ModOpExpr final: public BinaryOpExpr {
28 public:
30  enum class Variant {
31  UMod,
32  SMod,
33  FMod
34  };
35 
36 public:
39 
40  virtual bool isEqualTo(ShPtr<Value> otherValue) const override;
41  virtual ShPtr<Value> clone() override;
42 
43  Variant getVariant() const;
44 
47  virtual void accept(Visitor *v) override;
49 
50 private:
53 
54 private:
55  // Since instances are created by calling the static function create(), the
56  // constructor can be private.
59 };
60 
61 } // namespace llvmir2hll
62 } // namespace retdec
63 
64 #endif
A base class for all binary operators.
A base class for all binary operators.
Definition: binary_op_expr.h:21
ShPtr< Expression > op1
First operand.
Definition: binary_op_expr.h:44
ShPtr< Expression > op2
Second operand.
Definition: binary_op_expr.h:47
A modulo operator.
Definition: mod_op_expr.h:27
virtual void accept(Visitor *v) override
Visitor pattern implementation.
Definition: mod_op_expr.cpp:70
Variant
Variants of the operator.
Definition: mod_op_expr.h:30
virtual ShPtr< Value > clone() override
Returns a clone of the value.
Definition: mod_op_expr.cpp:31
Variant variant
Variant of the operation.
Definition: mod_op_expr.h:52
static ShPtr< ModOpExpr > create(ShPtr< Expression > op1, ShPtr< Expression > op2, Variant variant=Variant::UMod)
Creates a new modulo operator.
Definition: mod_op_expr.cpp:55
Variant getVariant() const
Returns variant of operation.
Definition: mod_op_expr.cpp:41
virtual bool isEqualTo(ShPtr< Value > otherValue) const override
Returns true if this value is equal to otherValue, false otherwise.
Definition: mod_op_expr.cpp:23
ModOpExpr(ShPtr< Expression > op1, ShPtr< Expression > op2, Variant variant=Variant::UMod)
Constructs a modulo operator.
Definition: mod_op_expr.cpp:19
A base class of all visitors.
Definition: visitor.h: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
Declarations, aliases, macros, etc. for the use of smart pointers.