retdec
float_type.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_LLVMIR2HLL_IR_FLOAT_TYPE_H
8 #define RETDEC_LLVMIR2HLL_IR_FLOAT_TYPE_H
9 
10 #include <map>
11 
14 
15 namespace retdec {
16 namespace llvmir2hll {
17 
18 class Visitor;
19 
26 class FloatType final: public Type {
27 public:
28  static ShPtr<FloatType> create(unsigned size);
29 
30  virtual ShPtr<Value> clone() override;
31 
32  virtual bool isEqualTo(ShPtr<Value> otherValue) const override;
33 
34  unsigned getSize() const;
35 
36  bool existsFloatTypeWith(unsigned size) const;
37 
38  bool existsFloatType() const;
39 
42  virtual void accept(Visitor *v) override;
44 
45 private:
47  using SizeToFloatTypeMap = std::map<unsigned, ShPtr<FloatType>>;
48 
49 private:
51  unsigned size;
52 
55 
56 private:
57  // Since instances are created by calling the static function create(), the
58  // constructor can be private.
59  FloatType(unsigned size);
60 };
61 
62 } // namespace llvmir2hll
63 } // namespace retdec
64 
65 #endif
A representation of an float point type.
Definition: float_type.h:26
virtual bool isEqualTo(ShPtr< Value > otherValue) const override
Returns true if this value is equal to otherValue, false otherwise.
Definition: float_type.cpp:26
virtual void accept(Visitor *v) override
Visitor pattern implementation.
Definition: float_type.cpp:86
std::map< unsigned, ShPtr< FloatType > > SizeToFloatTypeMap
Mapping of float point type sizes into FloatType instances.
Definition: float_type.h:47
bool existsFloatType() const
Returns true if exists float type.
Definition: float_type.cpp:57
virtual ShPtr< Value > clone() override
Returns a clone of the value.
Definition: float_type.cpp:22
static ShPtr< FloatType > create(unsigned size)
Creates a new float type.
Definition: float_type.cpp:69
bool existsFloatTypeWith(unsigned size) const
Returns true if exists type with size defined in args.
Definition: float_type.cpp:48
FloatType(unsigned size)
Constructs a new float type.
Definition: float_type.cpp:19
static SizeToFloatTypeMap createdTypes
Set of already created float point types of the given size.
Definition: float_type.h:54
unsigned getSize() const
Returns the number of bits.
Definition: float_type.cpp:37
unsigned size
Number of bits (size of the float point type).
Definition: float_type.h:51
A base class of all types.
Definition: type.h:20
A base class of all visitors.
Definition: visitor.h:95
A base class of all types.
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.