wire up support for MCContext/MCStreamer in -experimental-asm-printer mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74066 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-06-24 05:46:28 +00:00
parent 929a49356e
commit 40e3c7acad
2 changed files with 26 additions and 0 deletions

View File

@ -26,7 +26,9 @@
#include "llvm/Type.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/Support/CommandLine.h"
@ -933,6 +935,14 @@ void X86ATTAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
bool X86ATTAsmPrinter::doInitialization(Module &M) {
if (TAI->doesSupportDebugInformation() || TAI->doesSupportExceptionHandling())
MMI = getAnalysisIfAvailable<MachineModuleInfo>();
if (NewAsmPrinter) {
Context = new MCContext();
// FIXME: Send this to "O" instead of outs(). For now, we force it to
// stdout to make it easy to compare.
Streamer = createAsmStreamer(*Context, outs());
}
return AsmPrinter::doInitialization(M);
}
@ -1214,6 +1224,15 @@ bool X86ATTAsmPrinter::doFinalization(Module &M) {
DW->EndModule();
}
if (NewAsmPrinter) {
Streamer->Finish();
delete Streamer;
delete Context;
Streamer = 0;
Context = 0;
}
return AsmPrinter::doFinalization(M);
}

View File

@ -27,17 +27,24 @@
namespace llvm {
class MachineJumpTableInfo;
class MCContext;
class MCInst;
class MCStreamer;
class VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter {
MachineModuleInfo *MMI;
const X86Subtarget *Subtarget;
MCContext *Context;
MCStreamer *Streamer;
public:
explicit X86ATTAsmPrinter(raw_ostream &O, X86TargetMachine &TM,
const TargetAsmInfo *T, CodeGenOpt::Level OL,
bool V)
: AsmPrinter(O, TM, T, OL, V), MMI(0) {
Subtarget = &TM.getSubtarget<X86Subtarget>();
Context = 0;
Streamer = 0;
}
virtual const char *getPassName() const {