[cfe-commits] [cfe-dev] [LLVMdev] OpenMP support in CLANG: A proposal

Mahesha HS mahesha.llvm at gmail.com
Sun Oct 28 22:04:29 PDT 2012


On Sun, Oct 28, 2012 at 11:38 PM, Chris Lattner <clattner at apple.com> wrote:
>
> On Oct 28, 2012, at 6:54 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
>
>> On Sun, Oct 28, 2012 at 3:49 PM, Mahesha HS <mahesha.llvm at gmail.com> wrote:
>>> I curiously looked into the OpenMP parsing in GCC. It follows the
>>> method of string comparison but *without* maintaining any string table
>>> in a following manner (by switching based on the first character of an
>>> identifier token) . I think, I can also follow the same technique. I
>>> should have done this long before in order to prevent unnecessarily
>>> maintaining a string table. But, I still welcome other better
>>> techniques, if any.
>>
>> Clang already does this sort of thing, but the matching code is
>> autogenerated by TableGen.  For example, take a look at
>> tools/clang/include/clang/AST/CommentCommandInfo.inc in the build
>> tree.
>>
>> It might sound sensible to code the switch() for OMP clauses by hand
>> just because there are only a few of them.  But OTOH, it will create a
>> possibly unwanted precedent of hardcoding where we have the
>> infrastructure to autogenerate code.
>
> Personally, I'd rather that you optimize for keeping the parsing code *simple*.  There are places in the parser that we have to optimize for performance, but they are rare, and OpenMP directives are not common enough to go to extreme measures like this.  Please just make the code as simple, clear, and short as possible.

I agree with you. I think, I am in a right direction, though some
refactoring is required to make the code further *simple*. I will make
sure that that code is clear, simple, and short as possible.

--
mahesha

>
> -Chris



-- 
mahesha




More information about the cfe-commits mailing list