blob: 98ac34049176febf82be6d3b145d0776cb7e8360 [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
Chandler Carruthd04a8d42012-12-03 16:50:05 +000018#include "llvm/Support/DataTypes.h"
19#include <vector>
20
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000021namespace llvm {
22
23class Function;
Chandler Carruthd04a8d42012-12-03 16:50:05 +000024class JIT;
Bruno Cardoso Lopesa3f99f92009-05-30 20:51:52 +000025class JITCodeEmitter;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000026class MachineFunction;
27class MachineModuleInfo;
28class MachineMove;
Evan Cheng2d286172011-07-18 22:29:13 +000029class MCAsmInfo;
Micah Villmow3574eca2012-10-08 16:38:25 +000030class DataLayout;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000031class TargetMachine;
32class TargetRegisterInfo;
33
34class JITDwarfEmitter {
Micah Villmow3574eca2012-10-08 16:38:25 +000035 const DataLayout* TD;
Bruno Cardoso Lopesa3f99f92009-05-30 20:51:52 +000036 JITCodeEmitter* JCE;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000037 const TargetRegisterInfo* RI;
Evan Cheng2d286172011-07-18 22:29:13 +000038 const MCAsmInfo *MAI;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000039 MachineModuleInfo* MMI;
40 JIT& Jit;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000041 bool stackGrowthDirection;
Jim Grosbach8bf0ecd2011-03-22 15:21:58 +000042
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000043 unsigned char* EmitExceptionTable(MachineFunction* MF,
Jim Grosbach8bf0ecd2011-03-22 15:21:58 +000044 unsigned char* StartFunction,
Nicolas Geoffray5913e6c2008-04-20 17:44:19 +000045 unsigned char* EndFunction) const;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000046
Jim Grosbach8bf0ecd2011-03-22 15:21:58 +000047 void EmitFrameMoves(intptr_t BaseLabelPtr,
Nicolas Geoffray5913e6c2008-04-20 17:44:19 +000048 const std::vector<MachineMove> &Moves) const;
Jim Grosbach8bf0ecd2011-03-22 15:21:58 +000049
Nicolas Geoffray5913e6c2008-04-20 17:44:19 +000050 unsigned char* EmitCommonEHFrame(const Function* Personality) const;
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000051
Jim Grosbach8bf0ecd2011-03-22 15:21:58 +000052 unsigned char* EmitEHFrame(const Function* Personality,
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000053 unsigned char* StartBufferPtr,
Jim Grosbach8bf0ecd2011-03-22 15:21:58 +000054 unsigned char* StartFunction,
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000055 unsigned char* EndFunction,
Nicolas Geoffray5913e6c2008-04-20 17:44:19 +000056 unsigned char* ExceptionTable) const;
Jim Grosbach8bf0ecd2011-03-22 15:21:58 +000057
Nicolas Geoffraydc17ab22008-04-18 20:59:31 +000058public:
Jim Grosbach8bf0ecd2011-03-22 15:21:58 +000059
Nicolas Geoffraydc17ab22008-04-18 20:59:31 +000060 JITDwarfEmitter(JIT& jit);
Jim Grosbach8bf0ecd2011-03-22 15:21:58 +000061
62 unsigned char* EmitDwarfTable(MachineFunction& F,
Bruno Cardoso Lopesa3f99f92009-05-30 20:51:52 +000063 JITCodeEmitter& JCE,
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000064 unsigned char* StartFunction,
Reid Kleckner27632172009-09-20 23:52:43 +000065 unsigned char* EndFunction,
66 unsigned char* &EHFramePtr);
Jim Grosbach8bf0ecd2011-03-22 15:21:58 +000067
68
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000069 void setModuleInfo(MachineModuleInfo* Info) {
70 MMI = Info;
71 }
72};
73
Nicolas Geoffraydc17ab22008-04-18 20:59:31 +000074
Nicolas Geoffrayafe6c2b2008-02-13 18:39:37 +000075} // end namespace llvm
76
77#endif // LLVM_EXECUTION_ENGINE_JIT_DWARFEMITTER_H