LLVM API Documentation
#include "llvm/Analysis/MemoryBuiltins.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/Statistic.h"#include "llvm/Analysis/ValueTracking.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/GlobalVariable.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/Intrinsics.h"#include "llvm/IR/Metadata.h"#include "llvm/IR/Module.h"#include "llvm/Support/Debug.h"#include "llvm/Support/MathExtras.h"#include "llvm/Support/raw_ostream.h"#include "llvm/Target/TargetLibraryInfo.h"#include "llvm/Transforms/Utils/Local.h"
Go to the source code of this file.
Classes | |
| struct | AllocFnsTy |
Macros | |
| #define | DEBUG_TYPE "memory-builtins" |
Enumerations | |
| enum | AllocType { OpNewLike = 1<<0, MallocLike = 1<<1 | OpNewLike, CallocLike = 1<<2, ReallocLike = 1<<3, StrDupLike = 1<<4, AllocLike = MallocLike | CallocLike | StrDupLike, AnyAlloc = AllocLike | ReallocLike } |
Functions | |
| static Function * | getCalledFunction (const Value *V, bool LookThroughBitCast) |
| static const AllocFnsTy * | getAllocationData (const Value *V, AllocType AllocTy, const TargetLibraryInfo *TLI, bool LookThroughBitCast=false) |
| Returns the allocation data for the given value if it is a call to a known allocation function, and NULL otherwise. More... | |
| static bool | hasNoAliasAttr (const Value *V, bool LookThroughBitCast) |
| static Value * | computeArraySize (const CallInst *CI, const DataLayout *DL, const TargetLibraryInfo *TLI, bool LookThroughSExt=false) |
| STATISTIC (ObjectVisitorArgument,"Number of arguments with unsolved size and offset") | |
| STATISTIC (ObjectVisitorLoad,"Number of load instructions with unsolved size and offset") | |
Variables | |
| static const AllocFnsTy | AllocationFnData [] |
| #define DEBUG_TYPE "memory-builtins" |
Definition at line 15 of file MemoryBuiltins.cpp.
| enum AllocType |
| Enumerator | |
|---|---|
| OpNewLike | |
| MallocLike | |
| CallocLike | |
| ReallocLike | |
| StrDupLike | |
| AllocLike | |
| AnyAlloc | |
Definition at line 33 of file MemoryBuiltins.cpp.
|
static |
Definition at line 208 of file MemoryBuiltins.cpp.
References llvm::ComputeMultiple(), llvm::CallInst::getArgOperand(), llvm::getMallocAllocatedType(), llvm::StructLayout::getSizeInBytes(), llvm::DataLayout::getStructLayout(), llvm::DataLayout::getTypeAllocSize(), llvm::Type::isSized(), and llvm::A64DB::ST.
Referenced by llvm::getMallocArraySize(), and llvm::isArrayMalloc().
|
static |
Returns the allocation data for the given value if it is a call to a known allocation function, and NULL otherwise.
Definition at line 92 of file MemoryBuiltins.cpp.
References AllocationFnData, AllocFnsTy::AllocTy, llvm::array_lengthof(), AllocFnsTy::FstParam, getCalledFunction(), llvm::Type::getContext(), llvm::Function::getFunctionType(), llvm::Type::getInt8PtrTy(), llvm::TargetLibraryInfo::getLibFunc(), llvm::Value::getName(), llvm::FunctionType::getNumParams(), llvm::FunctionType::getParamType(), llvm::FunctionType::getReturnType(), llvm::TargetLibraryInfo::has(), llvm::Type::isIntegerTy(), AllocFnsTy::NumParams, and AllocFnsTy::SndParam.
Referenced by llvm::isAllocationFn(), llvm::isAllocLikeFn(), llvm::isCallocLikeFn(), llvm::isMallocLikeFn(), llvm::isOperatorNewLikeFn(), llvm::isReallocLikeFn(), llvm::ObjectSizeOffsetVisitor::visitCallSite(), and llvm::ObjectSizeOffsetEvaluator::visitCallSite().
Definition at line 73 of file MemoryBuiltins.cpp.
References llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledFunction(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), llvm::GlobalValue::isDeclaration(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::isNoBuiltin(), and llvm::Value::stripPointerCasts().
Referenced by getAllocationData().
Definition at line 141 of file MemoryBuiltins.cpp.
References llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::hasFnAttr(), llvm::Attribute::NoAlias, and llvm::Value::stripPointerCasts().
Referenced by llvm::isNoAliasFn().
| STATISTIC | ( | ObjectVisitorArgument | , |
| "Number of arguments with unsolved size and offset" | |||
| ) |
| STATISTIC | ( | ObjectVisitorLoad | , |
| "Number of load instructions with unsolved size and offset" | |||
| ) |
|
static |
Definition at line 53 of file MemoryBuiltins.cpp.
Referenced by getAllocationData().