diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-05-20 18:10:42 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-05-20 18:10:42 +0000 |
commit | 5875c33746a86c4596b3039768889680ff4f5752 (patch) | |
tree | 3643a6a0aa28e5f38c4caeb5b6a73eedcca182d5 /lib/TableGen | |
parent | 6514551be704adb577682148ca825c08fd642329 (diff) | |
download | external_llvm-5875c33746a86c4596b3039768889680ff4f5752.zip external_llvm-5875c33746a86c4596b3039768889680ff4f5752.tar.gz external_llvm-5875c33746a86c4596b3039768889680ff4f5752.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157161 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/TableGen')
-rw-r--r-- | lib/TableGen/StringMatcher.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/TableGen/StringMatcher.cpp b/lib/TableGen/StringMatcher.cpp index 0ce626d..1668170 100644 --- a/lib/TableGen/StringMatcher.cpp +++ b/lib/TableGen/StringMatcher.cpp @@ -87,11 +87,11 @@ EmitStringMatcherForChar(const std::vector<const StringPair*> &Matches, << 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"; } |