This patch adds parameter "EliminateFI" to RegScavenger::scavengeRegister, which tells register scavenger not to eliminate frame index of the emergency spill slot if set to false. I have pseudo load, store and copy instructions which are generated during register allocation and expanded post-RA but before the final stack size is known. I use register scavenger to search for a temporary integer GPR that is used during pseudo-expansion. This is what happens during pseudo-expansion: The following pseudo LoadAC $acc, FI // Pseudo load instructions. Load from FI to accumulator $acc. is expanded into this sequence: LW $reg, FI // load from FI to temporary GPR $reg MTLO $reg // copy $reg to register LO LW $reg, FI + 4 // load from FI+4 to GPR $reg MTHI $reg // copy $reg to register HI -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130325/d05b1990/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: rs-eliminatefi1.patch Type: application/octet-stream Size: 2353 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130325/d05b1990/attachment.obj>
Jakob Stoklund Olesen
2013-Mar-25 20:06 UTC
[LLVMdev] [PATCH] RegScavenger::scavengeRegister
On Mar 25, 2013, at 12:04 PM, Akira Hatanaka <ahatanak at gmail.com> wrote:> This patch adds parameter "EliminateFI" to RegScavenger::scavengeRegister, which tells register scavenger not to eliminate frame index of the emergency spill slot if set to false. > > I have pseudo load, store and copy instructions which are generated during register allocation and expanded post-RA but before the final stack size is known. I use register scavenger to search for a temporary integer GPR that is used during pseudo-expansion. > > This is what happens during pseudo-expansion: > > The following pseudo > > LoadAC $acc, FI // Pseudo load instructions. Load from FI to accumulator $acc. > > > is expanded into this sequence: > > LW $reg, FI // load from FI to temporary GPR $reg > MTLO $reg // copy $reg to register LO > LW $reg, FI + 4 // load from FI+4 to GPR $reg > MTHI $reg // copy $reg to register HIHi Akira, The register scavenger is not really supposed to be used in more than one pass, because you would need to allocate a separate emergency spill slot for each pass. I think Hal is trying to solve a very similar problem for PPC. Hal, are you expanding pseudos during PEI? /jakob
Hi Jakob, I believe Hal is trying to enable register scavenger to find two (or more) registers that can be used as temporaries. One problem I see with this approach is that, if you use register scavenger during PEI, you will have to pessimistically set aside two emergency spill slots before you call scavengeRegister, even if it turns out you only need one. Having an extra stack slot might not be a big problem, but still it is nice if we can avoid allocating a slot unnecessarily. I probably won't need these pseudo instructions that are expanded post-RA in the first place if I can tell the register allocators to spill accumulator registers to general purpose integer registers instead of directly to stack and disallow copying between accumulator registers. But I guess that is a much more difficult problem to solve. Is that right? On Mon, Mar 25, 2013 at 1:06 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk>wrote:> > On Mar 25, 2013, at 12:04 PM, Akira Hatanaka <ahatanak at gmail.com> wrote: > > > This patch adds parameter "EliminateFI" to > RegScavenger::scavengeRegister, which tells register scavenger not to > eliminate frame index of the emergency spill slot if set to false. > > > > I have pseudo load, store and copy instructions which are generated > during register allocation and expanded post-RA but before the final stack > size is known. I use register scavenger to search for a temporary integer > GPR that is used during pseudo-expansion. > > > > This is what happens during pseudo-expansion: > > > > The following pseudo > > > > LoadAC $acc, FI // Pseudo load instructions. Load from FI to accumulator > $acc. > > > > > > is expanded into this sequence: > > > > LW $reg, FI // load from FI to temporary GPR $reg > > MTLO $reg // copy $reg to register LO > > LW $reg, FI + 4 // load from FI+4 to GPR $reg > > MTHI $reg // copy $reg to register HI > > Hi Akira, > > The register scavenger is not really supposed to be used in more than one > pass, because you would need to allocate a separate emergency spill slot > for each pass. > > I think Hal is trying to solve a very similar problem for PPC. > > Hal, are you expanding pseudos during PEI? > > /jakob > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130325/14fc9f12/attachment.html>
----- Original Message -----> From: "Jakob Stoklund Olesen" <stoklund at 2pi.dk> > To: "Akira Hatanaka" <ahatanak at gmail.com> > Cc: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu>, "Hal Finkel" <hfinkel at anl.gov> > Sent: Monday, March 25, 2013 3:06:16 PM > Subject: Re: [LLVMdev] [PATCH] RegScavenger::scavengeRegister > > > On Mar 25, 2013, at 12:04 PM, Akira Hatanaka <ahatanak at gmail.com> > wrote: > > > This patch adds parameter "EliminateFI" to > > RegScavenger::scavengeRegister, which tells register scavenger not > > to eliminate frame index of the emergency spill slot if set to > > false. > > > > I have pseudo load, store and copy instructions which are generated > > during register allocation and expanded post-RA but before the > > final stack size is known. I use register scavenger to search for > > a temporary integer GPR that is used during pseudo-expansion. > > > > This is what happens during pseudo-expansion: > > > > The following pseudo > > > > LoadAC $acc, FI // Pseudo load instructions. Load from FI to > > accumulator $acc. > > > > > > is expanded into this sequence: > > > > LW $reg, FI // load from FI to temporary GPR $reg > > MTLO $reg // copy $reg to register LO > > LW $reg, FI + 4 // load from FI+4 to GPR $reg > > MTHI $reg // copy $reg to register HI > > Hi Akira, > > The register scavenger is not really supposed to be used in more than > one pass, because you would need to allocate a separate emergency > spill slot for each pass. > > I think Hal is trying to solve a very similar problem for PPC. > > Hal, are you expanding pseudos during PEI?In part, yes. It is for eliminating FIs and expanding some pseudos for spilling registers that don't have direct load/store instructions. -Hal> > /jakob > >