summaryrefslogtreecommitdiff
path: root/utils/TableGen/AsmWriterEmitter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-08-14 22:50:53 +0000
committerChris Lattner <sabre@nondot.org>2004-08-14 22:50:53 +0000
commit175580c0f36b026daf9de0adabdb7ddcf7619db6 (patch)
tree516190ebd0daa6299b0f5d756b0cd6007937dfda /utils/TableGen/AsmWriterEmitter.cpp
parentca068e861b7f1184d31f6c8f26f88feb076badf1 (diff)
downloadllvm-175580c0f36b026daf9de0adabdb7ddcf7619db6.tar.gz
llvm-175580c0f36b026daf9de0adabdb7ddcf7619db6.tar.bz2
llvm-175580c0f36b026daf9de0adabdb7ddcf7619db6.tar.xz
Make the AsmWriter a first-class tblgen object. Allow targets to specify
name of the generated asmwriter class, and the name of the format string. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15747 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/AsmWriterEmitter.cpp')
-rw-r--r--utils/TableGen/AsmWriterEmitter.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/utils/TableGen/AsmWriterEmitter.cpp b/utils/TableGen/AsmWriterEmitter.cpp
index b2e2125f82..7b3a5046c3 100644
--- a/utils/TableGen/AsmWriterEmitter.cpp
+++ b/utils/TableGen/AsmWriterEmitter.cpp
@@ -14,6 +14,7 @@
#include "AsmWriterEmitter.h"
#include "CodeGenTarget.h"
+#include "Record.h"
#include <ostream>
using namespace llvm;
@@ -28,13 +29,19 @@ void AsmWriterEmitter::run(std::ostream &O) {
EmitSourceFileHeader("Assembly Writer Source Fragment", O);
CodeGenTarget Target;
+
+ Record *AsmWriter = Target.getAsmWriter();
+
+ std::string AsmWriterClassName =
+ AsmWriter->getValueAsString("AsmWriterClassName");
+
O <<
"/// printInstruction - This method is automatically generated by tablegen\n"
"/// 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()
- << "AsmPrinter::printInstruction(const MachineInstr *MI) {\n";
+ "bool " << Target.getName() << AsmWriterClassName
+ << "::printInstruction(const MachineInstr *MI) {\n";
O << " switch (MI->getOpcode()) {\n"
" default: return false;\n";