This is the mail archive of the gcc-help@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: Inline assembly and clobbered registers


ludo@gnu.org (Ludovic CourtÃs) writes:

> Yes, thatâs why Iâm asking for ideas to work around this.  :-)

Ah, yes, trying to catch up now.

> Namely, clobbering a specific register doesnât sound wise here since
> this asm snippet will be part of the bytecode interpreter, where GCCâs
> register allocator can supposedly do a better job if I donât make its
> life harder by clobbering an arbitrarily-chosen register.

I would do this anyhow.  Assuming your target has several general
purpose registers, then the register allocator will work around the loss
of one of them across an asm statement.  How about something like

   int result asm ("r1");

and then mark the asm as clobbering r1.

Ian


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