cddadb2661e69b0d49368eb1d8eff150cb024521
[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 class Value;
16
17 struct MachineCodeEmitter {
18
19   /// startFunction - This callback is invoked when the specified function is
20   /// about to be code generated.
21   ///
22   virtual void startFunction(MachineFunction &F) {}
23   
24   /// finishFunction - This callback is invoked when the specified function has
25   /// finished code generation.
26   ///
27   virtual void finishFunction(MachineFunction &F) {}
28
29   /// startBasicBlock - This callback is invoked when a new basic block is about
30   /// to be emitted.
31   ///
32   virtual void startBasicBlock(MachineBasicBlock &BB) {}
33
34   /// emitByte - This callback is invoked when a byte needs to be written to the
35   /// output stream.
36   ///
37   virtual void emitByte(unsigned char B) {}
38
39   /// emitPCRelativeDisp - This callback is invoked when we need to write out a
40   /// PC relative displacement for the specified Value*.  This is used for call
41   /// and jump instructions typically.
42   ///
43   virtual void emitPCRelativeDisp(Value *V) {}
44 };
45
46 #endif