Re: Register allocation in special circumstancies

torbenm@diku.dk (Torben AEgidius Mogensen)
12 Feb 2001 01:16:04 -0500

          From comp.compilers

Related articles
Register allocation in special circumstancies ruff@mcst.ru (Andrey S. Bokhanko) (2001-02-01)
Re: Register allocation in special circumstancies andyjnsn@ma.ultranet.com (Andy Johnson) (2001-02-04)
Re: Register allocation in special circumstancies thp@hill.cs.ucr.edu (Tom Payne) (2001-02-04)
Re: Register allocation in special circumstancies christian.bau@isltd.insignia.com (2001-02-04)
Re: Register allocation in special circumstancies torbenm@diku.dk (2001-02-12)
Re: Register allocation in special circumstancies fjh@cs.mu.OZ.AU (2001-02-15)
Re: Register allocation in special circumstancies christian.bau@isltd.insignia.com (2001-02-15)
Re: Register allocation in special circumstancies vince.delvecchio@spd.analog.com (Vince Del Vecchio) (2001-02-15)
Re: Register allocation in special circumstancies dmr@bell-labs.com (Dennis Ritchie) (2001-02-15)
| List of all articles for this month |

From: torbenm@diku.dk (Torben AEgidius Mogensen)
Newsgroups: comp.compilers
Date: 12 Feb 2001 01:16:04 -0500
Organization: Department of Computer Science, U of Copenhagen
References: 01-02-014
Keywords: registers, optimize
Posted-Date: 12 Feb 2001 01:16:04 EST

"Andrey S. Bokhanko" <ruff@mcst.ru> writes:


>As we all know, C language has nasty (for compiler developers)
>feature: setjmp/longjmp.


>But we can't disable one special optimization: register
>allocation. So, that's where the problem is: if r.a. based on
>classical graph coloring approach, we must construct Register
>Interference Graph (RIG), and hence we must take into account this
>nasty feature of "setjmp" points. But how to do it?


The simplest thing would be to wrap every setjmp inside a function,
which isn't inlined. This way, it won't affect the register allocation
of the function that uses setjmp. And inside the new function you have
a well-defined register state defined by the calling convention, which
makes saving the state fairly simple.


Of course, this adds the cost of a function call to every setjmp, but
that is a small price to pay. And you can argue that anyone wanting to
use such a dirty feature as setjmp/longjmp should be prepared to pay
some price for doing so.


Torben Mogensen (torbenm@diku.dk)





Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.