LLVM API Documentation
#include "llvm/Analysis/ValueTracking.h"#include "llvm/ADT/SmallPtrSet.h"#include "llvm/Analysis/InstructionSimplify.h"#include "llvm/IR/Constants.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/GlobalAlias.h"#include "llvm/IR/GlobalVariable.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/LLVMContext.h"#include "llvm/IR/Metadata.h"#include "llvm/IR/Operator.h"#include "llvm/Support/ConstantRange.h"#include "llvm/Support/GetElementPtrTypeIterator.h"#include "llvm/Support/MathExtras.h"#include "llvm/Support/PatternMatch.h"#include <cstring>Go to the source code of this file.
Functions | |
| static unsigned | getBitWidth (Type *Ty, const DataLayout *TD) |
| static void | ComputeMaskedBitsAddSub (bool Add, Value *Op0, Value *Op1, bool NSW, APInt &KnownZero, APInt &KnownOne, APInt &KnownZero2, APInt &KnownOne2, const DataLayout *TD, unsigned Depth) |
| static void | ComputeMaskedBitsMul (Value *Op0, Value *Op1, bool NSW, APInt &KnownZero, APInt &KnownOne, APInt &KnownZero2, APInt &KnownOne2, const DataLayout *TD, unsigned Depth) |
| static bool | isGEPKnownNonNull (GEPOperator *GEP, const DataLayout *DL, unsigned Depth) |
| Test whether a GEP's result is known to be non-null. | |
| static Value * | BuildSubAggregate (Value *From, Value *To, Type *IndexedType, SmallVector< unsigned, 10 > &Idxs, unsigned IdxSkip, Instruction *InsertBefore) |
| static Value * | BuildSubAggregate (Value *From, ArrayRef< unsigned > idx_range, Instruction *InsertBefore) |
| static uint64_t | GetStringLengthH (Value *V, SmallPtrSet< PHINode *, 32 > &PHIs) |
Variables | |
| const unsigned | MaxDepth = 6 |
| static Value* BuildSubAggregate | ( | Value * | From, |
| Value * | To, | ||
| Type * | IndexedType, | ||
| SmallVector< unsigned, 10 > & | Idxs, | ||
| unsigned | IdxSkip, | ||
| Instruction * | InsertBefore | ||
| ) | [static] |
Definition at line 1522 of file ValueTracking.cpp.
References llvm::InsertValueInst::Create(), llvm::dyn_cast(), llvm::Instruction::eraseFromParent(), llvm::FindInsertedValue(), llvm::InsertValueInst::getAggregateOperand(), llvm::StructType::getElementType(), llvm::StructType::getNumElements(), llvm::makeArrayRef(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::pop_back(), and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
Referenced by BuildSubAggregate(), and llvm::FindInsertedValue().
| static Value* BuildSubAggregate | ( | Value * | From, |
| ArrayRef< unsigned > | idx_range, | ||
| Instruction * | InsertBefore | ||
| ) | [static] |
| static void ComputeMaskedBitsAddSub | ( | bool | Add, |
| Value * | Op0, | ||
| Value * | Op1, | ||
| bool | NSW, | ||
| APInt & | KnownZero, | ||
| APInt & | KnownOne, | ||
| APInt & | KnownZero2, | ||
| APInt & | KnownOne2, | ||
| const DataLayout * | TD, | ||
| unsigned | Depth | ||
| ) | [static] |
Definition at line 46 of file ValueTracking.cpp.
References llvm::ComputeMaskedBits(), llvm::APInt::countTrailingOnes(), llvm::APInt::getBitWidth(), llvm::APInt::getHighBitsSet(), llvm::APInt::getLowBitsSet(), llvm::APInt::getSignBit(), and llvm::APInt::isNegative().
Referenced by llvm::ComputeMaskedBits().
| static void ComputeMaskedBitsMul | ( | Value * | Op0, |
| Value * | Op1, | ||
| bool | NSW, | ||
| APInt & | KnownZero, | ||
| APInt & | KnownOne, | ||
| APInt & | KnownZero2, | ||
| APInt & | KnownOne2, | ||
| const DataLayout * | TD, | ||
| unsigned | Depth | ||
| ) | [static] |
Definition at line 132 of file ValueTracking.cpp.
References llvm::ComputeMaskedBits(), llvm::APInt::countLeadingOnes(), llvm::APInt::countTrailingOnes(), llvm::APInt::getBitWidth(), llvm::APInt::getHighBitsSet(), llvm::APInt::getLowBitsSet(), llvm::isKnownNonZero(), llvm::APInt::isNegative(), and llvm::APInt::setBit().
Referenced by llvm::ComputeMaskedBits().
| static unsigned getBitWidth | ( | Type * | Ty, |
| const DataLayout * | TD | ||
| ) | [static] |
getBitWidth - Returns the bitwidth of the given scalar or pointer type (if unknown returns 0). For vector types, returns the element type's bitwidth.
Definition at line 39 of file ValueTracking.cpp.
References llvm::DataLayout::getPointerSizeInBits(), and llvm::Type::getScalarSizeInBits().
Referenced by llvm::ComputeSignBit(), llvm::ConstantFoldCastInstruction(), ConstantFoldConvertToInt(), DecomposeGEPExpression(), dyn_castFoldableMul(), dyn_castZExtVal(), EliminateDeadSwitchCases(), ExtractConstantBytes(), llvm::ExecutionEngine::getConstantValue(), llvm::EVT::getEVT(), llvm::Type::getIntegerBitWidth(), llvm::Type::getPrimitiveSizeInBits(), llvm::NVPTXTargetLowering::getPrototype(), llvm::IntegersSubsetGeneric< IntItem >::getSingleValue(), llvm::IntegersSubsetGeneric< IntItem >::getSize(), getTypePrefix(), llvm::DataLayout::getTypeSizeInBits(), llvm::MVT::getVT(), llvm::Type::isIntegerTy(), llvm::isKnownNonZero(), llvm::isSafeToSpeculativelyExecute(), isZero(), LLVMCreateGenericValueOfInt(), LLVMGetIntTypeWidth(), llvm::ExecutionEngine::LoadValueFromMemory(), llvm::TypePrinting::print(), llvm::MCJIT::runFunction(), llvm::JIT::runFunction(), sameNoopInput(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitICmpInst(), llvm::InstCombiner::visitICmpInstWithCastAndCast(), llvm::InstCombiner::visitICmpInstWithInstAndIntCst(), llvm::WriteMDNodeComment(), and WriteTypeTable().
| static uint64_t GetStringLengthH | ( | Value * | V, |
| SmallPtrSet< PHINode *, 32 > & | PHIs | ||
| ) | [static] |
GetStringLengthH - If we can compute the length of the string pointed to by the specified pointer, return 'len+1'. If we can't, return 0.
Definition at line 1805 of file ValueTracking.cpp.
References llvm::getConstantStringInfo(), llvm::SmallPtrSet< PtrType, SmallSize >::insert(), llvm::StringRef::size(), and llvm::Value::stripPointerCasts().
Referenced by llvm::GetStringLength().
| static bool isGEPKnownNonNull | ( | GEPOperator * | GEP, |
| const DataLayout * | DL, | ||
| unsigned | Depth | ||
| ) | [static] |
Test whether a GEP's result is known to be non-null.
Uses properties inherent in a GEP to try to determine whether it is known to be non-null.
Currently this routine does not support vector GEPs.
Definition at line 886 of file ValueTracking.cpp.
References llvm::gep_type_begin(), llvm::gep_type_end(), llvm::StructLayout::getElementOffset(), llvm::GEPOperator::getPointerAddressSpace(), llvm::GEPOperator::getPointerOperand(), llvm::DataLayout::getStructLayout(), llvm::Value::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::ConstantInt::getZExtValue(), llvm::GEPOperator::isInBounds(), llvm::isKnownNonZero(), llvm::Type::isPointerTy(), and MaxDepth.
Referenced by llvm::isKnownNonZero().
Definition at line 35 of file ValueTracking.cpp.
Referenced by llvm::SUnit::biasCriticalPath(), llvm::ComputeMaskedBits(), llvm::ComputeMultiple(), isGEPKnownNonNull(), llvm::isKnownNonZero(), and llvm::isKnownToBeAPowerOfTwo().