aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorVictor Hernandez <vhernandez@apple.com>2009-09-18 19:20:02 +0000
committerVictor Hernandez <vhernandez@apple.com>2009-09-18 19:20:02 +0000
commit88d9839d07a6b5a03484d664913de0f2b33d3bff (patch)
tree67e7dc39ea2679b1d969d34e5d08ea176aa7d569 /include
parent6ba2e87061bad9a24c75db69ab9b80bb6e16d96b (diff)
downloadexternal_llvm-88d9839d07a6b5a03484d664913de0f2b33d3bff.zip
external_llvm-88d9839d07a6b5a03484d664913de0f2b33d3bff.tar.gz
external_llvm-88d9839d07a6b5a03484d664913de0f2b33d3bff.tar.bz2
Update malloc call creation code (AllocType is now the element type of the malloc, not the resulting type).
In getMallocArraySize(), fix bug in the case that array size is the product of 2 constants. Extend isArrayMalloc() and getMallocArraySize() to handle case where malloc is used as char array. Ensure that ArraySize in LowerAllocations::runOnBasicBlock() is correct type. Extend Instruction::isSafeToSpeculativelyExecute() to handle malloc calls. Add verification for malloc calls. Reviewed by Dan Gohman. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82257 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/MallocHelper.h14
-rw-r--r--include/llvm/Instructions.h12
2 files changed, 13 insertions, 13 deletions
diff --git a/include/llvm/Analysis/MallocHelper.h b/include/llvm/Analysis/MallocHelper.h
index 06959ab..0588dff 100644
--- a/include/llvm/Analysis/MallocHelper.h
+++ b/include/llvm/Analysis/MallocHelper.h
@@ -16,11 +16,10 @@
#define LLVM_ANALYSIS_MALLOCHELPER_H
namespace llvm {
-class BitCastInst;
class CallInst;
-class Instruction;
+class LLVMContext;
class PointerType;
-class Twine;
+class TargetData;
class Type;
class Value;
@@ -31,7 +30,6 @@ class Value;
/// isMalloc - Returns true if the the value is either a malloc call or a
/// bitcast of the result of a malloc call
bool isMalloc(const Value* I);
-bool isMalloc(Value* I);
/// extractMallocCall - Returns the corresponding CallInst if the instruction
/// is a malloc call. Since CallInst::CreateMalloc() only creates calls, we
@@ -54,8 +52,9 @@ CallInst* extractMallocCallFromBitCast(Value* I);
/// Otherwise it returns NULL.
/// The unique bitcast is needed to determine the type/size of the array
/// allocation.
-CallInst* isArrayMalloc(Value* I);
-const CallInst* isArrayMalloc(const Value* I);
+CallInst* isArrayMalloc(Value* I, LLVMContext &Context, const TargetData* TD);
+const CallInst* isArrayMalloc(const Value* I, LLVMContext &Context,
+ 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.
@@ -79,7 +78,8 @@ const Type* getMallocAllocatedType(const CallInst* CI);
/// 1. The malloc call's allocated type cannot be determined.
/// 2. IR wasn't created by a call to CallInst::CreateMalloc() with a non-NULL
/// ArraySize.
-Value* getMallocArraySize(CallInst* CI);
+Value* getMallocArraySize(CallInst* CI, LLVMContext &Context,
+ const TargetData* TD);
} // End llvm namespace
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 637e355..fbee2af 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -1039,12 +1039,12 @@ public:
/// constant 1.
/// 2. Call malloc with that argument.
/// 3. Bitcast the result of the malloc call to the specified type.
- static Value *CreateMalloc(Instruction *I,
- const Type *AllocTy, const Type *IntPtrTy,
- Value *ArraySize = 0, const Twine &NameStr = "");
- static Value *CreateMalloc(BasicBlock *InsertAtEnd,
- const Type *AllocTy, const Type *IntPtrTy,
- Value *ArraySize = 0, const Twine &NameStr = "");
+ static Value *CreateMalloc(Instruction *InsertBefore, const Type *IntPtrTy,
+ const Type *AllocTy, Value *ArraySize = 0,
+ const Twine &Name = "");
+ static Value *CreateMalloc(BasicBlock *InsertAtEnd, const Type *IntPtrTy,
+ const Type *AllocTy, Value *ArraySize = 0,
+ const Twine &Name = "");
~CallInst();