convert the non-MCInstPrinter'ized EmitInstruction

implementations to use EmitRawText instead of writing
directly to "O".

llvm-svn: 100318
This commit is contained in:
Chris Lattner 2010-04-04 06:12:20 +00:00
parent 83a093183c
commit 3d86cd6710
10 changed files with 60 additions and 37 deletions

View File

@ -1000,13 +1000,6 @@ void ARMAsmPrinter::printJT2BlockOperand(const MachineInstr *MI, int OpNum,
if (i != e-1)
O << '\n';
}
// Make sure the instruction that follows TBB is 2-byte aligned.
// FIXME: Constant island pass should insert an "ALIGN" instruction instead.
if (ByteOffset && (JTBBs.size() & 1)) {
O << '\n';
EmitAlignment(1);
}
}
void ARMAsmPrinter::printTBAddrMode(const MachineInstr *MI, int OpNum,
@ -1104,14 +1097,21 @@ bool ARMAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
void ARMAsmPrinter::EmitInstruction(const MachineInstr *MI) {
if (EnableMCInst) {
printInstructionThroughMCStreamer(MI);
} else {
int Opc = MI->getOpcode();
if (Opc == ARM::CONSTPOOL_ENTRY)
EmitAlignment(2);
printInstruction(MI, O);
OutStreamer.AddBlankLine();
return;
}
if (MI->getOpcode() == ARM::CONSTPOOL_ENTRY)
EmitAlignment(2);
SmallString<128> Str;
raw_svector_ostream OS(Str);
printInstruction(MI, OS);
OutStreamer.EmitRawText(OS.str());
// Make sure the instruction that follows TBB is 2-byte aligned.
// FIXME: Constant island pass should insert an "ALIGN" instruction instead.
if (MI->getOpcode() == ARM::t2TBB)
EmitAlignment(1);
}
void ARMAsmPrinter::EmitStartOfAsmFile(Module &M) {

View File

@ -28,6 +28,7 @@
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
using namespace llvm;
@ -46,8 +47,10 @@ namespace {
}
void printInstruction(const MachineInstr *MI, raw_ostream &O);
void EmitInstruction(const MachineInstr *MI) {
printInstruction(MI, O);
OutStreamer.AddBlankLine();
SmallString<128> Str;
raw_svector_ostream OS(Str);
printInstruction(MI, OS);
OutStreamer.EmitRawText(OS.str());
}
static const char *getRegisterName(unsigned RegNo);

View File

@ -53,8 +53,10 @@ namespace {
static const char *getRegisterName(unsigned RegNo);
void EmitInstruction(const MachineInstr *MI) {
printInstruction(MI, O);
OutStreamer.AddBlankLine();
SmallString<128> Str;
raw_svector_ostream OS(Str);
printInstruction(MI, OS);
OutStreamer.EmitRawText(OS.str());
}
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
unsigned AsmVariant, const char *ExtraCode,

View File

@ -30,6 +30,7 @@
#include "llvm/Target/TargetOptions.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
@ -57,8 +58,10 @@ namespace {
void EmitInstruction(const MachineInstr *MI) {
printInstruction(MI, O);
OutStreamer.AddBlankLine();
SmallString<128> Str;
raw_svector_ostream OS(Str);
printInstruction(MI, OS);
OutStreamer.EmitRawText(OS.str());
}
void printOp(const MachineOperand &MO, raw_ostream &OS);

View File

@ -37,11 +37,12 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/MathExtras.h"
#include <cctype>
@ -80,8 +81,10 @@ namespace {
void printInstruction(const MachineInstr *MI, raw_ostream &O);
void EmitInstruction(const MachineInstr *MI) {
printInstruction(MI, O);
O << '\n';
SmallString<128> Str;
raw_svector_ostream OS(Str);
printInstruction(MI, OS);
OutStreamer.EmitRawText(OS.str());
}
virtual void EmitFunctionBodyStart();
virtual void EmitFunctionBodyEnd();

View File

@ -37,10 +37,10 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/MathExtras.h"
#include <cctype>
@ -77,8 +77,10 @@ namespace {
void printInstruction(const MachineInstr *MI, raw_ostream &O); // autogen'd.
void EmitInstruction(const MachineInstr *MI) {
printInstruction(MI, O);
OutStreamer.AddBlankLine();
SmallString<128> Str;
raw_svector_ostream OS(Str);
printInstruction(MI, OS);
OutStreamer.EmitRawText(OS.str());
}
virtual void EmitFunctionBodyStart();
virtual void EmitFunctionBodyEnd();

View File

@ -601,8 +601,10 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
}
}
printInstruction(MI, O);
OutStreamer.AddBlankLine();
SmallString<128> Str;
raw_svector_ostream OS(Str);
printInstruction(MI, OS);
OutStreamer.EmitRawText(OS.str());
}
void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() {

View File

@ -23,6 +23,7 @@
#include "llvm/MC/MCSymbol.h"
#include "llvm/Target/Mangler.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/FormattedStream.h"
using namespace llvm;
@ -44,8 +45,10 @@ namespace {
void printCCOperand(const MachineInstr *MI, int opNum, raw_ostream &OS);
virtual void EmitInstruction(const MachineInstr *MI) {
printInstruction(MI, O);
OutStreamer.AddBlankLine();
SmallString<128> Str;
raw_svector_ostream OS(Str);
printInstruction(MI, OS);
OutStreamer.EmitRawText(OS.str());
}
void printInstruction(const MachineInstr *MI, raw_ostream &OS);// autogen'd.
static const char *getRegisterName(unsigned RegNo);

View File

@ -33,6 +33,7 @@
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
using namespace llvm;
@ -77,9 +78,10 @@ namespace {
#include "SystemZGenAsmWriter.inc"
void SystemZAsmPrinter::EmitInstruction(const MachineInstr *MI) {
// Call the autogenerated instruction printer routines.
printInstruction(MI, O);
OutStreamer.AddBlankLine();
SmallString<128> Str;
raw_svector_ostream OS(Str);
printInstruction(MI, OS);
OutStreamer.EmitRawText(OS.str());
}
void SystemZAsmPrinter::printPCRelImmOperand(const MachineInstr *MI, int OpNum,

View File

@ -34,6 +34,7 @@
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
@ -334,8 +335,10 @@ void XCoreAsmPrinter::EmitInstruction(const MachineInstr *MI) {
OutStreamer.AddBlankLine();
return;
}
printInstruction(MI, O);
OutStreamer.AddBlankLine();
SmallString<128> Str;
raw_svector_ostream OS(Str);
printInstruction(MI, OS);
OutStreamer.EmitRawText(OS.str());
}
// Force static initialization.