r244306 - Make 'arm' cover both 32 and 64 bit architecutres

Ben Langmuir via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 6 18:59:57 PDT 2015


Author: benlangmuir
Date: Thu Aug  6 20:59:56 2015
New Revision: 244306

URL: http://llvm.org/viewvc/llvm-project?rev=244306&view=rev
Log:
Make 'arm' cover both 32 and 64 bit architecutres

... and add aarch32 to specifically refer to the 32-bit ones.

Previously, 'arm' meant only 32-bit architectures and there was no way
for a module to build with both 32 and 64 bit ARM architectures.

Now a module that is intended to work on both architectures can specify
    requires arm
whereas a module only for 32-bit platforms can say
    requires aarch32
and just like before, 64-bit only can say
    requires aarch64

Added:
    cfe/trunk/test/Modules/compiler_builtins_aarch64.m
    cfe/trunk/test/Modules/target-features.m
Modified:
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/test/Modules/Inputs/module.map

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=244306&r1=244305&r2=244306&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Aug  6 20:59:56 2015
@@ -4551,6 +4551,7 @@ public:
   bool hasFeature(StringRef Feature) const override {
     return llvm::StringSwitch<bool>(Feature)
         .Case("arm", true)
+        .Case("aarch32", true)
         .Case("softfloat", SoftFloat)
         .Case("thumb", isThumb())
         .Case("neon", (FPU & NeonFPU) && !SoftFloat)
@@ -5198,6 +5199,7 @@ public:
   bool hasFeature(StringRef Feature) const override {
     return Feature == "aarch64" ||
       Feature == "arm64" ||
+      Feature == "arm" ||
       (Feature == "neon" && FPU == NeonMode);
   }
 

Modified: cfe/trunk/test/Modules/Inputs/module.map
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/module.map?rev=244306&r1=244305&r2=244306&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/module.map (original)
+++ cfe/trunk/test/Modules/Inputs/module.map Thu Aug  6 20:59:56 2015
@@ -347,3 +347,16 @@ module RequiresWithMissingHeader {
     header "RequiresWithMissingHeader-Missing2.h"
   }
 }
+
+module TargetFeatures {
+  module arm {
+    requires arm
+    module aarch32 { requires aarch32 }
+    module aarch64 { requires aarch64 }
+  }
+  module x86 {
+    requires x86
+    module x86_32 { requires x86_32 }
+    module x86_64 { requires x86_64 }
+  }
+}

Added: cfe/trunk/test/Modules/compiler_builtins_aarch64.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/compiler_builtins_aarch64.m?rev=244306&view=auto
==============================================================================
--- cfe/trunk/test/Modules/compiler_builtins_aarch64.m (added)
+++ cfe/trunk/test/Modules/compiler_builtins_aarch64.m Thu Aug  6 20:59:56 2015
@@ -0,0 +1,6 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fsyntax-only -triple aarch64-unknown-unknown -target-feature +neon -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -verify %s
+// expected-no-diagnostics
+// REQUIRES: aarch64-registered-target
+ at import _Builtin_intrinsics.arm;
+ at import _Builtin_intrinsics.arm.neon;

Added: cfe/trunk/test/Modules/target-features.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/target-features.m?rev=244306&view=auto
==============================================================================
--- cfe/trunk/test/Modules/target-features.m (added)
+++ cfe/trunk/test/Modules/target-features.m Thu Aug  6 20:59:56 2015
@@ -0,0 +1,61 @@
+// REQUIRES: x86-registered-target
+// REQUIRES: arm-registered-target
+// REQUIRES: aarch64-registered-target
+
+// RUN: rm -rf %t
+
+// Sanity check one of the compilations.
+// RUN: %clang_cc1 -triple aarch64-unknown-unknown -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs -fsyntax-only %s -verify -DSANITY_CHECK
+// expected-no-diagnostics
+
+// Check all the targets:
+// RUN: not %clang_cc1 -triple armv7-unknown-unknown -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs -fsyntax-only  %s 2> %t.aarch32
+// RUN: FileCheck %s -check-prefix=AARCH32 < %t.aarch32
+// RUN: not %clang_cc1 -triple aarch64-unknown-unknown -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs -fsyntax-only  %s 2> %t.aarch64
+// RUN: FileCheck %s -check-prefix=AARCH64 < %t.aarch64
+// RUN: not %clang_cc1 -triple i386-unknown-unknown -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs -fsyntax-only  %s 2> %t.x86_32
+// RUN: FileCheck %s -check-prefix=X86_32 < %t.x86_32
+// RUN: not %clang_cc1 -triple x86_64-unknown-unknown -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs -fsyntax-only  %s 2> %t.x86_64
+// RUN: FileCheck %s -check-prefix=X86_64 < %t.x86_64
+
+#ifndef SANITY_CHECK
+ at import TargetFeatures;
+// AARCH32-NOT: module 'TargetFeatures' requires
+// AARCH64-NOT: module 'TargetFeatures' requires
+// X86_32-NOT: module 'TargetFeatures' requires
+// X86_64-NOT: module 'TargetFeatures' requires
+ at import TargetFeatures.arm;
+// AARCH32-NOT: module 'TargetFeatures.arm' requires
+// AARCH64-NOT: module 'TargetFeatures.arm' requires
+// X86_32: module 'TargetFeatures.arm' requires feature 'arm'
+// X86_64: module 'TargetFeatures.arm' requires feature 'arm'
+ at import TargetFeatures.arm.aarch32;
+// AARCH32-NOT: module 'TargetFeatures.arm.aarch32' requires
+// AARCH64: module 'TargetFeatures.arm.aarch32' requires feature 'aarch32'
+// X86_32: module 'TargetFeatures.arm.aarch32' requires feature 
+// X86_64: module 'TargetFeatures.arm.aarch32' requires feature
+#endif
+
+ at import TargetFeatures.arm.aarch64;
+// AARCH32: module 'TargetFeatures.arm.aarch64' requires feature 'aarch64'
+// AARCH64-NOT: module 'TargetFeatures.arm.aarch64' requires
+// X86_32: module 'TargetFeatures.arm.aarch64' requires feature 
+// X86_64: module 'TargetFeatures.arm.aarch64' requires feature
+
+#ifndef SANITY_CHECK
+ at import TargetFeatures.x86;
+// AARCH32:  module 'TargetFeatures.x86' requires feature 'x86'
+// AARCH64:  module 'TargetFeatures.x86' requires feature 'x86'
+// X86_32-NOT: module 'TargetFeatures.x86' requires
+// X86_64-NOT: module 'TargetFeatures.x86' requires
+ at import TargetFeatures.x86.x86_32;
+// AARCH32:  module 'TargetFeatures.x86.x86_32' requires feature
+// AARCH64:  module 'TargetFeatures.x86.x86_32' requires feature
+// X86_32-NOT: module 'TargetFeatures.x86.x86_32' requires
+// X86_64: module 'TargetFeatures.x86.x86_32' requires feature 'x86_32'
+ at import TargetFeatures.x86.x86_64;
+// AARCH32:  module 'TargetFeatures.x86.x86_64' requires feature
+// AARCH64:  module 'TargetFeatures.x86.x86_64' requires feature
+// X86_32: module 'TargetFeatures.x86.x86_64' requires feature 'x86_64'
+// X86_64-NOT: module 'TargetFeatures.x86.x86_64' requires
+#endif




More information about the cfe-commits mailing list