[PATCH] CFE Knob for: Add a thread-model knob for lowering atomics on baremetal & single threaded systems
Jonathan Roelofs
jonathan at codesourcery.com
Fri Aug 29 11:28:02 PDT 2014
On 8/29/14, 12:16 PM, Aaron Ballman wrote:
> On Fri, Aug 29, 2014 at 1:26 PM, Jon Roelofs <jonathan at codesourcery.com> wrote:
>> ================
>> Comment at: lib/CodeGen/BackendUtil.cpp:422-429
>> @@ -421,1 +421,10 @@
>>
>> + if (CodeGenOpts.ThreadModel == "posix")
>> + Options.ThreadModel = llvm::ThreadModel::POSIX;
>> + else if (CodeGenOpts.ThreadModel == "single")
>> + Options.ThreadModel = llvm::ThreadModel::Single;
>> + else {
>> + assert(false && "Invalid Thread model!");
>> + Options.ThreadModel = llvm::ThreadModel::POSIX;
>> + }
>> +
>> ----------------
>> majnemer wrote:
>>> You may want to consider using LLVM's [[ http://llvm.org/docs/doxygen/html/classllvm_1_1StringSwitch.html#details | StringSwitch ]] here.
>> 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.
Oh. That's awesome!
I'll swap this out for StringSwitch then.
Jon
>
> ~Aaron
>
--
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded
More information about the cfe-commits
mailing list