1 //===--- llvm/Analysis/DebugInfo.h - Debug Information Helpers --*- 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 // This file defines a bunch of datatypes that are useful for creating and
11 // walking debug info in LLVM IR form. They essentially provide wrappers around
12 // the information in the global variables that's needed when constructing the
15 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_ANALYSIS_DEBUGINFO_H
18 #define LLVM_ANALYSIS_DEBUGINFO_H
20 #include "llvm/Metadata.h"
21 #include "llvm/Target/TargetMachine.h"
22 #include "llvm/ADT/StringMap.h"
23 #include "llvm/ADT/DenseMap.h"
24 #include "llvm/ADT/SmallVector.h"
25 #include "llvm/ADT/SmallPtrSet.h"
26 #include "llvm/Support/Dwarf.h"
27 #include "llvm/Support/ValueHandle.h"
37 struct DbgStopPointInst;
38 struct DbgDeclareInst;
39 struct DbgFuncStartInst;
40 struct DbgRegionStartInst;
41 struct DbgRegionEndInst;
43 struct DebugLocTracker;
49 TrackingVH<MDNode> DbgNode;
51 /// DIDescriptor constructor. If the specified node is non-null, check
52 /// to make sure that the tag in the descriptor matches 'RequiredTag'. If
53 /// not, the debug info is corrupt and we ignore it.
54 DIDescriptor(MDNode *N, unsigned RequiredTag);
56 const char *getStringField(unsigned Elt) const;
57 unsigned getUnsignedField(unsigned Elt) const {
58 return (unsigned)getUInt64Field(Elt);
60 uint64_t getUInt64Field(unsigned Elt) const;
61 DIDescriptor getDescriptorField(unsigned Elt) const;
63 template <typename DescTy>
64 DescTy getFieldAs(unsigned Elt) const {
65 return DescTy(getDescriptorField(Elt).getNode());
68 GlobalVariable *getGlobalVariableField(unsigned Elt) const;
71 explicit DIDescriptor() : DbgNode(0) {}
72 explicit DIDescriptor(MDNode *N) : DbgNode(N) {}
74 bool isNull() const { return DbgNode == 0; }
76 MDNode *getNode() const { return DbgNode; }
78 unsigned getVersion() const {
79 return getUnsignedField(0) & LLVMDebugVersionMask;
82 unsigned getTag() const {
83 return getUnsignedField(0) & ~LLVMDebugVersionMask;
86 /// ValidDebugInfo - Return true if N represents valid debug info value.
87 static bool ValidDebugInfo(MDNode *N, CodeGenOpt::Level OptLevel);
89 /// dump - print descriptor.
92 bool isDerivedType() const;
93 bool isCompositeType() const;
94 bool isBasicType() const;
95 bool isVariable() const;
96 bool isSubprogram() const;
97 bool isGlobalVariable() const;
99 bool isCompileUnit() const;
100 bool isLexicalBlock() const;
101 bool isSubrange() const;
102 bool isEnumerator() const;
104 bool isGlobal() const;
107 /// DISubrange - This is used to represent ranges, for array bounds.
108 class DISubrange : public DIDescriptor {
110 explicit DISubrange(MDNode *N = 0)
111 : DIDescriptor(N, dwarf::DW_TAG_subrange_type) {}
113 int64_t getLo() const { return (int64_t)getUInt64Field(1); }
114 int64_t getHi() const { return (int64_t)getUInt64Field(2); }
117 /// DIArray - This descriptor holds an array of descriptors.
118 class DIArray : public DIDescriptor {
120 explicit DIArray(MDNode *N = 0)
123 unsigned getNumElements() const;
124 DIDescriptor getElement(unsigned Idx) const {
125 return getDescriptorField(Idx);
129 /// DIScope - A base class for various scopes.
130 class DIScope : public DIDescriptor {
132 explicit DIScope(MDNode *N = 0) : DIDescriptor (N) {
133 if (DbgNode && !isScope())
136 virtual ~DIScope() {}
138 const char *getFilename() const;
139 const char *getDirectory() const;
142 /// DICompileUnit - A wrapper for a compile unit.
143 class DICompileUnit : public DIScope {
145 explicit DICompileUnit(MDNode *N = 0) : DIScope(N) {
146 if (DbgNode && !isCompileUnit())
150 unsigned getLanguage() const { return getUnsignedField(2); }
151 const char *getFilename() const { return getStringField(3); }
152 const char *getDirectory() const { return getStringField(4); }
153 const char *getProducer() const { return getStringField(5); }
155 /// isMain - Each input file is encoded as a separate compile unit in LLVM
156 /// debugging information output. However, many target specific tool chains
157 /// prefer to encode only one compile unit in an object file. In this
158 /// situation, the LLVM code generator will include debugging information
159 /// entities in the compile unit that is marked as main compile unit. The
160 /// code generator accepts maximum one main compile unit per module. If a
161 /// module does not contain any main compile unit then the code generator
162 /// will emit multiple compile units in the output object file.
164 bool isMain() const { return getUnsignedField(6); }
165 bool isOptimized() const { return getUnsignedField(7); }
166 const char *getFlags() const { return getStringField(8); }
167 unsigned getRunTimeVersion() const { return getUnsignedField(9); }
169 /// Verify - Verify that a compile unit is well formed.
172 /// dump - print compile unit.
176 /// DIEnumerator - A wrapper for an enumerator (e.g. X and Y in 'enum {X,Y}').
177 /// FIXME: it seems strange that this doesn't have either a reference to the
178 /// type/precision or a file/line pair for location info.
179 class DIEnumerator : public DIDescriptor {
181 explicit DIEnumerator(MDNode *N = 0)
182 : DIDescriptor(N, dwarf::DW_TAG_enumerator) {}
184 const char *getName() const { return getStringField(1); }
185 uint64_t getEnumValue() const { return getUInt64Field(2); }
188 /// DIType - This is a wrapper for a type.
189 /// FIXME: Types should be factored much better so that CV qualifiers and
190 /// others do not require a huge and empty descriptor full of zeros.
191 class DIType : public DIDescriptor {
194 FlagPrivate = 1 << 0,
195 FlagProtected = 1 << 1,
196 FlagFwdDecl = 1 << 2,
197 FlagAppleBlock = 1 << 3,
198 FlagBlockByrefStruct = 1 << 4
202 DIType(MDNode *N, unsigned Tag)
203 : DIDescriptor(N, Tag) {}
204 // This ctor is used when the Tag has already been validated by a derived
206 DIType(MDNode *N, bool, bool) : DIDescriptor(N) {}
210 /// Verify - Verify that a type descriptor is well formed.
213 explicit DIType(MDNode *N);
217 DIDescriptor getContext() const { return getDescriptorField(1); }
218 const char *getName() const { return getStringField(2); }
219 DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); }
220 unsigned getLineNumber() const { return getUnsignedField(4); }
221 uint64_t getSizeInBits() const { return getUInt64Field(5); }
222 uint64_t getAlignInBits() const { return getUInt64Field(6); }
223 // FIXME: Offset is only used for DW_TAG_member nodes. Making every type
224 // carry this is just plain insane.
225 uint64_t getOffsetInBits() const { return getUInt64Field(7); }
226 unsigned getFlags() const { return getUnsignedField(8); }
227 bool isPrivate() const {
228 return (getFlags() & FlagPrivate) != 0;
230 bool isProtected() const {
231 return (getFlags() & FlagProtected) != 0;
233 bool isForwardDecl() const {
234 return (getFlags() & FlagFwdDecl) != 0;
236 // isAppleBlock - Return true if this is the Apple Blocks extension.
237 bool isAppleBlockExtension() const {
238 return (getFlags() & FlagAppleBlock) != 0;
240 bool isBlockByrefStruct() const {
241 return (getFlags() & FlagBlockByrefStruct) != 0;
244 /// dump - print type.
248 /// DIBasicType - A basic type, like 'int' or 'float'.
249 class DIBasicType : public DIType {
251 explicit DIBasicType(MDNode *N = 0)
252 : DIType(N, dwarf::DW_TAG_base_type) {}
254 unsigned getEncoding() const { return getUnsignedField(9); }
256 /// dump - print basic type.
260 /// DIDerivedType - A simple derived type, like a const qualified type,
261 /// a typedef, a pointer or reference, etc.
262 class DIDerivedType : public DIType {
264 explicit DIDerivedType(MDNode *N, bool, bool)
265 : DIType(N, true, true) {}
267 explicit DIDerivedType(MDNode *N = 0)
268 : DIType(N, true, true) {
269 if (DbgNode && !isDerivedType())
273 DIType getTypeDerivedFrom() const { return getFieldAs<DIType>(9); }
275 /// getOriginalTypeSize - If this type is derived from a base type then
276 /// return base type size.
277 uint64_t getOriginalTypeSize() const;
278 /// dump - print derived type.
281 /// replaceAllUsesWith - Replace all uses of debug info referenced by
282 /// this descriptor. After this completes, the current debug info value
284 void replaceAllUsesWith(DIDescriptor &D);
287 /// DICompositeType - This descriptor holds a type that can refer to multiple
288 /// other types, like a function or struct.
289 /// FIXME: Why is this a DIDerivedType??
290 class DICompositeType : public DIDerivedType {
292 explicit DICompositeType(MDNode *N = 0)
293 : DIDerivedType(N, true, true) {
294 if (N && !isCompositeType())
298 DIArray getTypeArray() const { return getFieldAs<DIArray>(10); }
299 unsigned getRunTimeLang() const { return getUnsignedField(11); }
301 /// Verify - Verify that a composite type descriptor is well formed.
304 /// dump - print composite type.
308 /// DIGlobal - This is a common class for global variables and subprograms.
309 class DIGlobal : public DIDescriptor {
311 explicit DIGlobal(MDNode *N, unsigned RequiredTag)
312 : DIDescriptor(N, RequiredTag) {}
315 virtual ~DIGlobal() {}
317 DIDescriptor getContext() const { return getDescriptorField(2); }
318 const char *getName() const { return getStringField(3); }
319 const char *getDisplayName() const { return getStringField(4); }
320 const char *getLinkageName() const { return getStringField(5); }
321 DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(6); }
322 unsigned getLineNumber() const { return getUnsignedField(7); }
323 DIType getType() const { return getFieldAs<DIType>(8); }
325 /// isLocalToUnit - Return true if this subprogram is local to the current
326 /// compile unit, like 'static' in C.
327 unsigned isLocalToUnit() const { return getUnsignedField(9); }
328 unsigned isDefinition() const { return getUnsignedField(10); }
330 /// dump - print global.
334 /// DISubprogram - This is a wrapper for a subprogram (e.g. a function).
335 class DISubprogram : public DIScope {
337 explicit DISubprogram(MDNode *N = 0) : DIScope(N) {
338 if (DbgNode && !isSubprogram())
342 DIDescriptor getContext() const { return getDescriptorField(2); }
343 const char *getName() const { return getStringField(3); }
344 const char *getDisplayName() const { return getStringField(4); }
345 const char *getLinkageName() const { return getStringField(5); }
346 DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(6); }
347 unsigned getLineNumber() const { return getUnsignedField(7); }
348 DICompositeType getType() const { return getFieldAs<DICompositeType>(8); }
350 /// getReturnTypeName - Subprogram return types are encoded either as
351 /// DIType or as DICompositeType.
352 const char *getReturnTypeName() const {
353 DICompositeType DCT(getFieldAs<DICompositeType>(8));
355 DIArray A = DCT.getTypeArray();
356 DIType T(A.getElement(0).getNode());
359 DIType T(getFieldAs<DIType>(8));
363 /// isLocalToUnit - Return true if this subprogram is local to the current
364 /// compile unit, like 'static' in C.
365 unsigned isLocalToUnit() const { return getUnsignedField(9); }
366 unsigned isDefinition() const { return getUnsignedField(10); }
367 const char *getFilename() const { return getCompileUnit().getFilename();}
368 const char *getDirectory() const { return getCompileUnit().getDirectory();}
370 /// Verify - Verify that a subprogram descriptor is well formed.
373 /// dump - print subprogram.
376 /// describes - Return true if this subprogram provides debugging
377 /// information for the function F.
378 bool describes(const Function *F);
381 /// DIGlobalVariable - This is a wrapper for a global variable.
382 class DIGlobalVariable : public DIGlobal {
384 explicit DIGlobalVariable(MDNode *N = 0)
385 : DIGlobal(N, dwarf::DW_TAG_variable) {}
387 GlobalVariable *getGlobal() const { return getGlobalVariableField(11); }
389 /// Verify - Verify that a global variable descriptor is well formed.
392 /// dump - print global variable.
396 /// DIVariable - This is a wrapper for a variable (e.g. parameter, local,
398 class DIVariable : public DIDescriptor {
400 explicit DIVariable(MDNode *N = 0)
402 if (DbgNode && !isVariable())
406 DIDescriptor getContext() const { return getDescriptorField(1); }
407 const char *getName() const { return getStringField(2); }
408 DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); }
409 unsigned getLineNumber() const { return getUnsignedField(4); }
410 DIType getType() const { return getFieldAs<DIType>(5); }
413 /// Verify - Verify that a variable descriptor is well formed.
416 /// HasComplexAddr - Return true if the variable has a complex address.
417 bool hasComplexAddress() const {
418 return getNumAddrElements() > 0;
421 unsigned getNumAddrElements() const { return DbgNode->getNumElements()-6; }
423 uint64_t getAddrElement(unsigned Idx) const {
424 return getUInt64Field(Idx+6);
427 /// isBlockByrefVariable - Return true if the variable was declared as
428 /// a "__block" variable (Apple Blocks).
429 bool isBlockByrefVariable() const {
430 return getType().isBlockByrefStruct();
433 /// dump - print variable.
437 /// DILexicalBlock - This is a wrapper for a lexical block.
438 class DILexicalBlock : public DIScope {
440 explicit DILexicalBlock(MDNode *N = 0) : DIScope(N) {
441 if (DbgNode && !isLexicalBlock())
444 DIScope getContext() const { return getFieldAs<DIScope>(1); }
445 const char *getDirectory() const { return getContext().getDirectory(); }
446 const char *getFilename() const { return getContext().getFilename(); }
449 /// DILocation - This object holds location information. This object
450 /// is not associated with any DWARF tag.
451 class DILocation : public DIDescriptor {
453 explicit DILocation(MDNode *N) : DIDescriptor(N) { ; }
455 unsigned getLineNumber() const { return getUnsignedField(0); }
456 unsigned getColumnNumber() const { return getUnsignedField(1); }
457 DIScope getScope() const { return getFieldAs<DIScope>(2); }
458 DILocation getOrigLocation() const { return getFieldAs<DILocation>(3); }
459 const char *getFilename() const { return getScope().getFilename(); }
460 const char *getDirectory() const { return getScope().getDirectory(); }
463 /// DIFactory - This object assists with the construction of the various
467 LLVMContext& VMContext;
469 // Cached values for uniquing and faster lookups.
470 const Type *EmptyStructPtr; // "{}*".
471 Function *StopPointFn; // llvm.dbg.stoppoint
472 Function *FuncStartFn; // llvm.dbg.func.start
473 Function *RegionStartFn; // llvm.dbg.region.start
474 Function *RegionEndFn; // llvm.dbg.region.end
475 Function *DeclareFn; // llvm.dbg.declare
476 StringMap<Constant*> StringCache;
477 DenseMap<Constant*, DIDescriptor> SimpleConstantCache;
479 DIFactory(const DIFactory &); // DO NOT IMPLEMENT
480 void operator=(const DIFactory&); // DO NOT IMPLEMENT
482 enum ComplexAddrKind { OpPlus=1, OpDeref };
484 explicit DIFactory(Module &m);
486 /// GetOrCreateArray - Create an descriptor for an array of descriptors.
487 /// This implicitly uniques the arrays created.
488 DIArray GetOrCreateArray(DIDescriptor *Tys, unsigned NumTys);
490 /// GetOrCreateSubrange - Create a descriptor for a value range. This
491 /// implicitly uniques the values returned.
492 DISubrange GetOrCreateSubrange(int64_t Lo, int64_t Hi);
494 /// CreateCompileUnit - Create a new descriptor for the specified compile
496 DICompileUnit CreateCompileUnit(unsigned LangID,
501 bool isOptimized = false,
502 const char *Flags = "",
503 unsigned RunTimeVer = 0);
505 /// CreateEnumerator - Create a single enumerator value.
506 DIEnumerator CreateEnumerator(StringRef Name, uint64_t Val);
508 /// CreateBasicType - Create a basic type like int, float, etc.
509 DIBasicType CreateBasicType(DIDescriptor Context, StringRef Name,
510 DICompileUnit CompileUnit, unsigned LineNumber,
511 uint64_t SizeInBits, uint64_t AlignInBits,
512 uint64_t OffsetInBits, unsigned Flags,
515 /// CreateDerivedType - Create a derived type like const qualified type,
516 /// pointer, typedef, etc.
517 DIDerivedType CreateDerivedType(unsigned Tag, DIDescriptor Context,
519 DICompileUnit CompileUnit,
521 uint64_t SizeInBits, uint64_t AlignInBits,
522 uint64_t OffsetInBits, unsigned Flags,
525 /// CreateCompositeType - Create a composite type like array, struct, etc.
526 DICompositeType CreateCompositeType(unsigned Tag, DIDescriptor Context,
528 DICompileUnit CompileUnit,
531 uint64_t AlignInBits,
532 uint64_t OffsetInBits, unsigned Flags,
535 unsigned RunTimeLang = 0);
537 /// CreateSubprogram - Create a new descriptor for the specified subprogram.
538 /// See comments in DISubprogram for descriptions of these fields.
539 DISubprogram CreateSubprogram(DIDescriptor Context, StringRef Name,
540 StringRef DisplayName,
541 StringRef LinkageName,
542 DICompileUnit CompileUnit, unsigned LineNo,
543 DIType Type, bool isLocalToUnit,
546 /// CreateGlobalVariable - Create a new descriptor for the specified global.
548 CreateGlobalVariable(DIDescriptor Context, StringRef Name,
549 StringRef DisplayName,
550 StringRef LinkageName,
551 DICompileUnit CompileUnit,
552 unsigned LineNo, DIType Type, bool isLocalToUnit,
553 bool isDefinition, llvm::GlobalVariable *GV);
555 /// CreateVariable - Create a new descriptor for the specified variable.
556 DIVariable CreateVariable(unsigned Tag, DIDescriptor Context,
558 DICompileUnit CompileUnit, unsigned LineNo,
561 /// CreateComplexVariable - Create a new descriptor for the specified
562 /// variable which has a complex address expression for its address.
563 DIVariable CreateComplexVariable(unsigned Tag, DIDescriptor Context,
564 const std::string &Name,
565 DICompileUnit CompileUnit, unsigned LineNo,
567 SmallVector<Value *, 9> &addr);
569 /// CreateLexicalBlock - This creates a descriptor for a lexical block
570 /// with the specified parent context.
571 DILexicalBlock CreateLexicalBlock(DIDescriptor Context);
573 /// CreateLocation - Creates a debug info location.
574 DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo,
575 DIScope S, DILocation OrigLoc);
577 /// InsertStopPoint - Create a new llvm.dbg.stoppoint intrinsic invocation,
578 /// inserting it at the end of the specified basic block.
579 void InsertStopPoint(DICompileUnit CU, unsigned LineNo, unsigned ColNo,
582 /// InsertSubprogramStart - Create a new llvm.dbg.func.start intrinsic to
583 /// mark the start of the specified subprogram.
584 void InsertSubprogramStart(DISubprogram SP, BasicBlock *BB);
586 /// InsertRegionStart - Insert a new llvm.dbg.region.start intrinsic call to
587 /// mark the start of a region for the specified scoping descriptor.
588 void InsertRegionStart(DIDescriptor D, BasicBlock *BB);
590 /// InsertRegionEnd - Insert a new llvm.dbg.region.end intrinsic call to
591 /// mark the end of a region for the specified scoping descriptor.
592 void InsertRegionEnd(DIDescriptor D, BasicBlock *BB);
594 /// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
595 void InsertDeclare(llvm::Value *Storage, DIVariable D,
596 BasicBlock *InsertAtEnd);
598 /// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
599 void InsertDeclare(llvm::Value *Storage, DIVariable D,
600 Instruction *InsertBefore);
603 Constant *GetTagConstant(unsigned TAG);
606 /// Finds the stoppoint coressponding to this instruction, that is the
607 /// stoppoint that dominates this instruction
608 const DbgStopPointInst *findStopPoint(const Instruction *Inst);
610 /// Finds the stoppoint corresponding to first real (non-debug intrinsic)
611 /// instruction in this Basic Block, and returns the stoppoint for it.
612 const DbgStopPointInst *findBBStopPoint(const BasicBlock *BB);
614 /// Finds the dbg.declare intrinsic corresponding to this value if any.
615 /// It looks through pointer casts too.
616 const DbgDeclareInst *findDbgDeclare(const Value *V, bool stripCasts = true);
618 /// Find the debug info descriptor corresponding to this global variable.
619 Value *findDbgGlobalDeclare(GlobalVariable *V);
621 bool getLocationInfo(const Value *V, std::string &DisplayName,
622 std::string &Type, unsigned &LineNo, std::string &File,
625 /// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug
627 bool isValidDebugInfoIntrinsic(DbgStopPointInst &SPI,
628 CodeGenOpt::Level OptLev);
630 /// isValidDebugInfoIntrinsic - Return true if FSI is a valid debug
632 bool isValidDebugInfoIntrinsic(DbgFuncStartInst &FSI,
633 CodeGenOpt::Level OptLev);
635 /// isValidDebugInfoIntrinsic - Return true if RSI is a valid debug
637 bool isValidDebugInfoIntrinsic(DbgRegionStartInst &RSI,
638 CodeGenOpt::Level OptLev);
640 /// isValidDebugInfoIntrinsic - Return true if REI is a valid debug
642 bool isValidDebugInfoIntrinsic(DbgRegionEndInst &REI,
643 CodeGenOpt::Level OptLev);
645 /// isValidDebugInfoIntrinsic - Return true if DI is a valid debug
647 bool isValidDebugInfoIntrinsic(DbgDeclareInst &DI,
648 CodeGenOpt::Level OptLev);
650 /// ExtractDebugLocation - Extract debug location information
651 /// from llvm.dbg.stoppoint intrinsic.
652 DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI,
653 DebugLocTracker &DebugLocInfo);
655 /// ExtractDebugLocation - Extract debug location information
657 DebugLoc ExtractDebugLocation(DILocation &Loc,
658 DebugLocTracker &DebugLocInfo);
660 /// ExtractDebugLocation - Extract debug location information
661 /// from llvm.dbg.func_start intrinsic.
662 DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI,
663 DebugLocTracker &DebugLocInfo);
665 /// isInlinedFnStart - Return true if FSI is starting an inlined function.
666 bool isInlinedFnStart(DbgFuncStartInst &FSI, const Function *CurrentFn);
668 /// isInlinedFnEnd - Return true if REI is ending an inlined function.
669 bool isInlinedFnEnd(DbgRegionEndInst &REI, const Function *CurrentFn);
670 /// DebugInfoFinder - This object collects DebugInfo from a module.
671 class DebugInfoFinder {
674 /// processModule - Process entire module and collect debug info
676 void processModule(Module &M);
679 /// processType - Process DIType.
680 void processType(DIType DT);
682 /// processLexicalBlock - Process DILexicalBlock.
683 void processLexicalBlock(DILexicalBlock LB);
685 /// processSubprogram - Process DISubprogram.
686 void processSubprogram(DISubprogram SP);
688 /// processStopPoint - Process DbgStopPointInst.
689 void processStopPoint(DbgStopPointInst *SPI);
691 /// processFuncStart - Process DbgFuncStartInst.
692 void processFuncStart(DbgFuncStartInst *FSI);
694 /// processRegionStart - Process DbgRegionStart.
695 void processRegionStart(DbgRegionStartInst *DRS);
697 /// processRegionEnd - Process DbgRegionEnd.
698 void processRegionEnd(DbgRegionEndInst *DRE);
700 /// processDeclare - Process DbgDeclareInst.
701 void processDeclare(DbgDeclareInst *DDI);
703 /// addCompileUnit - Add compile unit into CUs.
704 bool addCompileUnit(DICompileUnit CU);
706 /// addGlobalVariable - Add global variable into GVs.
707 bool addGlobalVariable(DIGlobalVariable DIG);
709 // addSubprogram - Add subprgoram into SPs.
710 bool addSubprogram(DISubprogram SP);
712 /// addType - Add type into Tys.
713 bool addType(DIType DT);
716 typedef SmallVector<MDNode *, 8>::iterator iterator;
717 iterator compile_unit_begin() { return CUs.begin(); }
718 iterator compile_unit_end() { return CUs.end(); }
719 iterator subprogram_begin() { return SPs.begin(); }
720 iterator subprogram_end() { return SPs.end(); }
721 iterator global_variable_begin() { return GVs.begin(); }
722 iterator global_variable_end() { return GVs.end(); }
723 iterator type_begin() { return TYs.begin(); }
724 iterator type_end() { return TYs.end(); }
726 unsigned compile_unit_count() { return CUs.size(); }
727 unsigned global_variable_count() { return GVs.size(); }
728 unsigned subprogram_count() { return SPs.size(); }
729 unsigned type_count() { return TYs.size(); }
732 SmallVector<MDNode *, 8> CUs; // Compile Units
733 SmallVector<MDNode *, 8> SPs; // Subprograms
734 SmallVector<MDNode *, 8> GVs; // Global Variables;
735 SmallVector<MDNode *, 8> TYs; // Types
736 SmallPtrSet<MDNode *, 64> NodesSeen;
738 } // end namespace llvm