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"
36 struct DbgStopPointInst;
37 struct DbgDeclareInst;
38 struct DbgFuncStartInst;
39 struct DbgRegionStartInst;
40 struct DbgRegionEndInst;
42 struct DebugLocTracker;
50 /// DIDescriptor constructor. If the specified node is non-null, check
51 /// to make sure that the tag in the descriptor matches 'RequiredTag'. If
52 /// not, the debug info is corrupt and we ignore it.
53 DIDescriptor(MDNode *N, unsigned RequiredTag);
55 const std::string &getStringField(unsigned Elt, std::string &Result) const;
56 unsigned getUnsignedField(unsigned Elt) const {
57 return (unsigned)getUInt64Field(Elt);
59 uint64_t getUInt64Field(unsigned Elt) const;
60 DIDescriptor getDescriptorField(unsigned Elt) const;
62 template <typename DescTy>
63 DescTy getFieldAs(unsigned Elt) const {
64 return DescTy(getDescriptorField(Elt).getNode());
67 GlobalVariable *getGlobalVariableField(unsigned Elt) const;
70 explicit DIDescriptor() : DbgNode(0) {}
71 explicit DIDescriptor(MDNode *N) : DbgNode(N) {}
73 bool isNull() const { return DbgNode == 0; }
75 MDNode *getNode() const { return DbgNode; }
77 unsigned getVersion() const {
78 return getUnsignedField(0) & LLVMDebugVersionMask;
81 unsigned getTag() const {
82 return getUnsignedField(0) & ~LLVMDebugVersionMask;
85 /// ValidDebugInfo - Return true if N represents valid debug info value.
86 static bool ValidDebugInfo(MDNode *N, CodeGenOpt::Level OptLevel);
88 /// dump - print descriptor.
91 bool isDerivedType() const;
92 bool isCompositeType() const;
93 bool isBasicType() const;
94 bool isVariable() const;
95 bool isSubprogram() const;
96 bool isGlobalVariable() const;
98 bool isCompileUnit() const;
99 bool isLexicalBlock() const;
102 /// DISubrange - This is used to represent ranges, for array bounds.
103 class DISubrange : public DIDescriptor {
105 explicit DISubrange(MDNode *N = 0)
106 : DIDescriptor(N, dwarf::DW_TAG_subrange_type) {}
108 int64_t getLo() const { return (int64_t)getUInt64Field(1); }
109 int64_t getHi() const { return (int64_t)getUInt64Field(2); }
112 /// DIArray - This descriptor holds an array of descriptors.
113 class DIArray : public DIDescriptor {
115 explicit DIArray(MDNode *N = 0)
118 unsigned getNumElements() const;
119 DIDescriptor getElement(unsigned Idx) const {
120 return getDescriptorField(Idx);
124 /// DIScope - A base class for various scopes.
125 class DIScope : public DIDescriptor {
127 explicit DIScope(MDNode *N = 0) : DIDescriptor (N) {
128 if (DbgNode && !isScope())
132 virtual const std::string &getFilename(std::string &F) const {
136 virtual const std::string &getDirectory(std::string &D) const {
141 /// DICompileUnit - A wrapper for a compile unit.
142 class DICompileUnit : public DIScope {
144 explicit DICompileUnit(MDNode *N = 0) {
146 if (DbgNode && !isCompileUnit())
150 unsigned getLanguage() const { return getUnsignedField(2); }
151 const std::string &getFilename(std::string &F) const {
152 return getStringField(3, F);
154 const std::string &getDirectory(std::string &F) const {
155 return getStringField(4, F);
157 const std::string &getProducer(std::string &F) const {
158 return getStringField(5, F);
161 /// isMain - Each input file is encoded as a separate compile unit in LLVM
162 /// debugging information output. However, many target specific tool chains
163 /// prefer to encode only one compile unit in an object file. In this
164 /// situation, the LLVM code generator will include debugging information
165 /// entities in the compile unit that is marked as main compile unit. The
166 /// code generator accepts maximum one main compile unit per module. If a
167 /// module does not contain any main compile unit then the code generator
168 /// will emit multiple compile units in the output object file.
170 bool isMain() const { return getUnsignedField(6); }
171 bool isOptimized() const { return getUnsignedField(7); }
172 const std::string &getFlags(std::string &F) const {
173 return getStringField(8, F);
175 unsigned getRunTimeVersion() const { return getUnsignedField(9); }
177 /// Verify - Verify that a compile unit is well formed.
180 /// dump - print compile unit.
184 /// DIEnumerator - A wrapper for an enumerator (e.g. X and Y in 'enum {X,Y}').
185 /// FIXME: it seems strange that this doesn't have either a reference to the
186 /// type/precision or a file/line pair for location info.
187 class DIEnumerator : public DIDescriptor {
189 explicit DIEnumerator(MDNode *N = 0)
190 : DIDescriptor(N, dwarf::DW_TAG_enumerator) {}
192 const std::string &getName(std::string &F) const {
193 return getStringField(1, F);
195 uint64_t getEnumValue() const { return getUInt64Field(2); }
198 /// DIType - This is a wrapper for a type.
199 /// FIXME: Types should be factored much better so that CV qualifiers and
200 /// others do not require a huge and empty descriptor full of zeros.
201 class DIType : public DIDescriptor {
204 FlagPrivate = 1 << 0,
205 FlagProtected = 1 << 1,
206 FlagFwdDecl = 1 << 2,
207 FlagAppleBlock = 1 << 3,
208 FlagBlockByrefStruct = 1 << 4
212 DIType(MDNode *N, unsigned Tag)
213 : DIDescriptor(N, Tag) {}
214 // This ctor is used when the Tag has already been validated by a derived
216 DIType(MDNode *N, bool, bool) : DIDescriptor(N) {}
220 /// Verify - Verify that a type descriptor is well formed.
223 explicit DIType(MDNode *N);
227 DIDescriptor getContext() const { return getDescriptorField(1); }
228 const std::string &getName(std::string &F) const {
229 return getStringField(2, F);
231 DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); }
232 unsigned getLineNumber() const { return getUnsignedField(4); }
233 uint64_t getSizeInBits() const { return getUInt64Field(5); }
234 uint64_t getAlignInBits() const { return getUInt64Field(6); }
235 // FIXME: Offset is only used for DW_TAG_member nodes. Making every type
236 // carry this is just plain insane.
237 uint64_t getOffsetInBits() const { return getUInt64Field(7); }
238 unsigned getFlags() const { return getUnsignedField(8); }
239 bool isPrivate() const {
240 return (getFlags() & FlagPrivate) != 0;
242 bool isProtected() const {
243 return (getFlags() & FlagProtected) != 0;
245 bool isForwardDecl() const {
246 return (getFlags() & FlagFwdDecl) != 0;
248 // isAppleBlock - Return true if this is the Apple Blocks extension.
249 bool isAppleBlockExtension() const {
250 return (getFlags() & FlagAppleBlock) != 0;
252 bool isBlockByrefStruct() const {
253 return (getFlags() & FlagBlockByrefStruct) != 0;
256 /// dump - print type.
260 /// DIBasicType - A basic type, like 'int' or 'float'.
261 class DIBasicType : public DIType {
263 explicit DIBasicType(MDNode *N = 0)
264 : DIType(N, dwarf::DW_TAG_base_type) {}
266 unsigned getEncoding() const { return getUnsignedField(9); }
268 /// dump - print basic type.
272 /// DIDerivedType - A simple derived type, like a const qualified type,
273 /// a typedef, a pointer or reference, etc.
274 class DIDerivedType : public DIType {
276 explicit DIDerivedType(MDNode *N, bool, bool)
277 : DIType(N, true, true) {}
279 explicit DIDerivedType(MDNode *N = 0)
280 : DIType(N, true, true) {
281 if (DbgNode && !isDerivedType())
285 DIType getTypeDerivedFrom() const { return getFieldAs<DIType>(9); }
287 /// getOriginalTypeSize - If this type is derived from a base type then
288 /// return base type size.
289 uint64_t getOriginalTypeSize() const;
290 /// dump - print derived type.
293 /// replaceAllUsesWith - Replace all uses of debug info referenced by
294 /// this descriptor. After this completes, the current debug info value
296 void replaceAllUsesWith(DIDescriptor &D);
299 /// DICompositeType - This descriptor holds a type that can refer to multiple
300 /// other types, like a function or struct.
301 /// FIXME: Why is this a DIDerivedType??
302 class DICompositeType : public DIDerivedType {
304 explicit DICompositeType(MDNode *N = 0)
305 : DIDerivedType(N, true, true) {
306 if (N && !isCompositeType())
310 DIArray getTypeArray() const { return getFieldAs<DIArray>(10); }
311 unsigned getRunTimeLang() const { return getUnsignedField(11); }
313 /// Verify - Verify that a composite type descriptor is well formed.
316 /// dump - print composite type.
320 /// DIGlobal - This is a common class for global variables and subprograms.
321 class DIGlobal : public DIDescriptor {
323 explicit DIGlobal(MDNode *N, unsigned RequiredTag)
324 : DIDescriptor(N, RequiredTag) {}
327 virtual ~DIGlobal() {}
329 DIDescriptor getContext() const { return getDescriptorField(2); }
330 const std::string &getName(std::string &F) const {
331 return getStringField(3, F);
333 const std::string &getDisplayName(std::string &F) const {
334 return getStringField(4, F);
336 const std::string &getLinkageName(std::string &F) const {
337 return getStringField(5, F);
339 DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(6); }
340 unsigned getLineNumber() const { return getUnsignedField(7); }
341 DIType getType() const { return getFieldAs<DIType>(8); }
343 /// isLocalToUnit - Return true if this subprogram is local to the current
344 /// compile unit, like 'static' in C.
345 unsigned isLocalToUnit() const { return getUnsignedField(9); }
346 unsigned isDefinition() const { return getUnsignedField(10); }
348 /// dump - print global.
352 /// DISubprogram - This is a wrapper for a subprogram (e.g. a function).
353 class DISubprogram : public DIScope {
355 explicit DISubprogram(MDNode *N = 0) {
357 if (DbgNode && !isSubprogram())
361 DIDescriptor getContext() const { return getDescriptorField(2); }
362 const std::string &getName(std::string &F) const {
363 return getStringField(3, F);
365 const std::string &getDisplayName(std::string &F) const {
366 return getStringField(4, F);
368 const std::string &getLinkageName(std::string &F) const {
369 return getStringField(5, F);
371 DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(6); }
372 unsigned getLineNumber() const { return getUnsignedField(7); }
373 DICompositeType getType() const { return getFieldAs<DICompositeType>(8); }
375 /// getReturnTypeName - Subprogram return types are encoded either as
376 /// DIType or as DICompositeType.
377 const std::string &getReturnTypeName(std::string &F) const {
378 DICompositeType DCT(getFieldAs<DICompositeType>(8));
380 DIArray A = DCT.getTypeArray();
381 DIType T(A.getElement(0).getNode());
384 DIType T(getFieldAs<DIType>(8));
388 /// isLocalToUnit - Return true if this subprogram is local to the current
389 /// compile unit, like 'static' in C.
390 unsigned isLocalToUnit() const { return getUnsignedField(9); }
391 unsigned isDefinition() const { return getUnsignedField(10); }
393 const std::string &getFilename(std::string &F) const {
394 return getCompileUnit().getFilename(F);
396 const std::string &getDirectory(std::string &F) const {
397 return getCompileUnit().getDirectory(F);
400 /// Verify - Verify that a subprogram descriptor is well formed.
403 /// dump - print subprogram.
406 /// describes - Return true if this subprogram provides debugging
407 /// information for the function F.
408 bool describes(const Function *F);
411 /// DIGlobalVariable - This is a wrapper for a global variable.
412 class DIGlobalVariable : public DIGlobal {
414 explicit DIGlobalVariable(MDNode *N = 0)
415 : DIGlobal(N, dwarf::DW_TAG_variable) {}
417 GlobalVariable *getGlobal() const { return getGlobalVariableField(11); }
419 /// Verify - Verify that a global variable descriptor is well formed.
422 /// dump - print global variable.
426 /// DIVariable - This is a wrapper for a variable (e.g. parameter, local,
428 class DIVariable : public DIDescriptor {
430 explicit DIVariable(MDNode *N = 0)
432 if (DbgNode && !isVariable())
436 DIDescriptor getContext() const { return getDescriptorField(1); }
437 const std::string &getName(std::string &F) const {
438 return getStringField(2, F);
440 DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); }
441 unsigned getLineNumber() const { return getUnsignedField(4); }
442 DIType getType() const { return getFieldAs<DIType>(5); }
445 /// Verify - Verify that a variable descriptor is well formed.
448 /// isBlockByrefVariable - Return true if the variable was declared as
449 /// a "__block" variable (Apple Blocks).
450 bool isBlockByrefVariable() const {
451 return getType().isBlockByrefStruct();
454 /// dump - print variable.
458 /// DILexicalBlock - This is a wrapper for a lexical block.
459 class DILexicalBlock : public DIScope {
461 explicit DILexicalBlock(MDNode *N = 0) {
463 if (DbgNode && !isLexicalBlock())
466 DIScope getContext() const { return getFieldAs<DIScope>(1); }
468 const std::string &getFilename(std::string &F) const {
469 return getContext().getFilename(F);
471 const std::string &getDirectory(std::string &D) const {
472 return getContext().getDirectory(D);
476 /// DILocation - This object holds location information. This object
477 /// is not associated with any DWARF tag.
478 class DILocation : public DIDescriptor {
480 explicit DILocation(MDNode *L) { DbgNode = L; }
482 unsigned getLineNumber() const { return getUnsignedField(0); }
483 unsigned getColumnNumber() const { return getUnsignedField(1); }
484 DIScope getScope() const { return getFieldAs<DIScope>(3); }
485 DILocation getOrigLocation() const { return getFieldAs<DILocation>(4); }
486 std::string getFilename(std::string &F) const {
487 return getScope().getFilename(F);
489 std::string getDirectory(std::string &D) const {
490 return getScope().getDirectory(D);
494 /// DIFactory - This object assists with the construction of the various
498 LLVMContext& VMContext;
500 // Cached values for uniquing and faster lookups.
501 const Type *EmptyStructPtr; // "{}*".
502 Function *StopPointFn; // llvm.dbg.stoppoint
503 Function *FuncStartFn; // llvm.dbg.func.start
504 Function *RegionStartFn; // llvm.dbg.region.start
505 Function *RegionEndFn; // llvm.dbg.region.end
506 Function *DeclareFn; // llvm.dbg.declare
507 StringMap<Constant*> StringCache;
508 DenseMap<Constant*, DIDescriptor> SimpleConstantCache;
510 DIFactory(const DIFactory &); // DO NOT IMPLEMENT
511 void operator=(const DIFactory&); // DO NOT IMPLEMENT
513 explicit DIFactory(Module &m);
515 /// GetOrCreateArray - Create an descriptor for an array of descriptors.
516 /// This implicitly uniques the arrays created.
517 DIArray GetOrCreateArray(DIDescriptor *Tys, unsigned NumTys);
519 /// GetOrCreateSubrange - Create a descriptor for a value range. This
520 /// implicitly uniques the values returned.
521 DISubrange GetOrCreateSubrange(int64_t Lo, int64_t Hi);
523 /// CreateCompileUnit - Create a new descriptor for the specified compile
525 DICompileUnit CreateCompileUnit(unsigned LangID,
526 const std::string &Filename,
527 const std::string &Directory,
528 const std::string &Producer,
530 bool isOptimized = false,
531 const char *Flags = "",
532 unsigned RunTimeVer = 0);
534 /// CreateEnumerator - Create a single enumerator value.
535 DIEnumerator CreateEnumerator(const std::string &Name, uint64_t Val);
537 /// CreateBasicType - Create a basic type like int, float, etc.
538 DIBasicType CreateBasicType(DIDescriptor Context, const std::string &Name,
539 DICompileUnit CompileUnit, unsigned LineNumber,
540 uint64_t SizeInBits, uint64_t AlignInBits,
541 uint64_t OffsetInBits, unsigned Flags,
544 /// CreateDerivedType - Create a derived type like const qualified type,
545 /// pointer, typedef, etc.
546 DIDerivedType CreateDerivedType(unsigned Tag, DIDescriptor Context,
547 const std::string &Name,
548 DICompileUnit CompileUnit,
550 uint64_t SizeInBits, uint64_t AlignInBits,
551 uint64_t OffsetInBits, unsigned Flags,
554 /// CreateCompositeType - Create a composite type like array, struct, etc.
555 DICompositeType CreateCompositeType(unsigned Tag, DIDescriptor Context,
556 const std::string &Name,
557 DICompileUnit CompileUnit,
560 uint64_t AlignInBits,
561 uint64_t OffsetInBits, unsigned Flags,
564 unsigned RunTimeLang = 0);
566 /// CreateSubprogram - Create a new descriptor for the specified subprogram.
567 /// See comments in DISubprogram for descriptions of these fields.
568 DISubprogram CreateSubprogram(DIDescriptor Context, const std::string &Name,
569 const std::string &DisplayName,
570 const std::string &LinkageName,
571 DICompileUnit CompileUnit, unsigned LineNo,
572 DIType Type, bool isLocalToUnit,
575 /// CreateGlobalVariable - Create a new descriptor for the specified global.
577 CreateGlobalVariable(DIDescriptor Context, const std::string &Name,
578 const std::string &DisplayName,
579 const std::string &LinkageName,
580 DICompileUnit CompileUnit,
581 unsigned LineNo, DIType Type, bool isLocalToUnit,
582 bool isDefinition, llvm::GlobalVariable *GV);
584 /// CreateVariable - Create a new descriptor for the specified variable.
585 DIVariable CreateVariable(unsigned Tag, DIDescriptor Context,
586 const std::string &Name,
587 DICompileUnit CompileUnit, unsigned LineNo,
590 /// CreateLexicalBlock - This creates a descriptor for a lexical block
591 /// with the specified parent context.
592 DILexicalBlock CreateLexicalBlock(DIDescriptor Context);
594 /// CreateLocation - Creates a debug info location.
595 DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo,
596 DIScope S, DILocation OrigLoc);
598 /// InsertStopPoint - Create a new llvm.dbg.stoppoint intrinsic invocation,
599 /// inserting it at the end of the specified basic block.
600 void InsertStopPoint(DICompileUnit CU, unsigned LineNo, unsigned ColNo,
603 /// InsertSubprogramStart - Create a new llvm.dbg.func.start intrinsic to
604 /// mark the start of the specified subprogram.
605 void InsertSubprogramStart(DISubprogram SP, BasicBlock *BB);
607 /// InsertRegionStart - Insert a new llvm.dbg.region.start intrinsic call to
608 /// mark the start of a region for the specified scoping descriptor.
609 void InsertRegionStart(DIDescriptor D, BasicBlock *BB);
611 /// InsertRegionEnd - Insert a new llvm.dbg.region.end intrinsic call to
612 /// mark the end of a region for the specified scoping descriptor.
613 void InsertRegionEnd(DIDescriptor D, BasicBlock *BB);
615 /// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
616 void InsertDeclare(llvm::Value *Storage, DIVariable D, BasicBlock *BB);
619 Constant *GetTagConstant(unsigned TAG);
622 /// Finds the stoppoint coressponding to this instruction, that is the
623 /// stoppoint that dominates this instruction
624 const DbgStopPointInst *findStopPoint(const Instruction *Inst);
626 /// Finds the stoppoint corresponding to first real (non-debug intrinsic)
627 /// instruction in this Basic Block, and returns the stoppoint for it.
628 const DbgStopPointInst *findBBStopPoint(const BasicBlock *BB);
630 /// Finds the dbg.declare intrinsic corresponding to this value if any.
631 /// It looks through pointer casts too.
632 const DbgDeclareInst *findDbgDeclare(const Value *V, bool stripCasts = true);
634 /// Find the debug info descriptor corresponding to this global variable.
635 Value *findDbgGlobalDeclare(GlobalVariable *V);
637 bool getLocationInfo(const Value *V, std::string &DisplayName,
638 std::string &Type, unsigned &LineNo, std::string &File,
641 /// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug
643 bool isValidDebugInfoIntrinsic(DbgStopPointInst &SPI,
644 CodeGenOpt::Level OptLev);
646 /// isValidDebugInfoIntrinsic - Return true if FSI is a valid debug
648 bool isValidDebugInfoIntrinsic(DbgFuncStartInst &FSI,
649 CodeGenOpt::Level OptLev);
651 /// isValidDebugInfoIntrinsic - Return true if RSI is a valid debug
653 bool isValidDebugInfoIntrinsic(DbgRegionStartInst &RSI,
654 CodeGenOpt::Level OptLev);
656 /// isValidDebugInfoIntrinsic - Return true if REI is a valid debug
658 bool isValidDebugInfoIntrinsic(DbgRegionEndInst &REI,
659 CodeGenOpt::Level OptLev);
661 /// isValidDebugInfoIntrinsic - Return true if DI is a valid debug
663 bool isValidDebugInfoIntrinsic(DbgDeclareInst &DI,
664 CodeGenOpt::Level OptLev);
666 /// ExtractDebugLocation - Extract debug location information
667 /// from llvm.dbg.stoppoint intrinsic.
668 DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI,
669 DebugLocTracker &DebugLocInfo);
671 /// ExtractDebugLocation - Extract debug location information
672 /// from llvm.dbg.func_start intrinsic.
673 DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI,
674 DebugLocTracker &DebugLocInfo);
676 /// isInlinedFnStart - Return true if FSI is starting an inlined function.
677 bool isInlinedFnStart(DbgFuncStartInst &FSI, const Function *CurrentFn);
679 /// isInlinedFnEnd - Return true if REI is ending an inlined function.
680 bool isInlinedFnEnd(DbgRegionEndInst &REI, const Function *CurrentFn);
681 /// DebugInfoFinder - This object collects DebugInfo from a module.
682 class DebugInfoFinder {
685 /// processModule - Process entire module and collect debug info
687 void processModule(Module &M);
690 /// processType - Process DIType.
691 void processType(DIType DT);
693 /// processSubprogram - Enumberate DISubprogram.
694 void processSubprogram(DISubprogram SP);
696 /// processStopPoint - Process DbgStopPointInst.
697 void processStopPoint(DbgStopPointInst *SPI);
699 /// processFuncStart - Process DbgFuncStartInst.
700 void processFuncStart(DbgFuncStartInst *FSI);
702 /// processRegionStart - Process DbgRegionStart.
703 void processRegionStart(DbgRegionStartInst *DRS);
705 /// processRegionEnd - Process DbgRegionEnd.
706 void processRegionEnd(DbgRegionEndInst *DRE);
708 /// processDeclare - Process DbgDeclareInst.
709 void processDeclare(DbgDeclareInst *DDI);
711 /// addCompileUnit - Add compile unit into CUs.
712 bool addCompileUnit(DICompileUnit CU);
714 /// addGlobalVariable - Add global variable into GVs.
715 bool addGlobalVariable(DIGlobalVariable DIG);
717 // addSubprogram - Add subprgoram into SPs.
718 bool addSubprogram(DISubprogram SP);
720 /// addType - Add type into Tys.
721 bool addType(DIType DT);
724 typedef SmallVector<MDNode *, 8>::iterator iterator;
725 iterator compile_unit_begin() { return CUs.begin(); }
726 iterator compile_unit_end() { return CUs.end(); }
727 iterator subprogram_begin() { return SPs.begin(); }
728 iterator subprogram_end() { return SPs.end(); }
729 iterator global_variable_begin() { return GVs.begin(); }
730 iterator global_variable_end() { return GVs.end(); }
731 iterator type_begin() { return TYs.begin(); }
732 iterator type_end() { return TYs.end(); }
734 unsigned compile_unit_count() { return CUs.size(); }
735 unsigned global_variable_count() { return GVs.size(); }
736 unsigned subprogram_count() { return SPs.size(); }
737 unsigned type_count() { return TYs.size(); }
740 SmallVector<MDNode *, 8> CUs; // Compile Units
741 SmallVector<MDNode *, 8> SPs; // Subprograms
742 SmallVector<MDNode *, 8> GVs; // Global Variables;
743 SmallVector<MDNode *, 8> TYs; // Types
744 SmallPtrSet<MDNode *, 64> NodesSeen;
746 } // end namespace llvm