make printInstruction return void since its result is omitted. Make the
authorChris Lattner <sabre@nondot.org>
Sat, 8 Aug 2009 01:32:19 +0000 (01:32 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 8 Aug 2009 01:32:19 +0000 (01:32 +0000)
error condition get trapped with an assert.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78449 91177308-0d34-0410-b5e6-96231b3b80d8

14 files changed:
lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
lib/Target/MSP430/MSP430AsmPrinter.cpp
lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
lib/Target/PIC16/PIC16AsmPrinter.h
lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h
lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h
lib/Target/XCore/XCoreAsmPrinter.cpp
utils/TableGen/AsmWriterEmitter.cpp

index c817ee932b0f7ea20b512e7813b22c49b150a748..2d9aa0f9d29a37a070d628ec584530368dbee0ba 100644 (file)
@@ -170,7 +170,7 @@ namespace {
                                        const char *ExtraCode);
 
     void PrintGlobalVariable(const GlobalVariable* GVar);
-    bool printInstruction(const MachineInstr *MI);  // autogenerated.
+    void printInstruction(const MachineInstr *MI);  // autogenerated.
     void printMachineInstruction(const MachineInstr *MI);
     bool runOnMachineFunction(MachineFunction &F);
     bool doInitialization(Module &M);
index 92b85d304ca3b59381aeef381e0d9744832020e9..a4690a9adef99f7b7ef836f60c3fe468997c0624 100644 (file)
@@ -46,7 +46,7 @@ namespace {
     virtual const char *getPassName() const {
       return "Alpha Assembly Printer";
     }
-    bool printInstruction(const MachineInstr *MI);
+    void printInstruction(const MachineInstr *MI);
     void printOp(const MachineOperand &MO, bool IsCallOp = false);
     void printOperand(const MachineInstr *MI, int opNum);
     void printBaseOffsetPair(const MachineInstr *MI, int i, bool brackets=true);
index b507968b872d57441eaaeb317403b8421c757974..e8e79a4024108ad3625b01799e0861a05cddbf8e 100644 (file)
@@ -48,7 +48,7 @@ namespace {
 
     void printOperand(const MachineInstr *MI, int opNum);
     void printMemoryOperand(const MachineInstr *MI, int opNum);
-    bool printInstruction(const MachineInstr *MI);  // autogenerated.
+    void printInstruction(const MachineInstr *MI);  // autogenerated.
     void emitLinkage(const std::string &n, GlobalValue::LinkageTypes l);
     bool runOnMachineFunction(MachineFunction &F);
     bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
index 3fbba3d8f0f5ef7d8ddcebc68fdddda00f06cbfe..0fd485abefaa7f544474437e8a49e88c90f369cd 100644 (file)
@@ -67,7 +67,7 @@ namespace {
     /// from the instruction set description.  This method returns true if the
     /// machine instruction was sufficiently described to print it, otherwise it
     /// returns false.
-    bool printInstruction(const MachineInstr *MI);
+    void printInstruction(const MachineInstr *MI);
 
     void printMachineInstruction(const MachineInstr *MI);
     void printOp(const MachineOperand &MO);
index 573ca57ec0e34a4374d89961e54e6f102a714e71..6209fc4c0a155e29c6bc3a8ae0723c192c572e71 100644 (file)
@@ -55,7 +55,7 @@ namespace {
     void printSrcMemOperand(const MachineInstr *MI, int OpNum,
                             const char* Modifier = 0);
     void printCCOperand(const MachineInstr *MI, int OpNum);
-    bool printInstruction(const MachineInstr *MI);  // autogenerated.
+    void printInstruction(const MachineInstr *MI);  // autogenerated.
     void printMachineInstruction(const MachineInstr * MI);
 
     void emitFunctionHeader(const MachineFunction &MF);
index 121c7ca333f77c8aeea12ca621f85d39b3a2f811..bcdbe008d6c0a815875aba41954be04f91112e9b 100644 (file)
@@ -79,7 +79,7 @@ namespace {
     void emitFunctionEnd(MachineFunction &MF);
     void emitFrameDirective(MachineFunction &MF);
 
-    bool printInstruction(const MachineInstr *MI);  // autogenerated.
+    void printInstruction(const MachineInstr *MI);  // autogenerated.
     bool runOnMachineFunction(MachineFunction &F);
     bool doInitialization(Module &M);
   };
index 19c490f78fe85569a67fff8df40244ed3c29c51a..b7a50a9befce7db5324d5cf5bd27b68ace1228db 100644 (file)
@@ -45,7 +45,7 @@ namespace llvm {
     bool runOnMachineFunction(MachineFunction &F);
     void printOperand(const MachineInstr *MI, int opNum);
     void printCCOperand(const MachineInstr *MI, int opNum);
-    bool printInstruction(const MachineInstr *MI); // definition autogenerated.
+    void printInstruction(const MachineInstr *MI); // definition autogenerated.
     bool printMachineInstruction(const MachineInstr *MI);
     void EmitFunctionDecls (Module &M);
     void EmitUndefinedVars (Module &M);
index 8a0c767db58fdff264dc72813c05ea209b42fd67..9884ca32bfa2677d7080b79cf23359aaa21dbc77 100644 (file)
@@ -116,7 +116,7 @@ namespace {
     /// from the instruction set description.  This method returns true if the
     /// machine instruction was sufficiently described to print it, otherwise it
     /// returns false.
-    bool printInstruction(const MachineInstr *MI);
+    void printInstruction(const MachineInstr *MI);
 
     void printMachineInstruction(const MachineInstr *MI);
     void printOp(const MachineOperand &MO);
index b12edffc76e4a145b97be765d0fafdd9448c20c8..ff11cdf03917fcd59925e8b74715bd1f3b59ba70 100644 (file)
@@ -65,7 +65,7 @@ namespace {
                          const char *Modifier = 0);
     void printCCOperand(const MachineInstr *MI, int opNum);
 
-    bool printInstruction(const MachineInstr *MI);  // autogenerated.
+    void printInstruction(const MachineInstr *MI);  // autogenerated.
     bool runOnMachineFunction(MachineFunction &F);
     bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
                        unsigned AsmVariant, const char *ExtraCode);
index 2c73517db9bf45e44fcf689b5a82e732cdbb3997..00ebf4c938133f1a27d97db35b11145b4210bdaf 100644 (file)
@@ -63,7 +63,7 @@ namespace {
       O << (int32_t)MI->getOperand(OpNum).getImm();
     }
 
-    bool printInstruction(const MachineInstr *MI);  // autogenerated.
+    void printInstruction(const MachineInstr *MI);  // autogenerated.
     void printMachineInstruction(const MachineInstr * MI);
 
     void emitFunctionHeader(const MachineFunction &MF);
index 65ef5ff6e4bfebefd07a481747b58be6d2322da5..7839b74ce686fcff12943ae01bac78f618149f60 100644 (file)
@@ -61,11 +61,11 @@ class VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter {
   /// from the instruction set description.  This method returns true if the
   /// machine instruction was sufficiently described to print it, otherwise it
   /// returns false.
-  bool printInstruction(const MachineInstr *MI);
+  void printInstruction(const MachineInstr *MI);
   
   
   // New MCInst printing stuff.
-  bool printInstruction(const MCInst *MI);
+  void printInstruction(const MCInst *MI);
 
   void printSymbolOperand(const MachineOperand &MO);
   void printOperand(const MCInst *MI, unsigned OpNo,
index 8f12381ceb4d736ea291011f7007f12a488d1e75..c7c5df208902192897a032671fc27420e5df1adc 100644 (file)
@@ -37,7 +37,7 @@ struct VISIBILITY_HIDDEN X86IntelAsmPrinter : public AsmPrinter {
   /// from the instruction set description.  This method returns true if the
   /// machine instruction was sufficiently described to print it, otherwise it
   /// returns false.
-  bool printInstruction(const MachineInstr *MI);
+  void printInstruction(const MachineInstr *MI);
 
   // This method is used by the tablegen'erated instruction printer.
   void printOperand(const MachineInstr *MI, unsigned OpNo,
index 1b08c5f4c373f8d26f0bef6b94d63ff8756d240f..4604b74c8339b05c8013fd8943073f833dc5b45a 100644 (file)
@@ -77,7 +77,7 @@ namespace {
     void emitFunctionStart(MachineFunction &MF);
     void emitFunctionEnd(MachineFunction &MF);
 
-    bool printInstruction(const MachineInstr *MI);  // autogenerated.
+    void printInstruction(const MachineInstr *MI);  // autogenerated.
     void printMachineInstruction(const MachineInstr *MI);
     bool runOnMachineFunction(MachineFunction &F);
     bool doInitialization(Module &M);
index 95d4aac1300754dcfdefa07c23cb1a6693227a73..61117c16a3163551b09ae71ea41bdb5aacaded50 100644 (file)
@@ -451,7 +451,7 @@ FindUniqueOperandCommands(std::vector<std::string> &UniqueOperandCommands,
 
     // If this is the last operand, emit a return.
     if (Inst->Operands.size() == 1)
-      Command += "    return true;\n";
+      Command += "    return;\n";
     
     // Check to see if we already have 'Command' in UniqueOperandCommands.
     // If not, add it.
@@ -529,7 +529,7 @@ FindUniqueOperandCommands(std::vector<std::string> &UniqueOperandCommands,
           // Don't early-out too soon.  Other instructions in this
           // group may have more operands.
           FirstInst->Operands.size() == MaxSize) {
-        Command += "    return true;\n";
+        Command += "    return;\n";
       }
       
       UniqueOperandCommands[CommandIdx] += Command;
@@ -565,7 +565,7 @@ void AsmWriterEmitter::run(raw_ostream &O) {
   "/// from the instruction set description.  This method returns true if the\n"
   "/// machine instruction was sufficiently described to print it, otherwise\n"
   "/// it returns false.\n"
-    "bool " << Target.getName() << ClassName
+    "void " << Target.getName() << ClassName
             << "::printInstruction(const MachineInstr *MI) {\n";
 
   std::vector<AsmWriterInst> Instructions;
@@ -640,7 +640,7 @@ void AsmWriterEmitter::run(raw_ostream &O) {
     // For the first operand check, add a default value for instructions with
     // just opcode strings to use.
     if (isFirst) {
-      UniqueOperandCommands.push_back("    return true;\n");
+      UniqueOperandCommands.push_back("    return;\n");
       isFirst = false;
     }
 
@@ -733,16 +733,16 @@ void AsmWriterEmitter::run(raw_ostream &O) {
   O << "  if (MI->getOpcode() == TargetInstrInfo::INLINEASM) {\n"
     << "    O << \"\\t\";\n"
     << "    printInlineAsm(MI);\n"
-    << "    return true;\n"
+    << "    return;\n"
     << "  } else if (MI->isLabel()) {\n"
     << "    printLabel(MI);\n"
-    << "    return true;\n"
+    << "    return;\n"
     << "  } else if (MI->getOpcode() == TargetInstrInfo::DECLARE) {\n"
     << "    printDeclare(MI);\n"
-    << "    return true;\n"
+    << "    return;\n"
     << "  } else if (MI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF) {\n"
     << "    printImplicitDef(MI);\n"
-    << "    return true;\n"
+    << "    return;\n"
     << "  }\n\n";
 
   O << "\n#endif\n";
@@ -751,7 +751,7 @@ void AsmWriterEmitter::run(raw_ostream &O) {
 
   O << "  // Emit the opcode for the instruction.\n"
     << "  unsigned Bits = OpInfo[MI->getOpcode()];\n"
-    << "  if (Bits == 0) return false;\n"
+    << "  assert(Bits != 0 && \"Cannot print this instruction.\");\n"
     << "  O << AsmStrs+(Bits & " << (1 << AsmStrBits)-1 << ");\n\n";
 
   // Output the table driven operand information.
@@ -815,9 +815,9 @@ void AsmWriterEmitter::run(raw_ostream &O) {
       EmitInstructions(Instructions, O);
 
     O << "  }\n";
-    O << "  return true;\n";
+    O << "  return;\n";
   }
 
-  O << "  return true;\n";
+  O << "  return;\n";
   O << "}\n";
 }