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.
27 explicit ELFCodeEmitter(ELFWriter &ew) : EW(ew), TM(EW.TM) {}
29 void startFunction(MachineFunction &F);
30 bool finishFunction(MachineFunction &F);
32 void addRelocation(const MachineRelocation &MR) {
33 assert(0 && "relo not handled yet!");
36 virtual void StartMachineBasicBlock(MachineBasicBlock *MBB) {
39 virtual uintptr_t getConstantPoolEntryAddress(unsigned Index) const {
40 assert(0 && "CP not implementated yet!");
43 virtual uintptr_t getJumpTableEntryAddress(unsigned Index) const {
44 assert(0 && "JT not implementated yet!");
48 virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const {
49 assert(0 && "JT not implementated yet!");
53 virtual uintptr_t getLabelAddress(uint64_t Label) const {
54 assert(0 && "Label address not implementated yet!");
59 virtual void emitLabel(uint64_t LabelID) {
60 assert(0 && "emit Label not implementated yet!");
64 virtual void setModuleInfo(llvm::MachineModuleInfo* MMI) { }
66 /// JIT SPECIFIC FUNCTIONS - DO NOT IMPLEMENT THESE HERE!
67 void startGVStub(const GlobalValue* F, unsigned StubSize,
68 unsigned Alignment = 1) {
69 assert(0 && "JIT specific function called!");
72 void startGVStub(const GlobalValue* F, void *Buffer, unsigned StubSize) {
73 assert(0 && "JIT specific function called!");
76 void *finishGVStub(const GlobalValue *F) {
77 assert(0 && "JIT specific function called!");
81 }; // end class ELFCodeEmitter
83 } // end namespace llvm