Bruno Cardoso Lopes | 4cb3143 | 2009-06-03 17:47:27 +0000 | [diff] [blame] | 1 | //===-- 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 | |
| 17 | namespace 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; |
Bruno Cardoso Lopes | f5b0c5a | 2009-06-06 03:56:29 +0000 | [diff] [blame] | 24 | ELFSection *ES; // Section to write to. |
Bruno Cardoso Lopes | 5d41910 | 2009-06-05 00:22:10 +0000 | [diff] [blame] | 25 | uint8_t *FnStartPtr; |
Bruno Cardoso Lopes | 4cb3143 | 2009-06-03 17:47:27 +0000 | [diff] [blame] | 26 | public: |
Bruno Cardoso Lopes | 5d41910 | 2009-06-05 00:22:10 +0000 | [diff] [blame] | 27 | explicit ELFCodeEmitter(ELFWriter &ew) : EW(ew), TM(EW.TM) {} |
Bruno Cardoso Lopes | 4cb3143 | 2009-06-03 17:47:27 +0000 | [diff] [blame] | 28 | |
| 29 | void startFunction(MachineFunction &F); |
| 30 | bool finishFunction(MachineFunction &F); |
| 31 | |
| 32 | void addRelocation(const MachineRelocation &MR) { |
| 33 | assert(0 && "relo not handled yet!"); |
| 34 | } |
| 35 | |
| 36 | virtual void StartMachineBasicBlock(MachineBasicBlock *MBB) { |
| 37 | } |
| 38 | |
| 39 | virtual uintptr_t getConstantPoolEntryAddress(unsigned Index) const { |
| 40 | assert(0 && "CP not implementated yet!"); |
| 41 | return 0; |
| 42 | } |
| 43 | virtual uintptr_t getJumpTableEntryAddress(unsigned Index) const { |
| 44 | assert(0 && "JT not implementated yet!"); |
| 45 | return 0; |
| 46 | } |
| 47 | |
| 48 | virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const { |
| 49 | assert(0 && "JT not implementated yet!"); |
| 50 | return 0; |
| 51 | } |
| 52 | |
| 53 | virtual uintptr_t getLabelAddress(uint64_t Label) const { |
| 54 | assert(0 && "Label address not implementated yet!"); |
| 55 | abort(); |
| 56 | return 0; |
| 57 | } |
| 58 | |
| 59 | virtual void emitLabel(uint64_t LabelID) { |
| 60 | assert(0 && "emit Label not implementated yet!"); |
| 61 | abort(); |
| 62 | } |
| 63 | |
| 64 | virtual void setModuleInfo(llvm::MachineModuleInfo* MMI) { } |
| 65 | |
| 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!"); |
| 70 | abort(); |
| 71 | } |
| 72 | void startGVStub(const GlobalValue* F, void *Buffer, unsigned StubSize) { |
| 73 | assert(0 && "JIT specific function called!"); |
| 74 | abort(); |
| 75 | } |
| 76 | void *finishGVStub(const GlobalValue *F) { |
| 77 | assert(0 && "JIT specific function called!"); |
| 78 | abort(); |
| 79 | return 0; |
| 80 | } |
| 81 | }; // end class ELFCodeEmitter |
| 82 | |
| 83 | } // end namespace llvm |
| 84 | |
| 85 | #endif |
| 86 | |