This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Is it possible to have non-optimised block within a source file.
- To: Geoff Keating <geoffk at geoffk dot org>
- Subject: Re: Is it possible to have non-optimised block within a source file.
- From: "Janis Johnson" <janis at us dot ibm dot com>
- Date: Tue, 26 Jun 2001 16:47:10 -0700
- Cc: gcc at gcc dot gnu dot org
"Geoffrey Keating" <geoffk@geoffk.org> writes:
> "Janis Johnson" <janis@us.ibm.com> writes:
>
> > What Richard needs is a mechanism to provide hook code that will seldom
> > be executed and that, when disabled, won't result in any slowdown to
the
> > function containing the hook.
>
> I notice that your suggestion below doesn't do this, because
> it inserts an extra jump in the code flow.
>
> If you're willing to allow self-modifying code, and don't want a
> global variable, why not just have the equivalent of
>
> asm ("mov %0,#0" : "r"(temp));
> if (__builtin_expect (temp, 0))
> ...
>
> and modify the zero byte in the assembler instruction?
Yes, I think that would do it, and without requiring any changes to the
compiler. Thanks!
Janis