This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Is it possible to have non-optimised block within a source file.



"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]