diff options
author | Chris Lattner <sabre@nondot.org> | 2010-06-23 05:21:28 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-06-23 05:21:28 +0000 |
commit | b48a2d5d2fb71df0ff5cbfc33d0879da19ead9f4 (patch) | |
tree | 560677b7307183e1f6c0155b55a2718f394e4df8 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 2213aa360a792272957625d7713178252971998e (diff) | |
download | bcm5719-llvm-b48a2d5d2fb71df0ff5cbfc33d0879da19ead9f4.tar.gz bcm5719-llvm-b48a2d5d2fb71df0ff5cbfc33d0879da19ead9f4.zip |
polish the -finstrument-functions implementation, patch by Nelson Elhage!
llvm-svn: 106618
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 8a0b41a7cad..704de3531c8 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -180,11 +180,14 @@ void CodeGenFunction::EmitFunctionInstrumentation(const char *Fn) { if (!ShouldInstrumentFunction()) return; + const llvm::PointerType *PointerTy; const llvm::FunctionType *FunctionTy; std::vector<const llvm::Type*> ProfileFuncArgs; - ProfileFuncArgs.push_back(CurFn->getType()); - ProfileFuncArgs.push_back(llvm::Type::getInt8PtrTy(VMContext)); + // void __cyg_profile_func_{enter,exit} (void *this_fn, void *call_site); + PointerTy = llvm::Type::getInt8PtrTy(VMContext); + ProfileFuncArgs.push_back(PointerTy); + ProfileFuncArgs.push_back(PointerTy); FunctionTy = llvm::FunctionType::get( llvm::Type::getVoidTy(VMContext), ProfileFuncArgs, false); @@ -195,7 +198,9 @@ void CodeGenFunction::EmitFunctionInstrumentation(const char *Fn) { llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), 0), "callsite"); - Builder.CreateCall2(F, CurFn, CallSite); + Builder.CreateCall2(F, + llvm::ConstantExpr::getBitCast(CurFn, PointerTy), + CallSite); } void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, |