[cfe-dev] Fwd: Targets.cpp enhancement for x86, Triple enhancement

John Thompson john.thompson.jtsoftware at gmail.com
Mon Sep 21 18:09:30 PDT 2009


Hi.  This is my third time posting this.  Could someone spare some time to
check it out before it gets stale again.
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?
---------- Forwarded message ----------
From: John Thompson <john.thompson.jtsoftware at gmail.com>
Date: Tue, Sep 15, 2009 at 6:46 AM
Subject: Targets.cpp enhancement for x86, Triple enhancement
To: cfe-dev at cs.uiuc.edu


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.

It's another pass at refining Targets.cpp for Windows targets, revised for
the current repository.  From my original email:

***

Unfortunately, it requires some LLVM enhancements, placed in the
separate llvm_triple_enhancement.patch file:

I extended the Triple class, supporting more explicitly the optional
environment field, adding an EnvironmentType enum for that with an
item for Visual Studio (-vc), and adding a Win64 OSType.  There are
probably more environments that can be added to the EnvironmentType
enum.

Changed the default triples from cmake to be i686-pc-win32-vc and if
64-bit is enabled, x86_64-pc-win64-vc.

The Targets.cpp changes, placed in clang_targets_enhancement.patch:
Added separate TargetInfo's for Visual Studio, MinGW, and Cygwin, as
illustrated by the following hierarchy:

TargetInfo
  X86TargetInfo
      X86_32TargetInfo
          DarwinI386TargetInfo
          OpenBSDI386TargetInfo
          CygwinWindowsX86_32TargetInfo  (i686-pc-cygwin) (new)
          WindowsX86_32TargetInfo (i686-pc-win32)
              VisualStudioWindowsX86_32TargetInfo  (i686-pc-win32-vc) (new)
              MinGWX86_32TargetInfo  (i686-pc-mingw32) (new)
       X86_64TargetInfo
          DarwinX86_64TargetInfo
          OpenBSDX86_64TargetInfo
          WindowsX86_64TargetInfo  (x86_64-pc-win64) (new)
              VisualStudioWindowsX86_64TargetInfo  (x86_64-pc-win64-vc)
(new)
              MinGWX86_64TargetInfo  (x86_64-pc-mingw64) (new)

Messing with the triple was of some concern to me, so I also tried an
alternate approach without adding -vc to the triple, making the
default -win32 map to Visual Studio, and having MinGW and Cygwin be
separate as above, but then I figured you might want -winXX with no
environment field to be the native Clang target for Windows, mapping
to the generic Windows TargetInfo, assuming at some point Clang has
it's own runtime and headers.  But let me know if this would be the
more desired approach.

Note that though I've tested the Targets;cpp part in the debugger,
I've not yet been able to build, and therefore, run the LLVM tests.  I
don't expect the Triple class changes to change any existing behavior,
but I have a slight worry that the change of the default triple from
cmake might impact something, but being on the apparently less-used
cmake path, perhaps it's less of a concern.  I built and ran the Clang
tests on Linux successfully.
-John



-- 
John Thompson
John.Thompson.JTSoftware at gmail.com




-- 
John Thompson
John.Thompson.JTSoftware at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090921/0e09dd80/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang_targets_enhancement.patch
Type: application/octet-stream
Size: 7022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090921/0e09dd80/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm_triple_enhancement.patch
Type: application/octet-stream
Size: 4967 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090921/0e09dd80/attachment-0001.obj>


More information about the cfe-dev mailing list