[PATCH] Support constant expressions, including non-type template parameters, in pragma loop hints
Tyler Nowicki
tnowicki at apple.com
Tue Jul 29 15:15:21 PDT 2014
Hi Aaron,
I’ve cut another piece off the constant expression patch. This piece adds the state variable to the loop hint attribute. Would you be able tor review it?
Parts of this patch may seem a little overkill, they are necessary to support constant expressions. Specifically, the way the argument to a loop hint pragma is handled. The single token argument is replaced by an array of tokens which either give a keyword (single token) or a constant expression (multiple tokens). We need to have these cases separated out to pass the hint to the SemaStmtAttr handler. Consequently validation of the keywords must move from SemaStmtAttr handler to the loop hint annotation token handler. It makes the token handler a bit more complicated and the SemaStmtAttr a bit simpler.
A couple of new tests are included as well.
Tyler
On Jul 28, 2014, at 3:00 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
> On Mon, Jul 28, 2014 at 5:37 PM, Tyler Nowicki <tnowicki at apple.com> wrote:
>>
>>>> Hi,
>>>>
>>>> My internship finishes up this week, and Aaron informed me he won’t be able
>>>> to respond until next week. Would someone be able to review the patches
>>>> these patches so I can get them in before I leave?
>>>
>>> Not to make a liar of you (I really am on "vacation"), but I don't
>>> want you to get stuck waiting on me. :-)
>>>
>>> Minor comments, but with fixing them up, LGTM!
>>
>> Thanks! Sorry to drag you away from your vacation.
>
> No worries. :-)
>
>>
>> I made your corrections and I will commit the patch. The only think I didn’t do was to change the raw_ostream because this patch is a lead-up to the constant expression patch. AFAIK the only way to print a constant expression is to use printPretty which requires a raw_ostream. So 'OS << value' in the this patch becomes 'value->printPretty(OS, nullptr, Policy);’ in the next.
>
> Ah, sounds good to me!
>
>>>> Index: include/clang/Basic/Attr.td
>>>> ===================================================================
>>>> --- include/clang/Basic/Attr.td (revision 214099)
>>>> +++ include/clang/Basic/Attr.td (working copy)
>>>> @@ -1815,12 +1815,6 @@
>>>> llvm_unreachable("Unhandled LoopHint option.");
>>>> }
>>>>
>>>> - static StringRef getValueName(int Value) {
>>>> - if (Value)
>>>> - return "enable";
>>>> - return "disable";
>>>> - }
>>>> -
>>>
>>> Good catch here, but will this conflict with Mark's upcoming patch? I
>>> don't think it will, but better to ask now. ;-)
>>
>> I don’t think so. Mark’s nounroll patch is already in.
>
> Phew. :-)
>
> ~Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140729/663376c2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: loop_hint_attr_state-svn.patch
Type: application/octet-stream
Size: 21911 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140729/663376c2/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140729/663376c2/attachment-0001.html>
More information about the cfe-commits
mailing list