blob: 11ebcc871da1714bb11cf4ed62e7844a5bb69dbe [file] [log] [blame]
Bruno Cardoso Lopes4cb31432009-06-03 17:47:27 +00001//===-- lib/CodeGen/ELFCodeEmitter.h ----------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef ELFCODEEMITTER_H
11#define ELFCODEEMITTER_H
12
13#include "ELFWriter.h"
14#include "llvm/CodeGen/MachineCodeEmitter.h"
15#include <vector>
16
17namespace llvm {
18
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 {
22 ELFWriter &EW;
23 TargetMachine &TM;
24 ELFWriter::ELFSection *ES; // Section to write to.
25 std::vector<unsigned char> *OutBuffer;
26 size_t FnStart;
27 public:
28 explicit ELFCodeEmitter(ELFWriter &ew) : EW(ew), TM(EW.TM), OutBuffer(0) {}
29
30 void startFunction(MachineFunction &F);
31 bool finishFunction(MachineFunction &F);
32
33 void addRelocation(const MachineRelocation &MR) {
34 assert(0 && "relo not handled yet!");
35 }
36
37 virtual void StartMachineBasicBlock(MachineBasicBlock *MBB) {
38 }
39
40 virtual uintptr_t getConstantPoolEntryAddress(unsigned Index) const {
41 assert(0 && "CP not implementated yet!");
42 return 0;
43 }
44 virtual uintptr_t getJumpTableEntryAddress(unsigned Index) const {
45 assert(0 && "JT not implementated yet!");
46 return 0;
47 }
48
49 virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const {
50 assert(0 && "JT not implementated yet!");
51 return 0;
52 }
53
54 virtual uintptr_t getLabelAddress(uint64_t Label) const {
55 assert(0 && "Label address not implementated yet!");
56 abort();
57 return 0;
58 }
59
60 virtual void emitLabel(uint64_t LabelID) {
61 assert(0 && "emit Label not implementated yet!");
62 abort();
63 }
64
65 virtual void setModuleInfo(llvm::MachineModuleInfo* MMI) { }
66
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!");
71 abort();
72 }
73 void startGVStub(const GlobalValue* F, void *Buffer, unsigned StubSize) {
74 assert(0 && "JIT specific function called!");
75 abort();
76 }
77 void *finishGVStub(const GlobalValue *F) {
78 assert(0 && "JIT specific function called!");
79 abort();
80 return 0;
81 }
82}; // end class ELFCodeEmitter
83
84} // end namespace llvm
85
86#endif
87