This is the mail archive of the 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]
Other format: [Raw text]

Re: [RFC] asm goto

On 07/27/2009 07:44 PM, Chris Lattner wrote:
Does it matter if you get duplicate entries in "trace_table"? The
compiler is allowed to duplicate the asm. Using %= in the asm would be
more fool-proof, but it wouldn't work with your approach.

If the asm gets duplicated, it won't be a duplicate pair in trace_table. You're forgetting the 0: label.

How does this affect the CFG? The compiler has to assume an abnormal
edge coming out of the asm?

Nope, the compiler has a normal edge coming out. And since it can manipulate the vector of labels attached to the asm, it can easily redirect the label if it wants to, e.g., split a critical edge.

One nice thing about the "asm goto" approach is that you'll probably get
a more obvious diagnostic out of a compiler that doesn't support this


void f1(void) { bar: asm goto("" : : : : bar); }
void f2(void) { foo: asm ("" : : : : foo); }

zz.c: In function ‘f1’:
zz.c:1: error: expected ‘(’ before ‘goto’
zz.c:1: error: expected identifier or ‘*’ before ‘(’ token
zz.c: In function ‘f2’:
zz.c:2: error: expected string literal before ‘:’ token

With gcc 4.4, the messages are sort of equally bad.


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