[llvm-commits] [llvm] r73074 - in /llvm/trunk: docs/TableGenFundamentals.html test/TableGen/regmatch.td utils/TableGen/Record.cpp utils/TableGen/Record.h utils/TableGen/TGLexer.cpp utils/TableGen/TGLexer.h utils/TableGen/TGParser.cpp
Török Edwin
edwintorok at gmail.com
Mon Jun 8 10:19:49 PDT 2009
On 2009-06-08 20:00, David Greene wrote:
> Author: greened
> Date: Mon Jun 8 12:00:34 2009
> New Revision: 73074
>
> URL: http://llvm.org/viewvc/llvm-project?rev=73074&view=rev
> Log:
>
> Add a !regmatch operator to do pattern matching in TableGen.
>
> }
> + case REGMATCH: {
> + StringInit *LHSs = dynamic_cast<StringInit*>(LHS);
> + StringInit *RHSs = dynamic_cast<StringInit*>(RHS);
> + if (LHSs && RHSs) {
> + regex_t compiled;
> + int err = regcomp (&compiled, LHSs->getValue().c_str(), REG_EXTENDED);
>
Hi David,
If you are not using the nmatch/pmatch features of regexec(), you can
pass REG_NOSUB here.
In some situations it can result in a more efficient regular expression.
If REGMATCH is used often you could also compile the regular expression
just once (store it in a map?) and run it multiple times.
Best regards,
--Edwin
More information about the llvm-commits
mailing list