7 #ifndef RETDEC_LLVMIR2HLL_IR_CONST_INT_H
8 #define RETDEC_LLVMIR2HLL_IR_CONST_INT_H
14 #include <llvm/ADT/APInt.h>
15 #include <llvm/ADT/APSInt.h>
54 std::string
toString(
unsigned radix = 10,
55 const std::string &prefix =
"")
const;
56 std::string
toHexString(
const std::string &prefix =
"0x")
const;
An integer constant.
Definition: const_int.h:33
static ShPtr< ConstInt > getTwoToPositivePower(ShPtr< ConstInt > x)
Computes 2^x, where x >= 0, and returns the result.
Definition: const_int.cpp:335
bool isZero() const
Determines whether the constant is zero.
Definition: const_int.cpp:192
bool isNegativeOne() const
Determines whether the constant is negative one.
Definition: const_int.cpp:176
static ShPtr< ConstInt > create(std::int64_t value, unsigned bitWidth, bool isSigned=true)
Constructs an integer constant initialized to the given value of the given bit width.
Definition: const_int.cpp:300
virtual bool isEqualTo(ShPtr< Value > otherValue) const override
Returns true if this value is equal to otherValue, false otherwise.
Definition: const_int.cpp:36
bool isMoreReadableInHexa() const
Returns true if the constant is more readable in the hexadecimal radix than in the decimal radix,...
Definition: const_int.cpp:224
virtual void accept(Visitor *v) override
Visitor pattern implementation.
Definition: const_int.cpp:344
bool isSigned() const
Returns true if the integer is signed, false otherwise.
Definition: const_int.cpp:72
ConstInt(const llvm::APSInt &value)
Constructs an integer constant initialized to the given value.
Definition: const_int.cpp:26
bool isPositive() const
Determines whether the constant is positive (> 0).
Definition: const_int.cpp:185
std::string toString(unsigned radix=10, const std::string &prefix="") const
Converts the constant into a string in the given radix and optionally the given prefix.
Definition: const_int.cpp:111
virtual ShPtr< retdec::llvmir2hll::Type > getType() const override
Returns the type of the expression.
Definition: const_int.cpp:47
ShPtr< IntType > type
Type of the constant.
Definition: const_int.h:74
bool isMinSigned() const
Determines whether the constant has minimum signed value on it's bitwidth.
Definition: const_int.cpp:63
std::string toHexString(const std::string &prefix="0x") const
Converts the constant into a string in the hexadecimal format and prepends the given prefix.
Definition: const_int.cpp:141
bool isUnsigned() const
Returns true if the integer is unsigned, false otherwise.
Definition: const_int.cpp:79
llvm::APSInt value
Value of the constant.
Definition: const_int.h:71
virtual ShPtr< Value > clone() override
Returns a clone of the value.
Definition: const_int.cpp:30
llvm::APSInt getValue() const
Returns the constant's value.
Definition: const_int.cpp:86
bool isOne() const
Determines whether the constant is one.
Definition: const_int.cpp:201
bool isNegative() const
Determines whether the constant is negative (< 0).
Definition: const_int.cpp:162
void flipSign()
Flip the sign of value.
Definition: const_int.cpp:152
virtual void replace(ShPtr< Expression > oldExpr, ShPtr< Expression > newExpr) override
Replaces all occurrences of oldExpr with newExpr in the current expression.
Definition: const_int.cpp:51
A base class for all constants.
Definition: constant.h:20
A base class of all visitors.
Definition: visitor.h:95
A base class for all constants.
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.