This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: '%=' invalid? (inline assembly)


Dave Korn wrote on 06 May 2008 18:40:

>> Why does '%=' not work in code directly copied from the gcc sources?
> 
>   The stuff in .md files is not inline assembly and cannot be [ ... ]

  Having said all that, we still have your original problem to deal with:

> Cristiano Di Buduo wrote on 06 May 2008 18:16:
> 
>> Hi, i'm porting a project to gcc, and it heavily relies on inline
>> assembly. 
>> 
>> I have some inline functions that, when optimized, generate duplicate
>> labels. So i read through the docs, and stumbled upon the %=
>> functionality.

  So, if all you need is a unique label each place the function is inlined for
a short loop or branch, you have a couple of options, that let you get unique
symbols at the assembler level, not at the compiler.

  Assuming you're using GAS, it allows you to define "local symbols" (not to
be confused with local labels, that begin with 'L'; a local symbol uses an
integer as a label, and then in your code you can refer to the nearest local
symbol with that number.  See the "Symbol names" chapter of the GAS docs.

  A second option might be to try and make use of the "\@" feature of macros,
although I'm not sure how easy that would be; you might have to do some
trickery to avoid emitting the macro definition repeatedly every time the asm
got inlined.

  So the local symbol option is probably your best and simplest bet.


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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