LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
llvm::APIntOps Namespace Reference

Functions

APInt smin (const APInt &A, const APInt &B)
 Determine the smaller of two APInts considered to be signed. More...
 
APInt smax (const APInt &A, const APInt &B)
 Determine the larger of two APInts considered to be signed. More...
 
APInt umin (const APInt &A, const APInt &B)
 Determine the smaller of two APInts considered to be signed. More...
 
APInt umax (const APInt &A, const APInt &B)
 Determine the larger of two APInts considered to be unsigned. More...
 
bool isIntN (unsigned N, const APInt &APIVal)
 Check if the specified APInt has a N-bits unsigned integer value. More...
 
bool isSignedIntN (unsigned N, const APInt &APIVal)
 Check if the specified APInt has a N-bits signed integer value. More...
 
bool isMask (unsigned numBits, const APInt &APIVal)
 
bool isShiftedMask (unsigned numBits, const APInt &APIVal)
 Return true if the argument APInt value contains a sequence of ones with the remainder zero. More...
 
APInt byteSwap (const APInt &APIVal)
 Returns a byte-swapped representation of the specified APInt Value. More...
 
unsigned logBase2 (const APInt &APIVal)
 Returns the floor log base 2 of the specified APInt value. More...
 
APInt GreatestCommonDivisor (const APInt &Val1, const APInt &Val2)
 Compute GCD of two APInt values. More...
 
double RoundAPIntToDouble (const APInt &APIVal)
 Converts the given APInt to a double value. More...
 
double RoundSignedAPIntToDouble (const APInt &APIVal)
 Converts the given APInt to a double value. More...
 
float RoundAPIntToFloat (const APInt &APIVal)
 Converts the given APInt to a float vlalue. More...
 
float RoundSignedAPIntToFloat (const APInt &APIVal)
 Converts the given APInt to a float value. More...
 
APInt RoundDoubleToAPInt (double Double, unsigned width)
 Converts the given double value into a APInt. More...
 
APInt RoundFloatToAPInt (float Float, unsigned width)
 Converts a float value into a APInt. More...
 
APInt ashr (const APInt &LHS, unsigned shiftAmt)
 Arithmetic right-shift function. More...
 
APInt lshr (const APInt &LHS, unsigned shiftAmt)
 Logical right-shift function. More...
 
APInt shl (const APInt &LHS, unsigned shiftAmt)
 Left-shift function. More...
 
APInt sdiv (const APInt &LHS, const APInt &RHS)
 Signed division function for APInt. More...
 
APInt udiv (const APInt &LHS, const APInt &RHS)
 Unsigned division function for APInt. More...
 
APInt srem (const APInt &LHS, const APInt &RHS)
 Function for signed remainder operation. More...
 
APInt urem (const APInt &LHS, const APInt &RHS)
 Function for unsigned remainder operation. More...
 
APInt mul (const APInt &LHS, const APInt &RHS)
 Function for multiplication operation. More...
 
APInt add (const APInt &LHS, const APInt &RHS)
 Function for addition operation. More...
 
APInt sub (const APInt &LHS, const APInt &RHS)
 Function for subtraction operation. More...
 
APInt And (const APInt &LHS, const APInt &RHS)
 Bitwise AND function for APInt. More...
 
APInt Or (const APInt &LHS, const APInt &RHS)
 Bitwise OR function for APInt. More...
 
APInt Xor (const APInt &LHS, const APInt &RHS)
 Bitwise XOR function for APInt. More...
 
APInt Not (const APInt &APIVal)
 Bitwise complement function. More...
 

Function Documentation

APInt llvm::APIntOps::add ( const APInt &  LHS,
const APInt &  RHS 
)
inline

Function for addition operation.

Performs addition on APInt values.

Definition at line 1829 of file APInt.h.

APInt llvm::APIntOps::And ( const APInt &  LHS,
const APInt &  RHS 
)
inline

Bitwise AND function for APInt.

Performs bitwise AND operation on APInt LHS and APInt RHS.

Definition at line 1840 of file APInt.h.

Referenced by BuildNew(), CanEvaluateSExtd(), CanEvaluateShifted(), CanEvaluateShuffled(), CanEvaluateTruncated(), CanEvaluateZExtd(), CollectBSwapParts(), collectFailStats(), llvm::ComputeMaskedBits(), llvm::ComputeNumSignBits(), ComputeSpeculationCost(), llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldCompareInstOperands(), llvm::SystemZInstrInfo::convertToThreeAddress(), createReplacementInstr(), ExtractConstantBytes(), FindLIVLoopCondition(), llvm::SelectionDAGBuilder::FindMergedConditions(), llvm::FoldBranchToCommonDest(), llvm::InstCombiner::FoldICmpShrCst(), FoldMaskAndShiftToExtract(), llvm::InstCombiner::FoldOrOfICmps(), llvm::InstCombiner::FoldShiftByConstant(), GatherConstantCompares(), llvm::ConstantExpr::get(), llvm::ConstantExpr::getAnd(), llvm::ConstantExpr::getBinOpAbsorber(), llvm::ConstantExpr::getBinOpIdentity(), getBinOpPrecedence(), llvm::ExecutionEngine::getConstantValue(), GetDecodedBinaryOpcode(), GetEncodedBinaryOpcode(), llvm::objcarc::GetInstructionClass(), llvm::Instruction::getOpcodeName(), getReductionBinOp(), GetSelectFoldableConstant(), GetSelectFoldableOperands(), GetShiftedValue(), llvm::BinaryOperator::init(), llvm::TargetLoweringBase::InstructionOpcodeToISD(), llvm::Instruction::isAssociative(), llvm::Instruction::isCommutative(), llvm::Instruction::isIdempotent(), LeftDistributesOverRight(), nvptx::LowerConstant(), lowerConstant(), OptimizeAndOrXor(), llvm::FastISel::SelectOperator(), shouldSpeculateInstrs(), SimplifyAndInst(), SimplifyBinOp(), SimplifyBranchOnICmpChain(), llvm::SimplifyInstruction(), SimplifyOrInst(), llvm::TargetLowering::SimplifySetCC(), SimplifyXorInst(), SymbolicallyEvaluateBinop(), llvm::Interpreter::visitBinaryOperator(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), llvm::InstCombiner::visitSelectInstWithICmp(), llvm::InstCombiner::visitXor(), and llvm::InstCombiner::visitZExt().

APInt llvm::APIntOps::ashr ( const APInt &  LHS,
unsigned  shiftAmt 
)
inline

Arithmetic right-shift function.

Arithmetic right-shift the APInt by shiftAmt.

Definition at line 1783 of file APInt.h.

References llvm::APInt::ashr().

Referenced by llvm::ScalarEvolution::getSignedRange().

APInt llvm::APIntOps::byteSwap ( const APInt &  APIVal)
inline

Returns a byte-swapped representation of the specified APInt Value.

Definition at line 1729 of file APInt.h.

References llvm::APInt::byteSwap().

APInt llvm::APIntOps::GreatestCommonDivisor ( const APInt Val1,
const APInt Val2 
)

Compute GCD of two APInt values.

This function returns the greatest common divisor of the two APInt values using Euclid's algorithm.

Returns
the greatest common divisor of Val1 and Val2

Definition at line 804 of file APInt.cpp.

References llvm::ARM_PROC::A, T, and urem().

Referenced by gcd().

bool llvm::APIntOps::isIntN ( unsigned  N,
const APInt &  APIVal 
)
inline

Check if the specified APInt has a N-bits unsigned integer value.

Definition at line 1708 of file APInt.h.

References llvm::APInt::isIntN().

bool llvm::APIntOps::isMask ( unsigned  numBits,
const APInt &  APIVal 
)
inline
Returns
true if the argument APInt value is a sequence of ones starting at the least significant bit with the remainder zero.

Definition at line 1717 of file APInt.h.

References llvm::APInt::getBitWidth(), and llvm::APInt::getLowBitsSet().

Referenced by isShiftedMask().

bool llvm::APIntOps::isShiftedMask ( unsigned  numBits,
const APInt &  APIVal 
)
inline

Return true if the argument APInt value contains a sequence of ones with the remainder zero.

Definition at line 1724 of file APInt.h.

References isMask().

Referenced by isRunOfOnes().

bool llvm::APIntOps::isSignedIntN ( unsigned  N,
const APInt &  APIVal 
)
inline

Check if the specified APInt has a N-bits signed integer value.

Definition at line 1711 of file APInt.h.

References llvm::APInt::isSignedIntN().

unsigned llvm::APIntOps::logBase2 ( const APInt &  APIVal)
inline

Returns the floor log base 2 of the specified APInt value.

Definition at line 1732 of file APInt.h.

References llvm::APInt::logBase2().

APInt llvm::APIntOps::lshr ( const APInt &  LHS,
unsigned  shiftAmt 
)
inline

Logical right-shift function.

Logical right-shift the APInt by shiftAmt.

Definition at line 1790 of file APInt.h.

References llvm::APInt::lshr().

Referenced by llvm::ComputeMaskedBits(), llvm::APInt::getHiBits(), llvm::APInt::getLoBits(), and llvm::ScalarEvolution::getUnsignedRange().

APInt llvm::APIntOps::mul ( const APInt &  LHS,
const APInt &  RHS 
)
inline

Function for multiplication operation.

Performs multiplication on APInt values.

Definition at line 1824 of file APInt.h.

APInt llvm::APIntOps::Not ( const APInt &  APIVal)
inline

Bitwise complement function.

Performs a bitwise complement operation on APInt.

Definition at line 1855 of file APInt.h.

Referenced by GatherConstantCompares(), llvm::InstCombiner::visitICmpInst(), and llvm::InstCombiner::visitOr().

APInt llvm::APIntOps::Or ( const APInt &  LHS,
const APInt &  RHS 
)
inline

Bitwise OR function for APInt.

Performs bitwise OR operation on APInt LHS and APInt RHS.

Definition at line 1845 of file APInt.h.

Referenced by llvm::X86TargetLowering::BuildFILD(), BuildNew(), CanEvaluateSExtd(), CanEvaluateShifted(), CanEvaluateShuffled(), CanEvaluateTruncated(), CanEvaluateZExtd(), CollectBSwapParts(), collectFailStats(), CollectInsertionElements(), llvm::ComputeMaskedBits(), llvm::ComputeNumSignBits(), ComputeSpeculationCost(), llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldCompareInstOperands(), createReplacementInstr(), ExtractConstantBytes(), FindLIVLoopCondition(), llvm::SelectionDAGBuilder::FindMergedConditions(), llvm::FoldBranchToCommonDest(), llvm::InstCombiner::FoldShiftByConstant(), GatherConstantCompares(), llvm::ConstantExpr::get(), llvm::ConstantExpr::getBinOpAbsorber(), llvm::ConstantExpr::getBinOpIdentity(), getBinOpPrecedence(), llvm::ExecutionEngine::getConstantValue(), GetDecodedBinaryOpcode(), GetEncodedBinaryOpcode(), llvm::objcarc::GetInstructionClass(), GetLinearExpression(), llvm::Instruction::getOpcodeName(), llvm::ConstantExpr::getOr(), getReductionBinOp(), GetSelectFoldableConstant(), GetSelectFoldableOperands(), GetShiftedValue(), llvm::BinaryOperator::init(), llvm::TargetLoweringBase::InstructionOpcodeToISD(), llvm::Instruction::isAssociative(), llvm::Instruction::isCommutative(), llvm::Instruction::isIdempotent(), LeftDistributesOverRight(), nvptx::LowerConstant(), lowerConstant(), lowerFCOPYSIGN64(), OptimizeAndOrXor(), llvm::X86TargetLowering::ReplaceNodeResults(), llvm::FastISel::SelectOperator(), shouldSpeculateInstrs(), SimplifyAndInst(), SimplifyBinOp(), SimplifyBranchOnICmpChain(), llvm::SimplifyInstruction(), SimplifyOrInst(), llvm::InstCombiner::visitAnd(), llvm::Interpreter::visitBinaryOperator(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), llvm::InstCombiner::visitOr(), llvm::InstCombiner::visitXor(), and llvm::InstCombiner::visitZExt().

double llvm::APIntOps::RoundAPIntToDouble ( const APInt &  APIVal)
inline

Converts the given APInt to a double value.

Treats the APInt as an unsigned value for conversion purposes.

Definition at line 1745 of file APInt.h.

References llvm::APInt::roundToDouble().

Referenced by RoundAPIntToFloat().

float llvm::APIntOps::RoundAPIntToFloat ( const APInt &  APIVal)
inline

Converts the given APInt to a float vlalue.

Definition at line 1757 of file APInt.h.

References RoundAPIntToDouble().

APInt llvm::APIntOps::RoundDoubleToAPInt ( double  Double,
unsigned  width 
)

Converts the given double value into a APInt.

This function convert a double value to an APInt value.

Definition at line 815 of file APInt.cpp.

References llvm::Intrinsic::exp, I, llvm::APInt::shl(), and T.

Referenced by llvm::ExecutionEngine::getConstantValue(), and RoundFloatToAPInt().

APInt llvm::APIntOps::RoundFloatToAPInt ( float  Float,
unsigned  width 
)
inline

Converts a float value into a APInt.

Converts a float value into an APInt value.

Definition at line 1776 of file APInt.h.

References RoundDoubleToAPInt().

Referenced by llvm::ExecutionEngine::getConstantValue().

double llvm::APIntOps::RoundSignedAPIntToDouble ( const APInt &  APIVal)
inline

Converts the given APInt to a double value.

Treats the APInt as a signed value for conversion purposes.

Definition at line 1752 of file APInt.h.

References llvm::APInt::signedRoundToDouble().

float llvm::APIntOps::RoundSignedAPIntToFloat ( const APInt &  APIVal)
inline

Converts the given APInt to a float value.

Treast the APInt as a signed value for conversion purposes.

Definition at line 1764 of file APInt.h.

References llvm::APInt::signedRoundToDouble().

APInt llvm::APIntOps::sdiv ( const APInt &  LHS,
const APInt &  RHS 
)
inline

Signed division function for APInt.

Signed divide APInt LHS by APInt RHS.

Definition at line 1804 of file APInt.h.

References llvm::APInt::sdiv().

Referenced by sdiv(), and SolveQuadraticEquation().

APInt llvm::APIntOps::shl ( const APInt &  LHS,
unsigned  shiftAmt 
)
inline

Left-shift function.

Left-shift the APInt by shiftAmt.

Definition at line 1797 of file APInt.h.

References llvm::APInt::shl().

Referenced by llvm::APInt::getLoBits(), llvm::ScalarEvolution::getSignedRange(), llvm::ScalarEvolution::getUnsignedRange(), and insertInteger().

APInt llvm::APIntOps::smax ( const APInt &  A,
const APInt &  B 
)
inline

Determine the larger of two APInts considered to be signed.

Definition at line 1699 of file APInt.h.

References llvm::APInt::sgt().

Referenced by llvm::ScalarEvolution::getSignedRange(), llvm::ScalarEvolution::getSMaxExpr(), and llvm::ConstantRange::smax().

APInt llvm::APIntOps::smin ( const APInt &  A,
const APInt &  B 
)
inline

Determine the smaller of two APInts considered to be signed.

Definition at line 1696 of file APInt.h.

References llvm::APInt::slt().

Referenced by llvm::ScalarEvolution::getSignedRange().

APInt llvm::APIntOps::srem ( const APInt &  LHS,
const APInt &  RHS 
)
inline

Function for signed remainder operation.

Signed remainder operation on APInt.

Definition at line 1814 of file APInt.h.

References llvm::APInt::srem().

Referenced by srem().

APInt llvm::APIntOps::sub ( const APInt &  LHS,
const APInt &  RHS 
)
inline

Function for subtraction operation.

Performs subtraction on APInt values.

Definition at line 1834 of file APInt.h.

APInt llvm::APIntOps::udiv ( const APInt &  LHS,
const APInt &  RHS 
)
inline

Unsigned division function for APInt.

Unsigned divide APInt LHS by APInt RHS.

Definition at line 1809 of file APInt.h.

References llvm::APInt::udiv().

Referenced by llvm::SCEVAddRecExpr::getNumIterationsInRange(), and llvm::Interpreter::visitBinaryOperator().

APInt llvm::APIntOps::umax ( const APInt &  A,
const APInt &  B 
)
inline

Determine the larger of two APInts considered to be unsigned.

Definition at line 1705 of file APInt.h.

References llvm::APInt::ugt().

Referenced by llvm::ConstantRange::binaryOr(), llvm::ScalarEvolution::getUMaxExpr(), llvm::ScalarEvolution::getUnsignedRange(), and llvm::ConstantRange::umax().

APInt llvm::APIntOps::umin ( const APInt &  A,
const APInt &  B 
)
inline

Determine the smaller of two APInts considered to be signed.

Definition at line 1702 of file APInt.h.

References llvm::APInt::ult().

Referenced by llvm::ConstantRange::binaryAnd(), and llvm::ScalarEvolution::getUnsignedRange().

APInt llvm::APIntOps::urem ( const APInt &  LHS,
const APInt &  RHS 
)
inline

Function for unsigned remainder operation.

Unsigned remainder operation on APInt.

Definition at line 1819 of file APInt.h.

References llvm::APInt::urem().

Referenced by GreatestCommonDivisor(), SolveLinEquationWithOverflow(), and llvm::Interpreter::visitBinaryOperator().

APInt llvm::APIntOps::Xor ( const APInt &  LHS,
const APInt &  RHS 
)
inline

Bitwise XOR function for APInt.

Performs bitwise XOR operation on APInt.

Definition at line 1850 of file APInt.h.

Referenced by BuildNew(), CanEvaluateSExtd(), CanEvaluateShifted(), CanEvaluateShuffled(), CanEvaluateTruncated(), CanEvaluateZExtd(), collectFailStats(), llvm::ComputeMaskedBits(), llvm::ComputeNumSignBits(), ComputeSpeculationCost(), llvm::ConstantFoldBinaryInstruction(), llvm::BinaryOperator::CreateNot(), createReplacementInstr(), llvm::InstCombiner::FoldOrOfICmps(), llvm::InstCombiner::FoldOrWithConstants(), llvm::InstCombiner::FoldShiftByConstant(), llvm::ConstantExpr::get(), llvm::ConstantExpr::getBinOpIdentity(), getBinOpPrecedence(), llvm::ExecutionEngine::getConstantValue(), GetDecodedBinaryOpcode(), GetEncodedBinaryOpcode(), llvm::objcarc::GetInstructionClass(), llvm::ConstantExpr::getNot(), llvm::Instruction::getOpcodeName(), getReductionBinOp(), GetSelectFoldableConstant(), GetSelectFoldableOperands(), GetShiftedValue(), llvm::ConstantExpr::getXor(), llvm::BinaryOperator::init(), llvm::TargetLoweringBase::InstructionOpcodeToISD(), llvm::Instruction::isAssociative(), llvm::Instruction::isCommutative(), llvm::Instruction::isNilpotent(), llvm::BinaryOperator::isNot(), LeftDistributesOverRight(), nvptx::LowerConstant(), lowerConstant(), llvm::PatternMatch::not_match< LHS_t >::match(), OptimizeAndOrXor(), llvm::FastISel::SelectOperator(), shouldSpeculateInstrs(), SimplifyAndInst(), SimplifyBinOp(), llvm::SimplifyInstruction(), SimplifyXorInst(), llvm::InstCombiner::visitAnd(), llvm::Interpreter::visitBinaryOperator(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), llvm::InstCombiner::visitOr(), llvm::InstCombiner::visitXor(), and llvm::InstCombiner::visitZExt().