Re: memory operands and Register allocation

Hans-Peter Diettrich <>
Sun, 24 Feb 2008 09:27:05 +0100

          From comp.compilers

Related articles
memory operands and Register allocation (shrey) (2008-02-21)
Re: memory operands and Register allocation (Hans-Peter Diettrich) (2008-02-24)
| List of all articles for this month |

From: Hans-Peter Diettrich <>
Newsgroups: comp.compilers
Date: Sun, 24 Feb 2008 09:27:05 +0100
Organization: Compilers Central
References: 08-02-064
Keywords: registers
Posted-Date: 24 Feb 2008 12:25:54 EST

shrey wrote:

> Traditional RA algorithms are designed to provide a register for
> every operand. But some architectures can access memory directly.
> So instead of add ra, rb, rc -> add memloc1, memloc2, memloc3.

That's okay for one operation, no need to optimize further. When more
operations are involved, intermediate results better should reside in

> Is there any work on how to extend some of traditional algorithms to
> provide for this possibility ?

I'm not sure about algorithms. The costs of using registers vs. memory
are different, and it's only agreed that the cost of memory access is
higher than register access. Now it depends on the actual
(architectural) weights, whether it's cheaper to use an memory operand
instead of reserving a register for it. IMO an optimization problem of
higher order, e.g. linear programming, Simplex algorithm...

Another practical way may be a transformation of the register based
solution into final mixed mode code. Or a quick look at the number of
available registers will show, that for CISC machines (like x86) a
traditional register allocation optimization will be of little use.


Post a followup to this message

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