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.


> To: "Janis Johnson" <janis@us.ibm.com>
> From: Geoff Keating <geoffk@geoffk.org>
> Date: 26 Jun 2001 16:02:40 -0700

> 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?

The above, and coupled with a hot indicator and the ability to split a
single function into two or more sections I think would do the trick.
hot0 code is placed in a hot0 section, and so on through hot20.  cold
code is placed into cold0 - cold20.  Builtin expect could then place
cold code into a cold20 section, and place hot code into a hot0
section.  Annotation or profile based feedback could direct hot
functions into hot sections, and cold functions into cold sections and
so on.

In the end, I think we'd get a better end result than having a hook
builtin.

With a little luck, Geoff's suggestion might be a workable first
alternative.  Further, you may be able to

asm ("mov %0,#0" : "r"(temp));
if (__builtin_expect (temp, 0))
  {
    asm ("jmp blabla"
    asm ("section hot20");
    asm ("blabla:")
    bla bla
    asm ("section .text");
  }

in certain vertical situations.  This might have enough functionality
to keep the linux folks happy.  Let us know.  If you let us know what
doesn't work, we may be able to refine this some more.

Anyway, hope this helps.


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