1 //===-- lib/CodeGen/ELFCodeEmitter.h ----------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef ELFCODEEMITTER_H
11 #define ELFCODEEMITTER_H
13 #include "ELFWriter.h"
14 #include "llvm/CodeGen/MachineCodeEmitter.h"
19 /// ELFCodeEmitter - This class is used by the ELFWriter to
20 /// emit the code for functions to the ELF file.
21 class ELFCodeEmitter : public MachineCodeEmitter {
24 ELFWriter::ELFSection *ES; // Section to write to.
25 std::vector<unsigned char> *OutBuffer;
28 explicit ELFCodeEmitter(ELFWriter &ew) : EW(ew), TM(EW.TM), OutBuffer(0) {}
30 void startFunction(MachineFunction &F);
31 bool finishFunction(MachineFunction &F);
33 void addRelocation(const MachineRelocation &MR) {
34 assert(0 && "relo not handled yet!");
37 virtual void StartMachineBasicBlock(MachineBasicBlock *MBB) {
40 virtual uintptr_t getConstantPoolEntryAddress(unsigned Index) const {
41 assert(0 && "CP not implementated yet!");
44 virtual uintptr_t getJumpTableEntryAddress(unsigned Index) const {
45 assert(0 && "JT not implementated yet!");
49 virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const {
50 assert(0 && "JT not implementated yet!");
54 virtual uintptr_t getLabelAddress(uint64_t Label) const {
55 assert(0 && "Label address not implementated yet!");
60 virtual void emitLabel(uint64_t LabelID) {
61 assert(0 && "emit Label not implementated yet!");
65 virtual void setModuleInfo(llvm::MachineModuleInfo* MMI) { }
67 /// JIT SPECIFIC FUNCTIONS - DO NOT IMPLEMENT THESE HERE!
68 void startGVStub(const GlobalValue* F, unsigned StubSize,
69 unsigned Alignment = 1) {
70 assert(0 && "JIT specific function called!");
73 void startGVStub(const GlobalValue* F, void *Buffer, unsigned StubSize) {
74 assert(0 && "JIT specific function called!");
77 void *finishGVStub(const GlobalValue *F) {
78 assert(0 && "JIT specific function called!");
82 }; // end class ELFCodeEmitter
84 } // end namespace llvm