<div>Hi.  This is my third time posting this.  Could someone spare some time to check it out before it gets stale again.<br></div>
<div>One concern, however.  Because a recent change elsewhere made access to the original triple string unavailable, further information about the processor is lost.  I.e. x86 covers i386, i486, etc.  Is it important to preserve this?  I.e. perhaps as separate CPU types or perhaps as a CPU subtype?<br>
</div>
<div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">John Thompson</b> <span dir="ltr"><<a href="mailto:john.thompson.jtsoftware@gmail.com">john.thompson.jtsoftware@gmail.com</a>></span><br>
Date: Tue, Sep 15, 2009 at 6:46 AM<br>Subject: Targets.cpp enhancement for x86, Triple enhancement<br>To: <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br><br><br>
<div>I submitted something like this to cfe-commits a few weeks ago, but I guess in the release crunch it got lost.  Here's another crack at it here, as I stopped watching the commits traffic, as it got too heavy.</div>

<div> </div>
<div>It's another pass at refining Targets.cpp for Windows targets, revised for the current repository.  From my original email:</div>
<div> </div>
<div>***</div>
<p>Unfortunately, it requires some LLVM enhancements, placed in the<br>separate llvm_triple_enhancement.patch file:</p>
<p>I extended the Triple class, supporting more explicitly the optional<br>environment field, adding an EnvironmentType enum for that with an<br>item for Visual Studio (-vc), and adding a Win64 OSType.  There are<br>probably more environments that can be added to the EnvironmentType<br>
enum.</p>
<p>Changed the default triples from cmake to be i686-pc-win32-vc and if<br>64-bit is enabled, x86_64-pc-win64-vc.</p>
<p>The Targets.cpp changes, placed in clang_targets_enhancement.patch:</p>
<div>Added separate TargetInfo's for Visual Studio, MinGW, and Cygwin, as<br>illustrated by the following hierarchy:</div>
<div><br>TargetInfo<br>  X86TargetInfo<br>      X86_32TargetInfo<br>          DarwinI386TargetInfo<br>          OpenBSDI386TargetInfo</div>
<div>          CygwinWindowsX86_32TargetInfo  (i686-pc-cygwin) (new)<br>          WindowsX86_32TargetInfo (i686-pc-win32)<br>              VisualStudioWindowsX86_32TargetInfo  (i686-pc-win32-vc) (new)<br>              MinGWX86_32TargetInfo  (i686-pc-mingw32) (new)</div>

<div>       X86_64TargetInfo<br>          DarwinX86_64TargetInfo<br>          OpenBSDX86_64TargetInfo<br>          WindowsX86_64TargetInfo  (x86_64-pc-win64) (new)</div>
<div>              VisualStudioWindowsX86_64TargetInfo  (x86_64-pc-win64-vc) (new)<br>              MinGWX86_64TargetInfo  (x86_64-pc-mingw64) (new)</div>
<p>Messing with the triple was of some concern to me, so I also tried an<br>alternate approach without adding -vc to the triple, making the<br>default -win32 map to Visual Studio, and having MinGW and Cygwin be<br>separate as above, but then I figured you might want -winXX with no<br>
environment field to be the native Clang target for Windows, mapping<br>to the generic Windows TargetInfo, assuming at some point Clang has<br>it's own runtime and headers.  But let me know if this would be the<br>more desired approach.</p>

<p>Note that though I've tested the Targets;cpp part in the debugger,<br>I've not yet been able to build, and therefore, run the LLVM tests.  I<br>don't expect the Triple class changes to change any existing behavior,<br>
but I have a slight worry that the change of the default triple from<br>cmake might impact something, but being on the apparently less-used<br>cmake path, perhaps it's less of a concern.  I built and ran the Clang<br>
tests on Linux successfully.</p>
<div>-John</div>
<div><br clear="all"> </div>
<div></div><br>-- <br>John Thompson<br><a href="mailto:John.Thompson.JTSoftware@gmail.com" target="_blank">John.Thompson.JTSoftware@gmail.com</a><br><br></div><br><br clear="all">
<div></div><br>-- <br>John Thompson<br><a href="mailto:John.Thompson.JTSoftware@gmail.com">John.Thompson.JTSoftware@gmail.com</a><br><br>