<div dir="ltr"><span style="font-size:12.8px">Hi,</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I am trying to write my own backend using LLVM and I downloaded the support files from the book titled "LLVM Cookbook" for the "Toy" architecture described in the book.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I made the changes described in the book to register the TOY architecture but am seeing compile errors. I am not sure if I set this up correctly. The code that I am compiling for the backend was downloaded from the publisher and should be tested? (I think they used 3.5 whereas I am using 3.8.0)</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Any help would be much appreciated!</div><div style="font-size:12.8px"><br>Wolf</div><div style="font-size:12.8px"><br></div><div style=""><div style=""><span style="font-size:12.8px">[ 59%] Built target LLVMXCoreInfo</span></div><div style=""><span style="font-size:12.8px">[ 59%] Built target LLVMXCoreDesc</span></div><div style=""><span style="font-size:12.8px">[ 59%] Updating TOYGenRegisterInfo.inc...</span></div><div style=""><span style="font-size:12.8px">[ 59%] Updating TOYGenInstrInfo.inc...</span></div><div style=""><span style="font-size:12.8px">[ 60%] Updating TOYGenAsmWriter.inc...</span></div><div style=""><span style="font-size:12.8px">[ 60%] Updating TOYGenDAGISel.inc...</span></div><div style=""><span style="font-size:12.8px">[ 60%] Updating TOYGenCallingConv.inc...</span></div><div style=""><span style="font-size:12.8px">[ 60%] Updating TOYGenSubtargetInfo.inc...</span></div><div style=""><span style="font-size:12.8px">[ 60%] Updating TOYGenMCCodeEmitter.inc...</span></div><div style=""><span style="font-size:12.8px">[ 60%] Built target TOYCommonTableGen</span></div><div style=""><span style="font-size:12.8px">Scanning dependencies of target LLVMTOYCodeGen</span></div><div style=""><span style="font-size:12.8px">[ 60%] Building CXX object lib/Target/TOY/CMakeFiles/LLVMTOYCodeGen.dir/TOYSubtarget.cpp.o</span></div><div style=""><span style="font-size:12.8px">In file included from /home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/lib/Target/TOY/TOYInstrInfo.h:17:0,</span></div><div style=""><span style="font-size:12.8px">                 from /home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/lib/Target/TOY/TOYSubtarget.h:20,</span></div><div style=""><span style="font-size:12.8px">                 from /home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/lib/Target/TOY/TOYSubtarget.cpp:14:</span></div><div style=""><span style="font-size:12.8px">/home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/lib/Target/TOY/TOYRegisterInfo.h:34:19: error: ‘const uint32_t* llvm::TOYRegisterInfo::getCallPreservedMask(llvm::CallingConv::ID) const’ marked override, but does not override</span></div><div style=""><span style="font-size:12.8px">   const uint32_t *getCallPreservedMask(CallingConv::ID) const override;</span></div><div style=""><span style="font-size:12.8px">                   ^</span></div><div style=""><span style="font-size:12.8px">In file included from /home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/lib/Target/TOY/TOYSubtarget.cpp:14:0:</span></div><div style=""><span style="font-size:12.8px">/home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/lib/Target/TOY/TOYSubtarget.h:69:21: error: ‘const llvm::DataLayout* llvm::TOYSubtarget::getDataLayout() const’ marked override, but does not override</span></div><div style=""><span style="font-size:12.8px">   const DataLayout *getDataLayout() const override { return &DL; }</span></div><div style=""><span style="font-size:12.8px">                     ^</span></div><div style=""><span style="font-size:12.8px">/home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/lib/Target/TOY/TOYSubtarget.h:41:20: error: cannot declare field ‘llvm::TOYSubtarget::FrameLowering’ to be of abstract type ‘llvm::TOYFrameLowering’</span></div><div style=""><span style="font-size:12.8px">   TOYFrameLowering FrameLowering;</span></div><div style=""><span style="font-size:12.8px">                    ^</span></div><div style=""><span style="font-size:12.8px">In file included from /home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/lib/Target/TOY/TOYSubtarget.h:18:0,</span></div><div style=""><span style="font-size:12.8px">                 from /home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/lib/Target/TOY/TOYSubtarget.cpp:14:</span></div><div style=""><span style="font-size:12.8px">/home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/lib/Target/TOY/TOYFrameLowering.h:24:7: note:   because the following virtual functions are pure within ‘llvm::TOYFrameLowering’:</span></div><div style=""><span style="font-size:12.8px"> class TOYFrameLowering : public TargetFrameLowering {</span></div><div style=""><span style="font-size:12.8px">       ^</span></div><div style=""><span style="font-size:12.8px">In file included from /home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/lib/Target/TOY/TOYFrameLowering.h:18:0,</span></div><div style=""><span style="font-size:12.8px">                 from /home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/lib/Target/TOY/TOYSubtarget.h:18,</span></div><div style=""><span style="font-size:12.8px">                 from /home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/lib/Target/TOY/TOYSubtarget.cpp:14:</span></div><div style=""><span style="font-size:12.8px">/home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/include/llvm/Target/TargetFrameLowering.h:156:16: note: <span class="" style="white-space:pre">      </span>virtual void llvm::TargetFrameLowering::emitPrologue(llvm::MachineFunction&, llvm::MachineBasicBlock&) const</span></div><div style=""><span style="font-size:12.8px">   virtual void emitPrologue(MachineFunction &MF,</span></div><div style=""><span style="font-size:12.8px">                ^</span></div><div style=""><span style="font-size:12.8px">/home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/lib/Target/TOY/TOYSubtarget.cpp: In constructor ‘llvm::TOYSubtarget::TOYSubtarget(const string&, const string&, const string&, llvm::TOYTargetMachine&)’:</span></div><div style=""><span style="font-size:12.8px">/home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/lib/Target/TOY/TOYSubtarget.cpp:32:58: error: no matching function for call to ‘llvm::TOYGenSubtargetInfo::TOYGenSubtargetInfo(const string&, const string&, const string&)’</span></div><div style=""><span style="font-size:12.8px">       InstrInfo(), TLInfo(TM), TSInfo(DL), FrameLowering() {}</span></div><div style=""><span style="font-size:12.8px">                                                          ^</span></div><div style=""><span style="font-size:12.8px">/home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/lib/Target/TOY/TOYSubtarget.cpp:32:58: note: candidate is:</span></div><div style=""><span style="font-size:12.8px">In file included from /home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/lib/Target/TOY/TOYSubtarget.cpp:22:0:</span></div><div style=""><span style="font-size:12.8px">/home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/build/lib/Target/TOY/TOYGenSubtargetInfo.inc:117:1: note: llvm::TOYGenSubtargetInfo::TOYGenSubtargetInfo(const llvm::Triple&, llvm::StringRef, llvm::StringRef)</span></div><div style=""><span style="font-size:12.8px"> TOYGenSubtargetInfo::TOYGenSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)</span></div><div style=""><span style="font-size:12.8px"> ^</span></div><div style=""><span style="font-size:12.8px">/home/wolf/gang/llvm/llvm_build/llvm-3.8.0.src/build/lib/Target/TOY/TOYGenSubtargetInfo.inc:117:1: note:   no known conversion for argument 1 from ‘const string {aka const std::basic_string<char>}’ to ‘const llvm::Triple&’</span></div><div style=""><span style="font-size:12.8px">make[2]: *** [lib/Target/TOY/CMakeFiles/LLVMTOYCodeGen.dir/TOYSubtarget.cpp.o] Error 1</span></div><div style=""><span style="font-size:12.8px">make[1]: *** [lib/Target/TOY/CMakeFiles/LLVMTOYCodeGen.dir/all] Error 2</span></div><div style=""><span style="font-size:12.8px">make: *** [all] Error 2</span></div></div></div>