diff options
author | Reid Kleckner <rnk@google.com> | 2016-01-26 23:01:21 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-01-26 23:01:21 +0000 |
commit | 1c93b4cd7b1974c742a5e763c6cd4b25207544c4 (patch) | |
tree | 93b592a8a8cd6355360a6a591f32706c9b4efa00 /llvm/utils/TableGen/IntrinsicEmitter.cpp | |
parent | abae3a44aff87d2a7a1ab6756faedd18f391361e (diff) | |
download | bcm5719-llvm-1c93b4cd7b1974c742a5e763c6cd4b25207544c4.tar.gz bcm5719-llvm-1c93b4cd7b1974c742a5e763c6cd4b25207544c4.zip |
[llvm-tblgen] Stop emitting the intrinsic name matching code
The AMDGPU backend was the last user of the old StringMatcher
recognition code. Move it over to the new lookupLLVMIntrinsicName
funciton, which is now improved to handle all of the interesting edge
cases exposed by AMDGPU intrinsic names.
llvm-svn: 258875
Diffstat (limited to 'llvm/utils/TableGen/IntrinsicEmitter.cpp')
-rw-r--r-- | llvm/utils/TableGen/IntrinsicEmitter.cpp | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/llvm/utils/TableGen/IntrinsicEmitter.cpp b/llvm/utils/TableGen/IntrinsicEmitter.cpp index 42a6a152f55..c4e461453b7 100644 --- a/llvm/utils/TableGen/IntrinsicEmitter.cpp +++ b/llvm/utils/TableGen/IntrinsicEmitter.cpp @@ -40,8 +40,6 @@ public: void EmitEnumInfo(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS); - void EmitFnNameRecognizer(const std::vector<CodeGenIntrinsic> &Ints, - raw_ostream &OS); void EmitIntrinsicToNameTable(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS); void EmitIntrinsicToOverloadTable(const std::vector<CodeGenIntrinsic> &Ints, @@ -81,9 +79,6 @@ void IntrinsicEmitter::run(raw_ostream &OS) { // Emit the intrinsic ID -> overload table. EmitIntrinsicToOverloadTable(Ints, OS); - // Emit the function name recognizer. - EmitFnNameRecognizer(Ints, OS); - // Emit the intrinsic declaration generator. EmitGenerator(Ints, OS); @@ -132,61 +127,6 @@ void IntrinsicEmitter::EmitEnumInfo(const std::vector<CodeGenIntrinsic> &Ints, } void IntrinsicEmitter:: -EmitFnNameRecognizer(const std::vector<CodeGenIntrinsic> &Ints, - raw_ostream &OS) { - // Build a 'first character of function name' -> intrinsic # mapping. - std::map<char, std::vector<unsigned> > IntMapping; - for (unsigned i = 0, e = Ints.size(); i != e; ++i) - IntMapping[Ints[i].Name[5]].push_back(i); - - OS << "// Function name -> enum value recognizer code.\n"; - OS << "#ifdef GET_FUNCTION_RECOGNIZER\n"; - OS << " StringRef NameR(Name+6, Len-6); // Skip over 'llvm.'\n"; - OS << " switch (Name[5]) { // Dispatch on first letter.\n"; - OS << " default: break;\n"; - // Emit the intrinsic matching stuff by first letter. - for (std::map<char, std::vector<unsigned> >::iterator I = IntMapping.begin(), - E = IntMapping.end(); I != E; ++I) { - OS << " case '" << I->first << "':\n"; - std::vector<unsigned> &IntList = I->second; - - // Sort in reverse order of intrinsic name so "abc.def" appears after - // "abd.def.ghi" in the overridden name matcher - std::sort(IntList.begin(), IntList.end(), [&](unsigned i, unsigned j) { - return Ints[i].Name > Ints[j].Name; - }); - - // Emit all the overloaded intrinsics first, build a table of the - // non-overloaded ones. - std::vector<StringMatcher::StringPair> MatchTable; - - for (unsigned i = 0, e = IntList.size(); i != e; ++i) { - unsigned IntNo = IntList[i]; - std::string Result = "return " + TargetPrefix + "Intrinsic::" + - Ints[IntNo].EnumName + ";"; - - if (!Ints[IntNo].isOverloaded) { - MatchTable.push_back(std::make_pair(Ints[IntNo].Name.substr(6),Result)); - continue; - } - - // For overloaded intrinsics, only the prefix needs to match - std::string TheStr = Ints[IntNo].Name.substr(6); - TheStr += '.'; // Require "bswap." instead of bswap. - OS << " if (NameR.startswith(\"" << TheStr << "\")) " - << Result << '\n'; - } - - // Emit the matcher logic for the fixed length strings. - StringMatcher("NameR", MatchTable, OS).Emit(1); - OS << " break; // end of '" << I->first << "' case.\n"; - } - - OS << " }\n"; - OS << "#endif\n\n"; -} - -void IntrinsicEmitter:: EmitIntrinsicToNameTable(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS) { OS << "// Intrinsic ID to name table\n"; |