[cfe-commits] [patch] Implement -finstrument-functions

Nelson Elhage nelhage at nelhage.com
Sat Jun 19 10:01:11 PDT 2010


Thanks for the comments! Revised patch is attached. There's one point I
wasn't totally clear on, though, so this may need another revision:

On Fri, 18 Jun 2010 22:04:53 -0700, Chris Lattner <clattner at apple.com> wrote:
> On Jun 18, 2010, at 8:41 PM, Nelson Elhage wrote:
> 
> 
> +                      llvm::ConstantExpr::getBitCast(CurFn, PointerTy),
> 
> This can go away when you use CreateRuntimeFunction.

The instrumentation functions are typed as void (i8*, i8*). Since CurFn
isn't an i8*, there needs to be a cast somewhere. My revised patch asks
CreateRuntimeFunction for a __cyg_profile_func_* typed as void
(typeof(CurFn), i8*), which it will bitcast for me. I assume this is
what you were suggesting?

But that means that __cyg_profile_func_enter will end up declared as
taking a pointer to whatever function type CodeGenFunction sees first,
which seems to work fine, but doesn't seem correct. Should I be doing
something to ensure that it gets initially declared with the correct
type?

> 
> 
> +static void HandleNoInstrumentFunctionAttr(Decl *d, const AttributeList &Attr, Sema &S) {
> +  // check the attribute arguments.
> 
> Please stay in 80 cols.
> 
> Otherwise, the patch looks great!  Thanks for adding this, please send
> in a revised patch and I'm happy to commit it for you if you don't
> already have commit access.

Thanks. I don't have commit access -- This is only the third patch I've
sent in, so I'll hold off on asking for it unless I continue coming up
with patches.

> 
> -Chris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: instrument-functions.diff
Type: text/x-diff
Size: 10461 bytes
Desc: Implement -finstrument-functions
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100619/762ea21e/attachment.diff>


More information about the cfe-commits mailing list