I like the idea of just ditching them which, I think, is what Jim said as well.<br><br>-eric<br><br><div>On Mon Jan 06 2014 at 7:48:48 AM, David Woodhouse <<a href="mailto:dwmw2@infradead.org">dwmw2@infradead.org</a>> wrote:</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">With this, I can use 'clang -m16' and get 16-bit code output. This is<br>
needed for building the early boot code for the Linux kernel, amongst<br>
other things.<br>
<br>
With GCC, we do this using a fragile hack using asm(".code16gcc") and<br>
playing dirty tricks to ensure that it really does come at the *start*<br>
of the resulting assembler output. See GCC PR59672 for a request to add<br>
a simple '-m16' option there too: <a href="http://gcc.gnu.org/PR59672" target="_blank">http://gcc.gnu.org/PR59672</a><br>
<br>
Note that I don't bother to define a gratuitous new subclass of<br>
X86TargetMachine for the 16-bit target. Since X86_32TargetMachine is<br>
actually perfectly usable for 16-bit, 32-bit *and* 64-bit targets, in<br>
fact I *only* use that:<br>
<br>
--- a/lib/Target/X86/<u></u>X86TargetMachine.cpp<br>
+++ b/lib/Target/X86/<u></u>X86TargetMachine.cpp<br>
@@ -24,8 +24,9 @@ using namespace llvm;<br>
<br>
 extern "C" void LLVMInitializeX86Target() {<br>
   // Register the target.<br>
+  RegisterTargetMachine<X86_<u></u>32TargetMachine> W(TheX86_16Target);<br>
   RegisterTargetMachine<X86_<u></u>32TargetMachine> X(TheX86_32Target);<br>
-  RegisterTargetMachine<X86_<u></u>64TargetMachine> Y(TheX86_64Target);<br>
+  RegisterTargetMachine<X86_<u></u>32TargetMachine> Y(TheX86_64Target);<br>
 }<br>
<br>
<br>
Perhaps we should ditch those subclasses altogether and just use<br>
X86TargetMachine? See my mail a few minutes ago to llvmdev@ about that:<br>
<a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-January/069153.html" target="_blank">http://lists.cs.uiuc.edu/<u></u>pipermail/llvmdev/2014-<u></u>January/069153.html</a><br>
<br>
--<br>
David Woodhouse                            Open Source Technology Centre<br>
<a href="mailto:David.Woodhouse@intel.com" target="_blank">David.Woodhouse@intel.com</a>                              Intel Corporation<br>
______________________________<u></u>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvm-commits</a><br>
</blockquote>