[llvm-commits] [poolalloc] r132031 - in /poolalloc/trunk: include/assistDS/TypeChecks.h lib/AssistDS/TypeChecks.cpp
Arushi Aggarwal
aggarwa4 at illinois.edu
Tue May 24 19:52:45 PDT 2011
Author: aggarwa4
Date: Tue May 24 21:52:45 2011
New Revision: 132031
URL: http://llvm.org/viewvc/llvm-project?rev=132031&view=rev
Log:
WIP. Adding code to instrument indirect function calls.
Modified:
poolalloc/trunk/include/assistDS/TypeChecks.h
poolalloc/trunk/lib/AssistDS/TypeChecks.cpp
Modified: poolalloc/trunk/include/assistDS/TypeChecks.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/TypeChecks.h?rev=132031&r1=132030&r2=132031&view=diff
==============================================================================
--- poolalloc/trunk/include/assistDS/TypeChecks.h (original)
+++ poolalloc/trunk/include/assistDS/TypeChecks.h Tue May 24 21:52:45 2011
@@ -55,6 +55,7 @@
bool visitCallInst(Module &M, CallInst &CI);
bool visitInvokeInst(Module &M, InvokeInst &CI);
bool visitCallSite(Module &M, CallSite CS);
+ bool visitIndirectCallSite(Module &M, CallSite CS);
bool visitInternalFunction(Module &M, Function &F);
bool visitExternalFunction(Module &M, Function &F);
bool visitByValFunction(Module &M, Function &F);
Modified: poolalloc/trunk/lib/AssistDS/TypeChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/TypeChecks.cpp?rev=132031&r1=132030&r2=132031&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/TypeChecks.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/TypeChecks.cpp Tue May 24 21:52:45 2011
@@ -164,7 +164,7 @@
bool
TypeChecks::visitInternalVarArgFunction(Module &M, Function &F) {
- // Modify the function to add a call to get the num of arguments
+
VAArgInst *VASize = NULL;
VAArgInst *VAMetaData = NULL;
CallInst *VAStart = NULL;
@@ -181,7 +181,9 @@
if(CalledF->getIntrinsicID() != Intrinsic::vastart)
continue;
VAStart = CI;
+ // Modify the function to add a call to get the num of arguments
VASize = new VAArgInst(CI->getOperand(1), Int64Ty, "NumArgs");
+ // Modify the function to add a call to get the metadata array
VAMetaData = new VAArgInst(CI->getOperand(1), VoidPtrTy, "MD");
VASize->insertAfter(CI);
VAMetaData->insertAfter(VASize);
@@ -190,7 +192,6 @@
}
assert(VASize && "Varargs function without a call to VAStart???");
- // FIXME:handle external functions
// Modify function to add checks on every var_arg call to ensure that we
// are not accessing more arguments than we passed in.
@@ -274,7 +275,6 @@
bool
TypeChecks::visitByValFunction(Module &M, Function &F) {
-
bool hasByValArg = false;
for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I) {
if (I->hasByValAttr()) {
@@ -992,10 +992,19 @@
i++;
}
}
+ } else {
+ // indirect call site
+ return visitIndirectCallSite(M, CS);
}
return false;
}
+bool TypeChecks::visitIndirectCallSite(Module &M, CallSite CS) {
+ Instruction *I = CS.getInstruction();
+ I->dump();
+ return false;
+}
+
bool TypeChecks::visitInputFunctionValue(Module &M, Value *V, Instruction *CI) {
// Cast the pointer operand to i8* for the runtime function.
CastInst *BCI = BitCastInst::CreatePointerCast(V, VoidPtrTy, "", CI);
More information about the llvm-commits
mailing list