[llvm-commits] [llvm] r157161 - /llvm/trunk/lib/TableGen/StringMatcher.cpp

Chris Lattner clattner at apple.com
Sun May 20 11:58:47 PDT 2012


On May 20, 2012, at 11:10 AM, Benjamin Kramer wrote:

> Author: d0k
> Date: Sun May 20 13:10:42 2012
> New Revision: 157161
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=157161&view=rev
> Log:
> Emit memcmp directly from the StringMatcherEmitter.
> 
> There should be no difference in the resulting binary, given a sufficiently
> smart compiler. However we already had compiler timeouts on the generated
> code in Intrinsics.gen, this hopefully makes the lives of slow buildbots a
> little easier.

Thanks!  This also helps debug builds of tblgen.

-Chris

> 
> Modified:
>    llvm/trunk/lib/TableGen/StringMatcher.cpp
> 
> Modified: llvm/trunk/lib/TableGen/StringMatcher.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/StringMatcher.cpp?rev=157161&r1=157160&r2=157161&view=diff
> ==============================================================================
> --- llvm/trunk/lib/TableGen/StringMatcher.cpp (original)
> +++ llvm/trunk/lib/TableGen/StringMatcher.cpp Sun May 20 13:10:42 2012
> @@ -87,11 +87,11 @@
>       << Matches[0]->first[CharNo] << "')\n";
>       OS << Indent << "  break;\n";
>     } else {
> -      // Do the comparison with if (Str.substr(1, 3) != "foo").    
> +      // Do the comparison with if memcmp(Str.data()+1, "foo", 3).
>       // FIXME: Need to escape general strings.
> -      OS << Indent << "if (" << StrVariableName << ".substr(" << CharNo << ", "
> -      << NumChars << ") != \"";
> -      OS << Matches[0]->first.substr(CharNo, NumChars) << "\")\n";
> +      OS << Indent << "if (memcmp(" << StrVariableName << ".data()+" << CharNo
> +         << ", \"" << Matches[0]->first.substr(CharNo, NumChars) << "\", "
> +         << NumChars << "))\n";
>       OS << Indent << "  break;\n";
>     }
> 
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list