On 8/7/06, Chris Lattner <sabre at nondot.org> wrote:> > On Sun, 6 Aug 2006, Anton Vayvod wrote: > > I'm developing a register allocator that works iteratively. It spills > some > > virtual registers on each iteration until all the rest have physical > ones > > assigned. > > Take a look at the linear scan allocator. It is also iterative: it uses > the spiller interface to insert spill code, which creates (unspillable) > intervals for the spill code it inserts. > > > How can I spill some live intervals at the end of each iteration with > new > > live intervals having correct weights? > > The linscan allocator inserts spill code with infinite weight, take a look > at how it works.So, as far as I understood live intervals with weight equal to HUGE_VAL are spilled and I don't need to allocate physical registers for them, right? Shoud hasStackSlot method of VirtRegMap return true for these intervals' reg members? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060821/d306aec5/attachment.html>
Fernando Magno Quintao Pereira
2006-Aug-21 18:22 UTC
[LLVMdev] Recalculating live intervals
Well, someone correct me if am wrong, but, you still have to allocate physical registers to them, because their values must be reloaded before been used. But after you spill a register, you break its live ranges, so, each use of that register can be loaded into a different physical. In my register allocator, after I spill reg_v: For each use of reg_v: create a new reg_v' replace reg_v by reg_v' If the instruction containing reg_v' hasn't been scanned by the register allocator, when it happens, reg_v' will receive a physical register. You must assign to reg_v' a weight such that is is not spilled again, otherwise you may enter on an infinite loop, always spilling the same spilled register. Fernando> > So, as far as I understood live intervals with weight equal to HUGE_VAL are > spilled and I don't need to allocate physical registers for them, right? > Shoud hasStackSlot method of VirtRegMap return true for these intervals' reg > members? >
So what addIntervalsToSpills returns are new intervals to allocate with infinite weights, right? And I need not to allocate the old interval. Should hasStackSlot return true on its register then? On 8/21/06, Fernando Magno Quintao Pereira <fernando at cs.ucla.edu> wrote:> > > Well, someone correct me if am wrong, but, you still have to allocate > physical registers to them, because their values must be reloaded before > been used. But after you spill a register, you break its live ranges, so, > each use of that register can be loaded into a different physical. In my > register allocator, after I spill reg_v: > > For each use of reg_v: > create a new reg_v' > replace reg_v by reg_v' > > If the instruction containing reg_v' hasn't been scanned by the register > allocator, when it happens, reg_v' will receive a physical register. You > must assign to reg_v' a weight such that is is not spilled again, > otherwise you may enter on an infinite loop, always spilling the same > spilled register. > > Fernando > > > > > So, as far as I understood live intervals with weight equal to HUGE_VAL > are > > spilled and I don't need to allocate physical registers for them, right? > > Shoud hasStackSlot method of VirtRegMap return true for these intervals' > reg > > members? > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- Nae king! Nae quin! Nae laird! Nae master! We willnae be fooled again! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060821/1c8f5715/attachment.html>