[llvm-dev] Unable to clone an instruction in AsmPrinter::EmitInstruction

Akira Hatanaka via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 2 14:43:14 PST 2015


It looks like it's complaining because you are trying to call a non-const
function CloneMachineInstr but MF is a pointer to a const MachineFunction?

On Wed, Dec 2, 2015 at 1:47 PM, Rail Shafigulin via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> I'm working on a custom VLIW (we call it Escala). At the moment I'm trying
> to implement EscalaAsmPrinter::EmitInstruction(const MachineInstr *MI). I'm
> trying to clone an instruction and this produces and error. Below are the
> code as well as error:
>
> void EscalaAsmPrinter::EmitInstruction(const MachineInstr *MI) {
>   const MachineFunction *MF = MI->getParent()->getParent();
>   MachineInstr *CloneMI = MF->CloneMachineInstr(MI);
>   ...
>   ...
> }
>
> Here is the error:
>
> lib/Target/Escala/EscalaAsmPrinter.cpp: In member function ‘virtual void
> {anonymous}::EscalaAsmPrinter::EmitInstruction(const llvm::MachineInstr*)’:
> lib/Target/Escala/EscalaAsmPrinter.cpp:379:51: error: no matching function
> for call to ‘llvm::MachineFunction::CloneMachineInstr(const
> llvm::MachineInstr*&) const’
>    MachineInstr *CloneMI = MF->CloneMachineInstr(MI);
>
> ^
> lib/Target/Escala/EscalaAsmPrinter.cpp:379:51: note: candidate is:
> In file included from include/llvm/Target/TargetInstrInfo.h:19:0,
>                  from lib/Target/Escala/EscalaInstrInfo.h:19,
>                  from lib/Target/Escala/EscalaAsmPrinter.cpp:17:
> include/llvm/CodeGen/MachineFunction.h:383:17: note: llvm::MachineInstr*
> llvm::MachineFunction::CloneMachineInstr(const llvm::MachineInstr*) <near
> match>
>    MachineInstr *CloneMachineInstr(const MachineInstr *Orig);
>                         ^
>
> This just doesn't make sense to me. I'm missing something, but I can't
> figure out what exactly. Would someone be able to shed some light on this?
>
> Any help is really 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/c32967d0/attachment.html>


More information about the llvm-dev mailing list