Hi,<div><br></div><div>I'm developing a very basic new LLVM backend for a RISC machine (named Risco), based on the existing Sparc and Mips backends and the main tutorial [1]. I'm having trouble registering the backend so the main tools can see it.</div>

<div><br></div><div>My project code is outside the source tree, and I've altered the Makefile to generate a shared library for the backend (libLLVMRiscoCodeGen.so). I've tried running: llc -load ./libLLVMRiscoCodeGen.so -march=risco, but the target isn't recognized (it doesn't even appear in the llc -version output).</div>

<div><br></div><div>The main steps I did for registering the backend were:</div><div><br></div><div>- At RiscoTargetMachine.cpp:</div><div><br></div><div><div>extern "C" void LLVMInitializeRiscoTarget() {</div>
<div>
  // Register the target.</div><div>  RegisterTargetMachine<RiscoTargetMachine> X(TheRiscoTarget);</div><div>  RegisterAsmInfo<RiscoMCAsmInfo> A(TheRiscoTarget);</div><div>}</div></div><div><br></div><div>- At Risco.td:</div>

<div><br></div><div><div>def Risco : Target {</div><div>  let InstructionSet = RiscoInstrInfo;</div><div>}</div></div><div><br></div><div>- At RiscoTargetInfo.cpp:</div><div><br></div><div>Target llvm::TheRiscoTarget;</div>

<div><br></div><div>extern "C" void LLVMInitializeRiscoTargetInfo() {</div><div>  RegisterTarget<> X(TheRiscoTarget, "risco", "Risco");</div><div>}</div><div><br></div><div><br></div><div>

<br></div><div>What I found suspicious was that in the last file (RiscoTargetInfo.cpp), the original RegisterTarget template parameter was Triple::mips. I found it odd because, if I understood it right, this attaches backend information to a LLVM core file. What am I supposed to put there for a new backend? Do I leave the default parameter?</div>

<div><br></div><div>Is this the problem or am I missing something else?</div><div><br></div><div><br></div><div>[1] <a href="http://llvm.org/docs/WritingAnLLVMBackend.html">http://llvm.org/docs/WritingAnLLVMBackend.html</a><br clear="all">

<br>-- <br>[]'s<br><br>Giuliano Vilela.<div><div><div><br></div></div></div><br>
</div>