Re: Register allocation in special circumstancies

christian.bau@isltd.insignia.com (Christian Bau)
4 Feb 2001 22:14:41 -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: christian.bau@isltd.insignia.com (Christian Bau)
Newsgroups: comp.compilers
Date: 4 Feb 2001 22:14:41 -0500
Organization: Insignia Solutions
References: 01-02-014
Keywords: registers, C
Posted-Date: 04 Feb 2001 22:14:40 EST

"Andrey S. Bokhanko" <ruff@mcst.ru> wrote:
> As we all know, C language has nasty (for compiler developers)
> feature: setjmp/longjmp. If there is "setjmp" point in procedure, than
> to explicitly express control flow we have to create control flow
> edges from ALMOST EVERY reachable (from "setjmp" point) operation to
> that "setjmp" point. This is TOO costly (both in memory requirements
> and compilation time), so we decided not to make such edges. Of
> course, this decision prohibit application of wide class of
> optimizations in such procedures, but this is inevitable cost (AFAIK,
> gcc compiler works exactly same way).
>
> 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? I have some ideas,
> but they all are less than ideal, so any help will be gratefully
> appreciated.


In C (and I believe in C++) there is the rule: If a non-volatile variable
is modified between setjmp and longjmp then the contents of that variable
is indeterminate. I very much suspect that if you treat setjmp as a normal
function, implement it by saving and restoring registers, stackpointer and
program counter, AND keep all volatile variables out of registers then you
should be fine.


Post a followup to this message

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