[PATCH] Support constant expressions, including non-type template parameters, in pragma loop hints

Tyler Nowicki tnowicki at apple.com
Wed Jul 30 17:49:06 PDT 2014


Hi Aaron,

Thanks for the suggestions again. Here is the updated patch.

>>>> #include "clang/AST/Decl.h"
>>>> +#include "clang/AST/Expr.h"
>>> 
>>> This include should not be required here.
>> 
>> This is required to call printPretty on the value expression in LoopHintAttr.
> 
> Ugh. That's unfortunate. Perhaps ClangAttrEmitter needs to understand
> that some AdditionalMembers are meant for the class declaration
> (Attrs.inc), and others are meant for the class definition
> (AttrImpl.inc)…

Looks like that might be tricky. I think the easiest way to do that would be to modify tablegen to use an AdditionalMembersImpl field that would contain the implementation of methods defined in the AdditionalMembers field.

I can try to do that before I leave, but with only 2 more days it is unlikely that I will be able to finish it.


> I was thinking of parsing nonsense (like a fuzzer):
> 
> #pragma clang loop vectorize_width(1+(^*/2 * ()
> #pragma clang loop vectorize_width(1+(-0[0]))))))
> 
> Just to ensure that we always recover gracefully from crazy input.

I added the suggested tests. No problems.

Tyler

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140730/8e8074d7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: loop_hint_constant_expression-svn.patch
Type: application/octet-stream
Size: 3699 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140730/8e8074d7/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140730/8e8074d7/attachment-0001.html>


More information about the cfe-commits mailing list