[Patch] Options: use TableGen to build PrefixesUnion (Was: Re: [cfe-commits] r166444 - in /cfe/trunk: include/clang/Driver/ lib/Driver/ lib/Frontend/ utils/TableGen/)

Hans Wennborg hans at chromium.org
Thu Jul 11 17:26:04 PDT 2013


Hi,

I have a patch (split into three steps since it goes across
clang/llvm) that fixes this.

Please take a look!

Thanks,
Hans

On Fri, Mar 15, 2013 at 12:16 PM, Daniel Dunbar <daniel at zuster.org> wrote:
> Hi Michael,
>
> I just happened to notice one thing about this patch that is suboptimal.
> This code:
> --
>   // Build prefixes.
>   for (unsigned i = FirstSearchableIndex + 1, e = getNumOptions() + 1;
>                 i != e; ++i) {
>     if (const char *const *P = getInfo(i).Prefixes) {
>       for (; *P != 0; ++P) {
>         PrefixesUnion.insert(*P);
>       }
>     }
>   }
> --
> does a lot of runtime computation (relatively) for very little value.
>
> Could you fix these two structures (PrefixesUnion and PrefixChars) to be
> computed by the tblgen pass?
>
>  - Daniel
>
>
>
> On Mon, Oct 22, 2012 at 3:13 PM, Michael J. Spencer <bigcheesegs at gmail.com>
> wrote:
>>
>> Author: mspencer
>> Date: Mon Oct 22 17:13:48 2012
>> New Revision: 166444
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=166444&view=rev
>> Log:
>> [Options] Add prefixes to options.
>>
>> Each option has a set of prefixes. When matching an argument such as
>> -funroll-loops. First the leading - is removed as it is a prefix. Then
>> a lower_bound search for "funroll-loops" is done against the option table
>> by
>> option name. From there each option prefix + option name combination is
>> tested
>> against the argument.
>>
>> This allows us to support Microsoft style options where both / and - are
>> valid
>> prefixes. It also simplifies the cases we already have where options come
>> in
>> both - and -- forms. Almost every option for gnu-ld happens to have this
>> form.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1-llvm-tablegen-prefixesunion.patch
Type: application/octet-stream
Size: 4875 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130711/56533a4b/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2-clang-pass-in-tablegenned-prefixesunion.patch
Type: application/octet-stream
Size: 3293 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130711/56533a4b/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3-llvm-use-tablegenned-prefixesunion.patch
Type: application/octet-stream
Size: 4292 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130711/56533a4b/attachment-0002.obj>


More information about the cfe-commits mailing list