[llvm-commits] [poolalloc] r130069 - /poolalloc/trunk/lib/AssistDS/TypeChecks.cpp
Arushi Aggarwal
aggarwa4 at illinois.edu
Sat Apr 23 12:54:27 PDT 2011
Author: aggarwa4
Date: Sat Apr 23 14:54:27 2011
New Revision: 130069
URL: http://llvm.org/viewvc/llvm-project?rev=130069&view=rev
Log:
Handle realloc.
Modified:
poolalloc/trunk/lib/AssistDS/TypeChecks.cpp
Modified: poolalloc/trunk/lib/AssistDS/TypeChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/TypeChecks.cpp?rev=130069&r1=130068&r2=130069&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/TypeChecks.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/TypeChecks.cpp Sat Apr 23 14:54:27 2011
@@ -286,7 +286,6 @@
// Special case handling of certain libc allocation functions here.
if (Function *F = dyn_cast<Function>(Callee))
if (F->isIntrinsic()) {
- CS.getInstruction()->dump();
switch(F->getIntrinsicID()) {
case Intrinsic::memcpy:
case Intrinsic::memmove:
@@ -306,8 +305,22 @@
case Intrinsic::memset:
break;
}
+ } else if(F->getNameStr() == "realloc") {
+ CastInst *BCI_Src = BitCastInst::CreatePointerCast(I->getOperand(1), VoidPtrTy);
+ CastInst *BCI_Dest = BitCastInst::CreatePointerCast(I, VoidPtrTy);
+ BCI_Src->insertAfter(I);
+ BCI_Dest->insertAfter(BCI_Src);
+ std::vector<Value *> Args;
+ Args.push_back(BCI_Dest);
+ Args.push_back(BCI_Src);
+ Args.push_back(I->getOperand(2));
+ Args.push_back(ConstantInt::get(Int32Ty, tagCounter++));
+ Constant *F = M.getOrInsertFunction("copyTypeInfo", VoidTy, VoidPtrTy, VoidPtrTy, I->getOperand(2)->getType(), Int32Ty, NULL);
+ CallInst *CI = CallInst::Create(F, Args.begin(), Args.end());
+ CI->insertAfter(BCI_Dest);
}
+
return true;
}
More information about the llvm-commits
mailing list