From: Craig Topper Date: Wed, 13 Jan 2016 07:20:13 +0000 (+0000) Subject: [TableGen] Cleanup output formatting and add llvm_unreachables to the output the... X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=cd0aefe26fed244e0e7057e82cd7cac636894519 [TableGen] Cleanup output formatting and add llvm_unreachables to the output the AsmMatcher uses when it overflows the 64-bit tables. No in tree targets use this code, but I tested it with an temporarily reduced table width. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257583 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/TableGen/AsmWriterEmitter.cpp b/utils/TableGen/AsmWriterEmitter.cpp index af82f9c21da..cf7cbd96286 100644 --- a/utils/TableGen/AsmWriterEmitter.cpp +++ b/utils/TableGen/AsmWriterEmitter.cpp @@ -65,7 +65,7 @@ private: static void PrintCases(std::vector > &OpsToPrint, raw_ostream &O) { - O << " case " << OpsToPrint.back().first << ": "; + O << " case " << OpsToPrint.back().first << ":"; AsmWriterOperand TheOp = OpsToPrint.back().second; OpsToPrint.pop_back(); @@ -73,13 +73,13 @@ static void PrintCases(std::vector &Insts, // If this is the operand that varies between all of the instructions, // emit a switch for just this operand now. O << " switch (MI->getOpcode()) {\n"; + O << " default: llvm_unreachable(\"Unexpected opcode.\");\n"; std::vector > OpsToPrint; OpsToPrint.push_back(std::make_pair(FirstInst.CGI->Namespace + "::" + FirstInst.CGI->TheDef->getName(), @@ -499,11 +500,11 @@ void AsmWriterEmitter::EmitPrintInstruction(raw_ostream &O) { if (!Instructions.empty()) { // Find the opcode # of inline asm. O << " switch (MI->getOpcode()) {\n"; + O << " default: llvm_unreachable(\"Unexpected opcode.\");\n"; while (!Instructions.empty()) EmitInstructions(Instructions, O); O << " }\n"; - O << " return;\n"; } O << "}\n";