DwarfDebug.h revision 23670e5b95fcaf88238239729457393b8cc831ff
1//===-- llvm/CodeGen/DwarfDebug.h - Dwarf Debug Framework ------*- 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// This file contains support for writing dwarf debug info into asm files.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef CODEGEN_ASMPRINTER_DWARFDEBUG_H__
15#define CODEGEN_ASMPRINTER_DWARFDEBUG_H__
16
17#include "llvm/CodeGen/AsmPrinter.h"
18#include "llvm/CodeGen/MachineLocation.h"
19#include "DIE.h"
20#include "llvm/ADT/DenseMap.h"
21#include "llvm/ADT/FoldingSet.h"
22#include "llvm/ADT/SmallPtrSet.h"
23#include "llvm/ADT/StringMap.h"
24#include "llvm/ADT/UniqueVector.h"
25#include "llvm/Support/Allocator.h"
26#include "llvm/Support/DebugLoc.h"
27
28namespace llvm {
29
30class CompileUnit;
31class DbgConcreteScope;
32class DbgScope;
33class DbgVariable;
34class MachineFrameInfo;
35class MachineModuleInfo;
36class MachineOperand;
37class MCAsmInfo;
38class DIEAbbrev;
39class DIE;
40class DIEBlock;
41class DIEEntry;
42
43class DIEnumerator;
44class DIDescriptor;
45class DIVariable;
46class DIGlobal;
47class DIGlobalVariable;
48class DISubprogram;
49class DIBasicType;
50class DIDerivedType;
51class DIType;
52class DINameSpace;
53class DISubrange;
54class DICompositeType;
55class DITemplateTypeParameter;
56class DITemplateValueParameter;
57
58//===----------------------------------------------------------------------===//
59/// SrcLineInfo - This class is used to record source line correspondence.
60///
61class SrcLineInfo {
62  unsigned Line;                     // Source line number.
63  unsigned Column;                   // Source column.
64  unsigned SourceID;                 // Source ID number.
65  MCSymbol *Label;                   // Label in code ID number.
66public:
67  SrcLineInfo(unsigned L, unsigned C, unsigned S, MCSymbol *label)
68    : Line(L), Column(C), SourceID(S), Label(label) {}
69
70  // Accessors
71  unsigned getLine() const { return Line; }
72  unsigned getColumn() const { return Column; }
73  unsigned getSourceID() const { return SourceID; }
74  MCSymbol *getLabel() const { return Label; }
75};
76
77/// DotDebugLocEntry - This struct describes location entries emitted in
78/// .debug_loc section.
79typedef struct DotDebugLocEntry {
80  const MCSymbol *Begin;
81  const MCSymbol *End;
82  MachineLocation Loc;
83  bool Merged;
84  DotDebugLocEntry() : Begin(0), End(0), Merged(false) {}
85  DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, MachineLocation &L)
86    : Begin(B), End(E), Loc(L), Merged(false) {}
87  /// Empty entries are also used as a trigger to emit temp label. Such
88  /// labels are referenced is used to find debug_loc offset for a given DIE.
89  bool isEmpty() { return Begin == 0 && End == 0; }
90  bool isMerged() { return Merged; }
91  void Merge(DotDebugLocEntry *Next) {
92    if (!(Begin && Loc == Next->Loc && End == Next->Begin))
93      return;
94    Next->Begin = Begin;
95    Merged = true;
96  }
97} DotDebugLocEntry;
98
99class DwarfDebug {
100  /// Asm - Target of Dwarf emission.
101  AsmPrinter *Asm;
102
103  /// MMI - Collected machine module information.
104  MachineModuleInfo *MMI;
105
106  //===--------------------------------------------------------------------===//
107  // Attributes used to construct specific Dwarf sections.
108  //
109
110  CompileUnit *FirstCU;
111  DenseMap <const MDNode *, CompileUnit *> CUMap;
112
113  /// AbbreviationsSet - Used to uniquely define abbreviations.
114  ///
115  FoldingSet<DIEAbbrev> AbbreviationsSet;
116
117  /// Abbreviations - A list of all the unique abbreviations in use.
118  ///
119  std::vector<DIEAbbrev *> Abbreviations;
120
121  /// SourceIdMap - Source id map, i.e. pair of directory id and source file
122  /// id mapped to a unique id.
123  StringMap<unsigned> SourceIdMap;
124
125  /// DIEBlocks - A list of all the DIEBlocks in use.
126  std::vector<DIEBlock *> DIEBlocks;
127
128  // DIEValueAllocator - All DIEValues are allocated through this allocator.
129  BumpPtrAllocator DIEValueAllocator;
130
131  /// StringPool - A String->Symbol mapping of strings used by indirect
132  /// references.
133  StringMap<std::pair<MCSymbol*, unsigned> > StringPool;
134  unsigned NextStringPoolNumber;
135
136  MCSymbol *getStringPoolEntry(StringRef Str);
137
138  /// SectionMap - Provides a unique id per text section.
139  ///
140  UniqueVector<const MCSection*> SectionMap;
141
142  /// CurrentFnDbgScope - Top level scope for the current function.
143  ///
144  DbgScope *CurrentFnDbgScope;
145
146  /// CurrentFnArguments - List of Arguments (DbgValues) for current function.
147  SmallVector<DbgVariable *, 8> CurrentFnArguments;
148
149  /// DbgScopeMap - Tracks the scopes in the current function.  Owns the
150  /// contained DbgScope*s.
151  ///
152  DenseMap<const MDNode *, DbgScope *> DbgScopeMap;
153
154  /// ConcreteScopes - Tracks the concrete scopees in the current function.
155  /// These scopes are also included in DbgScopeMap.
156  DenseMap<const MDNode *, DbgScope *> ConcreteScopes;
157
158  /// AbstractScopes - Tracks the abstract scopes a module. These scopes are
159  /// not included DbgScopeMap.  AbstractScopes owns its DbgScope*s.
160  DenseMap<const MDNode *, DbgScope *> AbstractScopes;
161
162  /// AbstractSPDies - Collection of abstract subprogram DIEs.
163  DenseMap<const MDNode *, DIE *> AbstractSPDies;
164
165  /// AbstractScopesList - Tracks abstract scopes constructed while processing
166  /// a function. This list is cleared during endFunction().
167  SmallVector<DbgScope *, 4>AbstractScopesList;
168
169  /// AbstractVariables - Collection on abstract variables.  Owned by the
170  /// DbgScopes in AbstractScopes.
171  DenseMap<const MDNode *, DbgVariable *> AbstractVariables;
172
173  /// DbgVariableToFrameIndexMap - Tracks frame index used to find
174  /// variable's value.
175  DenseMap<const DbgVariable *, int> DbgVariableToFrameIndexMap;
176
177  /// DbgVariableToDbgInstMap - Maps DbgVariable to corresponding DBG_VALUE
178  /// machine instruction.
179  DenseMap<const DbgVariable *, const MachineInstr *> DbgVariableToDbgInstMap;
180
181  /// DotDebugLocEntries - Collection of DotDebugLocEntry.
182  SmallVector<DotDebugLocEntry, 4> DotDebugLocEntries;
183
184  /// UseDotDebugLocEntry - DW_AT_location attributes for the DIEs in this set
185  /// idetifies corresponding .debug_loc entry offset.
186  SmallPtrSet<const DIE *, 4> UseDotDebugLocEntry;
187
188  /// VarToAbstractVarMap - Maps DbgVariable with corresponding Abstract
189  /// DbgVariable, if any.
190  DenseMap<const DbgVariable *, const DbgVariable *> VarToAbstractVarMap;
191
192  /// InliendSubprogramDIEs - Collection of subprgram DIEs that are marked
193  /// (at the end of the module) as DW_AT_inline.
194  SmallPtrSet<DIE *, 4> InlinedSubprogramDIEs;
195
196  /// ContainingTypeMap - This map is used to keep track of subprogram DIEs that
197  /// need DW_AT_containing_type attribute. This attribute points to a DIE that
198  /// corresponds to the MDNode mapped with the subprogram DIE.
199  DenseMap<DIE *, const MDNode *> ContainingTypeMap;
200
201  typedef SmallVector<DbgScope *, 2> ScopeVector;
202
203  /// InlineInfo - Keep track of inlined functions and their location.  This
204  /// information is used to populate debug_inlined section.
205  typedef std::pair<const MCSymbol *, DIE *> InlineInfoLabels;
206  DenseMap<const MDNode *, SmallVector<InlineInfoLabels, 4> > InlineInfo;
207  SmallVector<const MDNode *, 4> InlinedSPNodes;
208
209  // ProcessedSPNodes - This is a collection of subprogram MDNodes that
210  // are processed to create DIEs.
211  SmallPtrSet<const MDNode *, 16> ProcessedSPNodes;
212
213  /// LabelsBeforeInsn - Maps instruction with label emitted before
214  /// instruction.
215  DenseMap<const MachineInstr *, MCSymbol *> LabelsBeforeInsn;
216
217  /// LabelsAfterInsn - Maps instruction with label emitted after
218  /// instruction.
219  DenseMap<const MachineInstr *, MCSymbol *> LabelsAfterInsn;
220
221  /// insnNeedsLabel - Collection of instructions that need a label to mark
222  /// a debuggging information entity.
223  SmallPtrSet<const MachineInstr *, 8> InsnNeedsLabel;
224
225  /// InsnsNeedsLabelAfter - Collection of instructions that need a label after
226  /// the instruction because they end a scope of clobber a register.
227  SmallPtrSet<const MachineInstr *, 8> InsnsNeedsLabelAfter;
228
229  /// RegClobberInsn - For each DBG_VALUE instruction referring to a register
230  /// that is clobbered before the variable gets a new DBG_VALUE, map the
231  /// instruction that clobbered the register. This instruction will also be in
232  /// InsnsNeedsLabelAfter.
233  DenseMap<const MachineInstr *, const MachineInstr *> RegClobberInsn;
234
235  SmallVector<const MCSymbol *, 8> DebugRangeSymbols;
236
237  /// Previous instruction's location information. This is used to determine
238  /// label location to indicate scope boundries in dwarf debug info.
239  DebugLoc PrevInstLoc;
240  MCSymbol *PrevLabel;
241
242  struct FunctionDebugFrameInfo {
243    unsigned Number;
244    std::vector<MachineMove> Moves;
245
246    FunctionDebugFrameInfo(unsigned Num, const std::vector<MachineMove> &M)
247      : Number(Num), Moves(M) {}
248  };
249
250  std::vector<FunctionDebugFrameInfo> DebugFrames;
251
252  // Section Symbols: these are assembler temporary labels that are emitted at
253  // the beginning of each supported dwarf section.  These are used to form
254  // section offsets and are created by EmitSectionLabels.
255  MCSymbol *DwarfFrameSectionSym, *DwarfInfoSectionSym, *DwarfAbbrevSectionSym;
256  MCSymbol *DwarfStrSectionSym, *TextSectionSym, *DwarfDebugRangeSectionSym;
257  MCSymbol *DwarfDebugLocSectionSym;
258  MCSymbol *FunctionBeginSym, *FunctionEndSym;
259
260  DIEInteger *DIEIntegerOne;
261private:
262
263  /// getNumSourceIds - Return the number of unique source ids.
264  unsigned getNumSourceIds() const {
265    return SourceIdMap.size();
266  }
267
268  /// assignAbbrevNumber - Define a unique number for the abbreviation.
269  ///
270  void assignAbbrevNumber(DIEAbbrev &Abbrev);
271
272  /// createDIEEntry - Creates a new DIEEntry to be a proxy for a debug
273  /// information entry.
274  DIEEntry *createDIEEntry(DIE *Entry);
275
276  /// addUInt - Add an unsigned integer attribute data and value.
277  ///
278  void addUInt(DIE *Die, unsigned Attribute, unsigned Form, uint64_t Integer);
279
280  /// addSInt - Add an signed integer attribute data and value.
281  ///
282  void addSInt(DIE *Die, unsigned Attribute, unsigned Form, int64_t Integer);
283
284  /// addString - Add a string attribute data and value.
285  ///
286  void addString(DIE *Die, unsigned Attribute, unsigned Form,
287                 const StringRef Str);
288
289  /// addLabel - Add a Dwarf label attribute data and value.
290  ///
291  void addLabel(DIE *Die, unsigned Attribute, unsigned Form,
292                const MCSymbol *Label);
293
294  /// addDelta - Add a label delta attribute data and value.
295  ///
296  void addDelta(DIE *Die, unsigned Attribute, unsigned Form,
297                const MCSymbol *Hi, const MCSymbol *Lo);
298
299  /// addDIEEntry - Add a DIE attribute data and value.
300  ///
301  void addDIEEntry(DIE *Die, unsigned Attribute, unsigned Form, DIE *Entry);
302
303  /// addBlock - Add block data.
304  ///
305  void addBlock(DIE *Die, unsigned Attribute, unsigned Form, DIEBlock *Block);
306
307  /// addSourceLine - Add location information to specified debug information
308  /// entry.
309  void addSourceLine(DIE *Die, DIVariable V);
310  void addSourceLine(DIE *Die, DIGlobalVariable G);
311  void addSourceLine(DIE *Die, DISubprogram SP);
312  void addSourceLine(DIE *Die, DIType Ty);
313  void addSourceLine(DIE *Die, DINameSpace NS);
314
315  /// addAddress - Add an address attribute to a die based on the location
316  /// provided.
317  void addAddress(DIE *Die, unsigned Attribute,
318                  const MachineLocation &Location);
319
320  /// addRegisterAddress - Add register location entry in variable DIE.
321  bool addRegisterAddress(DIE *Die, const MachineOperand &MO);
322
323  /// addConstantValue - Add constant value entry in variable DIE.
324  bool addConstantValue(DIE *Die, const MachineOperand &MO);
325  bool addConstantValue(DIE *Die, ConstantInt *CI, bool Unsigned);
326
327  /// addConstantFPValue - Add constant value entry in variable DIE.
328  bool addConstantFPValue(DIE *Die, const MachineOperand &MO);
329
330  /// addComplexAddress - Start with the address based on the location provided,
331  /// and generate the DWARF information necessary to find the actual variable
332  /// (navigating the extra location information encoded in the type) based on
333  /// the starting location.  Add the DWARF information to the die.
334  ///
335  void addComplexAddress(DbgVariable *&DV, DIE *Die, unsigned Attribute,
336                         const MachineLocation &Location);
337
338  // FIXME: Should be reformulated in terms of addComplexAddress.
339  /// addBlockByrefAddress - Start with the address based on the location
340  /// provided, and generate the DWARF information necessary to find the
341  /// actual Block variable (navigating the Block struct) based on the
342  /// starting location.  Add the DWARF information to the die.  Obsolete,
343  /// please use addComplexAddress instead.
344  ///
345  void addBlockByrefAddress(DbgVariable *&DV, DIE *Die, unsigned Attribute,
346                            const MachineLocation &Location);
347
348  /// addVariableAddress - Add DW_AT_location attribute for a DbgVariable based
349  /// on provided frame index.
350  void addVariableAddress(DbgVariable *&DV, DIE *Die, int64_t FI);
351
352  /// addToContextOwner - Add Die into the list of its context owner's children.
353  void addToContextOwner(DIE *Die, DIDescriptor Context);
354
355  /// addType - Add a new type attribute to the specified entity.
356  void addType(DIE *Entity, DIType Ty);
357
358
359  /// getOrCreateNameSpace - Create a DIE for DINameSpace.
360  DIE *getOrCreateNameSpace(DINameSpace NS);
361
362  /// getOrCreateTypeDIE - Find existing DIE or create new DIE for the
363  /// given DIType.
364  DIE *getOrCreateTypeDIE(DIType Ty);
365
366  /// getOrCreateTemplateTypeParameterDIE - Find existing DIE or create new DIE
367  /// for the given DITemplateTypeParameter.
368  DIE *getOrCreateTemplateTypeParameterDIE(DITemplateTypeParameter TP);
369
370  /// getOrCreateTemplateValueParameterDIE - Find existing DIE or create new DIE
371  /// for the given DITemplateValueParameter.
372  DIE *getOrCreateTemplateValueParameterDIE(DITemplateValueParameter TVP);
373
374  void addPubTypes(DISubprogram SP);
375
376  /// constructTypeDIE - Construct basic type die from DIBasicType.
377  void constructTypeDIE(DIE &Buffer,
378                        DIBasicType BTy);
379
380  /// constructTypeDIE - Construct derived type die from DIDerivedType.
381  void constructTypeDIE(DIE &Buffer,
382                        DIDerivedType DTy);
383
384  /// constructTypeDIE - Construct type DIE from DICompositeType.
385  void constructTypeDIE(DIE &Buffer,
386                        DICompositeType CTy);
387
388  /// constructSubrangeDIE - Construct subrange DIE from DISubrange.
389  void constructSubrangeDIE(DIE &Buffer, DISubrange SR, DIE *IndexTy);
390
391  /// constructArrayTypeDIE - Construct array type DIE from DICompositeType.
392  void constructArrayTypeDIE(DIE &Buffer,
393                             DICompositeType *CTy);
394
395  /// constructEnumTypeDIE - Construct enum type DIE from DIEnumerator.
396  DIE *constructEnumTypeDIE(DIEnumerator ETy);
397
398  /// createMemberDIE - Create new member DIE.
399  DIE *createMemberDIE(DIDerivedType DT);
400
401  /// createSubprogramDIE - Create new DIE using SP.
402  DIE *createSubprogramDIE(DISubprogram SP);
403
404  /// getOrCreateDbgScope - Create DbgScope for the scope.
405  DbgScope *getOrCreateDbgScope(const MDNode *Scope, const MDNode *InlinedAt);
406
407  DbgScope *getOrCreateAbstractScope(const MDNode *N);
408
409  /// findAbstractVariable - Find abstract variable associated with Var.
410  DbgVariable *findAbstractVariable(DIVariable &Var, DebugLoc Loc);
411
412  /// updateSubprogramScopeDIE - Find DIE for the given subprogram and
413  /// attach appropriate DW_AT_low_pc and DW_AT_high_pc attributes.
414  /// If there are global variables in this scope then create and insert
415  /// DIEs for these variables.
416  DIE *updateSubprogramScopeDIE(const MDNode *SPNode);
417
418  /// constructLexicalScope - Construct new DW_TAG_lexical_block
419  /// for this scope and attach DW_AT_low_pc/DW_AT_high_pc labels.
420  DIE *constructLexicalScopeDIE(DbgScope *Scope);
421
422  /// constructInlinedScopeDIE - This scope represents inlined body of
423  /// a function. Construct DIE to represent this concrete inlined copy
424  /// of the function.
425  DIE *constructInlinedScopeDIE(DbgScope *Scope);
426
427  /// constructVariableDIE - Construct a DIE for the given DbgVariable.
428  DIE *constructVariableDIE(DbgVariable *DV, DbgScope *S);
429
430  /// constructScopeDIE - Construct a DIE for this scope.
431  DIE *constructScopeDIE(DbgScope *Scope);
432
433  /// EmitSectionLabels - Emit initial Dwarf sections with a label at
434  /// the start of each one.
435  void EmitSectionLabels();
436
437  /// emitDIE - Recusively Emits a debug information entry.
438  ///
439  void emitDIE(DIE *Die);
440
441  /// computeSizeAndOffset - Compute the size and offset of a DIE.
442  ///
443  unsigned computeSizeAndOffset(DIE *Die, unsigned Offset, bool Last);
444
445  /// computeSizeAndOffsets - Compute the size and offset of all the DIEs.
446  ///
447  void computeSizeAndOffsets();
448
449  /// EmitDebugInfo - Emit the debug info section.
450  ///
451  void emitDebugInfo();
452
453  /// emitAbbreviations - Emit the abbreviation section.
454  ///
455  void emitAbbreviations() const;
456
457  /// emitEndOfLineMatrix - Emit the last address of the section and the end of
458  /// the line matrix.
459  ///
460  void emitEndOfLineMatrix(unsigned SectionEnd);
461
462  /// emitCommonDebugFrame - Emit common frame info into a debug frame section.
463  ///
464  void emitCommonDebugFrame();
465
466  /// emitFunctionDebugFrame - Emit per function frame info into a debug frame
467  /// section.
468  void emitFunctionDebugFrame(const FunctionDebugFrameInfo &DebugFrameInfo);
469
470  /// emitDebugPubNames - Emit visible names into a debug pubnames section.
471  ///
472  void emitDebugPubNames();
473
474  /// emitDebugPubTypes - Emit visible types into a debug pubtypes section.
475  ///
476  void emitDebugPubTypes();
477
478  /// emitDebugStr - Emit visible names into a debug str section.
479  ///
480  void emitDebugStr();
481
482  /// emitDebugLoc - Emit visible names into a debug loc section.
483  ///
484  void emitDebugLoc();
485
486  /// EmitDebugARanges - Emit visible names into a debug aranges section.
487  ///
488  void EmitDebugARanges();
489
490  /// emitDebugRanges - Emit visible names into a debug ranges section.
491  ///
492  void emitDebugRanges();
493
494  /// emitDebugMacInfo - Emit visible names into a debug macinfo section.
495  ///
496  void emitDebugMacInfo();
497
498  /// emitDebugInlineInfo - Emit inline info using following format.
499  /// Section Header:
500  /// 1. length of section
501  /// 2. Dwarf version number
502  /// 3. address size.
503  ///
504  /// Entries (one "entry" for each function that was inlined):
505  ///
506  /// 1. offset into __debug_str section for MIPS linkage name, if exists;
507  ///   otherwise offset into __debug_str for regular function name.
508  /// 2. offset into __debug_str section for regular function name.
509  /// 3. an unsigned LEB128 number indicating the number of distinct inlining
510  /// instances for the function.
511  ///
512  /// The rest of the entry consists of a {die_offset, low_pc}  pair for each
513  /// inlined instance; the die_offset points to the inlined_subroutine die in
514  /// the __debug_info section, and the low_pc is the starting address  for the
515  ///  inlining instance.
516  void emitDebugInlineInfo();
517
518  /// GetOrCreateSourceID - Look up the source id with the given directory and
519  /// source file names. If none currently exists, create a new id and insert it
520  /// in the SourceIds map.
521  unsigned GetOrCreateSourceID(StringRef DirName, StringRef FullName);
522
523  /// constructCompileUnit - Create new CompileUnit for the given
524  /// metadata node with tag DW_TAG_compile_unit.
525  void constructCompileUnit(const MDNode *N);
526
527  /// getCompielUnit - Get CompileUnit DIE.
528  CompileUnit *getCompileUnit(const MDNode *N) const;
529
530  /// constructGlobalVariableDIE - Construct global variable DIE.
531  void constructGlobalVariableDIE(const MDNode *N);
532
533  /// construct SubprogramDIE - Construct subprogram DIE.
534  void constructSubprogramDIE(const MDNode *N);
535
536  /// recordSourceLine - Register a source line with debug info. Returns the
537  /// unique label that was emitted and which provides correspondence to
538  /// the source line list.
539  MCSymbol *recordSourceLine(unsigned Line, unsigned Col, const MDNode *Scope);
540
541  /// recordVariableFrameIndex - Record a variable's index.
542  void recordVariableFrameIndex(const DbgVariable *V, int Index);
543
544  /// findVariableFrameIndex - Return true if frame index for the variable
545  /// is found. Update FI to hold value of the index.
546  bool findVariableFrameIndex(const DbgVariable *V, int *FI);
547
548  /// findDbgScope - Find DbgScope for the debug loc attached with an
549  /// instruction.
550  DbgScope *findDbgScope(const MachineInstr *MI);
551
552  /// identifyScopeMarkers() - Indentify instructions that are marking
553  /// beginning of or end of a scope.
554  void identifyScopeMarkers();
555
556  /// extractScopeInformation - Scan machine instructions in this function
557  /// and collect DbgScopes. Return true, if atleast one scope was found.
558  bool extractScopeInformation();
559
560  /// addCurrentFnArgument - If Var is an current function argument that add
561  /// it in CurrentFnArguments list.
562  bool addCurrentFnArgument(const MachineFunction *MF,
563                            DbgVariable *Var, DbgScope *Scope);
564
565  /// collectVariableInfo - Populate DbgScope entries with variables' info.
566  void collectVariableInfo(const MachineFunction *,
567                           SmallPtrSet<const MDNode *, 16> &ProcessedVars);
568
569  /// collectVariableInfoFromMMITable - Collect variable information from
570  /// side table maintained by MMI.
571  void collectVariableInfoFromMMITable(const MachineFunction * MF,
572                                       SmallPtrSet<const MDNode *, 16> &P);
573public:
574  //===--------------------------------------------------------------------===//
575  // Main entry points.
576  //
577  DwarfDebug(AsmPrinter *A, Module *M);
578  ~DwarfDebug();
579
580  /// beginModule - Emit all Dwarf sections that should come prior to the
581  /// content.
582  void beginModule(Module *M);
583
584  /// endModule - Emit all Dwarf sections that should come after the content.
585  ///
586  void endModule();
587
588  /// beginFunction - Gather pre-function debug information.  Assumes being
589  /// emitted immediately after the function entry point.
590  void beginFunction(const MachineFunction *MF);
591
592  /// endFunction - Gather and emit post-function debug information.
593  ///
594  void endFunction(const MachineFunction *MF);
595
596  /// getLabelBeforeInsn - Return Label preceding the instruction.
597  const MCSymbol *getLabelBeforeInsn(const MachineInstr *MI);
598
599  /// getLabelAfterInsn - Return Label immediately following the instruction.
600  const MCSymbol *getLabelAfterInsn(const MachineInstr *MI);
601
602  /// beginInstruction - Process beginning of an instruction.
603  void beginInstruction(const MachineInstr *MI);
604
605  /// endInstruction - Prcess end of an instruction.
606  void endInstruction(const MachineInstr *MI);
607};
608} // End of namespace llvm
609
610#endif
611