[PATCH] CFE Knob for: Add a thread-model knob for lowering atomics on baremetal & single threaded systems

Jon Roelofs jonathan at codesourcery.com
Wed Sep 3 08:48:24 PDT 2014


================
Comment at: lib/CodeGen/BackendUtil.cpp:431
@@ +430,3 @@
+      .Case("posix", llvm::ThreadModel::POSIX)
+      .Case("single", llvm::ThreadModel::Single);
+
----------------
t.p.northover wrote:
> rengolin wrote:
> > Shouldn't this have a .Default()? If so, which value?
> And is "posix" really the best term for the C++11 model? Windows has just as much history of threading, and it was all rather a bodge before the C++11 description came around.
I based the name on the thing printed out by `clang++ -v - < /dev/null` and `g++ -v - < /dev/null`:

$ clang++ -v - < /dev/null
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix
clang: error: -E or -x required when input is from standard input

See: https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_concurrency.html

================
Comment at: lib/CodeGen/BackendUtil.cpp:431
@@ +430,3 @@
+      .Case("posix", llvm::ThreadModel::POSIX)
+      .Case("single", llvm::ThreadModel::Single);
+
----------------
jroelofs wrote:
> t.p.northover wrote:
> > rengolin wrote:
> > > Shouldn't this have a .Default()? If so, which value?
> > And is "posix" really the best term for the C++11 model? Windows has just as much history of threading, and it was all rather a bodge before the C++11 description came around.
> I based the name on the thing printed out by `clang++ -v - < /dev/null` and `g++ -v - < /dev/null`:
> 
> $ clang++ -v - < /dev/null
> Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
> Target: x86_64-apple-darwin13.3.0
> Thread model: posix
> clang: error: -E or -x required when input is from standard input
> 
> See: https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_concurrency.html
>From earlier in the thread:

"I considered it, but Stringswitch wouldn't let me assert that every case was handled."

"StringSwitch does that automatically for you when getting the result
if you leave off the .Default call."

http://reviews.llvm.org/D4985






More information about the cfe-commits mailing list