blob: 9120ed44e6a60595d194cdd0ef6fa36a31ebd8c8 [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;
26class TargetMachine;
27class TargetRegisterInfo;
28
29class JITDwarfEmitter {
30 const TargetData* TD;
Bruno Cardoso Lopesa3f99f92009-05-30 20:51:52 +000031 JITCodeEmitter* JCE;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000032 const TargetRegisterInfo* RI;
33 MachineModuleInfo* MMI;
34 JIT& Jit;
35 bool needsIndirectEncoding;
36 bool stackGrowthDirection;
37
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000038 unsigned char* EmitExceptionTable(MachineFunction* MF,
39 unsigned char* StartFunction,
Nicolas Geoffray5913e6c2008-04-20 17:44:19 +000040 unsigned char* EndFunction) const;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000041
42 void EmitFrameMoves(intptr_t BaseLabelPtr,
Nicolas Geoffray5913e6c2008-04-20 17:44:19 +000043 const std::vector<MachineMove> &Moves) const;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000044
Nicolas Geoffray5913e6c2008-04-20 17:44:19 +000045 unsigned char* EmitCommonEHFrame(const Function* Personality) const;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000046
47 unsigned char* EmitEHFrame(const Function* Personality,
48 unsigned char* StartBufferPtr,
49 unsigned char* StartFunction,
50 unsigned char* EndFunction,
Nicolas Geoffray5913e6c2008-04-20 17:44:19 +000051 unsigned char* ExceptionTable) const;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000052
Nicolas Geoffray5913e6c2008-04-20 17:44:19 +000053 unsigned GetExceptionTableSizeInBytes(MachineFunction* MF) const;
Nicolas Geoffraydc17ab22008-04-18 20:59:31 +000054
Nicolas Geoffray5913e6c2008-04-20 17:44:19 +000055 unsigned
56 GetFrameMovesSizeInBytes(intptr_t BaseLabelPtr,
57 const std::vector<MachineMove> &Moves) const;
Nicolas Geoffraydc17ab22008-04-18 20:59:31 +000058
Nicolas Geoffray5913e6c2008-04-20 17:44:19 +000059 unsigned GetCommonEHFrameSizeInBytes(const Function* Personality) const;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000060
Nicolas Geoffray5913e6c2008-04-20 17:44:19 +000061 unsigned GetEHFrameSizeInBytes(const Function* Personality,
62 unsigned char* StartFunction) const;
Nicolas Geoffraydc17ab22008-04-18 20:59:31 +000063
64public:
65
66 JITDwarfEmitter(JIT& jit);
67
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000068 unsigned char* EmitDwarfTable(MachineFunction& F,
Bruno Cardoso Lopesa3f99f92009-05-30 20:51:52 +000069 JITCodeEmitter& JCE,
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000070 unsigned char* StartFunction,
71 unsigned char* EndFunction);
72
Nicolas Geoffraydc17ab22008-04-18 20:59:31 +000073
Nicolas Geoffray5913e6c2008-04-20 17:44:19 +000074 unsigned GetDwarfTableSizeInBytes(MachineFunction& F,
Bruno Cardoso Lopesa3f99f92009-05-30 20:51:52 +000075 JITCodeEmitter& JCE,
Nicolas Geoffray5913e6c2008-04-20 17:44:19 +000076 unsigned char* StartFunction,
77 unsigned char* EndFunction);
Nicolas Geoffraydc17ab22008-04-18 20:59:31 +000078
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000079 void setModuleInfo(MachineModuleInfo* Info) {
80 MMI = Info;
81 }
82};
83
Nicolas Geoffraydc17ab22008-04-18 20:59:31 +000084
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000085} // end namespace llvm
86
87#endif // LLVM_EXECUTION_ENGINE_JIT_DWARFEMITTER_H