Convert backend to use passes, implement X86TargetMachine
[oota-llvm.git] / lib / Target / X86 / Printer.cpp
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"
9 #include "llvm/Pass.h"
10 #include "llvm/CodeGen/MachineFunction.h"
11 #include <iostream>
12
13 namespace {
14   struct Printer : public FunctionPass {
15     TargetMachine &TM;
16     std::ostream &O;
17
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);
42 }