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