Update documentation on how to set up a project
[oota-llvm.git] / docs / WritingAnLLVMBackend.html
index 1fb88a363321c1186205a25cdbc5276335046981..dcea204e47cd02d7f322004a1e4aa9c693f1a1d7 100644 (file)
   <li><a href="#intro">Introduction</a>
   <li><a href="#backends">Writing a backend</a>
   <ol>
-    <li><a href="#machine">Machine backends</a></li>
+    <li><a href="#machine">Machine backends</a>
     <ol>
       <li><a href="#machineTOC">Outline</a></li>
       <li><a href="#machineDetails">Implementation details</a></li>
     </ol></li>  
-    <li><a href="#machine">Machine backends</a></li>
     <li><a href="#lang">Language backends</a></li>
   </ol></li>
   <li><a href="#related">Related reading material</a>
@@ -92,6 +91,18 @@ implement the following:</p>
       href="CodeGenerator.html#targetmachine">TargetMachine</a></tt>, which
       configures <tt><a href="CodeGenerator.html#targetdata">TargetData</a></tt>
       correctly</li>
+  <li>Register your new target using the <tt>RegisterTarget</tt>
+  template:<br><br>
+<div class="doc_code"><pre>
+RegisterTarget&lt;<em>MyTargetMachine</em>&gt; M("short_name", "  Target name");
+</pre></div>
+      <br>Here, <em>MyTargetMachine</em> is the name of your implemented
+      subclass of <tt><a
+      href="CodeGenerator.html#targetmachine">TargetMachine</a></tt>,
+      <em>short_name</em> is the option that will be active following
+      <tt>-march=</tt> to select a target in llc and lli, and the last string
+      is the description of your target to appear in <tt>-help</tt>
+      listing.</li>
   </ul></li>
 <li>Implement the assembly printer for the architecture.  Usually, if you have
 described the instruction set with the assembly printer generator in mind, that
@@ -148,15 +159,15 @@ architected registers.</p>
 <div class="doc_code">
 <pre>
 // class Register is defined in Target.td
-<b>class</b> <em>Target</em>Reg : Register {
+<b>class</b> <em>Target</em>Reg&lt;string name&gt; : Register&lt;name&gt; {
   <b>let</b> Namespace = "<em>Target</em>";
 }
 
-<b>class</b> IntReg&lt;<b>bits</b>&lt;5&gt; num&gt; : <em>Target</em>Reg {
+<b>class</b> IntReg&lt;<b>bits</b>&lt;5&gt; num, string name&gt; : <em>Target</em>Reg&lt;name&gt; {
   <b>field</b> <b>bits</b>&lt;5&gt; Num = num;
 }
 
-<b>def</b> R0 : IntReg&lt;0&gt;;
+<b>def</b> R0 : IntReg&lt;0, "%R0"&gt;;
 ...
 
 // class RegisterClass is defined in Target.td