Related articles |
---|
Interaction between optimizer and inline asm in gcc? colohan+@cs.cmu.edu (Christopher Brian Colohan) (2002-05-17) |
Re: Interaction between optimizer and inline asm in gcc? loewis@informatik.hu-berlin.de (2002-05-23) |
Re: Interaction between optimizer and inline asm in gcc? sam@zoy.org (2002-05-23) |
Re: Interaction between optimizer and inline asm in gcc? journeyman@compilerguru.com (2002-05-23) |
Re: Interaction between optimizer and inline asm in gcc? kg_russell@yahoo.co.uk (2002-05-23) |
From: | journeyman@compilerguru.com (journeyman) |
Newsgroups: | comp.compilers |
Date: | 23 May 2002 01:48:26 -0400 |
Organization: | Giganews.Com - Premium News Outsourcing |
References: | 02-05-092 |
Keywords: | GCC, optimize, comment |
Posted-Date: | 23 May 2002 01:48:26 EDT |
On 17 May 2002 00:27:03 -0400, Christopher Brian Colohan
<colohan+@cs.cmu.edu> wrote:
>I am working on an architecture research project where we are using
>inline assembly instructions to instrument and change the behaviour of
>loops.
>
>I was wondering if anyone has looked into the impact of doing this on
>gcc's optimizer: in other words, how conservatively does gcc treat
>inline asm statements? For example, would inserting such a statement
>inhibit loop unrolling?
I don't know how GCC does it, but I will be implementing inline ASM
some time in the near future on my project. There are 2 basic ways to
do it. Either the optimizer knows something about the semantics of
the asm code and can deal with it, or it punts, turning off
optimizations. As a wild guess, I'd say how gcc handles it is up to
whoever ports to a particular architecture, but the only portable way
of doing it is to punt on asm.
In our compiler, the parser already passes asm as a string to the back
end. The back end will just pass it through to the assembler. I plan
to treat asm code as a function call. It's responsible for saving the
nonvolatile registers, and the caller assumes anything global can be
touched. If it touches a local variable, the variable will have to be
declared volatile.
Morris
[GCC is smarter than that about inline asm. See the documentation. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.