1 //===--- lib/CodeGen/DwarfPrinter.h - Dwarf Printer -------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Emit general DWARF directives.
12 //===----------------------------------------------------------------------===//
14 #ifndef CODEGEN_ASMPRINTER_DWARFPRINTER_H__
15 #define CODEGEN_ASMPRINTER_DWARFPRINTER_H__
17 #include "llvm/CodeGen/MachineLocation.h"
18 #include "llvm/Support/Compiler.h"
19 #include "llvm/Support/FormattedStream.h"
24 class MachineFunction;
25 class MachineModuleInfo;
29 class TargetRegisterInfo;
38 //===-------------------------------------------------------------==---===//
39 // Core attributes used by the DWARF printer.
42 /// Asm - Target of Dwarf emission.
45 /// MAI - Target asm information.
51 /// RI - Register Information.
52 const TargetRegisterInfo *RI;
54 /// M - Current module.
57 /// MF - Current machine function.
58 const MachineFunction *MF;
60 /// MMI - Collected machine module information.
61 MachineModuleInfo *MMI;
63 /// SubprogramCount - The running count of functions being compiled.
64 unsigned SubprogramCount;
66 DwarfPrinter(AsmPrinter *A);
69 //===------------------------------------------------------------------===//
72 const AsmPrinter *getAsm() const { return Asm; }
73 MachineModuleInfo *getMMI() const { return MMI; }
74 const MCAsmInfo *getMCAsmInfo() const { return MAI; }
75 const TargetData *getTargetData() const { return TD; }
77 /// SizeOfEncodedValue - Return the size of the encoding in bytes.
78 unsigned SizeOfEncodedValue(unsigned Encoding) const;
80 /// EmitEncodingByte - Emit a .byte 42 directive that corresponds to an
81 /// encoding. If verbose assembly output is enabled, we output comments
82 /// describing the encoding. Desc is a string saying what the encoding is
83 /// specifying (e.g. "LSDA").
84 void EmitEncodingByte(unsigned Val, const char *Desc);
86 /// EmitCFAByte - Emit a .byte 42 directive for a DW_CFA_xxx value.
87 void EmitCFAByte(unsigned Val);
90 /// EmitReference - Emit a reference to a label.
92 void EmitReference(const MCSymbol *Sym, unsigned Encoding) const;
93 void EmitReference(const GlobalValue *GV, unsigned Encoding) const;
95 /// EmitDifference - Emit the difference between two labels.
96 void EmitDifference(const MCSymbol *LabelHi, const MCSymbol *LabelLo,
97 bool IsSmall = false);
99 /// EmitSectionOffset - Emit Label-Section or use a special purpose directive
100 /// to emit a section offset if the target has one.
101 void EmitSectionOffset(const MCSymbol *Label, const MCSymbol *Section,
102 bool IsSmall = false, bool isEH = false);
104 /// EmitFrameMoves - Emit frame instructions to describe the layout of the
106 void EmitFrameMoves(MCSymbol *BaseLabel,
107 const std::vector<MachineMove> &Moves, bool isEH);
110 } // end llvm namespace