Arrange to have a TargetMachine available in X86InstrInfo::print

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4734 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2002-11-17 23:20:37 +00:00
parent e9c04aedca
commit 927dd095c4
3 changed files with 10 additions and 7 deletions

View File

@@ -41,7 +41,7 @@ bool Printer::runOnFunction (Function & F)
MachineFunction & MF = MachineFunction::get (&F); MachineFunction & MF = MachineFunction::get (&F);
const MachineInstrInfo & MII = TM.getInstrInfo (); const MachineInstrInfo & MII = TM.getInstrInfo ();
O << "# x86 printing only sorta implemented so far!\n"; O << "; x86 printing only sorta implemented so far!\n";
// Print out labels for the function. // Print out labels for the function.
O << "\t.globl\t" << F.getName () << "\n"; O << "\t.globl\t" << F.getName () << "\n";
@@ -59,7 +59,7 @@ bool Printer::runOnFunction (Function & F)
{ {
// Print the assembly for the instruction. // Print the assembly for the instruction.
O << "\t"; O << "\t";
MII.print(*i_i, O); MII.print(*i_i, O, TM);
} }
} }
@@ -69,7 +69,8 @@ bool Printer::runOnFunction (Function & F)
// print - Print out an x86 instruction in intel syntax // print - Print out an x86 instruction in intel syntax
void X86InstrInfo::print(const MachineInstr *MI, std::ostream &O) const { void X86InstrInfo::print(const MachineInstr *MI, std::ostream &O,
const TargetMachine &TM) const {
// FIXME: This sucks. // FIXME: This sucks.
O << getName(MI->getOpCode()) << "\n"; O << getName(MI->getOpCode()) << "\n";
} }

View File

@@ -41,7 +41,7 @@ bool Printer::runOnFunction (Function & F)
MachineFunction & MF = MachineFunction::get (&F); MachineFunction & MF = MachineFunction::get (&F);
const MachineInstrInfo & MII = TM.getInstrInfo (); const MachineInstrInfo & MII = TM.getInstrInfo ();
O << "# x86 printing only sorta implemented so far!\n"; O << "; x86 printing only sorta implemented so far!\n";
// Print out labels for the function. // Print out labels for the function.
O << "\t.globl\t" << F.getName () << "\n"; O << "\t.globl\t" << F.getName () << "\n";
@@ -59,7 +59,7 @@ bool Printer::runOnFunction (Function & F)
{ {
// Print the assembly for the instruction. // Print the assembly for the instruction.
O << "\t"; O << "\t";
MII.print(*i_i, O); MII.print(*i_i, O, TM);
} }
} }
@@ -69,7 +69,8 @@ bool Printer::runOnFunction (Function & F)
// print - Print out an x86 instruction in intel syntax // print - Print out an x86 instruction in intel syntax
void X86InstrInfo::print(const MachineInstr *MI, std::ostream &O) const { void X86InstrInfo::print(const MachineInstr *MI, std::ostream &O,
const TargetMachine &TM) const {
// FIXME: This sucks. // FIXME: This sucks.
O << getName(MI->getOpCode()) << "\n"; O << getName(MI->getOpCode()) << "\n";
} }

View File

@@ -32,7 +32,8 @@ public:
/// print - Print out an x86 instruction in intel syntax /// print - Print out an x86 instruction in intel syntax
/// ///
virtual void print(const MachineInstr *MI, std::ostream &O) const; virtual void print(const MachineInstr *MI, std::ostream &O,
const TargetMachine &TM) const;
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//