diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-04 05:04:31 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-04 05:04:31 +0000 |
commit | d374087be5360a353a4239a155b1227057145f48 (patch) | |
tree | d8a5027115587ce258f71d8a74b240242ba5c82c /tools | |
parent | 35c33bd772b3cfb34fdc6b5c9171f955454d0043 (diff) | |
download | external_llvm-d374087be5360a353a4239a155b1227057145f48.zip external_llvm-d374087be5360a353a4239a155b1227057145f48.tar.gz external_llvm-d374087be5360a353a4239a155b1227057145f48.tar.bz2 |
fix an ugly wart in the MCInstPrinter api where the
raw_ostream to print an instruction to had to be specified
at MCInstPrinter construction time instead of being able
to pick at each call to printInstruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100307 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/edis/EDDisassembler.cpp | 10 | ||||
-rw-r--r-- | tools/llvm-mc/Disassembler.cpp | 8 | ||||
-rw-r--r-- | tools/llvm-mc/llvm-mc.cpp | 2 |
3 files changed, 8 insertions, 12 deletions
diff --git a/tools/edis/EDDisassembler.cpp b/tools/edis/EDDisassembler.cpp index f2b2f91..8729b49 100644 --- a/tools/edis/EDDisassembler.cpp +++ b/tools/edis/EDDisassembler.cpp @@ -195,10 +195,7 @@ EDDisassembler::EDDisassembler(CPUKey &key) : InstString.reset(new std::string); InstStream.reset(new raw_string_ostream(*InstString)); - - InstPrinter.reset(Tgt->createMCInstPrinter(syntaxVariant, - *AsmInfo, - *InstStream)); + InstPrinter.reset(Tgt->createMCInstPrinter(syntaxVariant, *AsmInfo)); if (!InstPrinter) return; @@ -314,11 +311,10 @@ bool EDDisassembler::registerIsProgramCounter(unsigned registerID) { return (programCounters.find(registerID) != programCounters.end()); } -int EDDisassembler::printInst(std::string& str, - MCInst& inst) { +int EDDisassembler::printInst(std::string &str, MCInst &inst) { PrinterMutex.acquire(); - InstPrinter->printInst(&inst); + InstPrinter->printInst(&inst, *InstStream); InstStream->flush(); str = *InstString; InstString->clear(); diff --git a/tools/llvm-mc/Disassembler.cpp b/tools/llvm-mc/Disassembler.cpp index 0caf539..9fe0790 100644 --- a/tools/llvm-mc/Disassembler.cpp +++ b/tools/llvm-mc/Disassembler.cpp @@ -48,8 +48,8 @@ public: } static bool PrintInsts(const MCDisassembler &DisAsm, - MCInstPrinter &Printer, const ByteArrayTy &Bytes, - SourceMgr &SM) { + MCInstPrinter &Printer, const ByteArrayTy &Bytes, + SourceMgr &SM) { // Wrap the vector in a MemoryObject. VectorMemoryObject memoryObject(Bytes); @@ -62,7 +62,7 @@ static bool PrintInsts(const MCDisassembler &DisAsm, if (DisAsm.getInstruction(Inst, Size, memoryObject, Index, /*REMOVE*/ nulls())) { - Printer.printInst(&Inst); + Printer.printInst(&Inst, outs()); outs() << "\n"; } else { @@ -92,7 +92,7 @@ int Disassembler::disassemble(const Target &T, const std::string &Triple, return -1; } - OwningPtr<MCInstPrinter> IP(T.createMCInstPrinter(0, *AsmInfo, outs())); + OwningPtr<MCInstPrinter> IP(T.createMCInstPrinter(0, *AsmInfo)); if (!IP) { errs() << "error: no instruction printer for target " << Triple << '\n'; return -1; diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index 6f1448b..be7e55d 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -290,7 +290,7 @@ static int AssembleInput(const char *ProgName) { if (FileType == OFT_AssemblyFile) { MCInstPrinter *IP = - TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *Out); + TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI); if (ShowEncoding) CE.reset(TheTarget->createCodeEmitter(*TM, Ctx)); Str.reset(createAsmStreamer(Ctx, *Out,TM->getTargetData()->isLittleEndian(), |