Change allowsUnalignedMemoryAccesses to take type argument since some targets
[llvm/avr.git] / lib / CodeGen / AsmPrinter / DwarfPrinter.h
blob6e75992cb07c2f67820d7def02de8ee0f2636417
1 //===--- lib/CodeGen/DwarfPrinter.h - Dwarf Printer -------------*- C++ -*-===//
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 // Emit general DWARF directives.
11 //
12 //===----------------------------------------------------------------------===//
14 #ifndef CODEGEN_ASMPRINTER_DWARFPRINTER_H__
15 #define CODEGEN_ASMPRINTER_DWARFPRINTER_H__
17 #include "DwarfLabel.h"
18 #include "llvm/CodeGen/MachineLocation.h"
19 #include "llvm/Support/Compiler.h"
20 #include "llvm/Support/raw_ostream.h"
21 #include <vector>
23 namespace llvm {
24 class AsmPrinter;
25 class MachineFunction;
26 class MachineModuleInfo;
27 class Module;
28 class TargetAsmInfo;
29 class TargetData;
30 class TargetRegisterInfo;
32 class VISIBILITY_HIDDEN Dwarf {
33 protected:
34 //===-------------------------------------------------------------==---===//
35 // Core attributes used by the DWARF printer.
38 /// O - Stream to .s file.
39 ///
40 raw_ostream &O;
42 /// Asm - Target of Dwarf emission.
43 ///
44 AsmPrinter *Asm;
46 /// TAI - Target asm information.
47 ///
48 const TargetAsmInfo *TAI;
50 /// TD - Target data.
51 ///
52 const TargetData *TD;
54 /// RI - Register Information.
55 ///
56 const TargetRegisterInfo *RI;
58 /// M - Current module.
59 ///
60 Module *M;
62 /// MF - Current machine function.
63 ///
64 MachineFunction *MF;
66 /// MMI - Collected machine module information.
67 ///
68 MachineModuleInfo *MMI;
70 /// SubprogramCount - The running count of functions being compiled.
71 ///
72 unsigned SubprogramCount;
74 /// Flavor - A unique string indicating what dwarf producer this is, used to
75 /// unique labels.
76 ///
77 const char * const Flavor;
79 /// SetCounter - A unique number for each '.set' directive.
80 ///
81 unsigned SetCounter;
83 Dwarf(raw_ostream &OS, AsmPrinter *A, const TargetAsmInfo *T,
84 const char *flavor);
85 public:
86 //===------------------------------------------------------------------===//
87 // Accessors.
89 const AsmPrinter *getAsm() const { return Asm; }
90 MachineModuleInfo *getMMI() const { return MMI; }
91 const TargetAsmInfo *getTargetAsmInfo() const { return TAI; }
92 const TargetData *getTargetData() const { return TD; }
94 void PrintRelDirective(bool Force32Bit = false,
95 bool isInSection = false) const;
98 /// PrintLabelName - Print label name in form used by Dwarf writer.
99 ///
100 void PrintLabelName(const DWLabel &Label) const {
101 PrintLabelName(Label.getTag(), Label.getNumber());
103 void PrintLabelName(const char *Tag, unsigned Number) const;
104 void PrintLabelName(const char *Tag, unsigned Number,
105 const char *Suffix) const;
107 /// EmitLabel - Emit location label for internal use by Dwarf.
109 void EmitLabel(const DWLabel &Label) const {
110 EmitLabel(Label.getTag(), Label.getNumber());
112 void EmitLabel(const char *Tag, unsigned Number) const;
114 /// EmitReference - Emit a reference to a label.
116 void EmitReference(const DWLabel &Label, bool IsPCRelative = false,
117 bool Force32Bit = false) const {
118 EmitReference(Label.getTag(), Label.getNumber(),
119 IsPCRelative, Force32Bit);
121 void EmitReference(const char *Tag, unsigned Number,
122 bool IsPCRelative = false,
123 bool Force32Bit = false) const;
124 void EmitReference(const std::string &Name, bool IsPCRelative = false,
125 bool Force32Bit = false) const;
127 /// EmitDifference - Emit the difference between two labels. Some
128 /// assemblers do not behave with absolute expressions with data directives,
129 /// so there is an option (needsSet) to use an intermediary set expression.
130 void EmitDifference(const DWLabel &LabelHi, const DWLabel &LabelLo,
131 bool IsSmall = false) {
132 EmitDifference(LabelHi.getTag(), LabelHi.getNumber(),
133 LabelLo.getTag(), LabelLo.getNumber(),
134 IsSmall);
136 void EmitDifference(const char *TagHi, unsigned NumberHi,
137 const char *TagLo, unsigned NumberLo,
138 bool IsSmall = false);
140 void EmitSectionOffset(const char* Label, const char* Section,
141 unsigned LabelNumber, unsigned SectionNumber,
142 bool IsSmall = false, bool isEH = false,
143 bool useSet = true);
145 /// EmitFrameMoves - Emit frame instructions to describe the layout of the
146 /// frame.
147 void EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID,
148 const std::vector<MachineMove> &Moves, bool isEH);
151 } // end llvm namespace
153 #endif