[cfe-commits] [PATCH][llvm][clang] Use Triple::MinGW32 instead of Triple::MinGW64

NAKAMURA Takumi geek4civic at gmail.com
Tue Feb 15 19:57:59 PST 2011


Hello.

I have reworked Triple patches.

  - Use Triple::MinGW32. (I got rid of Triple::MinGW)
  - *-mingw64 is no longer recognized. Use *-mingw32.

Please take a look into them, thank you.

* clang-0001-Triple-MinGW64-is-deprecated-and-removed.-We-can.patch.txt
* llvm-0001-Triple-MinGW64-is-deprecated-and-removed.-We-can.patch.txt

  Reworked.

* clang-0002-lib-Frontend-InitHeaderSearch.cpp-Add-mingw-w64-.patch.txt

  Almost same as last one.

...Takumi
-------------- next part --------------
From ae588cf518e2ffe66fac97d58ca2477e6de3e234 Mon Sep 17 00:00:00 2001
From: NAKAMURA Takumi <geek4civic at gmail.com>
Date: Wed, 16 Feb 2011 10:47:25 +0900
Subject: [PATCH 1/2] Triple::MinGW64 is deprecated and removed. We can use Triple::MinGW32 instead.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.7.1.GIT"

This is a multi-part message in MIME format.
--------------1.7.1.GIT
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


No one uses *-mingw64. mingw-w64 is represented as {i686|x86_64}-w64-mingw32.
---
 lib/Basic/Targets.cpp             |    2 +-
 lib/CodeGen/TargetInfo.cpp        |    2 +-
 lib/Driver/Driver.cpp             |    1 -
 lib/Driver/Tools.cpp              |    3 +--
 lib/Frontend/InitHeaderSearch.cpp |    9 ---------
 lib/Sema/TargetAttributesSema.cpp |    3 +--
 6 files changed, 4 insertions(+), 16 deletions(-)


--------------1.7.1.GIT
Content-Type: text/x-patch; name="0001-Triple-MinGW64-is-deprecated-and-removed.-We-can.patch.txt"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Triple-MinGW64-is-deprecated-and-removed.-We-can.patch.txt"

diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 2af28d6..35817a2 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -2691,7 +2691,7 @@ static TargetInfo *AllocateTarget(const std::string &T) {
       return new FreeBSDTargetInfo<X86_64TargetInfo>(T);
     case llvm::Triple::Solaris:
       return new SolarisTargetInfo<X86_64TargetInfo>(T);
-    case llvm::Triple::MinGW64:
+    case llvm::Triple::MinGW32:
       return new MinGWX86_64TargetInfo(T);
     case llvm::Triple::Win32:   // This is what Triple.h supports now.
       if (Triple.getEnvironment() == llvm::Triple::MachO)
diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
index c12e540..e27292c 100644
--- a/lib/CodeGen/TargetInfo.cpp
+++ b/lib/CodeGen/TargetInfo.cpp
@@ -2829,7 +2829,7 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
   case llvm::Triple::x86_64:
     switch (Triple.getOS()) {
     case llvm::Triple::Win32:
-    case llvm::Triple::MinGW64:
+    case llvm::Triple::MinGW32:
     case llvm::Triple::Cygwin:
       return *(TheTargetCodeGenInfo = new WinX86_64TargetCodeGenInfo(Types));
     default:
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index a4f6c3f..5a5986b 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -1349,7 +1349,6 @@ const HostInfo *Driver::GetHostInfo(const char *TripleStr) const {
   case llvm::Triple::Win32:
     return createWindowsHostInfo(*this, Triple);
   case llvm::Triple::MinGW32:
-  case llvm::Triple::MinGW64:
     return createMinGWHostInfo(*this, Triple);
   default:
     return createUnknownHostInfo(*this, Triple);
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index c8a3ef7..176384a 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -1448,8 +1448,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   if (KernelOrKext ||
     !Args.hasFlag(options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
                   getToolChain().getTriple().getOS() != llvm::Triple::Cygwin &&
-                  getToolChain().getTriple().getOS() != llvm::Triple::MinGW32 &&
-                  getToolChain().getTriple().getOS() != llvm::Triple::MinGW64))
+                  getToolChain().getTriple().getOS() != llvm::Triple::MinGW32))
     CmdArgs.push_back("-fno-use-cxa-atexit");
 
   // -fms-extensions=0 is default.
diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp
index 50b89aa..39f30e5 100644
--- a/lib/Frontend/InitHeaderSearch.cpp
+++ b/lib/Frontend/InitHeaderSearch.cpp
@@ -529,7 +529,6 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
   case llvm::Triple::Cygwin:
     AddPath("/usr/include/w32api", System, true, false, false);
     break;
-  case llvm::Triple::MinGW64:
   case llvm::Triple::MinGW32:
     AddPath("c:/mingw/include", System, true, false, false);
     break;
@@ -566,14 +565,6 @@ AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple) {
     // FIXME: Do we support g++-3.4.4?
     AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "3.4.4");
     break;
-  case llvm::Triple::MinGW64:
-    // Try gcc 4.5.0
-    AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw64", "4.5.0");
-    // Try gcc 4.4.0
-    AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw64", "4.4.0");
-    // Try gcc 4.3.0
-    AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw64", "4.3.0");
-    // Fall through.
   case llvm::Triple::MinGW32:
    // Try gcc 4.5.0
     AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.5.0"); 
diff --git a/lib/Sema/TargetAttributesSema.cpp b/lib/Sema/TargetAttributesSema.cpp
index bb61802..6d7f2e6 100644
--- a/lib/Sema/TargetAttributesSema.cpp
+++ b/lib/Sema/TargetAttributesSema.cpp
@@ -238,8 +238,7 @@ namespace {
                               const AttributeList &Attr, Sema &S) const {
       const llvm::Triple &Triple(S.Context.Target.getTriple());
       if (Triple.getOS() == llvm::Triple::Win32 ||
-          Triple.getOS() == llvm::Triple::MinGW32 ||
-          Triple.getOS() == llvm::Triple::MinGW64) {
+          Triple.getOS() == llvm::Triple::MinGW32) {
         switch (Attr.getKind()) {
         case AttributeList::AT_dllimport: HandleDLLImportAttr(D, Attr, S);
                                           return true;

--------------1.7.1.GIT--


-------------- next part --------------
From 7b89bb61e24b3f2e51aa6d0be94938de8a5700d5 Mon Sep 17 00:00:00 2001
From: NAKAMURA Takumi <geek4civic at gmail.com>
Date: Wed, 16 Feb 2011 10:41:06 +0900
Subject: [PATCH] Triple::MinGW64 is deprecated and removed. We can use Triple::MinGW32 generally.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.7.1.GIT"

This is a multi-part message in MIME format.
--------------1.7.1.GIT
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


No one uses *-mingw64. mingw-w64 is represented as {i686|x86_64}-w64-mingw32. In llvm side, i686 and x64 can be treated as similar way.
---
 include/llvm/ADT/Triple.h                          |    3 +--
 lib/Support/Triple.cpp                             |    3 ---
 lib/Target/ARM/ARMTargetMachine.cpp                |    1 -
 lib/Target/MBlaze/MBlazeTargetMachine.cpp          |    1 -
 lib/Target/X86/X86AsmBackend.cpp                   |    2 +-
 lib/Target/X86/X86Subtarget.h                      |    4 +---
 lib/Target/X86/X86TargetMachine.cpp                |    2 --
 test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll |    2 +-
 test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll       |    2 +-
 9 files changed, 5 insertions(+), 15 deletions(-)


--------------1.7.1.GIT
Content-Type: text/x-patch; name="0001-Triple-MinGW64-is-deprecated-and-removed.-We-can.patch.txt"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Triple-MinGW64-is-deprecated-and-removed.-We-can.patch.txt"

diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h
index 9e2eb86..e6dcc23 100644
--- a/include/llvm/ADT/Triple.h
+++ b/include/llvm/ADT/Triple.h
@@ -84,8 +84,7 @@ public:
     FreeBSD,
     Linux,
     Lv2,        // PS3
-    MinGW32,
-    MinGW64,
+    MinGW32,    // i*86-pc-mingw32, *-w64-mingw32
     NetBSD,
     OpenBSD,
     Psp,
diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp
index d4a7dec..36edf6e 100644
--- a/lib/Support/Triple.cpp
+++ b/lib/Support/Triple.cpp
@@ -101,7 +101,6 @@ const char *Triple::getOSTypeName(OSType Kind) {
   case Linux: return "linux";
   case Lv2: return "lv2";
   case MinGW32: return "mingw32";
-  case MinGW64: return "mingw64";
   case NetBSD: return "netbsd";
   case OpenBSD: return "openbsd";
   case Psp: return "psp";
@@ -318,8 +317,6 @@ Triple::OSType Triple::ParseOS(StringRef OSName) {
     return Lv2;
   else if (OSName.startswith("mingw32"))
     return MinGW32;
-  else if (OSName.startswith("mingw64"))
-    return MinGW64;
   else if (OSName.startswith("netbsd"))
     return NetBSD;
   else if (OSName.startswith("openbsd"))
diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp
index 60df718..0ee773b 100644
--- a/lib/Target/ARM/ARMTargetMachine.cpp
+++ b/lib/Target/ARM/ARMTargetMachine.cpp
@@ -45,7 +45,6 @@ static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
   case Triple::Darwin:
     return createMachOStreamer(Ctx, TAB, OS, Emitter, RelaxAll);
   case Triple::MinGW32:
-  case Triple::MinGW64:
   case Triple::Cygwin:
   case Triple::Win32:
     llvm_unreachable("ARM does not support Windows COFF format");
diff --git a/lib/Target/MBlaze/MBlazeTargetMachine.cpp b/lib/Target/MBlaze/MBlazeTargetMachine.cpp
index f83f70b..cd949e1 100644
--- a/lib/Target/MBlaze/MBlazeTargetMachine.cpp
+++ b/lib/Target/MBlaze/MBlazeTargetMachine.cpp
@@ -41,7 +41,6 @@ static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
     llvm_unreachable("MBlaze does not support Darwin MACH-O format");
     return NULL;
   case Triple::MinGW32:
-  case Triple::MinGW64:
   case Triple::Cygwin:
   case Triple::Win32:
     llvm_unreachable("MBlaze does not support Windows COFF format");
diff --git a/lib/Target/X86/X86AsmBackend.cpp b/lib/Target/X86/X86AsmBackend.cpp
index 3c426be..da5f5b1 100644
--- a/lib/Target/X86/X86AsmBackend.cpp
+++ b/lib/Target/X86/X86AsmBackend.cpp
@@ -428,7 +428,7 @@ TargetAsmBackend *llvm::createX86_64AsmBackend(const Target &T,
   switch (Triple(TT).getOS()) {
   case Triple::Darwin:
     return new DarwinX86_64AsmBackend(T);
-  case Triple::MinGW64:
+  case Triple::MinGW32:
   case Triple::Cygwin:
   case Triple::Win32:
     if (Triple(TT).getEnvironment() == Triple::MachO)
diff --git a/lib/Target/X86/X86Subtarget.h b/lib/Target/X86/X86Subtarget.h
index 48ceb21..2bd60da 100644
--- a/lib/Target/X86/X86Subtarget.h
+++ b/lib/Target/X86/X86Subtarget.h
@@ -175,9 +175,7 @@ public:
   bool isTargetLinux() const { return TargetTriple.getOS() == Triple::Linux; }
 
   bool isTargetWindows() const { return TargetTriple.getOS() == Triple::Win32; }
-  bool isTargetMingw() const { 
-    return TargetTriple.getOS() == Triple::MinGW32 ||
-           TargetTriple.getOS() == Triple::MinGW64; }
+  bool isTargetMingw() const { return TargetTriple.getOS() == Triple::MinGW32; }
   bool isTargetCygwin() const { return TargetTriple.getOS() == Triple::Cygwin; }
   bool isTargetCygMing() const {
     return isTargetMingw() || isTargetCygwin();
diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp
index f216279..b2a9a5c 100644
--- a/lib/Target/X86/X86TargetMachine.cpp
+++ b/lib/Target/X86/X86TargetMachine.cpp
@@ -30,7 +30,6 @@ static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
   case Triple::Darwin:
     return new X86MCAsmInfoDarwin(TheTriple);
   case Triple::MinGW32:
-  case Triple::MinGW64:
   case Triple::Cygwin:
   case Triple::Win32:
     if (TheTriple.getEnvironment() == Triple::MachO)
@@ -53,7 +52,6 @@ static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
   case Triple::Darwin:
     return createMachOStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll);
   case Triple::MinGW32:
-  case Triple::MinGW64:
   case Triple::Cygwin:
   case Triple::Win32:
     if (TheTriple.getEnvironment() == Triple::MachO)
diff --git a/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll b/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll
index 9d06a9e..98b1e0e 100644
--- a/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll
+++ b/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll
@@ -1,4 +1,4 @@
-; RUN: llc -mtriple=x86_64-pc-mingw64 < %s | FileCheck %s
+; RUN: llc -mtriple=x86_64-mingw32 < %s | FileCheck %s
 ; CHECK-NOT: -{{[1-9][0-9]*}}(%rsp)
 
 define x86_fp80 @a(i64 %x) nounwind readnone {
diff --git a/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll b/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll
index 6e8d9a9..12bd285 100644
--- a/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll
+++ b/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll
@@ -1,4 +1,4 @@
-; RUN: llc -mtriple=x86_64-pc-mingw64 < %s | FileCheck %s
+; RUN: llc -mtriple=x86_64-mingw32 < %s | FileCheck %s
 ; CHECK: subq    $40, %rsp
 ; CHECK: movaps  %xmm8, (%rsp)
 ; CHECK: movaps  %xmm7, 16(%rsp)

--------------1.7.1.GIT--


-------------- next part --------------
From 641db868ffb08e4a49ea8207405e385dcd2d42df Mon Sep 17 00:00:00 2001
From: NAKAMURA Takumi <geek4civic at gmail.com>
Date: Wed, 16 Feb 2011 11:01:30 +0900
Subject: [PATCH 2/2] lib/Frontend/InitHeaderSearch.cpp: Add mingw-w64's include paths.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.7.1.GIT"

This is a multi-part message in MIME format.
--------------1.7.1.GIT
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 lib/Frontend/InitHeaderSearch.cpp |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)


--------------1.7.1.GIT
Content-Type: text/x-patch; name="0002-lib-Frontend-InitHeaderSearch.cpp-Add-mingw-w64-.patch.txt"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0002-lib-Frontend-InitHeaderSearch.cpp-Add-mingw-w64-.patch.txt"

diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp
index 39f30e5..cc9bb0c 100644
--- a/lib/Frontend/InitHeaderSearch.cpp
+++ b/lib/Frontend/InitHeaderSearch.cpp
@@ -566,6 +566,14 @@ AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple) {
     AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "3.4.4");
     break;
   case llvm::Triple::MinGW32:
+    // mingw-w64-20110207
+    AddPath("c:/MinGW/include/c++/4.5.3", System, true, false, false);
+    AddPath("c:/MinGW/include/c++/4.5.3/x86_64-w64-mingw32", System, true, false, false);
+    AddPath("c:/MinGW/include/c++/4.5.3/backward", System, true, false, false);
+    // mingw-w64-20101129
+    AddPath("c:/MinGW/include/c++/4.5.2", System, true, false, false);
+    AddPath("c:/MinGW/include/c++/4.5.2/x86_64-w64-mingw32", System, true, false, false);
+    AddPath("c:/MinGW/include/c++/4.5.2/backward", System, true, false, false);
    // Try gcc 4.5.0
     AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.5.0"); 
     // Try gcc 4.4.0

--------------1.7.1.GIT--




More information about the cfe-commits mailing list