<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>
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<<em>MyTargetMachine</em>> 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
<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<string name> : Register<name> {
<b>let</b> Namespace = "<em>Target</em>";
}
-<b>class</b> IntReg<<b>bits</b><5> num> : <em>Target</em>Reg {
+<b>class</b> IntReg<<b>bits</b><5> num, string name> : <em>Target</em>Reg<name> {
<b>field</b> <b>bits</b><5> Num = num;
}
-<b>def</b> R0 : IntReg<0>;
+<b>def</b> R0 : IntReg<0, "%R0">;
...
// class RegisterClass is defined in Target.td