Rail Shafigulin via llvm-dev
2015-Dec-02 21:47 UTC
[llvm-dev] Unable to clone an instruction in AsmPrinter::EmitInstruction
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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151202/51ee090e/attachment.html>
Akira Hatanaka via llvm-dev
2015-Dec-02 22:43 UTC
[llvm-dev] Unable to clone an instruction in AsmPrinter::EmitInstruction
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>
Rail Shafigulin via llvm-dev
2015-Dec-02 23:07 UTC
[llvm-dev] Unable to clone an instruction in AsmPrinter::EmitInstruction
On Wed, Dec 2, 2015 at 2:43 PM, Akira Hatanaka <ahatanak at gmail.com> wrote:> 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? >Thanks for the help. -- Rail Shafigulin Software Engineer Esencia Technologies -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151202/b59b72e1/attachment.html>