summaryrefslogtreecommitdiffstats
path: root/llvm/lib/TableGen/StringMatcher.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-05-20 18:10:42 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-05-20 18:10:42 +0000
commita40555826e1b970712a0a4e1704de71fb33136dd (patch)
tree187a3be6d8f6fa1f116c41e32a6b53d0bb78bd2b /llvm/lib/TableGen/StringMatcher.cpp
parent76004e69a6c5f1d5ad92a82b3f6fae80a9e024ab (diff)
downloadbcm5719-llvm-a40555826e1b970712a0a4e1704de71fb33136dd.tar.gz
bcm5719-llvm-a40555826e1b970712a0a4e1704de71fb33136dd.zip
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. llvm-svn: 157161
Diffstat (limited to 'llvm/lib/TableGen/StringMatcher.cpp')
-rw-r--r--llvm/lib/TableGen/StringMatcher.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/TableGen/StringMatcher.cpp b/llvm/lib/TableGen/StringMatcher.cpp
index 0ce626d4b19..16681702d1d 100644
--- a/llvm/lib/TableGen/StringMatcher.cpp
+++ b/llvm/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";
}
OpenPOWER on IntegriCloud