Chris Lattner | 7261408 | 2002-10-25 22:55:53 +0000 | [diff] [blame] | 1 | //===-- X86/Printer.cpp - Convert X86 code to human readable rep. ---------===// |
| 2 | // |
| 3 | // This file contains a printer that converts from our internal representation |
| 4 | // of LLVM code to a nice human readable form that is suitable for debuggging. |
| 5 | // |
| 6 | //===----------------------------------------------------------------------===// |
| 7 | |
| 8 | #include "X86.h" |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame^] | 9 | #include "llvm/Pass.h" |
| 10 | #include "llvm/CodeGen/MachineFunction.h" |
Chris Lattner | 7261408 | 2002-10-25 22:55:53 +0000 | [diff] [blame] | 11 | #include <iostream> |
| 12 | |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame^] | 13 | namespace { |
| 14 | struct Printer : public FunctionPass { |
| 15 | TargetMachine &TM; |
| 16 | std::ostream &O; |
Chris Lattner | 7261408 | 2002-10-25 22:55:53 +0000 | [diff] [blame] | 17 | |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame^] | 18 | Printer(TargetMachine &tm, std::ostream &o) : TM(tm), O(o) {} |
| 19 | |
| 20 | bool runOnFunction(Function &F); |
| 21 | }; |
| 22 | } |
| 23 | |
| 24 | bool Printer::runOnFunction(Function &F) { |
| 25 | MachineFunction &MF = MachineFunction::get(&F); |
| 26 | O << "x86 printing not implemented yet!\n"; |
| 27 | |
| 28 | // This should use the X86InstructionInfo::print method to print assembly |
| 29 | // for each instruction |
| 30 | return false; |
| 31 | } |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | /// createX86CodePrinterPass - Print out the specified machine code function to |
| 37 | /// the specified stream. This function should work regardless of whether or |
| 38 | /// not the function is in SSA form or not. |
| 39 | /// |
| 40 | Pass *createX86CodePrinterPass(TargetMachine &TM, std::ostream &O) { |
| 41 | return new Printer(TM, O); |
Chris Lattner | 7261408 | 2002-10-25 22:55:53 +0000 | [diff] [blame] | 42 | } |