[PATCH] MS ABI: Implement /volatile:ms

Dmitry Vyukov dvyukov at google.com
Thu Feb 12 10:29:35 PST 2015


================
Comment at: lib/CodeGen/CGAtomic.cpp:1011
@@ +1010,3 @@
+  AtomicInfo AI(*this, LV);
+  return CGM.getCodeGenOpts().MSVolatile && !AI.shouldUseLibcall() &&
+         (LV.isVolatile() || hasVolatileMember(LV.getType()));
----------------
majnemer wrote:
> dvyukov wrote:
> > I don't get the !AI.shouldUseLibcall() part.
> > If the atomic operation would use a libcall, then you don't turn volatile access into atomic? Why? How is it related to libcalls?
> `shouldUseLibcall` means that than atomic operation is not suitably aligned or sized to be lowered to a `load atomic` or `store atomic` instruction.  These conditions are identical to the conditions that MSVC uses to say that a volatile load or store will also have acquire or release semantics.
Doesn't shouldUseLibcall also mean that the value is too fat for backend codegen, so just call a library functions (e.g. a 64-bit store on a 32-bit platform)? That's what I figure out from the name. Perhaps deserves a comment.

http://reviews.llvm.org/D7580

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list