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

Re: [RFC] asm goto


On Jul 29, 2009, at 6:33 AM, Paolo Bonzini wrote:

> and it needs a means to specify the exit block/exceptions.

Hmm?

What if I want to say that the asm might throw an exception? That requires an edge to the exit block.

You can add a label and throw there, like:


#define JO _JO(__COUNTER__)

#define_JO(N) \
{ \
 register char *foo asm("%rax"); \
 if (1) \
   asm goto ("mov %0, %%rax; jo %l0" : : "a" ("overflow") : : \
            throw##N); \
 else throw##N: throw overflow_exception(foo); \
}

On Jul 29, 2009, at 8:34 AM, Richard Henderson wrote:


No it doesn't.  Exception handling isn't modeled that way.
It does require stmt_could_throw_p return true though.

When I said "exception" I was referring to whatever the language models as such. As I said before "The functional-language-to-C people will certainly abuse this extension." They don't necessarily convert their exception model into GCC's model. An edge to the exit block is likely more than sufficient for some situations, including cases like noreturn.


+------------------------------------------------------------+
| Alexander M. Rosenberg        <mailto:alexr@leftfield.org> |
| Nobody cares what I say, so no disclaimer appears here.    |


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