From 411fbbf5f3cc24b953f8fa802c2cc3d004da74f1 Mon Sep 17 00:00:00 2001 From: Nicolai Haehnle Date: Thu, 10 Mar 2016 18:51:58 +0000 Subject: [TableGen] more helpful error message in MapTableEmitter Differential Revision: http://reviews.llvm.org/D17275 llvm-svn: 263148 --- llvm/utils/TableGen/CodeGenMapTable.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'llvm/utils/TableGen/CodeGenMapTable.cpp') diff --git a/llvm/utils/TableGen/CodeGenMapTable.cpp b/llvm/utils/TableGen/CodeGenMapTable.cpp index 09ea705ae01..527f530da47 100644 --- a/llvm/utils/TableGen/CodeGenMapTable.cpp +++ b/llvm/utils/TableGen/CodeGenMapTable.cpp @@ -337,10 +337,20 @@ Record *MapTableEmitter::getInstrForColumn(Record *KeyInstr, } if (MatchFound) { - if (MatchInstr) // Already had a match + if (MatchInstr) { + // Already had a match // Error if multiple matches are found for a column. + std::string KeyValueStr; + for (Init *Value : KeyValue) { + if (!KeyValueStr.empty()) + KeyValueStr += ", "; + KeyValueStr += Value->getAsString(); + } + PrintFatalError("Multiple matches found for `" + KeyInstr->getName() + - "', for the relation `" + InstrMapDesc.getName()); + "', for the relation `" + InstrMapDesc.getName() + "', row fields [" + + KeyValueStr + "], column `" + CurValueCol->getAsString() + "'"); + } MatchInstr = CurInstr; } } -- cgit v1.2.3