|
LLVM
5.0.0
|
#include "llvm/Support/KnownBits.h"
Public Member Functions | |
| KnownBits () | |
| KnownBits (unsigned BitWidth) | |
| Create a known bits object of BitWidth bits initialized to unknown. More... | |
| unsigned | getBitWidth () const |
| Get the bit width of this value. More... | |
| bool | hasConflict () const |
| Returns true if there is conflicting information. More... | |
| bool | isConstant () const |
| Returns true if we know the value of all bits. More... | |
| const APInt & | getConstant () const |
| Returns the value when all bits have a known value. More... | |
| bool | isUnknown () const |
| Returns true if we don't know any bits. More... | |
| void | resetAll () |
| Resets the known state of all bits. More... | |
| bool | isZero () const |
| Returns true if value is all zero. More... | |
| bool | isAllOnes () const |
| Returns true if value is all one bits. More... | |
| void | setAllZero () |
| Make all bits known to be zero and discard any previous information. More... | |
| void | setAllOnes () |
| Make all bits known to be one and discard any previous information. More... | |
| bool | isNegative () const |
| Returns true if this value is known to be negative. More... | |
| bool | isNonNegative () const |
| Returns true if this value is known to be non-negative. More... | |
| void | makeNegative () |
| Make this value negative. More... | |
| void | makeNonNegative () |
| Make this value negative. More... | |
| KnownBits | trunc (unsigned BitWidth) |
| Truncate the underlying known Zero and One bits. More... | |
| KnownBits | zext (unsigned BitWidth) |
| Zero extends the underlying known Zero and One bits. More... | |
| KnownBits | sext (unsigned BitWidth) |
| Sign extends the underlying known Zero and One bits. More... | |
| KnownBits | zextOrTrunc (unsigned BitWidth) |
| Zero extends or truncates the underlying known Zero and One bits. More... | |
| unsigned | countMinTrailingZeros () const |
| Returns the minimum number of trailing zero bits. More... | |
| unsigned | countMinTrailingOnes () const |
| Returns the minimum number of trailing one bits. More... | |
| unsigned | countMinLeadingZeros () const |
| Returns the minimum number of leading zero bits. More... | |
| unsigned | countMinLeadingOnes () const |
| Returns the minimum number of leading one bits. More... | |
| unsigned | countMinSignBits () const |
| Returns the number of times the sign bit is replicated into the other bits. More... | |
| unsigned | countMaxTrailingZeros () const |
| Returns the maximum number of trailing zero bits possible. More... | |
| unsigned | countMaxTrailingOnes () const |
| Returns the maximum number of trailing one bits possible. More... | |
| unsigned | countMaxLeadingZeros () const |
| Returns the maximum number of leading zero bits possible. More... | |
| unsigned | countMaxLeadingOnes () const |
| Returns the maximum number of leading one bits possible. More... | |
| unsigned | countMinPopulation () const |
| Returns the number of bits known to be one. More... | |
| unsigned | countMaxPopulation () const |
| Returns the maximum number of bits that could be one. More... | |
Public Attributes | |
| APInt | Zero |
| APInt | One |
Definition at line 23 of file KnownBits.h.
|
inline |
Definition at line 34 of file KnownBits.h.
Referenced by sext(), trunc(), zext(), and zextOrTrunc().
|
inline |
Create a known bits object of BitWidth bits initialized to unknown.
Definition at line 37 of file KnownBits.h.
|
inline |
Returns the maximum number of leading one bits possible.
Definition at line 183 of file KnownBits.h.
References llvm::APInt::countLeadingZeros(), and Zero.
|
inline |
Returns the maximum number of leading zero bits possible.
Definition at line 178 of file KnownBits.h.
References llvm::APInt::countLeadingZeros(), and One.
Referenced by llvm::SelectionDAG::computeKnownBits(), computeKnownBitsFromOperator(), foldCttzCtlz(), and isKnownNonZero().
|
inline |
Returns the maximum number of bits that could be one.
Definition at line 193 of file KnownBits.h.
References llvm::APInt::countPopulation(), getBitWidth(), and Zero.
Referenced by llvm::SelectionDAG::computeKnownBits(), computeKnownBitsFromOperator(), foldCtpop(), and llvm::SelectionDAG::isKnownToBeAPowerOfTwo().
|
inline |
Returns the maximum number of trailing one bits possible.
Definition at line 173 of file KnownBits.h.
References llvm::APInt::countTrailingZeros(), and Zero.
|
inline |
Returns the maximum number of trailing zero bits possible.
Definition at line 168 of file KnownBits.h.
References llvm::APInt::countTrailingZeros(), and One.
Referenced by llvm::SelectionDAG::computeKnownBits(), and foldCttzCtlz().
|
inline |
Returns the minimum number of leading one bits.
Definition at line 153 of file KnownBits.h.
References llvm::APInt::countLeadingOnes(), and One.
Referenced by llvm::SelectionDAG::computeKnownBits(), computeKnownBitsFromOperator(), countMinSignBits(), and llvm::InstCombiner::visitSwitchInst().
|
inline |
Returns the minimum number of leading zero bits.
Definition at line 148 of file KnownBits.h.
References llvm::APInt::countLeadingOnes(), and Zero.
Referenced by llvm::SelectionDAG::computeKnownBits(), computeKnownBitsFromAssume(), computeKnownBitsFromOperator(), computeKnownBitsMul(), llvm::computeOverflowForUnsignedMul(), countMinSignBits(), foldCttzCtlz(), llvm::RegsForValue::getCopyFromRegs(), isU24(), LowerAndToBT(), llvm::AMDGPUTargetLowering::performShlCombine(), and llvm::InstCombiner::visitSwitchInst().
|
inline |
Returns the number of bits known to be one.
Definition at line 188 of file KnownBits.h.
References llvm::APInt::countPopulation(), and One.
Referenced by foldCtpop(), and llvm::SelectionDAG::isKnownToBeAPowerOfTwo().
|
inline |
Returns the number of times the sign bit is replicated into the other bits.
Definition at line 159 of file KnownBits.h.
References countMinLeadingOnes(), countMinLeadingZeros(), isNegative(), and isNonNegative().
Referenced by ComputeNumSignBitsImpl().
|
inline |
Returns the minimum number of trailing one bits.
Definition at line 143 of file KnownBits.h.
References llvm::APInt::countTrailingOnes(), and One.
Referenced by computeKnownBitsFromOperator().
|
inline |
Returns the minimum number of trailing zero bits.
Definition at line 138 of file KnownBits.h.
References llvm::APInt::countTrailingOnes(), and Zero.
Referenced by llvm::SelectionDAG::computeKnownBits(), computeKnownBitsFromOperator(), computeKnownBitsMul(), foldCttzCtlz(), llvm::SelectionDAG::InferPtrAlignment(), isKnownNonZero(), isWordAligned(), and SimplifyShift().
|
inline |
Get the bit width of this value.
Definition at line 40 of file KnownBits.h.
References assert(), llvm::APInt::getBitWidth(), One, and Zero.
Referenced by computeKnownBits(), computeKnownBitsAddSub(), llvm::LanaiTargetLowering::computeKnownBitsForTargetNode(), llvm::AMDGPUTargetLowering::computeKnownBitsForTargetNode(), llvm::AArch64TargetLowering::computeKnownBitsForTargetNode(), llvm::ARMTargetLowering::computeKnownBitsForTargetNode(), llvm::X86TargetLowering::computeKnownBitsForTargetNode(), computeKnownBitsFromAssume(), computeKnownBitsFromOperator(), llvm::computeKnownBitsFromRangeMetadata(), computeKnownBitsFromShiftOperator(), computeKnownBitsMul(), computeSignedMinMaxValuesFromKnownBits(), computeUnsignedMinMaxValuesFromKnownBits(), countMaxPopulation(), llvm::FunctionLoweringInfo::GetLiveOutRegInfo(), isConstant(), llvm::TargetLowering::SimplifyDemandedBits(), SimplifyShift(), tryBitfieldInsertOpFromOr(), and llvm::InstCombiner::visitSwitchInst().
Returns the value when all bits have a known value.
This just returns One with a protective assertion.
Definition at line 57 of file KnownBits.h.
References assert(), isConstant(), and One.
Referenced by llvm::InstCombiner::run(), llvm::SimplifyInstruction(), and llvm::InstCombiner::visitReturnInst().
|
inline |
Returns true if there is conflicting information.
Definition at line 47 of file KnownBits.h.
References llvm::APInt::intersects(), One, and Zero.
Referenced by isAllOnes(), isConstant(), and isZero().
|
inline |
Returns true if value is all one bits.
Definition at line 78 of file KnownBits.h.
References assert(), hasConflict(), llvm::APInt::isAllOnesValue(), and One.
Referenced by computeKnownBitsFromAssume(), and llvm::InstCombiner::visitCallInst().
|
inline |
Returns true if we know the value of all bits.
Definition at line 50 of file KnownBits.h.
References assert(), llvm::APInt::countPopulation(), getBitWidth(), hasConflict(), One, and Zero.
Referenced by getConstant(), llvm::InstCombiner::run(), llvm::SimplifyInstruction(), and llvm::InstCombiner::visitReturnInst().
|
inline |
Returns true if this value is known to be negative.
Definition at line 96 of file KnownBits.h.
References llvm::APInt::isSignBitSet(), and One.
Referenced by checkRippleForSignedAdd(), computeKnownBitsAddSub(), computeKnownBitsFromAssume(), computeKnownBitsFromOperator(), computeKnownBitsMul(), llvm::SelectionDAG::ComputeNumSignBits(), computeOverflowForSignedAdd(), llvm::computeOverflowForUnsignedAdd(), countMinSignBits(), llvm::isKnownNegative(), isKnownNonZero(), makeNonNegative(), simplifyICmpWithBinOp(), and simplifyICmpWithZero().
|
inline |
Returns true if this value is known to be non-negative.
Definition at line 99 of file KnownBits.h.
References llvm::APInt::isSignBitSet(), and Zero.
Referenced by canReplaceGEPIdxWithZero(), checkRippleForSignedAdd(), llvm::SelectionDAG::computeKnownBits(), computeKnownBitsAddSub(), computeKnownBitsFromAssume(), computeKnownBitsFromOperator(), computeKnownBitsMul(), llvm::slpvectorizer::BoUpSLP::computeMinimumValueSizes(), llvm::SelectionDAG::ComputeNumSignBits(), ComputeNumSignBitsImpl(), computeOverflowForSignedAdd(), llvm::computeOverflowForUnsignedAdd(), countMinSignBits(), llvm::isKnownNonNegative(), isKnownNonZero(), makeNegative(), simplifyICmpWithBinOp(), simplifyICmpWithZero(), llvm::InstCombiner::simplifyRangeCheck(), and llvm::InstCombiner::visitSExt().
|
inline |
Returns true if we don't know any bits.
Definition at line 63 of file KnownBits.h.
References llvm::APInt::isNullValue(), One, and Zero.
Referenced by llvm::FunctionLoweringInfo::AddLiveOutRegInfo(), and llvm::ARMTargetLowering::computeKnownBitsForTargetNode().
|
inline |
Returns true if value is all zero.
Definition at line 72 of file KnownBits.h.
References assert(), hasConflict(), llvm::APInt::isAllOnesValue(), and Zero.
Referenced by computeKnownBitsFromAssume(), and isZero().
|
inline |
Make this value negative.
Definition at line 102 of file KnownBits.h.
References assert(), isNonNegative(), One, and llvm::APInt::setSignBit().
Referenced by computeKnownBitsAddSub(), computeKnownBitsFromAssume(), computeKnownBitsFromOperator(), and computeKnownBitsMul().
|
inline |
Make this value negative.
Definition at line 108 of file KnownBits.h.
References assert(), isNegative(), llvm::APInt::setSignBit(), and Zero.
Referenced by computeKnownBitsAddSub(), computeKnownBitsFromAssume(), computeKnownBitsFromOperator(), and computeKnownBitsMul().
|
inline |
Resets the known state of all bits.
Definition at line 66 of file KnownBits.h.
References llvm::APInt::clearAllBits(), One, and Zero.
Referenced by computeKnownBits(), llvm::SelectionDAG::computeKnownBits(), llvm::SparcTargetLowering::computeKnownBitsForTargetNode(), llvm::AMDGPUTargetLowering::computeKnownBitsForTargetNode(), llvm::ARMTargetLowering::computeKnownBitsForTargetNode(), llvm::PPCTargetLowering::computeKnownBitsForTargetNode(), llvm::X86TargetLowering::computeKnownBitsForTargetNode(), llvm::TargetLowering::computeKnownBitsForTargetNode(), computeKnownBitsFromAssume(), computeKnownBitsFromOperator(), computeKnownBitsFromShiftOperator(), and computeKnownBitsMul().
|
inline |
Make all bits known to be one and discard any previous information.
Definition at line 90 of file KnownBits.h.
References llvm::APInt::clearAllBits(), One, llvm::APInt::setAllBits(), and Zero.
Referenced by computeKnownBitsFromAssume().
|
inline |
Make all bits known to be zero and discard any previous information.
Definition at line 84 of file KnownBits.h.
References llvm::APInt::clearAllBits(), One, llvm::APInt::setAllBits(), and Zero.
Referenced by computeKnownBits(), llvm::X86TargetLowering::computeKnownBitsForTargetNode(), and computeKnownBitsFromAssume().
Sign extends the underlying known Zero and One bits.
This is equivalent to sign extending the value we're tracking.
Definition at line 127 of file KnownBits.h.
References KnownBits(), One, llvm::APInt::sext(), and Zero.
Referenced by llvm::SelectionDAG::computeKnownBits(), and computeKnownBitsFromOperator().
Truncate the underlying known Zero and One bits.
This is equivalent to truncating the value we're tracking.
Definition at line 115 of file KnownBits.h.
References KnownBits(), One, llvm::APInt::trunc(), and Zero.
Referenced by llvm::SelectionDAG::computeKnownBits(), computeKnownBitsFromOperator(), and llvm::TargetLowering::SimplifyDemandedBits().
Zero extends the underlying known Zero and One bits.
This is equivalent to zero extending the value we're tracking.
Definition at line 121 of file KnownBits.h.
References KnownBits(), One, Zero, and llvm::APInt::zext().
Referenced by llvm::SelectionDAG::computeKnownBits(), and llvm::X86TargetLowering::computeKnownBitsForTargetNode().
Zero extends or truncates the underlying known Zero and One bits.
This is equivalent to zero extending or truncating the value we're tracking.
Definition at line 133 of file KnownBits.h.
References KnownBits(), One, Zero, and llvm::APInt::zextOrTrunc().
Referenced by computeKnownBitsFromOperator(), and llvm::FunctionLoweringInfo::GetLiveOutRegInfo().
| APInt llvm::KnownBits::One |
Definition at line 25 of file KnownBits.h.
Referenced by llvm::FunctionLoweringInfo::AddLiveOutRegInfo(), aliasSameBasePointerGEPs(), llvm::SelectionDAGISel::CheckOrMask(), checkRippleForSignedAdd(), computeKnownBits(), llvm::SelectionDAG::computeKnownBits(), computeKnownBitsAddSub(), llvm::SparcTargetLowering::computeKnownBitsForTargetNode(), llvm::LanaiTargetLowering::computeKnownBitsForTargetNode(), llvm::AArch64TargetLowering::computeKnownBitsForTargetNode(), llvm::ARMTargetLowering::computeKnownBitsForTargetNode(), llvm::X86TargetLowering::computeKnownBitsForTargetNode(), computeKnownBitsFromAssume(), computeKnownBitsFromOperator(), llvm::computeKnownBitsFromRangeMetadata(), computeKnownBitsFromShiftOperator(), llvm::SelectionDAG::ComputeNumSignBits(), llvm::computeOverflowForUnsignedMul(), llvm::FunctionLoweringInfo::ComputePHILiveOutRegInfo(), computeSignedMinMaxValuesFromKnownBits(), computeUnsignedMinMaxValuesFromKnownBits(), countMaxLeadingZeros(), countMaxTrailingZeros(), countMinLeadingOnes(), countMinPopulation(), countMinTrailingOnes(), EliminateDeadSwitchCases(), foldCttzCtlz(), getBitWidth(), getConstant(), hasConflict(), isAllOnes(), isConstant(), isKnownNonEqual(), isKnownNonZero(), isKnownToBeAPowerOfTwo(), isNegative(), isUnknown(), makeNegative(), resetAll(), setAllOnes(), setAllZero(), sext(), llvm::TargetLowering::SimplifyDemandedBits(), SimplifyRightShift(), SimplifyShift(), trunc(), zext(), and zextOrTrunc().
| APInt llvm::KnownBits::Zero |
Definition at line 24 of file KnownBits.h.
Referenced by llvm::FunctionLoweringInfo::AddLiveOutRegInfo(), aliasSameBasePointerGEPs(), checkRippleForSignedAdd(), computeKnownBits(), llvm::SelectionDAG::computeKnownBits(), computeKnownBitsAddSub(), llvm::SparcTargetLowering::computeKnownBitsForTargetNode(), llvm::LanaiTargetLowering::computeKnownBitsForTargetNode(), llvm::AMDGPUTargetLowering::computeKnownBitsForTargetNode(), llvm::AArch64TargetLowering::computeKnownBitsForTargetNode(), llvm::ARMTargetLowering::computeKnownBitsForTargetNode(), llvm::PPCTargetLowering::computeKnownBitsForTargetNode(), llvm::X86TargetLowering::computeKnownBitsForTargetNode(), computeKnownBitsFromAssume(), computeKnownBitsFromOperator(), llvm::computeKnownBitsFromRangeMetadata(), computeKnownBitsFromShiftOperator(), computeKnownBitsMul(), llvm::SelectionDAG::ComputeNumSignBits(), ComputeNumSignBitsImpl(), llvm::computeOverflowForUnsignedMul(), llvm::SelectionDAG::computeOverflowKind(), llvm::FunctionLoweringInfo::ComputePHILiveOutRegInfo(), computeSignedMinMaxValuesFromKnownBits(), computeUnsignedMinMaxValuesFromKnownBits(), countMaxLeadingOnes(), countMaxPopulation(), countMaxTrailingOnes(), countMinLeadingZeros(), countMinTrailingZeros(), EliminateDeadSwitchCases(), getBitWidth(), hasConflict(), isBitfieldPositioningOp(), isConstant(), isKnownNonEqual(), isKnownToBeAPowerOfTwo(), isNonNegative(), llvm::AMDGPUTargetLowering::isOrEquivalentToAdd(), isTruePredicate(), isTruncateOf(), isUnknown(), isZero(), makeNonNegative(), MaskedValueIsZero(), llvm::SelectionDAG::MaskedValueIsZero(), llvm::ARMTargetLowering::PerformCMOVCombine(), llvm::ARMTargetLowering::PerformCMOVToBFICombine(), resetAll(), llvm::PPCTargetLowering::SelectAddressRegImm(), llvm::PPCTargetLowering::SelectAddressRegReg(), setAllOnes(), setAllZero(), sext(), llvm::TargetLowering::SimplifyDemandedBits(), SimplifySubInst(), trunc(), tryBitfieldInsertOpFromOr(), tryBitfieldInsertOpFromOrAndImm(), llvm::InstCombiner::visitAdd(), llvm::InstCombiner::visitSub(), zext(), and zextOrTrunc().
1.8.6