[llvm-branch-commits] [cfe-branch] r181919 - Merging r181728:
Bill Wendling
isanbard at gmail.com
Wed May 15 14:06:54 PDT 2013
Author: void
Date: Wed May 15 16:06:54 2013
New Revision: 181919
URL: http://llvm.org/viewvc/llvm-project?rev=181919&view=rev
Log:
Merging r181728:
------------------------------------------------------------------------
r181728 | rafael | 2013-05-13 13:09:47 -0700 (Mon, 13 May 2013) | 6 lines
Use atomic instructions on ARM linux.
This is safe given how the pre-v6 atomic ops funcions in libgcc are
implemented.
This fixes pr15429.
------------------------------------------------------------------------
Added:
cfe/branches/release_33/test/CodeGen/linux-arm-atomic.c
- copied unchanged from r181728, cfe/trunk/test/CodeGen/linux-arm-atomic.c
Modified:
cfe/branches/release_33/ (props changed)
cfe/branches/release_33/lib/Basic/Targets.cpp
Propchange: cfe/branches/release_33/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed May 15 16:06:54 2013
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:181286,181299,181368
+/cfe/trunk:181286,181299,181368,181728
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_33/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_33/lib/Basic/Targets.cpp?rev=181919&r1=181918&r2=181919&view=diff
==============================================================================
--- cfe/branches/release_33/lib/Basic/Targets.cpp (original)
+++ cfe/branches/release_33/lib/Basic/Targets.cpp Wed May 15 16:06:54 2013
@@ -3527,6 +3527,20 @@ class ARMTargetInfo : public TargetInfo
static const Builtin::Info BuiltinInfo[];
+ static bool shouldUseInlineAtomic(const llvm::Triple &T) {
+ // On linux, binaries targeting old cpus call functions in libgcc to
+ // perform atomic operations. The implementation in libgcc then calls into
+ // the kernel which on armv6 and newer uses ldrex and strex. The net result
+ // is that if we assume the kernel is at least as recent as the hardware,
+ // it is safe to use atomic instructions on armv6 and newer.
+ if (T.getOS() != llvm::Triple::Linux)
+ return false;
+ StringRef ArchName = T.getArchName();
+ if (ArchName.startswith("armv6") || ArchName.startswith("armv7"))
+ return true;
+ return false;
+ }
+
public:
ARMTargetInfo(const std::string &TripleStr)
: TargetInfo(TripleStr), ABI("aapcs-linux"), CPU("arm1136j-s"), IsAAPCS(true)
@@ -3559,8 +3573,9 @@ public:
TheCXXABI.set(TargetCXXABI::GenericARM);
// ARM has atomics up to 8 bytes
- // FIXME: Set MaxAtomicInlineWidth if we have the feature v6e
MaxAtomicPromoteWidth = 64;
+ if (shouldUseInlineAtomic(getTriple()))
+ MaxAtomicInlineWidth = 64;
// Do force alignment of members that follow zero length bitfields. If
// the alignment of the zero-length bitfield is greater than the member
More information about the llvm-branch-commits
mailing list