LLVM
8.0.1
|
Evaluate the size and offset of an object pointed to by a Value* statically. More...
#include "llvm/Analysis/MemoryBuiltins.h"
Static Public Member Functions | |
static bool | knownSize (const SizeOffsetType &SizeOffset) |
static bool | knownOffset (const SizeOffsetType &SizeOffset) |
static bool | bothKnown (const SizeOffsetType &SizeOffset) |
Evaluate the size and offset of an object pointed to by a Value* statically.
Fails if size or offset are not known at compile time.
Definition at line 194 of file MemoryBuiltins.h.
ObjectSizeOffsetVisitor::ObjectSizeOffsetVisitor | ( | const DataLayout & | DL, |
const TargetLibraryInfo * | TLI, | ||
LLVMContext & | Context, | ||
ObjectSizeOpts | Options = {} |
||
) |
Definition at line 490 of file MemoryBuiltins.cpp.
|
inlinestatic |
Definition at line 223 of file MemoryBuiltins.h.
References GEP.
Referenced by llvm::ObjectSizeOffsetEvaluator::compute(), StackMallocSizeClass(), visitGEPOperator(), and visitSelectInst().
SizeOffsetType ObjectSizeOffsetVisitor::compute | ( | Value * | V | ) |
Definition at line 499 of file MemoryBuiltins.cpp.
References llvm::dbgs(), GEP, llvm::APInt::getActiveBits(), llvm::APInt::getBitWidth(), llvm::APInt::getNullValue(), llvm::DataLayout::getPointerTypeSizeInBits(), llvm::Value::getType(), I, LLVM_DEBUG, P, llvm::Value::stripPointerCasts(), llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >::visit(), visitArgument(), visitConstantPointerNull(), visitGEPOperator(), visitGlobalAlias(), visitGlobalVariable(), visitUndefValue(), and llvm::APInt::zextOrTrunc().
Referenced by llvm::ObjectSizeOffsetEvaluator::compute(), StackMallocSizeClass(), visitGEPOperator(), visitGlobalAlias(), and visitSelectInst().
|
inlinestatic |
Definition at line 219 of file MemoryBuiltins.h.
|
inlinestatic |
Definition at line 215 of file MemoryBuiltins.h.
SizeOffsetType ObjectSizeOffsetVisitor::visitAllocaInst | ( | AllocaInst & | I | ) |
Definition at line 552 of file MemoryBuiltins.cpp.
References C, llvm::AllocaInst::getAlignment(), llvm::AllocaInst::getAllocatedType(), llvm::AllocaInst::getArraySize(), llvm::DataLayout::getTypeAllocSize(), llvm::AllocaInst::isArrayAllocation(), llvm::Type::isSized(), Size, and llvm::APInt::umul_ov().
SizeOffsetType ObjectSizeOffsetVisitor::visitArgument | ( | Argument & | A | ) |
Definition at line 574 of file MemoryBuiltins.cpp.
References llvm::PointerType::getElementType(), llvm::Argument::getParamAlignment(), llvm::Value::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::Argument::hasByValOrInAllocaAttr(), and Size.
Referenced by compute().
SizeOffsetType ObjectSizeOffsetVisitor::visitCallSite | ( | CallSite | CS | ) |
Definition at line 585 of file MemoryBuiltins.cpp.
References AllocFnsTy::AllocTy, Arg, llvm::dyn_cast(), AllocFnsTy::FstParam, getAllocationSize(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getArgument(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), llvm::GetStringLength(), llvm::ConstantInt::getValue(), Size, AllocFnsTy::SndParam, StrDupLike, llvm::APInt::ugt(), llvm::APInt::umul_ov(), and llvm::APInt::zextOrSelf().
SizeOffsetType ObjectSizeOffsetVisitor::visitConstantPointerNull | ( | ConstantPointerNull & | CPN | ) |
Definition at line 644 of file MemoryBuiltins.cpp.
References llvm::PointerType::getAddressSpace(), llvm::ConstantPointerNull::getType(), and llvm::ObjectSizeOpts::NullIsUnknownSize.
Referenced by compute().
SizeOffsetType ObjectSizeOffsetVisitor::visitExtractElementInst | ( | ExtractElementInst & | I | ) |
Definition at line 658 of file MemoryBuiltins.cpp.
SizeOffsetType ObjectSizeOffsetVisitor::visitExtractValueInst | ( | ExtractValueInst & | I | ) |
Definition at line 663 of file MemoryBuiltins.cpp.
SizeOffsetType ObjectSizeOffsetVisitor::visitGEPOperator | ( | GEPOperator & | GEP | ) |
Definition at line 668 of file MemoryBuiltins.cpp.
References llvm::GEPOperator::accumulateConstantOffset(), bothKnown(), compute(), and llvm::GEPOperator::getPointerOperand().
Referenced by compute().
SizeOffsetType ObjectSizeOffsetVisitor::visitGlobalAlias | ( | GlobalAlias & | GA | ) |
Definition at line 677 of file MemoryBuiltins.cpp.
References compute(), llvm::GlobalAlias::getAliasee(), and llvm::GlobalValue::isInterposable().
Referenced by compute().
SizeOffsetType ObjectSizeOffsetVisitor::visitGlobalVariable | ( | GlobalVariable & | GV | ) |
Definition at line 683 of file MemoryBuiltins.cpp.
References llvm::GlobalObject::getAlignment(), llvm::PointerType::getElementType(), llvm::GlobalValue::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::GlobalVariable::hasDefinitiveInitializer(), and Size.
Referenced by compute().
SizeOffsetType ObjectSizeOffsetVisitor::visitInstruction | ( | Instruction & | I | ) |
Definition at line 738 of file MemoryBuiltins.cpp.
References llvm::dbgs(), and LLVM_DEBUG.
SizeOffsetType ObjectSizeOffsetVisitor::visitIntToPtrInst | ( | IntToPtrInst & | ) |
Definition at line 691 of file MemoryBuiltins.cpp.
SizeOffsetType ObjectSizeOffsetVisitor::visitLoadInst | ( | LoadInst & | I | ) |
Definition at line 696 of file MemoryBuiltins.cpp.
SizeOffsetType ObjectSizeOffsetVisitor::visitPHINode | ( | PHINode & | ) |
Definition at line 701 of file MemoryBuiltins.cpp.
SizeOffsetType ObjectSizeOffsetVisitor::visitSelectInst | ( | SelectInst & | I | ) |
Definition at line 706 of file MemoryBuiltins.cpp.
References bothKnown(), compute(), llvm::ObjectSizeOpts::EvalMode, llvm::SelectInst::getFalseValue(), getSizeWithOverflow(), llvm::SelectInst::getTrueValue(), llvm::ObjectSizeOpts::Max, llvm::ObjectSizeOpts::Min, llvm::APInt::sgt(), and llvm::APInt::slt().
SizeOffsetType ObjectSizeOffsetVisitor::visitUndefValue | ( | UndefValue & | ) |
Definition at line 734 of file MemoryBuiltins.cpp.
Referenced by compute().