[PATCH] D11071: Add Windows ARM targets for mingw and cygwin to clang

Martell Malone martellmalone at gmail.com
Tue Jul 14 10:53:08 PDT 2015


martell updated this revision to Diff 29684.
martell added a comment.

compnerd requested that we leave the le postfix for itanium targets
added back in the blank namespace guard to fix compile errors

Yaron I previously had namespace guards around the 2 targets.
Removing these in the latest patch caused the compile failure
It seems all mingw targets have a separate guard like this.

If someone could explain why this is needed it would be great :)


http://reviews.llvm.org/D11071

Files:
  lib/Basic/Targets.cpp

Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -4916,7 +4916,53 @@
     WindowsARMTargetInfo::getVisualStudioDefines(Opts, Builder);
   }
 };
+} // end anonymous namespace.
+
+namespace {
+// ARM MinGW target
+class MinGWARMTargetInfo : public WindowsARMTargetInfo {
+public:
+  MinGWARMTargetInfo(const llvm::Triple &Triple)
+    : WindowsARMTargetInfo(Triple) {
+    TheCXXABI.set(TargetCXXABI::GenericARM);
+  }
 
+  void getTargetDefines(const LangOptions &Opts,
+                        MacroBuilder &Builder) const override {
+    WindowsARMTargetInfo::getTargetDefines(Opts, Builder);
+    DefineStd(Builder, "WIN32", Opts);
+    DefineStd(Builder, "WINNT", Opts);
+    Builder.defineMacro("_ARM_");
+    addMinGWDefines(Opts, Builder);
+  }
+};
+} // end anonymous namespace
+
+namespace {
+// ARM Cygwin target
+class CygwinARMTargetInfo : public ARMleTargetInfo {
+public:
+  CygwinARMTargetInfo(const llvm::Triple &Triple)
+      : ARMleTargetInfo(Triple) {
+    TLSSupported = false;
+    WCharType = UnsignedShort;
+    DoubleAlign = LongLongAlign = 64;
+    DescriptionString = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64";
+  }
+  void getTargetDefines(const LangOptions &Opts,
+                        MacroBuilder &Builder) const override {
+    ARMleTargetInfo::getTargetDefines(Opts, Builder);
+    Builder.defineMacro("_ARM_");
+    Builder.defineMacro("__CYGWIN__");
+    Builder.defineMacro("__CYGWIN32__");
+    DefineStd(Builder, "unix", Opts);
+    if (Opts.CPlusPlus)
+      Builder.defineMacro("_GNU_SOURCE");
+  }
+};
+} // end anonymous namespace
+
+namespace {
 class DarwinARMTargetInfo :
   public DarwinTargetInfo<ARMleTargetInfo> {
 protected:
@@ -7037,6 +7083,10 @@
       switch (Triple.getEnvironment()) {
       default:
         return new ARMleTargetInfo(Triple);
+      case llvm::Triple::Cygnus:
+        return new CygwinARMTargetInfo(Triple);
+      case llvm::Triple::GNU:
+        return new MinGWARMTargetInfo(Triple);
       case llvm::Triple::Itanium:
         return new ItaniumWindowsARMleTargetInfo(Triple);
       case llvm::Triple::MSVC:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11071.29684.patch
Type: text/x-patch
Size: 2202 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150714/1bab65a6/attachment.bin>


More information about the cfe-commits mailing list