diff options
| author | Bradley Smith <bradley.smith@arm.com> | 2016-03-03 13:52:22 +0000 |
|---|---|---|
| committer | Bradley Smith <bradley.smith@arm.com> | 2016-03-03 13:52:22 +0000 |
| commit | f4affc13c52f03683568450a6387a38519a17bdb (patch) | |
| tree | 91764e59069356494294f44be9f848a937db0ef0 /clang/lib | |
| parent | 65c02ec83785e6e4ddb656d7bc33d7242ef0737d (diff) | |
| download | bcm5719-llvm-f4affc13c52f03683568450a6387a38519a17bdb.tar.gz bcm5719-llvm-f4affc13c52f03683568450a6387a38519a17bdb.zip | |
[ARM] Add Clang targeting for ARMv8-M Baseline/Mainline
llvm-svn: 262619
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Basic/Targets.cpp | 20 | ||||
| -rw-r--r-- | clang/lib/Driver/Tools.cpp | 4 |
2 files changed, 17 insertions, 7 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 68a19985732..9f0fb902f38 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -4536,7 +4536,8 @@ class ARMTargetInfo : public TargetInfo { } bool supportsThumb2() const { - return CPUAttr.equals("6T2") || ArchVersion >= 7; + return CPUAttr.equals("6T2") || + (ArchVersion >= 7 && !CPUAttr.equals("8M_BASE")); } StringRef getCPUAttr() const { @@ -4563,6 +4564,10 @@ class ARMTargetInfo : public TargetInfo { return "8_1A"; case llvm::ARM::AK_ARMV8_2A: return "8_2A"; + case llvm::ARM::AK_ARMV8MBaseline: + return "8M_BASE"; + case llvm::ARM::AK_ARMV8MMainline: + return "8M_MAIN"; } } @@ -4852,13 +4857,14 @@ public: // __ARM_ARCH_ISA_ARM is defined to 1 if the core supports the ARM ISA. It // is not defined for the M-profile. - // NOTE that the deffault profile is assumed to be 'A' - if (CPUProfile.empty() || CPUProfile != "M") + // NOTE that the default profile is assumed to be 'A' + if (CPUProfile.empty() || ArchProfile != llvm::ARM::PK_M) Builder.defineMacro("__ARM_ARCH_ISA_ARM", "1"); - // __ARM_ARCH_ISA_THUMB is defined to 1 if the core supporst the original - // Thumb ISA (including v6-M). It is set to 2 if the core supports the - // Thumb-2 ISA as found in the v6T2 architecture and all v7 architecture. + // __ARM_ARCH_ISA_THUMB is defined to 1 if the core supports the original + // Thumb ISA (including v6-M and v8-M Baseline). It is set to 2 if the + // core supports the Thumb-2 ISA as found in the v6T2 architecture and all + // v7 and v8 architectures excluding v8-M Baseline. if (supportsThumb2()) Builder.defineMacro("__ARM_ARCH_ISA_THUMB", "2"); else if (supportsThumb()) @@ -4978,7 +4984,7 @@ public: Builder.defineMacro("__ARM_SIZEOF_MINIMAL_ENUM", Opts.ShortEnums ? "1" : "4"); - if (ArchVersion >= 6 && CPUAttr != "6M") { + if (ArchVersion >= 6 && CPUAttr != "6M" && CPUAttr != "8M_BASE") { Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1"); Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2"); Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4"); diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 6e97183da1c..285a8221f0b 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -963,6 +963,10 @@ static void getARMTargetFeatures(const ToolChain &TC, // No v6M core supports unaligned memory access (v6M ARM ARM A3.2). if (Triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v6m) D.Diag(diag::err_target_unsupported_unaligned) << "v6m"; + // v8M Baseline follows on from v6M, so doesn't support unaligned memory + // access either. + else if (Triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v8m_baseline) + D.Diag(diag::err_target_unsupported_unaligned) << "v8m.base"; } else Features.push_back("+strict-align"); } else { |

