1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Use StringRef in TableGen generated Intrinsics.gen file (NFC)

llvm-svn: 283792
This commit is contained in:
Mehdi Amini 2016-10-10 19:31:09 +00:00
parent 14c600c960
commit 3003721ba0
2 changed files with 7 additions and 9 deletions

View File

@ -88,10 +88,10 @@ namespace Intrinsic {
StringRef Name);
/// Map a GCC builtin name to an intrinsic ID.
ID getIntrinsicForGCCBuiltin(const char *Prefix, const char *BuiltinName);
ID getIntrinsicForGCCBuiltin(const char *Prefix, StringRef BuiltinName);
/// Map a MS builtin name to an intrinsic ID.
ID getIntrinsicForMSBuiltin(const char *Prefix, const char *BuiltinName);
ID getIntrinsicForMSBuiltin(const char *Prefix, StringRef BuiltinName);
/// This is a type descriptor which explains the type requirements of an
/// intrinsic. This is returned by getIntrinsicInfoTableEntries.

View File

@ -714,11 +714,11 @@ void IntrinsicEmitter::EmitIntrinsicToBuiltinMap(
if (TargetOnly) {
OS << "static " << TargetPrefix << "Intrinsic::ID "
<< "getIntrinsicFor" << CompilerName << "Builtin(const char "
<< "*TargetPrefixStr, const char *BuiltinNameStr) {\n";
<< "*TargetPrefixStr, StringRef BuiltinNameStr) {\n";
} else {
OS << "Intrinsic::ID Intrinsic::getIntrinsicFor" << CompilerName
<< "Builtin(const char "
<< "*TargetPrefixStr, const char *BuiltinNameStr) {\n";
<< "*TargetPrefixStr, StringRef BuiltinNameStr) {\n";
}
OS << " static const char BuiltinNames[] = {\n";
Table.EmitCharArray(OS);
@ -730,13 +730,11 @@ void IntrinsicEmitter::EmitIntrinsicToBuiltinMap(
OS << " const char *getName() const {\n";
OS << " return &BuiltinNames[StrTabOffset];\n";
OS << " }\n";
OS << " bool operator<(const char *RHS) const {\n";
OS << " return strcmp(getName(), RHS) < 0;\n";
OS << " bool operator<(StringRef RHS) const {\n";
OS << " return strncmp(getName(), RHS.data(), RHS.size()) < 0;\n";
OS << " }\n";
OS << " };\n";
OS << " StringRef BuiltinName(BuiltinNameStr);\n";
OS << " StringRef TargetPrefix(TargetPrefixStr);\n\n";
// Note: this could emit significantly better code if we cared.
@ -759,7 +757,7 @@ void IntrinsicEmitter::EmitIntrinsicToBuiltinMap(
OS << " std::end(" << I->first << "Names),\n";
OS << " BuiltinNameStr);\n";
OS << " if (I != std::end(" << I->first << "Names) &&\n";
OS << " strcmp(I->getName(), BuiltinNameStr) == 0)\n";
OS << " I->getName() == BuiltinNameStr)\n";
OS << " return I->IntrinID;\n";
OS << " }\n";
}