Start adding to the meat of MachineCodeEmitter
[oota-llvm.git] / include / llvm / CodeGen / MachineCodeEmitter.h
1 //===-- llvm/CodeGen/MachineCodeEmitter.h - Code emission -------*- C++ -*-===//
2 //
3 // This file defines an abstract interface that is used by the machine code
4 // emission framework to output the code.  This allows machine code emission to
5 // be seperated from concerns such as resolution of call targets, and where the
6 // machine code will be written (memory or disk, f.e.).
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_CODEGEN_MACHINE_CODE_EMITTER_H
11 #define LLVM_CODEGEN_MACHINE_CODE_EMITTER_H
12
13 class MachineFunction;
14 class MachineBasicBlock;
15
16 struct MachineCodeEmitter {
17
18   /// startFunction - This callback is invoked when the specified function is
19   /// about to be code generated.
20   ///
21   virtual void startFunction(MachineFunction &F) {}
22   
23   /// finishFunction - This callback is invoked when the specified function has
24   /// finished code generation.
25   ///
26   virtual void finishFunction(MachineFunction &F) {}
27
28   /// startBasicBlock - This callback is invoked when a new basic block is about
29   /// to be emitted.
30   ///
31   virtual void startBasicBlock(MachineBasicBlock &BB) {}
32
33   /// emitByte - This callback is invoked when a byte needs to be written to the
34   /// output stream.
35   virtual void emitByte(unsigned char B) {}
36 };
37
38 #endif