This is an archive of the discontinued LLVM Phabricator instance.

Canonicalise Windows target triple spellings
ClosedPublic

Authored by abdulras on Mar 4 2014, 11:53 AM.

Details

Summary

Construct a uniform Windows target triple nomenclature which is congruent to the
Linux counterpart. The old triples are normalised to the new canonical form.
This cleans up the long-standing issue of odd naming for various Windows
environments.

There are four different environments on Windows:

MSVC: The MS ABI, MSVCRT environment as defined by Microsoft
GNU: The MinGW32/MinGW32-W64 environment which uses MSVCRT and auxiliary libraries
Itanium: The MSVCRT environment + libc++ built with Itanium ABI
Cygnus: The Cygwin environment which uses custom libraries for everything

The following spellings are now written as:

i686-pc-win32 => i686-pc-windows-msvc
i686-pc-mingw32 => i686-pc-windows-gnu
i686-pc-cygwin => i686-pc-windows-cygnus

This should be sufficiently flexible to allow us to target other windows
environments in the future as necessary.

Diff Detail

Event Timeline

rnk added a comment.Mar 4 2014, 1:56 PM

This seems like the right direction, but we need to stage this so that we don't break Clang.

include/llvm/ADT/Triple.h
334

Are you planning to remove the MinGW32 OS enum?

lib/Support/Triple.cpp
531–539

These canonicalizations will change the behavior of Clang, because it often looks for getOS() == llvm::Triple::MinGW32 / Cygwin in many places. Can we defer this canonicalization until we've updated clang to do the right thing with the new triple?

"Cygnus" is really odd for me.

I prefer win32 rather than windows.

rnk accepted this revision.Mar 26 2014, 11:27 AM

lgtm

re: cygnus, I guess we could spell it i686--windows-cygwin, but that'd make parsing a little ambiguous. We will always accept i686--cygwin, which is what users will probably keep writing anyway.

Internally, we can't name the environment enum Cygwin until we remove the Cygwin from the OS enum.

lib/Target/X86/X86Subtarget.h
346–360

I'd make these Triple methods, but try to make the naming consistent with the other Triple methods, and then use that in various places.

abdulras closed this revision.Mar 31 2014, 11:08 AM

Committed with the suggested changes.