Skip to content

Instantly share code, notes, and snippets.

@jroelofs
Created July 2, 2014 16:35
Show Gist options
  • Save jroelofs/2b0a1511e197a526272d to your computer and use it in GitHub Desktop.
Save jroelofs/2b0a1511e197a526272d to your computer and use it in GitHub Desktop.
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp (revision 209242)
+++ lib/Basic/Targets.cpp (working copy)
@@ -3751,7 +3751,8 @@
if (!T.isOSLinux() &&
T.getOS() != llvm::Triple::FreeBSD &&
T.getOS() != llvm::Triple::NetBSD &&
- T.getOS() != llvm::Triple::Bitrig)
+ T.getOS() != llvm::Triple::Bitrig &&
+ T.getOS() != llvm::Triple::UnknownOS) // A 'None' OSType would be more appropriate
return false;
StringRef ArchName = T.getArchName();
if (T.getArch() == llvm::Triple::arm ||
@@ -3758,9 +3759,9 @@
T.getArch() == llvm::Triple::armeb) {
StringRef VersionStr;
if (ArchName.startswith("armv"))
- VersionStr = ArchName.substr(4);
+ VersionStr = ArchName.substr(4, 1);
else if (ArchName.startswith("armebv"))
- VersionStr = ArchName.substr(6);
+ VersionStr = ArchName.substr(6, 1);
else
return false;
unsigned Version;
@@ -3772,9 +3773,9 @@
T.getArch() == llvm::Triple::thumbeb);
StringRef VersionStr;
if (ArchName.startswith("thumbv"))
- VersionStr = ArchName.substr(6);
+ VersionStr = ArchName.substr(6, 1);
else if (ArchName.startswith("thumbebv"))
- VersionStr = ArchName.substr(8);
+ VersionStr = ArchName.substr(8, 1);
else
return false;
unsigned Version;
@@ -4118,6 +4119,13 @@
if (!getCPUDefineSuffix(Name))
return false;
+ // Cortex M does not support 8 byte atomics, while general Thumb2 does.
+ StringRef Profile = getCPUProfile(Name);
+ if (Profile == "M" && MaxAtomicInlineWidth) {
+ MaxAtomicPromoteWidth = 32;
+ MaxAtomicInlineWidth = 32;
+ }
+
CPU = Name;
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment