[llvm-commits] [poolalloc] r132568 - /poolalloc/trunk/lib/AssistDS/TypeChecks.cpp
Arushi Aggarwal
aggarwa4 at illinois.edu
Fri Jun 3 11:18:12 PDT 2011
Author: aggarwa4
Date: Fri Jun 3 13:18:12 2011
New Revision: 132568
URL: http://llvm.org/viewvc/llvm-project?rev=132568&view=rev
Log:
1. visitAddressTakenFunctions, is only for non var-arg
function. The new function created must also be non var-arg.
2. Handle sprintf.
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=132568&r1=132567&r2=132568&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/TypeChecks.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/TypeChecks.cpp Fri Jun 3 13:18:12 2011
@@ -460,7 +460,7 @@
}
// 2. Create the new function prototype
- const FunctionType *NewFTy = FunctionType::get(F.getReturnType(), TP, true);
+ const FunctionType *NewFTy = FunctionType::get(F.getReturnType(), TP, false);
Function *NewF = Function::Create(NewFTy,
GlobalValue::InternalLinkage,
F.getNameStr() + ".mod",
@@ -1397,6 +1397,21 @@
Args.push_back(ConstantInt::get(Int32Ty, tagCounter++));
CallInst::Create(trackInitInst, Args.begin(), Args.end(), "", I);
return true;
+ } else if(F->getNameStr() == std::string("sprintf")) {
+ CastInst *BCI = BitCastInst::CreatePointerCast(I->getOperand(1), VoidPtrTy, "", I);
+ std::vector<Value*>Args;
+ Args.push_back(BCI);
+ CastInst *Size = CastInst::CreateIntegerCast(I, Int64Ty, false);
+ Size->insertAfter(I);
+ Constant *One = ConstantInt::get(Int64Ty, 1);
+ Instruction *NewValue = BinaryOperator::Create(BinaryOperator::Add,
+ Size,
+ One);
+ NewValue->insertAfter(Size);
+ Args.push_back(NewValue);
+ Args.push_back(ConstantInt::get(Int32Ty, tagCounter++));
+ CallInst *CINew = CallInst::Create(trackInitInst, Args.begin(), Args.end());
+ CINew->insertAfter(NewValue);
} else if(F->getNameStr() == std::string("sscanf")) {
// FIXME: Need to look at the format string and check
unsigned i = 3;
More information about the llvm-commits
mailing list