[llvm-dev] Cloning a MachineInstr

Ziqiang Patrick Huang via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 2 15:21:45 PST 2015


There is a getParent() function in MachineBasicBlock that returns non-const
MachineFunction.

Patrick

2015-12-02 18:12 GMT-05:00 Rail Shafigulin via llvm-dev <
llvm-dev at lists.llvm.org>:

> 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?
>
> Any help is appreciated.
>
> --
> Rail Shafigulin
> Software Engineer
> Esencia Technologies
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151202/834ac806/attachment.html>


More information about the llvm-dev mailing list