15 #ifndef LLVM_SUPPORT_KNOWNBITS_H 16 #define LLVM_SUPPORT_KNOWNBITS_H 30 : Zero(
std::move(Zero)), One(
std::move(One)) {}
37 KnownBits(
unsigned BitWidth) : Zero(BitWidth, 0), One(BitWidth, 0) {}
42 "Zero and One should have the same width!");
void clearAllBits()
Set every bit to 0.
void setSignBit()
Set the sign bit to 1.
APInt sext(unsigned width) const
Sign extend to a new width.
This class represents lattice values for constants.
unsigned countMinPopulation() const
Returns the number of bits known to be one.
bool hasConflict() const
Returns true if there is conflicting information.
APInt zext(unsigned width) const
Zero extend to a new width.
APInt trunc(unsigned width) const
Truncate to new width.
void setAllBits()
Set every bit to 1.
APInt zextOrTrunc(unsigned width) const
Zero extend or truncate to width.
unsigned countMaxTrailingZeros() const
Returns the maximum number of trailing zero bits possible.
unsigned getBitWidth() const
Get the bit width of this value.
void setAllZero()
Make all bits known to be zero and discard any previous information.
unsigned getBitWidth() const
Return the number of bits in the APInt.
unsigned countMinTrailingZeros() const
Returns the minimum number of trailing zero bits.
unsigned countTrailingZeros() const
Count the number of trailing zero bits.
static KnownBits computeForAddSub(bool Add, bool NSW, const KnownBits &LHS, KnownBits RHS)
Compute known bits resulting from adding LHS and RHS.
KnownBits zext(unsigned BitWidth)
Zero extends the underlying known Zero and One bits.
This file implements a class to represent arbitrary precision integral constant values and operations...
unsigned countMinSignBits() const
Returns the number of times the sign bit is replicated into the other bits.
unsigned countMaxPopulation() const
Returns the maximum number of bits that could be one.
KnownBits zextOrTrunc(unsigned BitWidth)
Zero extends or truncates the underlying known Zero and One bits.
bool isNegative() const
Returns true if this value is known to be negative.
bool isAllOnesValue() const
Determine if all bits are set.
unsigned countPopulation() const
Count the number of bits set.
void resetAll()
Resets the known state of all bits.
unsigned countMaxTrailingOnes() const
Returns the maximum number of trailing one bits possible.
const APInt & getConstant() const
Returns the value when all bits have a known value.
bool isConstant() const
Returns true if we know the value of all bits.
KnownBits trunc(unsigned BitWidth)
Truncate the underlying known Zero and One bits.
bool isAllOnes() const
Returns true if value is all one bits.
bool isZero() const
Returns true if value is all zero.
void makeNonNegative()
Make this value non-negative.
KnownBits(unsigned BitWidth)
Create a known bits object of BitWidth bits initialized to unknown.
unsigned countMaxLeadingZeros() const
Returns the maximum number of leading zero bits possible.
unsigned countTrailingOnes() const
Count the number of trailing one bits.
Class for arbitrary precision integers.
unsigned countMinLeadingOnes() const
Returns the minimum number of leading one bits.
bool isUnknown() const
Returns true if we don't know any bits.
bool intersects(const APInt &RHS) const
This operation tests if there are any pairs of corresponding bits between this APInt and RHS that are...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void setAllOnes()
Make all bits known to be one and discard any previous information.
KnownBits sext(unsigned BitWidth)
Sign extends the underlying known Zero and One bits.
bool isSignBitSet() const
Determine if sign bit of this APInt is set.
unsigned countMaxLeadingOnes() const
Returns the maximum number of leading one bits possible.
unsigned countMinLeadingZeros() const
Returns the minimum number of leading zero bits.
unsigned countMinTrailingOnes() const
Returns the minimum number of trailing one bits.
unsigned countLeadingOnes() const
Count the number of leading one bits.
bool isNonNegative() const
Returns true if this value is known to be non-negative.
unsigned countLeadingZeros() const
The APInt version of the countLeadingZeros functions in MathExtras.h.
bool isNullValue() const
Determine if all bits are clear.
void makeNegative()
Make this value negative.