[llvm-dev] Cloning a MachineInstr

Mehdi Amini via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 2 15:57:13 PST 2015


> On Dec 2, 2015, at 3:12 PM, Rail Shafigulin via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> I'm trying to clone a MachineInstr in the AsmPrinter::EmitInstruction, Here is the code:
> 
> void EsenciaAsmPrinter::EmitInstruction(const MachineInstr *MI) {
>   const MachineFunction *MF = MI->getParent()->getParent();
>   MachineInstr *CloneMI = MF->CloneMachineInstr(MI);
> ...
> ...
> }
> 
> The problem is that MF is a const and CloneMachineInstr expects a non-const. Does anybody know if there is a way to create a copy of a given MachineInstr?

What are you trying to achieve in the end? 

— 
Mehdi



More information about the llvm-dev mailing list