Remove getInstructionName from MCInstPrinter implementations in favor of using the...
[oota-llvm.git] / utils / TableGen / AsmWriterEmitter.cpp
index de2dc51250487740578559d884edbad9b7ecb66e..bc6345467e3afc893c0d7750a01b2e89340f8b5f 100644 (file)
@@ -565,54 +565,6 @@ void AsmWriterEmitter::EmitGetRegisterName(raw_ostream &O) {
     << "}\n";
 }
 
-void AsmWriterEmitter::EmitGetInstructionName(raw_ostream &O) {
-  CodeGenTarget Target(Records);
-  Record *AsmWriter = Target.getAsmWriter();
-  std::string ClassName = AsmWriter->getValueAsString("AsmWriterClassName");
-
-  const std::vector<const CodeGenInstruction*> &NumberedInstructions =
-    Target.getInstructionsByEnumValue();
-
-  O <<
-"\n\n#ifdef GET_INSTRUCTION_NAME\n"
-"#undef GET_INSTRUCTION_NAME\n\n"
-"/// getInstructionName: This method is automatically generated by tblgen\n"
-"/// from the instruction set description.  This returns the enum name of the\n"
-"/// specified instruction.\n"
-    << "const char *" << Target.getName() << ClassName
-    << "::getInstructionName(unsigned Opcode) {\n"
-    << "  assert(Opcode < " << NumberedInstructions.size()
-    << " && \"Invalid instruction number!\");\n"
-    << "\n";
-
-  SequenceToOffsetTable<std::string> StringTable;
-  for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) {
-    const CodeGenInstruction &Inst = *NumberedInstructions[i];
-    StringTable.add(Inst.TheDef->getName());
-  }
-
-  StringTable.layout();
-  O << "  static const char Strs[] = {\n";
-  StringTable.emit(O, printChar);
-  O << "  };\n\n";
-
-  O << "  static const unsigned InstAsmOffset[] = {";
-  for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) {
-    const CodeGenInstruction &Inst = *NumberedInstructions[i];
-
-    std::string AsmName = Inst.TheDef->getName();
-    if ((i % 14) == 0)
-      O << "\n    ";
-
-    O << StringTable.get(AsmName) << ", ";
-  }
-  O << "  };\n"
-    << "\n";
-
-  O << "  return Strs+InstAsmOffset[Opcode];\n"
-  << "}\n\n#endif\n";
-}
-
 namespace {
 // IAPrinter - Holds information about an InstAlias. Two InstAliases match if
 // they both have the same conditionals. In which case, we cannot print out the
@@ -965,7 +917,6 @@ void AsmWriterEmitter::run(raw_ostream &O) {
 
   EmitPrintInstruction(O);
   EmitGetRegisterName(O);
-  EmitGetInstructionName(O);
   EmitPrintAliasInstruction(O);
 }