diff options
Diffstat (limited to 'include/llvm/Analysis/MemoryBuiltins.h')
-rw-r--r-- | include/llvm/Analysis/MemoryBuiltins.h | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/include/llvm/Analysis/MemoryBuiltins.h b/include/llvm/Analysis/MemoryBuiltins.h index 6395d29c68..5fd0bb09db 100644 --- a/include/llvm/Analysis/MemoryBuiltins.h +++ b/include/llvm/Analysis/MemoryBuiltins.h @@ -43,15 +43,8 @@ const CallInst* extractMallocCallFromBitCast(const Value* I); CallInst* extractMallocCallFromBitCast(Value* I); /// isArrayMalloc - Returns the corresponding CallInst if the instruction -/// matches the malloc call IR generated by CallInst::CreateMalloc(). This -/// means that it is a malloc call with one bitcast use AND the malloc call's -/// size argument is: -/// 1. a constant not equal to the size of the malloced type -/// or -/// 2. the result of a multiplication by the size of the malloced type -/// Otherwise it returns NULL. -/// The unique bitcast is needed to determine the type/size of the array -/// allocation. +/// is a call to malloc whose array size can be determined and the array size +/// is not constant 1. Otherwise, return NULL. CallInst* isArrayMalloc(Value* I, LLVMContext &Context, const TargetData* TD); const CallInst* isArrayMalloc(const Value* I, LLVMContext &Context, const TargetData* TD); @@ -66,16 +59,10 @@ const PointerType* getMallocType(const CallInst* CI); /// unique bitcast use, then return NULL. const Type* getMallocAllocatedType(const CallInst* CI); -/// getMallocArraySize - Returns the array size of a malloc call. For array -/// mallocs, the size is computated in 1 of 3 ways: -/// 1. If the element type is of size 1, then array size is the argument to -/// malloc. -/// 2. Else if the malloc's argument is a constant, the array size is that -/// argument divided by the element type's size. -/// 3. Else the malloc argument must be a multiplication and the array size is -/// the first operand of the multiplication. -/// For non-array mallocs, the computed size is constant 1. -/// This function returns NULL for all mallocs whose array size cannot be +/// getMallocArraySize - Returns the array size of a malloc call. If the +/// argument passed to malloc is a multiple of the size of the malloced type, +/// then return that multiple. For non-array mallocs, the multiple is +/// constant 1. Otherwise, return NULL for mallocs whose array size cannot be /// determined. Value* getMallocArraySize(CallInst* CI, LLVMContext &Context, const TargetData* TD); |