Re: Register allocation in special circumstancies

Tom Payne <thp@hill.cs.ucr.edu>
4 Feb 2001 22:13:33 -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: Tom Payne <thp@hill.cs.ucr.edu>
Newsgroups: comp.compilers
Date: 4 Feb 2001 22:13:33 -0500
Organization: University of California, Riverside
References: 01-02-014
Keywords: C
Posted-Date: 04 Feb 2001 22:13:32 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.


Hmmmm. If you implement setjmp by saving every register and longjmp
by restoring every register, then you have the problem that
longjmp'ing might reset some variables to obsolete values. The C
standard allows for that in the case of variables that are local to
the function in which the corresponding setjmp occurred, but that
still leaves a problem with any global that is register resident at
some setjmp point. Would it work to give each problematic global a
"home" memory location and, just before each occurrence of setjmp or
longjmp, to spill each register-resident problematic global to its
home location?


Tom Payne


Post a followup to this message

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