LLVM API Documentation

JITDwarfEmitter.h

Go to the documentation of this file.
00001 //===------ JITDwarfEmitter.h - Write dwarf tables into memory ------------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file defines a JITDwarfEmitter object that is used by the JIT to
00011 // write dwarf tables to memory.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_EXECUTION_ENGINE_JIT_DWARFEMITTER_H
00016 #define LLVM_EXECUTION_ENGINE_JIT_DWARFEMITTER_H
00017 
00018 namespace llvm {
00019 
00020 class Function;
00021 class MachineCodeEmitter;
00022 class MachineFunction;
00023 class MachineModuleInfo;
00024 class MachineMove;
00025 class TargetData;
00026 class TargetMachine;
00027 class TargetRegisterInfo;
00028 
00029 class JITDwarfEmitter {
00030   const TargetData* TD;
00031   MachineCodeEmitter* MCE;
00032   const TargetRegisterInfo* RI;
00033   MachineModuleInfo* MMI;
00034   JIT& Jit;
00035   bool needsIndirectEncoding;
00036   bool stackGrowthDirection;
00037   
00038   unsigned char* EmitExceptionTable(MachineFunction* MF,
00039                                     unsigned char* StartFunction, 
00040                                     unsigned char* EndFunction) const;
00041 
00042   void EmitFrameMoves(intptr_t BaseLabelPtr, 
00043                       const std::vector<MachineMove> &Moves) const;
00044     
00045   unsigned char* EmitCommonEHFrame(const Function* Personality) const;
00046 
00047   unsigned char* EmitEHFrame(const Function* Personality, 
00048                              unsigned char* StartBufferPtr,
00049                              unsigned char* StartFunction, 
00050                              unsigned char* EndFunction,
00051                              unsigned char* ExceptionTable) const;
00052     
00053   unsigned GetExceptionTableSizeInBytes(MachineFunction* MF) const;
00054   
00055   unsigned
00056     GetFrameMovesSizeInBytes(intptr_t BaseLabelPtr, 
00057                              const std::vector<MachineMove> &Moves) const;
00058     
00059   unsigned GetCommonEHFrameSizeInBytes(const Function* Personality) const;
00060 
00061   unsigned GetEHFrameSizeInBytes(const Function* Personality, 
00062                                  unsigned char* StartFunction) const; 
00063     
00064 public:
00065   
00066   JITDwarfEmitter(JIT& jit);
00067   
00068   unsigned char* EmitDwarfTable(MachineFunction& F, 
00069                                 MachineCodeEmitter& MCE,
00070                                 unsigned char* StartFunction,
00071                                 unsigned char* EndFunction);
00072   
00073   
00074   unsigned GetDwarfTableSizeInBytes(MachineFunction& F, 
00075                                     MachineCodeEmitter& MCE,
00076                                     unsigned char* StartFunction,
00077                                     unsigned char* EndFunction);
00078 
00079   void setModuleInfo(MachineModuleInfo* Info) {
00080     MMI = Info;
00081   }
00082 };
00083 
00084 
00085 } // end namespace llvm
00086 
00087 #endif // LLVM_EXECUTION_ENGINE_JIT_DWARFEMITTER_H