[LLVMdev] Adding MachineOperands that are not part of MCInstrDesc.

Tom Stellard tom at stellard.net
Thu Apr 23 06:16:33 PDT 2015


On Thu, Apr 23, 2015 at 08:33:03AM +0200, Jonas Paulsson wrote:
> Hi,
> 
> So what about post-ra - is it safe there?
> 

If you run the MachineVerfier post-ra it will fail.  For other passes,
it may be safe now, but there's no guarantee it will be safe in the
future.

-Tom

> 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
> 



More information about the llvm-dev mailing list