public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* inline labels
@ 2000-05-23 23:08 Dave Klint
  2000-05-23 23:19 ` Alexandre Oliva
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Klint @ 2000-05-23 23:08 UTC (permalink / raw)
  To: gcc-help

When compiling using the -O3, gcc will decide that some functions
can be inlined and expands them.  This is all well and good, but
when there's an asm() statement in the function with a label in
it, it causes the label to be defined more than once.  Is there
any way around this without reworking the assembly?

-dave

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: inline labels
  2000-05-23 23:08 inline labels Dave Klint
@ 2000-05-23 23:19 ` Alexandre Oliva
  2000-05-24 18:01   ` Dave Klint
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Oliva @ 2000-05-23 23:19 UTC (permalink / raw)
  To: Dave Klint; +Cc: gcc-help

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 875 bytes --]

On May 24, 2000, Dave Klint <davek@ca.mgisoft.com> wrote:

> When compiling using the -O3, gcc will decide that some functions
> can be inlined and expands them.  This is all well and good, but
> when there's an asm() statement in the function with a label in
> it, it causes the label to be defined more than once.  Is there
> any way around this without reworking the assembly?

The GCC manual talks about local labels in assembly statements.  You
may also look for `%='; it's described in the section about output
templates; I'm not sure it can be used in asm statements, though.

-- 
Alexandre Oliva    Enjoy Guaraná, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: inline labels
  2000-05-23 23:19 ` Alexandre Oliva
@ 2000-05-24 18:01   ` Dave Klint
  0 siblings, 0 replies; 3+ messages in thread
From: Dave Klint @ 2000-05-24 18:01 UTC (permalink / raw)
  To: gcc-help

> > When compiling using the -O3, gcc will decide that some functions
> > can be inlined and expands them.  This is all well and good, but
> > when there's an asm() statement in the function with a label in
> > it, it causes the label to be defined more than once.  Is there
> > any way around this without reworking the assembly?
> 
> The GCC manual talks about local labels in assembly statements.  You
> may also look for `%='; it's described in the section about output
> templates; I'm not sure it can be used in asm statements, though.

Just thought I'd post the answer to my own question, there are a lot
of other '%' things then I thought.  I checked the gnu docs at gnu.org
( http://gcc.gnu.org/onlinedocs/gcc_16.html#SEC179 ) and found out 
everything that I ever wanted to know about templates.  I checked the
docs before asking the question, but I guess I just didn't check
well enough.  The '%=' does give you a unique number that you can
use in the inline assembly labels.  For example

asm("movl foo,%eax
.Lfoo%=:
     incl %eax
     jc .Lfoo%="
);

works just fine, and things don't get clobbered when you let gcc
optimize.  Gcc rocks, that all I gotta say.

-dave

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-05-24 18:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-23 23:08 inline labels Dave Klint
2000-05-23 23:19 ` Alexandre Oliva
2000-05-24 18:01   ` Dave Klint

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).