<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi Giuliano,</div><div><br></div><div>Have you modified the configure script to know to enable the target? Look for the bit that handles "--enable-targets" and you'll see a list of the default targets (all of them) that are enabled in a build and a case statement that parses the options to "--enable-targets". Make sure your new target is added in both places.</div><div><br></div><div>include/llvm/ADT/Triple.h contains a enumeration for the targets. Make sure you've added "risco" there, too.</div><div><br></div><div>-Jim</div><div><br><div><div>On Oct 13, 2010, at 12:57 PM, Giuliano Vilela wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">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>
_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></blockquote></div><br></div></body></html>