Jonas Paulsson
2015-Apr-22 14:48 UTC
[LLVMdev] Adding MachineOperands that are not part of MCInstrDesc.
Hi, I wonder if it is okay to add an operand that is not part of MCInstrDesc to an MI after isel? There are things going on like instruction combining, rematerialization etc, which may call MI with TI->get(opcode). If an MI would get replaced with a new instance of itself in this way, any previously added operands would get lost, as they are not part of the MCInstrDesc. RegAlloc, does this, so I assume it is safe to add operands post-ra. I wonder if it also safe to add phys-reg defs/uses directly after DAG isel? Would it be a bug if they would be removed by a transformation? Thanks, Jonas Paulsson
Tom Stellard
2015-Apr-22 15:12 UTC
[LLVMdev] Adding MachineOperands that are not part of MCInstrDesc.
On Wed, Apr 22, 2015 at 04:48:54PM +0200, Jonas Paulsson wrote:> Hi, > > I wonder if it is okay to add an operand that is not part of > MCInstrDesc to an MI after isel? > > There are things going on like instruction combining, > rematerialization etc, which may call MI with TI->get(opcode). If an > MI would get replaced with a new instance of itself in this way, any > previously added operands would get lost, as they are not part of > the MCInstrDesc. > > RegAlloc, does this, so I assume it is safe to add operands post-ra. > I wonder if it also safe to add phys-reg defs/uses directly after > DAG isel? Would it be a bug if they would be removed by a > transformation? >You can add implicit uses and defs. You may get lucky and adding explicit defs and uses will work, but I would not recommend doing this. If you really need to do this, you could make the instruction variadic or create two instruction defs, one with n operands and one with n + 1. -Tom> Thanks, > > Jonas Paulsson > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Jonas Paulsson
2015-Apr-23 06:33 UTC
[LLVMdev] Adding MachineOperands that are not part of MCInstrDesc.
Hi, So what about post-ra - is it safe there? thanks, Jonas On 2015-04-22 17:12, Tom Stellard wrote:> On Wed, Apr 22, 2015 at 04:48:54PM +0200, Jonas Paulsson wrote: >> Hi, >> >> I wonder if it is okay to add an operand that is not part of >> MCInstrDesc to an MI after isel? >> >> There are things going on like instruction combining, >> rematerialization etc, which may call MI with TI->get(opcode). If an >> MI would get replaced with a new instance of itself in this way, any >> previously added operands would get lost, as they are not part of >> the MCInstrDesc. >> >> RegAlloc, does this, so I assume it is safe to add operands post-ra. >> I wonder if it also safe to add phys-reg defs/uses directly after >> DAG isel? Would it be a bug if they would be removed by a >> transformation? >> > You can add implicit uses and defs. You may get lucky and adding explicit defs > and uses will work, but I would not recommend doing this. If you really need > to do this, you could make the instruction variadic or create two instruction defs, > one with n operands and one with n + 1. > > -Tom > >> Thanks, >> >> Jonas Paulsson >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Apparently Analagous Threads
- [LLVMdev] Distinguish variadic register defines/uses in MCInstrDesc?
- [LLVMdev] Distinguish variadic register defines/uses in MCInstrDesc?
- [LLVMdev] Distinguish variadic register defines/uses in MCInstrDesc?
- [LLVMdev] Distinguish variadic register defines/uses in MCInstrDesc?
- Question about physical registers in ISel