On Sun, Oct 28, 2012 at 11:38 PM, Chris Lattner <[email protected]> wrote: > > On Oct 28, 2012, at 6:54 AM, Dmitri Gribenko <[email protected]> wrote: > >> On Sun, Oct 28, 2012 at 3:49 PM, Mahesha HS <[email protected]> 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 _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
