Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!world!iecc!compilers-sender From: pardo@cs.washington.edu (David Keppel) Newsgroups: comp.compilers Subject: Re: TEMPORARIES in Reg. Alloc. Keywords: design, registers, optimize Message-ID: <9104022112.AA28003@june.cs.washington.edu> Date: 2 Apr 91 21:12:20 GMT References: <401@rangkom.MY> Sender: compilers-sender@iecc.cambridge.ma.us Reply-To: pardo@cs.washington.edu (David Keppel) Organization: Computer Science & Engineering, U. of Washington, Seattle Lines: 41 Approved: compilers@iecc.cambridge.ma.us napi@rangkom.MY writes: >[How about letting temporaries fight for registers rather than > just pre-allocating a fixed number of registers?] My off-the-hat response: If your IR contains only primitive machine operations and if register allocation is done on the IR, then that's probably what you're doing already. For example: C: x = y + z * x; IR: t1 = z * x; x = y * t1; Loop induction and unrolling are machine-independent optimizations (that may have machine-dependent profitability) which can add and delete program variables and can add long- lived temporaries. Most compilers will probably (I'm guessing) treat those compiler-introduced temporaries as variables, at for the register allocator. With statement-level or basic-block optimizations, most temporaries are ``very temps'' and only one or two are needed at any given time. Thus, on machines with a large number (~30) of registers, the differences between pre-allocation and integrated allocation will be small. For sophisticated optimizations, I do not know and do not care to guess. Merging variables and temporaries can, in general, cause a phase ordering conflict with instruction selection. Which instruction sequence the compiler picks may depend on how many registers are available. How many registers are avaialible depends on how many temporaries are in use. How many temporaries are in use depends on the instruction sequence. ;-D on ( Optim eyes ) Pardo -- Send compilers articles to compilers@iecc.cambridge.ma.us or {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.