Overhaul my earlier submission due to feedback. It's a large patch, but most of
them are generic changes.
- Use the "fast" flag that's already being passed into the asm printers instead
of shoving it into the DwarfWriter.
- Instead of calling "MI->getParent()->getParent()" for every MI, set the
machine function when calling "runOnMachineFunction" in the asm printers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65379 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/Mips/Mips.h b/lib/Target/Mips/Mips.h
index 03f5a52..28c11b0 100644
--- a/lib/Target/Mips/Mips.h
+++ b/lib/Target/Mips/Mips.h
@@ -24,7 +24,8 @@
FunctionPass *createMipsISelDag(MipsTargetMachine &TM);
FunctionPass *createMipsDelaySlotFillerPass(MipsTargetMachine &TM);
FunctionPass *createMipsCodePrinterPass(raw_ostream &OS,
- MipsTargetMachine &TM);
+ MipsTargetMachine &TM,
+ bool Fast);
} // end namespace llvm;
// Defines symbolic names for Mips registers. This defines a mapping from
diff --git a/lib/Target/Mips/MipsAsmPrinter.cpp b/lib/Target/Mips/MipsAsmPrinter.cpp
index 94cd71a..732c5d7 100644
--- a/lib/Target/Mips/MipsAsmPrinter.cpp
+++ b/lib/Target/Mips/MipsAsmPrinter.cpp
@@ -46,13 +46,12 @@
STATISTIC(EmittedInsts, "Number of machine instrs printed");
namespace {
- struct VISIBILITY_HIDDEN MipsAsmPrinter : public AsmPrinter {
-
+ class VISIBILITY_HIDDEN MipsAsmPrinter : public AsmPrinter {
const MipsSubtarget *Subtarget;
-
+ public:
MipsAsmPrinter(raw_ostream &O, MipsTargetMachine &TM,
- const TargetAsmInfo *T):
- AsmPrinter(O, TM, T) {
+ const TargetAsmInfo *T, bool F)
+ : AsmPrinter(O, TM, T, F) {
Subtarget = &TM.getSubtarget<MipsSubtarget>();
}
@@ -91,9 +90,9 @@
/// using the given target machine description. This should work
/// regardless of whether the function is in SSA form.
FunctionPass *llvm::createMipsCodePrinterPass(raw_ostream &o,
- MipsTargetMachine &tm)
-{
- return new MipsAsmPrinter(o, tm, tm.getTargetAsmInfo());
+ MipsTargetMachine &tm,
+ bool fast) {
+ return new MipsAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast);
}
//===----------------------------------------------------------------------===//
@@ -266,6 +265,8 @@
bool MipsAsmPrinter::
runOnMachineFunction(MachineFunction &MF)
{
+ this->MF = &MF;
+
SetupMachineFunction(MF);
// Print out constants referenced by the function
diff --git a/lib/Target/Mips/MipsTargetMachine.cpp b/lib/Target/Mips/MipsTargetMachine.cpp
index ff2e5b8..4b13b78 100644
--- a/lib/Target/Mips/MipsTargetMachine.cpp
+++ b/lib/Target/Mips/MipsTargetMachine.cpp
@@ -128,6 +128,6 @@
raw_ostream &Out)
{
// Output assembly language.
- PM.add(createMipsCodePrinterPass(Out, *this));
+ PM.add(createMipsCodePrinterPass(Out, *this, Fast));
return false;
}