1 //===-- llvm/CodeGen/MachineDebugInfo.h -------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by James M. Laskey and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Collect debug information for a module. This information should be in a
11 // neutral form that can be used by different debugging schemes.
13 // The organization of information is primarily clustered around the source
14 // compile units. The main exception is source line correspondence where
15 // inlining may interleave code from various compile units.
17 // The following information can be retrieved from the MachineDebugInfo.
19 // -- Source directories - Directories are uniqued based on their canonical
20 // string and assigned a sequential numeric ID (base 1.)
21 // -- Source files - Files are also uniqued based on their name and directory
22 // ID. A file ID is sequential number (base 1.)
23 // -- Source line coorespondence - A vector of file ID, line#, column# triples.
24 // A DEBUG_LOCATION instruction is generated by the DAG Legalizer
25 // corresponding to each entry in the source line list. This allows a debug
26 // emitter to generate labels referenced by debug information tables.
28 //===----------------------------------------------------------------------===//
30 #ifndef LLVM_CODEGEN_MACHINEDEBUGINFO_H
31 #define LLVM_CODEGEN_MACHINEDEBUGINFO_H
33 #include "llvm/Support/Dwarf.h"
34 #include "llvm/Support/DataTypes.h"
35 #include "llvm/ADT/UniqueVector.h"
36 #include "llvm/GlobalValue.h"
37 #include "llvm/Pass.h"
38 #include "llvm/User.h"
45 //===----------------------------------------------------------------------===//
46 // Forward declarations.
54 //===----------------------------------------------------------------------===//
55 // Debug info constants.
58 LLVMDebugVersion = 1 // Current version of debug information.
61 //===----------------------------------------------------------------------===//
62 /// DIVisitor - Subclasses of this class apply steps to each of the fields in
63 /// the supplied DebugInfoDesc.
67 virtual ~DIVisitor() {}
69 /// ApplyToFields - Target the visitor to each field of the debug information
71 void ApplyToFields(DebugInfoDesc *DD);
73 /// Apply - Subclasses override each of these methods to perform the
74 /// appropriate action for the type of field.
75 virtual void Apply(int &Field) = 0;
76 virtual void Apply(unsigned &Field) = 0;
77 virtual void Apply(int64_t &Field) = 0;
78 virtual void Apply(uint64_t &Field) = 0;
79 virtual void Apply(bool &Field) = 0;
80 virtual void Apply(std::string &Field) = 0;
81 virtual void Apply(DebugInfoDesc *&Field) = 0;
82 virtual void Apply(GlobalVariable *&Field) = 0;
83 virtual void Apply(std::vector<DebugInfoDesc *> &Field) = 0;
86 //===----------------------------------------------------------------------===//
87 /// DebugInfoDesc - This class is the base class for debug info descriptors.
91 unsigned Tag; // Content indicator. Dwarf values are
92 // used but that does not limit use to
96 DebugInfoDesc(unsigned T) : Tag(T) {}
99 virtual ~DebugInfoDesc() {}
102 unsigned getTag() const { return Tag; }
104 /// TagFromGlobal - Returns the Tag number from a debug info descriptor
105 /// GlobalVariable. Return DIIValid if operand is not an unsigned int.
106 static unsigned TagFromGlobal(GlobalVariable *GV);
108 /// DescFactory - Create an instance of debug info descriptor based on Tag.
109 /// Return NULL if not a recognized Tag.
110 static DebugInfoDesc *DescFactory(unsigned Tag);
112 /// getLinkage - get linkage appropriate for this type of descriptor.
114 virtual GlobalValue::LinkageTypes getLinkage() const;
116 //===--------------------------------------------------------------------===//
117 // Subclasses should supply the following static methods.
119 // Implement isa/cast/dyncast.
120 static bool classof(const DebugInfoDesc *) { return true; }
122 //===--------------------------------------------------------------------===//
123 // Subclasses should supply the following virtual methods.
125 /// ApplyToFields - Target the vistor to the fields of the descriptor.
127 virtual void ApplyToFields(DIVisitor *Visitor);
129 /// getDescString - Return a string used to compose global names and labels.
131 virtual const char *getDescString() const = 0;
133 /// getTypeString - Return a string used to label this descriptor's type.
135 virtual const char *getTypeString() const = 0;
138 virtual void dump() = 0;
142 //===----------------------------------------------------------------------===//
143 /// AnchorDesc - Descriptors of this class act as markers for identifying
144 /// descriptors of certain groups.
145 class AnchorDesc : public DebugInfoDesc {
147 std::string Name; // Anchor type string.
151 AnchorDesc(const std::string &N);
154 const std::string &getName() const { return Name; }
156 // Implement isa/cast/dyncast.
157 static bool classof(const AnchorDesc *) { return true; }
158 static bool classof(const DebugInfoDesc *D);
160 /// getLinkage - get linkage appropriate for this type of descriptor.
162 virtual GlobalValue::LinkageTypes getLinkage() const;
164 /// ApplyToFields - Target the visitor to the fields of the AnchorDesc.
166 virtual void ApplyToFields(DIVisitor *Visitor);
168 /// getDescString - Return a string used to compose global names and labels.
170 virtual const char *getDescString() const;
172 /// getTypeString - Return a string used to label this descriptor's type.
174 virtual const char *getTypeString() const;
181 //===----------------------------------------------------------------------===//
182 /// AnchoredDesc - This class manages anchors for a variety of top level
184 class AnchoredDesc : public DebugInfoDesc {
186 AnchorDesc *Anchor; // Anchor for all descriptors of the
191 AnchoredDesc(unsigned T);
195 AnchorDesc *getAnchor() const { return Anchor; }
196 void setAnchor(AnchorDesc *A) { Anchor = A; }
198 //===--------------------------------------------------------------------===//
199 // Subclasses should supply the following virtual methods.
201 /// ApplyToFields - Target the visitor to the fields of the AnchoredDesc.
203 virtual void ApplyToFields(DIVisitor *Visitor);
206 //===----------------------------------------------------------------------===//
207 /// CompileUnitDesc - This class packages debug information associated with a
208 /// source/header file.
209 class CompileUnitDesc : public AnchoredDesc {
211 unsigned DebugVersion; // LLVM debug version when produced.
212 unsigned Language; // Language number (ex. DW_LANG_C89.)
213 std::string FileName; // Source file name.
214 std::string Directory; // Source file directory.
215 std::string Producer; // Compiler string.
221 unsigned getDebugVersion() const { return DebugVersion; }
222 unsigned getLanguage() const { return Language; }
223 const std::string &getFileName() const { return FileName; }
224 const std::string &getDirectory() const { return Directory; }
225 const std::string &getProducer() const { return Producer; }
226 void setLanguage(unsigned L) { Language = L; }
227 void setFileName(const std::string &FN) { FileName = FN; }
228 void setDirectory(const std::string &D) { Directory = D; }
229 void setProducer(const std::string &P) { Producer = P; }
231 // FIXME - Need translation unit getter/setter.
233 // Implement isa/cast/dyncast.
234 static bool classof(const CompileUnitDesc *) { return true; }
235 static bool classof(const DebugInfoDesc *D);
237 /// DebugVersionFromGlobal - Returns the version number from a compile unit
238 /// GlobalVariable. Return DIIValid if operand is not an unsigned int.
239 static unsigned DebugVersionFromGlobal(GlobalVariable *GV);
241 /// ApplyToFields - Target the visitor to the fields of the CompileUnitDesc.
243 virtual void ApplyToFields(DIVisitor *Visitor);
245 /// getDescString - Return a string used to compose global names and labels.
247 virtual const char *getDescString() const;
249 /// getTypeString - Return a string used to label this descriptor's type.
251 virtual const char *getTypeString() const;
253 /// getAnchorString - Return a string used to label this descriptor's anchor.
255 virtual const char *getAnchorString() const;
262 //===----------------------------------------------------------------------===//
263 /// TypeDesc - This class packages debug information associated with a type.
265 class TypeDesc : public DebugInfoDesc {
267 DebugInfoDesc *Context; // Context debug descriptor.
268 std::string Name; // Type name (may be empty.)
269 CompileUnitDesc *File; // Declared compile unit (may be NULL.)
270 int Line; // Declared line# (may be zero.)
271 uint64_t Size; // Type size (may be zero.)
274 TypeDesc(unsigned T);
278 DebugInfoDesc *getContext() const { return Context; }
279 const std::string &getName() const { return Name; }
280 CompileUnitDesc *getFile() const { return File; }
281 int getLine() const { return Line; }
282 uint64_t getSize() const { return Size; }
283 void setContext(DebugInfoDesc *C) { Context = C; }
284 void setName(const std::string &N) { Name = N; }
285 void setFile(CompileUnitDesc *U) { File = U; }
286 void setLine(int L) { Line = L; }
287 void setSize(uint64_t S) { Size = S; }
289 /// ApplyToFields - Target the visitor to the fields of the TypeDesc.
291 virtual void ApplyToFields(DIVisitor *Visitor);
293 /// getDescString - Return a string used to compose global names and labels.
295 virtual const char *getDescString() const;
297 /// getTypeString - Return a string used to label this descriptor's type.
299 virtual const char *getTypeString() const;
306 //===----------------------------------------------------------------------===//
307 /// BasicTypeDesc - This class packages debug information associated with a
308 /// basic type (eg. int, bool, double.)
309 class BasicTypeDesc : public TypeDesc {
311 unsigned Encoding; // Type encoding.
317 unsigned getEncoding() const { return Encoding; }
318 void setEncoding(unsigned E) { Encoding = E; }
320 // Implement isa/cast/dyncast.
321 static bool classof(const BasicTypeDesc *) { return true; }
322 static bool classof(const DebugInfoDesc *D);
324 /// ApplyToFields - Target the visitor to the fields of the BasicTypeDesc.
326 virtual void ApplyToFields(DIVisitor *Visitor);
328 /// getDescString - Return a string used to compose global names and labels.
330 virtual const char *getDescString() const;
332 /// getTypeString - Return a string used to label this descriptor's type.
334 virtual const char *getTypeString() const;
342 //===----------------------------------------------------------------------===//
343 /// DerivedTypeDesc - This class packages debug information associated with a
344 /// derived types (eg., typedef, pointer, reference.)
345 class DerivedTypeDesc : public TypeDesc {
347 TypeDesc *FromType; // Type derived from.
350 DerivedTypeDesc(unsigned T);
353 TypeDesc *getFromType() const { return FromType; }
354 void setFromType(TypeDesc *F) { FromType = F; }
356 // Implement isa/cast/dyncast.
357 static bool classof(const DerivedTypeDesc *) { return true; }
358 static bool classof(const DebugInfoDesc *D);
360 /// ApplyToFields - Target the visitor to the fields of the DerivedTypeDesc.
362 virtual void ApplyToFields(DIVisitor *Visitor);
364 /// getDescString - Return a string used to compose global names and labels.
366 virtual const char *getDescString() const;
368 /// getTypeString - Return a string used to label this descriptor's type.
370 virtual const char *getTypeString() const;
377 //===----------------------------------------------------------------------===//
378 /// CompositeTypeDesc - This class packages debug information associated with a
379 /// array/struct types (eg., arrays, struct, union, enums.)
380 class CompositeTypeDesc : public DerivedTypeDesc {
382 std::vector<DebugInfoDesc *> Elements;// Information used to compose type.
385 CompositeTypeDesc(unsigned T);
388 std::vector<DebugInfoDesc *> &getElements() { return Elements; }
390 // Implement isa/cast/dyncast.
391 static bool classof(const CompositeTypeDesc *) { return true; }
392 static bool classof(const DebugInfoDesc *D);
394 /// ApplyToFields - Target the visitor to the fields of the CompositeTypeDesc.
396 virtual void ApplyToFields(DIVisitor *Visitor);
398 /// getDescString - Return a string used to compose global names and labels.
400 virtual const char *getDescString() const;
402 /// getTypeString - Return a string used to label this descriptor's type.
404 virtual const char *getTypeString() const;
411 //===----------------------------------------------------------------------===//
412 /// SubrangeDesc - This class packages debug information associated with integer
414 class SubrangeDesc : public DebugInfoDesc {
416 int64_t Lo; // Low value of range
417 int64_t Hi; // High value of range
423 int64_t getLo() const { return Lo; }
424 int64_t getHi() const { return Hi; }
425 void setLo(int64_t L) { Lo = L; }
426 void setHi(int64_t H) { Hi = H; }
428 // Implement isa/cast/dyncast.
429 static bool classof(const SubrangeDesc *) { return true; }
430 static bool classof(const DebugInfoDesc *D);
432 /// ApplyToFields - Target the visitor to the fields of the SubrangeDesc.
434 virtual void ApplyToFields(DIVisitor *Visitor);
436 /// getDescString - Return a string used to compose global names and labels.
438 virtual const char *getDescString() const;
440 /// getTypeString - Return a string used to label this descriptor's type.
442 virtual const char *getTypeString() const;
449 //===----------------------------------------------------------------------===//
450 /// EnumeratorDesc - This class packages debug information associated with
451 /// named integer constants.
452 class EnumeratorDesc : public DebugInfoDesc {
454 std::string Name; // Enumerator name.
455 int64_t Value; // Enumerator value.
461 const std::string &getName() const { return Name; }
462 int64_t getValue() const { return Value; }
463 void setName(const std::string &N) { Name = N; }
464 void setValue(int64_t V) { Value = V; }
466 // Implement isa/cast/dyncast.
467 static bool classof(const EnumeratorDesc *) { return true; }
468 static bool classof(const DebugInfoDesc *D);
470 /// ApplyToFields - Target the visitor to the fields of the EnumeratorDesc.
472 virtual void ApplyToFields(DIVisitor *Visitor);
474 /// getDescString - Return a string used to compose global names and labels.
476 virtual const char *getDescString() const;
478 /// getTypeString - Return a string used to label this descriptor's type.
480 virtual const char *getTypeString() const;
487 //===----------------------------------------------------------------------===//
488 /// GlobalDesc - This class is the base descriptor for global functions and
490 class GlobalDesc : public AnchoredDesc {
492 DebugInfoDesc *Context; // Context debug descriptor.
493 std::string Name; // Global name.
494 TypeDesc *TyDesc; // Type debug descriptor.
495 bool IsStatic; // Is the global a static.
496 bool IsDefinition; // Is the global defined in context.
499 GlobalDesc(unsigned T);
503 DebugInfoDesc *getContext() const { return Context; }
504 const std::string &getName() const { return Name; }
505 TypeDesc *getTypeDesc() const { return TyDesc; }
506 bool isStatic() const { return IsStatic; }
507 bool isDefinition() const { return IsDefinition; }
508 void setContext(DebugInfoDesc *C) { Context = C; }
509 void setName(const std::string &N) { Name = N; }
510 void setTypeDesc(TypeDesc *T) { TyDesc = T; }
511 void setIsStatic(bool IS) { IsStatic = IS; }
512 void setIsDefinition(bool ID) { IsDefinition = ID; }
514 /// ApplyToFields - Target the visitor to the fields of the GlobalDesc.
516 virtual void ApplyToFields(DIVisitor *Visitor);
519 //===----------------------------------------------------------------------===//
520 /// GlobalVariableDesc - This class packages debug information associated with a
522 class GlobalVariableDesc : public GlobalDesc {
524 GlobalVariable *Global; // llvm global.
525 unsigned Line; // Source line number.
528 GlobalVariableDesc();
531 GlobalVariable *getGlobalVariable() const { return Global; }
532 unsigned getLine() const { return Line; }
533 void setGlobalVariable(GlobalVariable *GV) { Global = GV; }
534 void setLine(unsigned L) { Line = L; }
536 // Implement isa/cast/dyncast.
537 static bool classof(const GlobalVariableDesc *) { return true; }
538 static bool classof(const DebugInfoDesc *D);
540 /// ApplyToFields - Target the visitor to the fields of the
541 /// GlobalVariableDesc.
542 virtual void ApplyToFields(DIVisitor *Visitor);
544 /// getDescString - Return a string used to compose global names and labels.
546 virtual const char *getDescString() const;
548 /// getTypeString - Return a string used to label this descriptor's type.
550 virtual const char *getTypeString() const;
552 /// getAnchorString - Return a string used to label this descriptor's anchor.
554 virtual const char *getAnchorString() const;
561 //===----------------------------------------------------------------------===//
562 /// SubprogramDesc - This class packages debug information associated with a
563 /// subprogram/function.
564 class SubprogramDesc : public GlobalDesc {
566 // FIXME - Other attributes
572 // FIXME - Other getters/setters.
574 // Implement isa/cast/dyncast.
575 static bool classof(const SubprogramDesc *) { return true; }
576 static bool classof(const DebugInfoDesc *D);
578 /// ApplyToFields - Target the visitor to the fields of the SubprogramDesc.
580 virtual void ApplyToFields(DIVisitor *Visitor);
582 /// getDescString - Return a string used to compose global names and labels.
584 virtual const char *getDescString() const;
586 /// getTypeString - Return a string used to label this descriptor's type.
588 virtual const char *getTypeString() const;
590 /// getAnchorString - Return a string used to label this descriptor's anchor.
592 virtual const char *getAnchorString() const;
599 //===----------------------------------------------------------------------===//
600 /// DIDeserializer - This class is responsible for casting GlobalVariables
601 /// into DebugInfoDesc objects.
602 class DIDeserializer {
604 unsigned DebugVersion; // Version of debug information in use.
605 std::map<GlobalVariable *, DebugInfoDesc *> GlobalDescs;
606 // Previously defined gloabls.
609 DIDeserializer() : DebugVersion(LLVMDebugVersion) {}
613 unsigned getDebugVersion() const { return DebugVersion; }
615 /// Deserialize - Reconstitute a GlobalVariable into it's component
616 /// DebugInfoDesc objects.
617 DebugInfoDesc *Deserialize(Value *V);
618 DebugInfoDesc *Deserialize(GlobalVariable *GV);
621 //===----------------------------------------------------------------------===//
622 /// DISerializer - This class is responsible for casting DebugInfoDesc objects
623 /// into GlobalVariables.
626 Module *M; // Definition space module.
627 PointerType *StrPtrTy; // A "sbyte *" type. Created lazily.
628 PointerType *EmptyStructPtrTy; // A "{ }*" type. Created lazily.
629 std::map<unsigned, StructType *> TagTypes;
630 // Types per Tag. Created lazily.
631 std::map<DebugInfoDesc *, GlobalVariable *> DescGlobals;
632 // Previously defined descriptors.
633 std::map<const std::string, Constant *> StringCache;
634 // Previously defined strings.
640 , EmptyStructPtrTy(NULL)
648 Module *getModule() const { return M; };
649 void setModule(Module *module) { M = module; }
651 /// getStrPtrType - Return a "sbyte *" type.
653 const PointerType *getStrPtrType();
655 /// getEmptyStructPtrType - Return a "{ }*" type.
657 const PointerType *getEmptyStructPtrType();
659 /// getTagType - Return the type describing the specified descriptor (via
661 const StructType *getTagType(DebugInfoDesc *DD);
663 /// getString - Construct the string as constant string global.
665 Constant *getString(const std::string &String);
667 /// Serialize - Recursively cast the specified descriptor into a
668 /// GlobalVariable so that it can be serialized to a .bc or .ll file.
669 GlobalVariable *Serialize(DebugInfoDesc *DD);
672 //===----------------------------------------------------------------------===//
673 /// DIVerifier - This class is responsible for verifying the given network of
674 /// GlobalVariables are valid as DebugInfoDesc objects.
677 unsigned DebugVersion; // Version of debug information in use.
678 std::set<GlobalVariable *> Visited; // Tracks visits during recursion.
679 std::map<unsigned, unsigned> Counts; // Count of fields per Tag type.
681 /// markVisited - Return true if the GlobalVariable hase been "seen" before.
682 /// Mark markVisited otherwise.
683 bool markVisited(GlobalVariable *GV);
686 DIVerifier() : DebugVersion(LLVMDebugVersion) {}
689 /// Verify - Return true if the GlobalVariable appears to be a valid
690 /// serialization of a DebugInfoDesc.
691 bool Verify(Value *V);
692 bool Verify(GlobalVariable *GV);
695 //===----------------------------------------------------------------------===//
696 /// SourceLineInfo - This class is used to record source line correspondence.
698 class SourceLineInfo {
700 unsigned Line; // Source line number.
701 unsigned Column; // Source column.
702 unsigned SourceID; // Source ID number.
705 SourceLineInfo(unsigned L, unsigned C, unsigned S)
706 : Line(L), Column(C), SourceID(S) {}
709 unsigned getLine() const { return Line; }
710 unsigned getColumn() const { return Column; }
711 unsigned getSourceID() const { return SourceID; }
714 //===----------------------------------------------------------------------===//
715 /// SourceFileInfo - This class is used to track source information.
717 class SourceFileInfo {
719 unsigned DirectoryID; // Directory ID number.
720 std::string Name; // File name (not including directory.)
723 SourceFileInfo(unsigned D, const std::string &N) : DirectoryID(D), Name(N) {}
726 unsigned getDirectoryID() const { return DirectoryID; }
727 const std::string &getName() const { return Name; }
729 /// operator== - Used by UniqueVector to locate entry.
731 bool operator==(const SourceFileInfo &SI) const {
732 return getDirectoryID() == SI.getDirectoryID() && getName() == SI.getName();
735 /// operator< - Used by UniqueVector to locate entry.
737 bool operator<(const SourceFileInfo &SI) const {
738 return getDirectoryID() < SI.getDirectoryID() ||
739 (getDirectoryID() == SI.getDirectoryID() && getName() < SI.getName());
743 //===----------------------------------------------------------------------===//
744 /// MachineDebugInfo - This class contains debug information specific to a
745 /// module. Queries can be made by different debugging schemes and reformated
746 /// for specific use.
748 class MachineDebugInfo : public ImmutablePass {
750 // Use the same serializer/deserializer/verifier for the module.
753 // CompileUnits - Uniquing vector for compile units.
754 UniqueVector<CompileUnitDesc *> CompileUnits;
756 // Directories - Uniquing vector for directories.
757 UniqueVector<std::string> Directories;
759 // SourceFiles - Uniquing vector for source files.
760 UniqueVector<SourceFileInfo> SourceFiles;
762 // Lines - List of of source line correspondence.
763 std::vector<SourceLineInfo *> Lines;
769 /// doInitialization - Initialize the debug state for a new module.
771 bool doInitialization();
773 /// doFinalization - Tear down the debug state after completion of a module.
775 bool doFinalization();
777 /// getDescFor - Convert a Value to a debug information descriptor.
779 // FIXME - use new Value type when available.
780 DebugInfoDesc *getDescFor(Value *V);
782 /// Verify - Verify that a Value is debug information descriptor.
784 bool Verify(Value *V);
786 /// AnalyzeModule - Scan the module for global debug information.
788 void AnalyzeModule(Module &M);
790 /// hasInfo - Returns true if valid debug info is present.
792 bool hasInfo() const { return !CompileUnits.empty(); }
794 /// RecordLabel - Records location information and associates it with a
795 /// debug label. Returns a unique label ID used to generate a label and
796 /// provide correspondence to the source line list.
797 unsigned RecordLabel(unsigned Line, unsigned Column, unsigned Source) {
798 Lines.push_back(new SourceLineInfo(Line, Column, Source));
802 /// RecordSource - Register a source file with debug info. Returns an source
804 unsigned RecordSource(const std::string &Directory,
805 const std::string &Source) {
806 unsigned DirectoryID = Directories.insert(Directory);
807 return SourceFiles.insert(SourceFileInfo(DirectoryID, Source));
809 unsigned RecordSource(const CompileUnitDesc *CompileUnit) {
810 return RecordSource(CompileUnit->getDirectory(),
811 CompileUnit->getFileName());
814 /// getDirectories - Return the UniqueVector of std::string representing
816 const UniqueVector<std::string> &getDirectories() const {
820 /// getSourceFiles - Return the UniqueVector of source files.
822 const UniqueVector<SourceFileInfo> &getSourceFiles() const {
826 /// getSourceLines - Return a vector of source lines. Vector index + 1
828 const std::vector<SourceLineInfo *> &getSourceLines() const {
832 /// SetupCompileUnits - Set up the unique vector of compile units.
834 void SetupCompileUnits(Module &M);
836 /// getCompileUnits - Return a vector of debug compile units.
838 const UniqueVector<CompileUnitDesc *> getCompileUnits() const;
840 /// getGlobalVariablesUsing - Return all of the GlobalVariables that use the
841 /// named GlobalVariable.
842 std::vector<GlobalVariable*>
843 getGlobalVariablesUsing(Module &M, const std::string &RootName);
845 /// getAnchoredDescriptors - Return a vector of anchored debug descriptors.
847 template <class T>std::vector<T *> getAnchoredDescriptors(Module &M) {
849 std::vector<GlobalVariable *> Globals =
850 getGlobalVariablesUsing(M, Desc.getAnchorString());
851 std::vector<T *> AnchoredDescs;
852 for (unsigned i = 0, N = Globals.size(); i < N; ++i) {
853 GlobalVariable *GV = Globals[i];
854 // FIXME - Tag check only necessary for bring up (changed tag values.)
855 unsigned Tag = DebugInfoDesc::TagFromGlobal(GV);
856 if (Tag == Desc.getTag()) {
857 AnchoredDescs.push_back(cast<T>(DR.Deserialize(GV)));
861 return AnchoredDescs;
864 }; // End class MachineDebugInfo
866 } // End llvm namespace