gcc-patches@gcc.gnu.org
[Top] [All Lists]

Re: [PATCH] Attribute noclone

Subject: Re: [PATCH] Attribute noclone
From: Richard Henderson
Date: Fri, 24 Jul 2009 07:43:07 -0700
On 07/24/2009 05:56 AM, Richard Guenther wrote:
Users should use noinline if inlining a function would violate constraints
they set.  I can't see what constraints would not be violated by cloning
at the same time.

static void __attribute__((noinline))
large_stack_usage (int x, int y)
{
  ...
}

void
small_stack_usage (int x)
{
  if (x)
    large_stack_usage (1, 2);
}

void
trans_mem_usage (void)
{
  __tm_atomic {
    small_stack_usage (1);
  }
}

We really don't care if large_stack_usage gets cloned with those
constant parameters.  We also wouldn't care if it gets cloned to
instrument its memory usage for the atomic transaction.

I'm convinced it should be a separate attribute.  Though I still
think noclone is too big of a stick, I don't have a concrete
suggestion to replace it.

Most users will know about inlining but I suspect very few have the
idea of the compiler cloning their functions.

Yep, and because of that I don't believe most will have an
informed opinion as to whether it should be disabled.

I'm totally unconcerned with how __builtin_return_address is
"affected".  It's still doing its job properly.  I think it's
just our documentation that's unnecessarily alarmist.


r~

<Prev in Thread] Current Thread [Next in Thread>