blob: b320e2c17886c4c6dbdbd7740beff9426748ff80 [file] [log] [blame]
Chris Lattner72614082002-10-25 22:55:53 +00001//===-- 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 Lattnerb4f68ed2002-10-29 22:37:54 +00009#include "llvm/Pass.h"
10#include "llvm/CodeGen/MachineFunction.h"
Chris Lattner72614082002-10-25 22:55:53 +000011#include <iostream>
12
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000013namespace {
14 struct Printer : public FunctionPass {
15 TargetMachine &TM;
16 std::ostream &O;
Chris Lattner72614082002-10-25 22:55:53 +000017
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000018 Printer(TargetMachine &tm, std::ostream &o) : TM(tm), O(o) {}
19
20 bool runOnFunction(Function &F);
21 };
22}
23
24bool 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///
40Pass *createX86CodePrinterPass(TargetMachine &TM, std::ostream &O) {
41 return new Printer(TM, O);
Chris Lattner72614082002-10-25 22:55:53 +000042}