mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-22 23:31:32 +00:00
29dd209228
* Add support for functions referenced by name git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5206 91177308-0d34-0410-b5e6-96231b3b80d8
77 lines
2.9 KiB
C++
77 lines
2.9 KiB
C++
//===-- llvm/CodeGen/MachineCodeEmitter.h - Code emission -------*- C++ -*-===//
|
|
//
|
|
// This file defines an abstract interface that is used by the machine code
|
|
// emission framework to output the code. This allows machine code emission to
|
|
// be seperated from concerns such as resolution of call targets, and where the
|
|
// machine code will be written (memory or disk, f.e.).
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_CODEGEN_MACHINE_CODE_EMITTER_H
|
|
#define LLVM_CODEGEN_MACHINE_CODE_EMITTER_H
|
|
|
|
#include <string>
|
|
class MachineFunction;
|
|
class MachineBasicBlock;
|
|
class MachineConstantPool;
|
|
class Value;
|
|
class GlobalValue;
|
|
|
|
struct MachineCodeEmitter {
|
|
virtual ~MachineCodeEmitter() {}
|
|
|
|
/// startFunction - This callback is invoked when the specified function is
|
|
/// about to be code generated.
|
|
///
|
|
virtual void startFunction(MachineFunction &F) {}
|
|
|
|
/// finishFunction - This callback is invoked when the specified function has
|
|
/// finished code generation.
|
|
///
|
|
virtual void finishFunction(MachineFunction &F) {}
|
|
|
|
/// emitConstantPool - This callback is invoked to output the constant pool
|
|
/// for the function.
|
|
virtual void emitConstantPool(MachineConstantPool *MCP) {}
|
|
|
|
/// startBasicBlock - This callback is invoked when a new basic block is about
|
|
/// to be emitted.
|
|
///
|
|
virtual void startBasicBlock(MachineBasicBlock &BB) {}
|
|
|
|
/// emitByte - This callback is invoked when a byte needs to be written to the
|
|
/// output stream.
|
|
///
|
|
virtual void emitByte(unsigned char B) {}
|
|
|
|
/// emitPCRelativeDisp - This callback is invoked when we need to write out a
|
|
/// PC relative displacement for the specified Value*. This is used for call
|
|
/// and jump instructions typically.
|
|
///
|
|
virtual void emitPCRelativeDisp(Value *V) {}
|
|
|
|
/// emitGlobalAddress - This callback is invoked when we need to write out the
|
|
/// address of a global value to machine code. This is important for indirect
|
|
/// calls as well as accessing global variables.
|
|
///
|
|
virtual void emitGlobalAddress(GlobalValue *V, bool isPCRelative) {}
|
|
virtual void emitGlobalAddress(const std::string &Name, bool isPCRelative) {}
|
|
|
|
/// emitFunctionConstantValueAddress - This callback is invoked when the
|
|
/// address of a constant, which was spilled to memory, needs to be addressed.
|
|
/// This is used for constants which cannot be directly specified as operands
|
|
/// to instructions, such as large integer values on the sparc, or floating
|
|
/// point constants on the X86.
|
|
///
|
|
virtual void emitFunctionConstantValueAddress(unsigned ConstantNum,
|
|
int Offset) {}
|
|
|
|
/// createDebugMachineCodeEmitter - Return a dynamically allocated machine
|
|
/// code emitter, which just prints the opcodes and fields out the cout. This
|
|
/// can be used for debugging users of the MachineCodeEmitter interface.
|
|
///
|
|
static MachineCodeEmitter *createDebugMachineCodeEmitter();
|
|
};
|
|
|
|
#endif
|