diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/MemoryBuiltins.h | 34 | ||||
-rw-r--r-- | include/llvm/Instructions.h | 5 |
2 files changed, 22 insertions, 17 deletions
diff --git a/include/llvm/Analysis/MemoryBuiltins.h b/include/llvm/Analysis/MemoryBuiltins.h index 42721944b3..6944564b8f 100644 --- a/include/llvm/Analysis/MemoryBuiltins.h +++ b/include/llvm/Analysis/MemoryBuiltins.h @@ -33,44 +33,48 @@ bool isMalloc(const Value *I); /// extractMallocCall - Returns the corresponding CallInst if the instruction /// is a malloc call. Since CallInst::CreateMalloc() only creates calls, we /// ignore InvokeInst here. -const CallInst* extractMallocCall(const Value *I); -CallInst* extractMallocCall(Value *I); +const CallInst *extractMallocCall(const Value *I); +CallInst *extractMallocCall(Value *I); /// extractMallocCallFromBitCast - Returns the corresponding CallInst if the /// instruction is a bitcast of the result of a malloc call. -const CallInst* extractMallocCallFromBitCast(const Value *I); -CallInst* extractMallocCallFromBitCast(Value *I); +const CallInst *extractMallocCallFromBitCast(const Value *I); +CallInst *extractMallocCallFromBitCast(Value *I); /// isArrayMalloc - Returns the corresponding CallInst if the instruction /// 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, const TargetData *TD); -const CallInst* isArrayMalloc(const Value *I, +CallInst *isArrayMalloc(Value *I, const TargetData *TD); +const CallInst *isArrayMalloc(const Value *I, const TargetData *TD); /// getMallocType - Returns the PointerType resulting from the malloc call. -/// This PointerType is the result type of the call's only bitcast use. -/// If there is no unique bitcast use, then return NULL. -const PointerType* getMallocType(const CallInst *CI); +/// The PointerType depends on the number of bitcast uses of the malloc call: +/// 0: PointerType is the malloc calls' return type. +/// 1: PointerType is the bitcast's result type. +/// >1: Unique PointerType cannot be determined, return NULL. +const PointerType *getMallocType(const CallInst *CI); -/// getMallocAllocatedType - Returns the Type allocated by malloc call. This -/// Type is the result type of the call's only bitcast use. If there is no -/// unique bitcast use, then return NULL. -const Type* getMallocAllocatedType(const CallInst *CI); +/// getMallocAllocatedType - Returns the Type allocated by malloc call. +/// The Type depends on the number of bitcast uses of the malloc call: +/// 0: PointerType is the malloc calls' return type. +/// 1: PointerType is the bitcast's result type. +/// >1: Unique PointerType cannot be determined, return NULL. +const Type *getMallocAllocatedType(const CallInst *CI); /// 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, const TargetData *TD); +Value *getMallocArraySize(CallInst *CI, const TargetData *TD); //===----------------------------------------------------------------------===// // free Call Utility Functions. // /// isFreeCall - Returns true if the the value is a call to the builtin free() -bool isFreeCall(const Value* I); +bool isFreeCall(const Value *I); } // End llvm namespace diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index 28854dfe03..5b48e1a5d2 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -899,11 +899,12 @@ public: /// 3. Bitcast the result of the malloc call to the specified type. static Instruction *CreateMalloc(Instruction *InsertBefore, const Type *IntPtrTy, const Type *AllocTy, - Value *ArraySize = 0, + Value *AllocSize, Value *ArraySize = 0, const Twine &Name = ""); static Instruction *CreateMalloc(BasicBlock *InsertAtEnd, const Type *IntPtrTy, const Type *AllocTy, - Value *ArraySize = 0, Function* MallocF = 0, + Value *AllocSize, Value *ArraySize = 0, + Function* MallocF = 0, const Twine &Name = ""); /// CreateFree - Generate the IR for a call to the builtin free function. static void CreateFree(Value* Source, Instruction *InsertBefore); |