blob: 9db422e0ed570c84510e7ad542de682bbc54ee2c [file] [log] [blame]
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +00001//===------ 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
18namespace llvm {
19
20class Function;
Bruno Cardoso Lopesa3f99f92009-05-30 20:51:52 +000021class JITCodeEmitter;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000022class MachineFunction;
23class MachineModuleInfo;
24class MachineMove;
25class TargetData;
Anton Korobeynikovd9e33852010-11-18 23:25:52 +000026class TargetFrameInfo;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000027class TargetMachine;
28class TargetRegisterInfo;
29
30class JITDwarfEmitter {
31 const TargetData* TD;
Bruno Cardoso Lopesa3f99f92009-05-30 20:51:52 +000032 JITCodeEmitter* JCE;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000033 const TargetRegisterInfo* RI;
Anton Korobeynikovd9e33852010-11-18 23:25:52 +000034 const TargetFrameInfo *TFI;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000035 MachineModuleInfo* MMI;
36 JIT& Jit;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000037 bool stackGrowthDirection;
38
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000039 unsigned char* EmitExceptionTable(MachineFunction* MF,
40 unsigned char* StartFunction,
Nicolas Geoffray5913e6c2008-04-20 17:44:19 +000041 unsigned char* EndFunction) const;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000042
43 void EmitFrameMoves(intptr_t BaseLabelPtr,
Nicolas Geoffray5913e6c2008-04-20 17:44:19 +000044 const std::vector<MachineMove> &Moves) const;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000045
Nicolas Geoffray5913e6c2008-04-20 17:44:19 +000046 unsigned char* EmitCommonEHFrame(const Function* Personality) const;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000047
48 unsigned char* EmitEHFrame(const Function* Personality,
49 unsigned char* StartBufferPtr,
50 unsigned char* StartFunction,
51 unsigned char* EndFunction,
Nicolas Geoffray5913e6c2008-04-20 17:44:19 +000052 unsigned char* ExceptionTable) const;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000053
Nicolas Geoffraydc17ab22008-04-18 20:59:31 +000054public:
55
56 JITDwarfEmitter(JIT& jit);
57
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000058 unsigned char* EmitDwarfTable(MachineFunction& F,
Bruno Cardoso Lopesa3f99f92009-05-30 20:51:52 +000059 JITCodeEmitter& JCE,
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000060 unsigned char* StartFunction,
Reid Kleckner27632172009-09-20 23:52:43 +000061 unsigned char* EndFunction,
62 unsigned char* &EHFramePtr);
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000063
Nicolas Geoffraydc17ab22008-04-18 20:59:31 +000064
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000065 void setModuleInfo(MachineModuleInfo* Info) {
66 MMI = Info;
67 }
68};
69
Nicolas Geoffraydc17ab22008-04-18 20:59:31 +000070
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000071} // end namespace llvm
72
73#endif // LLVM_EXECUTION_ENGINE_JIT_DWARFEMITTER_H