no capture

Hi
   I am wondering when does clang generate the no capture attribute
for the arguments. One of its impacts seems to be that then the
argument is passed directly without storing in the stack. Is that
right?
How do I use the attribute in source ?

Thanks for your help.
shrey

I am wondering when does clang generate the no capture attribute
for the arguments. One of its impacts seems to be that then the
argument is passed directly without storing in the stack. Is that
right?
From LLVM Language Reference Manual — LLVM 16.0.0git documentation :

"nocapture
  This indicates that the callee does not make any copies of the
pointer that outlive the callee itself. This is not a valid attribute
for return values."

Thanks Anton..

Can I enforce this from C source ?
__attribute__(( nocaptue )) gets ignored by clang.

My goal is I would like some of the parameters to be directly passed
as arguments instead of through the stack. Is there a source level way
to do it ?

thanks
shrey

Do you mean that you want something to be passed in registers rather than
on the stack, or do you mean that you have a parameter of struct type which
is being passed indirectly via the stack? The former can sometimes be
overridden by using a different calling convention. The latter is basically
set in stone; you'll need code changes to make it happen if it's important.

We'll need to know what platform you're on and see a code sample
to give you more concrete advice.

John.

My goal is I would like some of the parameters to be directly passed
as arguments instead of through the stack. Is there a source level way
to do it ?

I don't see any connection with the "nocapture" attribute. "inreg"
attribute might help you in your goal.
For C source level support look somewhere near "regparm" attribute.