Nicolas Geoffray | afe6c2b | 2008-02-13 18:39:37 +0000 | [diff] [blame] | 1 | //===------ JITDwarfEmitter.h - Write dwarf tables into memory ------------===// |
| 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 | // This file defines a JITDwarfEmitter object that is used by the JIT to |
| 11 | // write dwarf tables to memory. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef LLVM_EXECUTION_ENGINE_JIT_DWARFEMITTER_H |
| 16 | #define LLVM_EXECUTION_ENGINE_JIT_DWARFEMITTER_H |
| 17 | |
| 18 | namespace llvm { |
| 19 | |
| 20 | class Function; |
Bruno Cardoso Lopes | a3f99f9 | 2009-05-30 20:51:52 +0000 | [diff] [blame] | 21 | class JITCodeEmitter; |
Nicolas Geoffray | afe6c2b | 2008-02-13 18:39:37 +0000 | [diff] [blame] | 22 | class MachineFunction; |
| 23 | class MachineModuleInfo; |
| 24 | class MachineMove; |
| 25 | class TargetData; |
| 26 | class TargetMachine; |
| 27 | class TargetRegisterInfo; |
| 28 | |
| 29 | class JITDwarfEmitter { |
| 30 | const TargetData* TD; |
Bruno Cardoso Lopes | a3f99f9 | 2009-05-30 20:51:52 +0000 | [diff] [blame] | 31 | JITCodeEmitter* JCE; |
Nicolas Geoffray | afe6c2b | 2008-02-13 18:39:37 +0000 | [diff] [blame] | 32 | const TargetRegisterInfo* RI; |
| 33 | MachineModuleInfo* MMI; |
| 34 | JIT& Jit; |
Nicolas Geoffray | afe6c2b | 2008-02-13 18:39:37 +0000 | [diff] [blame] | 35 | bool stackGrowthDirection; |
| 36 | |
Nicolas Geoffray | afe6c2b | 2008-02-13 18:39:37 +0000 | [diff] [blame] | 37 | unsigned char* EmitExceptionTable(MachineFunction* MF, |
| 38 | unsigned char* StartFunction, |
Nicolas Geoffray | 5913e6c | 2008-04-20 17:44:19 +0000 | [diff] [blame] | 39 | unsigned char* EndFunction) const; |
Nicolas Geoffray | afe6c2b | 2008-02-13 18:39:37 +0000 | [diff] [blame] | 40 | |
| 41 | void EmitFrameMoves(intptr_t BaseLabelPtr, |
Nicolas Geoffray | 5913e6c | 2008-04-20 17:44:19 +0000 | [diff] [blame] | 42 | const std::vector<MachineMove> &Moves) const; |
Nicolas Geoffray | afe6c2b | 2008-02-13 18:39:37 +0000 | [diff] [blame] | 43 | |
Nicolas Geoffray | 5913e6c | 2008-04-20 17:44:19 +0000 | [diff] [blame] | 44 | unsigned char* EmitCommonEHFrame(const Function* Personality) const; |
Nicolas Geoffray | afe6c2b | 2008-02-13 18:39:37 +0000 | [diff] [blame] | 45 | |
| 46 | unsigned char* EmitEHFrame(const Function* Personality, |
| 47 | unsigned char* StartBufferPtr, |
| 48 | unsigned char* StartFunction, |
| 49 | unsigned char* EndFunction, |
Nicolas Geoffray | 5913e6c | 2008-04-20 17:44:19 +0000 | [diff] [blame] | 50 | unsigned char* ExceptionTable) const; |
Nicolas Geoffray | afe6c2b | 2008-02-13 18:39:37 +0000 | [diff] [blame] | 51 | |
Nicolas Geoffray | 5913e6c | 2008-04-20 17:44:19 +0000 | [diff] [blame] | 52 | unsigned GetExceptionTableSizeInBytes(MachineFunction* MF) const; |
Nicolas Geoffray | dc17ab2 | 2008-04-18 20:59:31 +0000 | [diff] [blame] | 53 | |
Nicolas Geoffray | 5913e6c | 2008-04-20 17:44:19 +0000 | [diff] [blame] | 54 | unsigned |
| 55 | GetFrameMovesSizeInBytes(intptr_t BaseLabelPtr, |
| 56 | const std::vector<MachineMove> &Moves) const; |
Nicolas Geoffray | dc17ab2 | 2008-04-18 20:59:31 +0000 | [diff] [blame] | 57 | |
Nicolas Geoffray | 5913e6c | 2008-04-20 17:44:19 +0000 | [diff] [blame] | 58 | unsigned GetCommonEHFrameSizeInBytes(const Function* Personality) const; |
Nicolas Geoffray | afe6c2b | 2008-02-13 18:39:37 +0000 | [diff] [blame] | 59 | |
Nicolas Geoffray | 5913e6c | 2008-04-20 17:44:19 +0000 | [diff] [blame] | 60 | unsigned GetEHFrameSizeInBytes(const Function* Personality, |
| 61 | unsigned char* StartFunction) const; |
Nicolas Geoffray | dc17ab2 | 2008-04-18 20:59:31 +0000 | [diff] [blame] | 62 | |
| 63 | public: |
| 64 | |
| 65 | JITDwarfEmitter(JIT& jit); |
| 66 | |
Nicolas Geoffray | afe6c2b | 2008-02-13 18:39:37 +0000 | [diff] [blame] | 67 | unsigned char* EmitDwarfTable(MachineFunction& F, |
Bruno Cardoso Lopes | a3f99f9 | 2009-05-30 20:51:52 +0000 | [diff] [blame] | 68 | JITCodeEmitter& JCE, |
Nicolas Geoffray | afe6c2b | 2008-02-13 18:39:37 +0000 | [diff] [blame] | 69 | unsigned char* StartFunction, |
Reid Kleckner | 2763217 | 2009-09-20 23:52:43 +0000 | [diff] [blame^] | 70 | unsigned char* EndFunction, |
| 71 | unsigned char* &EHFramePtr); |
Nicolas Geoffray | afe6c2b | 2008-02-13 18:39:37 +0000 | [diff] [blame] | 72 | |
Nicolas Geoffray | dc17ab2 | 2008-04-18 20:59:31 +0000 | [diff] [blame] | 73 | |
Nicolas Geoffray | 5913e6c | 2008-04-20 17:44:19 +0000 | [diff] [blame] | 74 | unsigned GetDwarfTableSizeInBytes(MachineFunction& F, |
Bruno Cardoso Lopes | a3f99f9 | 2009-05-30 20:51:52 +0000 | [diff] [blame] | 75 | JITCodeEmitter& JCE, |
Nicolas Geoffray | 5913e6c | 2008-04-20 17:44:19 +0000 | [diff] [blame] | 76 | unsigned char* StartFunction, |
| 77 | unsigned char* EndFunction); |
Nicolas Geoffray | dc17ab2 | 2008-04-18 20:59:31 +0000 | [diff] [blame] | 78 | |
Nicolas Geoffray | afe6c2b | 2008-02-13 18:39:37 +0000 | [diff] [blame] | 79 | void setModuleInfo(MachineModuleInfo* Info) { |
| 80 | MMI = Info; |
| 81 | } |
| 82 | }; |
| 83 | |
Nicolas Geoffray | dc17ab2 | 2008-04-18 20:59:31 +0000 | [diff] [blame] | 84 | |
Nicolas Geoffray | afe6c2b | 2008-02-13 18:39:37 +0000 | [diff] [blame] | 85 | } // end namespace llvm |
| 86 | |
| 87 | #endif // LLVM_EXECUTION_ENGINE_JIT_DWARFEMITTER_H |