Mondada Gabriele
2009-Jan-23 11:28 UTC
[LLVMdev] Can TargetInstrInfo::storeRegToStackSlot use temp/virtual regs?
Hi, I'm implementing storeRegToStackSlot() and, in order to store some specific registers (floating point regs and address regs) I've to copy them to more standard regs and copy these last ones to the slot. I tried to generate instructions that use physical registers, but by doing that I overwrote registers already assigned by the register allocator. Is it possible to use virtual registers in the instructions generated by storeRegToStackSlot()? This function is called by the register allocator. So, if it needs to store regs on a slot, this means that there is no more registers available. So, I cannot believe that it is able to allocate new virtual registers generated by storeRegToStackSlot(). What is the good way to implement this ? Thanks a lot Gab
Dan Gohman
2009-Jan-26 21:28 UTC
[LLVMdev] Can TargetInstrInfo::storeRegToStackSlot use temp/virtual regs?
On Jan 23, 2009, at 3:28 AM, Mondada Gabriele wrote:> Hi, > I'm implementing storeRegToStackSlot() and, in order to store some > specific registers (floating point regs and address regs) I've to > copy them to more standard regs and copy these last ones to the slot. > I tried to generate instructions that use physical registers, but by > doing that I overwrote registers already assigned by the register > allocator. > Is it possible to use virtual registers in the instructions > generated by storeRegToStackSlot()? > This function is called by the register allocator. So, if it needs > to store regs on a slot, this means that there is no more registers > available. So, I cannot believe that it is able to allocate new > virtual registers generated by storeRegToStackSlot().Your analysis here sounds right. The current design with storeRegToStackSlot currently assumes that any register can be stored without requiring intermediate registers.> > What is the good way to implement this ?It looks like you'll have to make your own way here. If you find a good solution, perhaps others with similar needs may be able to follow. Dan
Cédric Venet
2009-Jan-27 12:21 UTC
[LLVMdev] Can TargetInstrInfo::storeRegToStackSlot use temp/virtual regs?
Dan Gohman a écrit :> On Jan 23, 2009, at 3:28 AM, Mondada Gabriele wrote: > > >> Hi, >> I'm implementing storeRegToStackSlot() and, in order to store some >> specific registers (floating point regs and address regs) I've to >> copy them to more standard regs and copy these last ones to the slot. >> I tried to generate instructions that use physical registers, but by >> doing that I overwrote registers already assigned by the register >> allocator. >> Is it possible to use virtual registers in the instructions >> generated by storeRegToStackSlot()? >> This function is called by the register allocator. So, if it needs >> to store regs on a slot, this means that there is no more registers >> available. So, I cannot believe that it is able to allocate new >> virtual registers generated by storeRegToStackSlot(). >> > > Your analysis here sounds right. The current design with > storeRegToStackSlot currently assumes that any register > can be stored without requiring intermediate registers. > > >> What is the good way to implement this ? >> > > It looks like you'll have to make your own way here. If > you find a good solution, perhaps others with similar needs > may be able to follow. >An easy way (but not very efficient) is to reserve a register for this (just disallow automatic selection of this register). It is just a few line to change in your td files. You may also want to check how it is done in the PIC16 backend. I think they also need a register at spill time (to compute the destination adress) but I may be wrong. I didn't work much with llvm, so I may be wrong regards, Cédric
Apparently Analagous Threads
- [LLVMdev] Can TargetInstrInfo::storeRegToStackSlot use temp/virtual regs?
- [LLVMdev] Can TargetInstrInfo::storeRegToStackSlot use temp/virtual regs?
- [LLVMdev] clobbering other physical registers in storeRegtoStackSlot.
- RFC: Setting MachineInstr flags through storeRegToStackSlot
- [LLVMdev] clobbering other physical registers in storeRegtoStackSlot.