llvm.org GIT mirror llvm / f4ec8bf
[Layering] Move DebugInfo.h into the IR library where its implementation already lives. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203046 91177308-0d34-0410-b5e6-96231b3b80d8 Chandler Carruth 6 years ago
57 changed file(s) with 955 addition(s) and 955 deletion(s). Raw diff Collapse all Expand all
+0
-900
include/llvm/DebugInfo.h less more
None //===--- llvm/Analysis/DebugInfo.h - Debug Information Helpers --*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines a bunch of datatypes that are useful for creating and
10 // walking debug info in LLVM IR form. They essentially provide wrappers around
11 // the information in the global variables that's needed when constructing the
12 // DWARF information.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_DEBUGINFO_H
17 #define LLVM_DEBUGINFO_H
18
19 #include "llvm/ADT/DenseMap.h"
20 #include "llvm/ADT/SmallPtrSet.h"
21 #include "llvm/ADT/SmallVector.h"
22 #include "llvm/ADT/StringRef.h"
23 #include "llvm/IR/Metadata.h"
24 #include "llvm/Support/Casting.h"
25 #include "llvm/Support/Dwarf.h"
26
27 namespace llvm {
28 class BasicBlock;
29 class Constant;
30 class Function;
31 class GlobalVariable;
32 class Module;
33 class Type;
34 class Value;
35 class DbgDeclareInst;
36 class DbgValueInst;
37 class Instruction;
38 class MDNode;
39 class MDString;
40 class NamedMDNode;
41 class LLVMContext;
42 class raw_ostream;
43
44 class DIFile;
45 class DISubprogram;
46 class DILexicalBlock;
47 class DILexicalBlockFile;
48 class DIVariable;
49 class DIType;
50 class DIScope;
51 class DIObjCProperty;
52
53 /// Maps from type identifier to the actual MDNode.
54 typedef DenseMap DITypeIdentifierMap;
55
56 /// DIDescriptor - A thin wraper around MDNode to access encoded debug info.
57 /// This should not be stored in a container, because the underlying MDNode
58 /// may change in certain situations.
59 class DIDescriptor {
60 // Befriends DIRef so DIRef can befriend the protected member
61 // function: getFieldAs.
62 template friend class DIRef;
63
64 public:
65 enum {
66 FlagPrivate = 1 << 0,
67 FlagProtected = 1 << 1,
68 FlagFwdDecl = 1 << 2,
69 FlagAppleBlock = 1 << 3,
70 FlagBlockByrefStruct = 1 << 4,
71 FlagVirtual = 1 << 5,
72 FlagArtificial = 1 << 6,
73 FlagExplicit = 1 << 7,
74 FlagPrototyped = 1 << 8,
75 FlagObjcClassComplete = 1 << 9,
76 FlagObjectPointer = 1 << 10,
77 FlagVector = 1 << 11,
78 FlagStaticMember = 1 << 12,
79 FlagIndirectVariable = 1 << 13,
80 FlagLValueReference = 1 << 14,
81 FlagRValueReference = 1 << 15
82 };
83
84 protected:
85 const MDNode *DbgNode;
86
87 StringRef getStringField(unsigned Elt) const;
88 unsigned getUnsignedField(unsigned Elt) const {
89 return (unsigned)getUInt64Field(Elt);
90 }
91 uint64_t getUInt64Field(unsigned Elt) const;
92 int64_t getInt64Field(unsigned Elt) const;
93 DIDescriptor getDescriptorField(unsigned Elt) const;
94
95 template DescTy getFieldAs(unsigned Elt) const {
96 return DescTy(getDescriptorField(Elt));
97 }
98
99 GlobalVariable *getGlobalVariableField(unsigned Elt) const;
100 Constant *getConstantField(unsigned Elt) const;
101 Function *getFunctionField(unsigned Elt) const;
102 void replaceFunctionField(unsigned Elt, Function *F);
103
104 public:
105 explicit DIDescriptor(const MDNode *N = 0) : DbgNode(N) {}
106
107 bool Verify() const;
108
109 operator MDNode *() const { return const_cast(DbgNode); }
110 MDNode *operator->() const { return const_cast(DbgNode); }
111
112 // An explicit operator bool so that we can do testing of DI values
113 // easily.
114 // FIXME: This operator bool isn't actually protecting anything at the
115 // moment due to the conversion operator above making DIDescriptor nodes
116 // implicitly convertable to bool.
117 LLVM_EXPLICIT operator bool() const { return DbgNode != 0; }
118
119 bool operator==(DIDescriptor Other) const { return DbgNode == Other.DbgNode; }
120 bool operator!=(DIDescriptor Other) const { return !operator==(Other); }
121
122 uint16_t getTag() const {
123 return getUnsignedField(0) & ~LLVMDebugVersionMask;
124 }
125
126 bool isDerivedType() const;
127 bool isCompositeType() const;
128 bool isBasicType() const;
129 bool isVariable() const;
130 bool isSubprogram() const;
131 bool isGlobalVariable() const;
132 bool isScope() const;
133 bool isFile() const;
134 bool isCompileUnit() const;
135 bool isNameSpace() const;
136 bool isLexicalBlockFile() const;
137 bool isLexicalBlock() const;
138 bool isSubrange() const;
139 bool isEnumerator() const;
140 bool isType() const;
141 bool isUnspecifiedParameter() const;
142 bool isTemplateTypeParameter() const;
143 bool isTemplateValueParameter() const;
144 bool isObjCProperty() const;
145 bool isImportedEntity() const;
146
147 /// print - print descriptor.
148 void print(raw_ostream &OS) const;
149
150 /// dump - print descriptor to dbgs() with a newline.
151 void dump() const;
152 };
153
154 /// DISubrange - This is used to represent ranges, for array bounds.
155 class DISubrange : public DIDescriptor {
156 friend class DIDescriptor;
157 void printInternal(raw_ostream &OS) const;
158
159 public:
160 explicit DISubrange(const MDNode *N = 0) : DIDescriptor(N) {}
161
162 int64_t getLo() const { return getInt64Field(1); }
163 int64_t getCount() const { return getInt64Field(2); }
164 bool Verify() const;
165 };
166
167 /// DIArray - This descriptor holds an array of descriptors.
168 class DIArray : public DIDescriptor {
169 public:
170 explicit DIArray(const MDNode *N = 0) : DIDescriptor(N) {}
171
172 unsigned getNumElements() const;
173 DIDescriptor getElement(unsigned Idx) const {
174 return getDescriptorField(Idx);
175 }
176 };
177
178 /// DIEnumerator - A wrapper for an enumerator (e.g. X and Y in 'enum {X,Y}').
179 /// FIXME: it seems strange that this doesn't have either a reference to the
180 /// type/precision or a file/line pair for location info.
181 class DIEnumerator : public DIDescriptor {
182 friend class DIDescriptor;
183 void printInternal(raw_ostream &OS) const;
184
185 public:
186 explicit DIEnumerator(const MDNode *N = 0) : DIDescriptor(N) {}
187
188 StringRef getName() const { return getStringField(1); }
189 int64_t getEnumValue() const { return getInt64Field(2); }
190 bool Verify() const;
191 };
192
193 template class DIRef;
194 typedef DIRef DIScopeRef;
195 typedef DIRef DITypeRef;
196
197 /// DIScope - A base class for various scopes.
198 class DIScope : public DIDescriptor {
199 protected:
200 friend class DIDescriptor;
201 void printInternal(raw_ostream &OS) const;
202
203 public:
204 explicit DIScope(const MDNode *N = 0) : DIDescriptor(N) {}
205
206 /// Gets the parent scope for this scope node or returns a
207 /// default constructed scope.
208 DIScopeRef getContext() const;
209 /// If the scope node has a name, return that, else return an empty string.
210 StringRef getName() const;
211 StringRef getFilename() const;
212 StringRef getDirectory() const;
213
214 /// Generate a reference to this DIScope. Uses the type identifier instead
215 /// of the actual MDNode if possible, to help type uniquing.
216 DIScopeRef getRef() const;
217 };
218
219 /// Represents reference to a DIDescriptor, abstracts over direct and
220 /// identifier-based metadata references.
221 template class DIRef {
222 template
223 friend DescTy DIDescriptor::getFieldAs(unsigned Elt) const;
224 friend DIScopeRef DIScope::getContext() const;
225 friend DIScopeRef DIScope::getRef() const;
226
227 /// Val can be either a MDNode or a MDString, in the latter,
228 /// MDString specifies the type identifier.
229 const Value *Val;
230 explicit DIRef(const Value *V);
231
232 public:
233 T resolve(const DITypeIdentifierMap &Map) const;
234 StringRef getName() const;
235 operator Value *() const { return const_cast(Val); }
236 };
237
238 template
239 T DIRef::resolve(const DITypeIdentifierMap &Map) const {
240 if (!Val)
241 return T();
242
243 if (const MDNode *MD = dyn_cast(Val))
244 return T(MD);
245
246 const MDString *MS = cast(Val);
247 // Find the corresponding MDNode.
248 DITypeIdentifierMap::const_iterator Iter = Map.find(MS);
249 assert(Iter != Map.end() && "Identifier not in the type map?");
250 assert(DIDescriptor(Iter->second).isType() &&
251 "MDNode in DITypeIdentifierMap should be a DIType.");
252 return T(Iter->second);
253 }
254
255 template StringRef DIRef::getName() const {
256 if (!Val)
257 return StringRef();
258
259 if (const MDNode *MD = dyn_cast(Val))
260 return T(MD).getName();
261
262 const MDString *MS = cast(Val);
263 return MS->getString();
264 }
265
266 /// Specialize getFieldAs to handle fields that are references to DIScopes.
267 template <> DIScopeRef DIDescriptor::getFieldAs(unsigned Elt) const;
268 /// Specialize DIRef constructor for DIScopeRef.
269 template <> DIRef::DIRef(const Value *V);
270
271 /// Specialize getFieldAs to handle fields that are references to DITypes.
272 template <> DITypeRef DIDescriptor::getFieldAs(unsigned Elt) const;
273 /// Specialize DIRef constructor for DITypeRef.
274 template <> DIRef::DIRef(const Value *V);
275
276 /// DIType - This is a wrapper for a type.
277 /// FIXME: Types should be factored much better so that CV qualifiers and
278 /// others do not require a huge and empty descriptor full of zeros.
279 class DIType : public DIScope {
280 protected:
281 friend class DIDescriptor;
282 void printInternal(raw_ostream &OS) const;
283
284 public:
285 explicit DIType(const MDNode *N = 0) : DIScope(N) {}
286
287 /// Verify - Verify that a type descriptor is well formed.
288 bool Verify() const;
289
290 DIScopeRef getContext() const { return getFieldAs(2); }
291 StringRef getName() const { return getStringField(3); }
292 unsigned getLineNumber() const { return getUnsignedField(4); }
293 uint64_t getSizeInBits() const { return getUInt64Field(5); }
294 uint64_t getAlignInBits() const { return getUInt64Field(6); }
295 // FIXME: Offset is only used for DW_TAG_member nodes. Making every type
296 // carry this is just plain insane.
297 uint64_t getOffsetInBits() const { return getUInt64Field(7); }
298 unsigned getFlags() const { return getUnsignedField(8); }
299 bool isPrivate() const { return (getFlags() & FlagPrivate) != 0; }
300 bool isProtected() const { return (getFlags() & FlagProtected) != 0; }
301 bool isForwardDecl() const { return (getFlags() & FlagFwdDecl) != 0; }
302 // isAppleBlock - Return true if this is the Apple Blocks extension.
303 bool isAppleBlockExtension() const {
304 return (getFlags() & FlagAppleBlock) != 0;
305 }
306 bool isBlockByrefStruct() const {
307 return (getFlags() & FlagBlockByrefStruct) != 0;
308 }
309 bool isVirtual() const { return (getFlags() & FlagVirtual) != 0; }
310 bool isArtificial() const { return (getFlags() & FlagArtificial) != 0; }
311 bool isObjectPointer() const { return (getFlags() & FlagObjectPointer) != 0; }
312 bool isObjcClassComplete() const {
313 return (getFlags() & FlagObjcClassComplete) != 0;
314 }
315 bool isVector() const { return (getFlags() & FlagVector) != 0; }
316 bool isStaticMember() const { return (getFlags() & FlagStaticMember) != 0; }
317 bool isLValueReference() const {
318 return (getFlags() & FlagLValueReference) != 0;
319 }
320 bool isRValueReference() const {
321 return (getFlags() & FlagRValueReference) != 0;
322 }
323 bool isValid() const { return DbgNode && isType(); }
324
325 /// replaceAllUsesWith - Replace all uses of debug info referenced by
326 /// this descriptor.
327 void replaceAllUsesWith(DIDescriptor &D);
328 void replaceAllUsesWith(MDNode *D);
329 };
330
331 /// DIBasicType - A basic type, like 'int' or 'float'.
332 class DIBasicType : public DIType {
333 public:
334 explicit DIBasicType(const MDNode *N = 0) : DIType(N) {}
335
336 unsigned getEncoding() const { return getUnsignedField(9); }
337
338 /// Verify - Verify that a basic type descriptor is well formed.
339 bool Verify() const;
340 };
341
342 /// DIDerivedType - A simple derived type, like a const qualified type,
343 /// a typedef, a pointer or reference, et cetera. Or, a data member of
344 /// a class/struct/union.
345 class DIDerivedType : public DIType {
346 friend class DIDescriptor;
347 void printInternal(raw_ostream &OS) const;
348
349 public:
350 explicit DIDerivedType(const MDNode *N = 0) : DIType(N) {}
351
352 DITypeRef getTypeDerivedFrom() const { return getFieldAs(9); }
353
354 /// getObjCProperty - Return property node, if this ivar is
355 /// associated with one.
356 MDNode *getObjCProperty() const;
357
358 DITypeRef getClassType() const {
359 assert(getTag() == dwarf::DW_TAG_ptr_to_member_type);
360 return getFieldAs(10);
361 }
362
363 Constant *getConstant() const {
364 assert((getTag() == dwarf::DW_TAG_member) && isStaticMember());
365 return getConstantField(10);
366 }
367
368 /// Verify - Verify that a derived type descriptor is well formed.
369 bool Verify() const;
370 };
371
372 /// DICompositeType - This descriptor holds a type that can refer to multiple
373 /// other types, like a function or struct.
374 /// DICompositeType is derived from DIDerivedType because some
375 /// composite types (such as enums) can be derived from basic types
376 // FIXME: Make this derive from DIType directly & just store the
377 // base type in a single DIType field.
378 class DICompositeType : public DIDerivedType {
379 friend class DIDescriptor;
380 void printInternal(raw_ostream &OS) const;
381
382 public:
383 explicit DICompositeType(const MDNode *N = 0) : DIDerivedType(N) {}
384
385 DIArray getTypeArray() const { return getFieldAs(10); }
386 void setTypeArray(DIArray Elements, DIArray TParams = DIArray());
387 unsigned getRunTimeLang() const { return getUnsignedField(11); }
388 DITypeRef getContainingType() const { return getFieldAs(12); }
389 void setContainingType(DICompositeType ContainingType);
390 DIArray getTemplateParams() const { return getFieldAs(13); }
391 MDString *getIdentifier() const;
392
393 /// Verify - Verify that a composite type descriptor is well formed.
394 bool Verify() const;
395 };
396
397 /// DIFile - This is a wrapper for a file.
398 class DIFile : public DIScope {
399 friend class DIDescriptor;
400
401 public:
402 explicit DIFile(const MDNode *N = 0) : DIScope(N) {}
403 MDNode *getFileNode() const;
404 bool Verify() const;
405 };
406
407 /// DICompileUnit - A wrapper for a compile unit.
408 class DICompileUnit : public DIScope {
409 friend class DIDescriptor;
410 void printInternal(raw_ostream &OS) const;
411
412 public:
413 explicit DICompileUnit(const MDNode *N = 0) : DIScope(N) {}
414
415 unsigned getLanguage() const { return getUnsignedField(2); }
416 StringRef getProducer() const { return getStringField(3); }
417
418 bool isOptimized() const { return getUnsignedField(4) != 0; }
419 StringRef getFlags() const { return getStringField(5); }
420 unsigned getRunTimeVersion() const { return getUnsignedField(6); }
421
422 DIArray getEnumTypes() const;
423 DIArray getRetainedTypes() const;
424 DIArray getSubprograms() const;
425 DIArray getGlobalVariables() const;
426 DIArray getImportedEntities() const;
427
428 StringRef getSplitDebugFilename() const { return getStringField(12); }
429 unsigned getEmissionKind() const { return getUnsignedField(13); }
430
431 /// Verify - Verify that a compile unit is well formed.
432 bool Verify() const;
433 };
434
435 /// DISubprogram - This is a wrapper for a subprogram (e.g. a function).
436 class DISubprogram : public DIScope {
437 friend class DIDescriptor;
438 void printInternal(raw_ostream &OS) const;
439
440 public:
441 explicit DISubprogram(const MDNode *N = 0) : DIScope(N) {}
442
443 DIScopeRef getContext() const { return getFieldAs(2); }
444 StringRef getName() const { return getStringField(3); }
445 StringRef getDisplayName() const { return getStringField(4); }
446 StringRef getLinkageName() const { return getStringField(5); }
447 unsigned getLineNumber() const { return getUnsignedField(6); }
448 DICompositeType getType() const { return getFieldAs(7); }
449
450 /// isLocalToUnit - Return true if this subprogram is local to the current
451 /// compile unit, like 'static' in C.
452 unsigned isLocalToUnit() const { return getUnsignedField(8); }
453 unsigned isDefinition() const { return getUnsignedField(9); }
454
455 unsigned getVirtuality() const { return getUnsignedField(10); }
456 unsigned getVirtualIndex() const { return getUnsignedField(11); }
457
458 DITypeRef getContainingType() const { return getFieldAs(12); }
459
460 unsigned getFlags() const { return getUnsignedField(13); }
461
462 unsigned isArtificial() const {
463 return (getUnsignedField(13) & FlagArtificial) != 0;
464 }
465 /// isPrivate - Return true if this subprogram has "private"
466 /// access specifier.
467 bool isPrivate() const { return (getUnsignedField(13) & FlagPrivate) != 0; }
468 /// isProtected - Return true if this subprogram has "protected"
469 /// access specifier.
470 bool isProtected() const {
471 return (getUnsignedField(13) & FlagProtected) != 0;
472 }
473 /// isExplicit - Return true if this subprogram is marked as explicit.
474 bool isExplicit() const { return (getUnsignedField(13) & FlagExplicit) != 0; }
475 /// isPrototyped - Return true if this subprogram is prototyped.
476 bool isPrototyped() const {
477 return (getUnsignedField(13) & FlagPrototyped) != 0;
478 }
479
480 /// Return true if this subprogram is a C++11 reference-qualified
481 /// non-static member function (void foo() &).
482 unsigned isLValueReference() const {
483 return (getUnsignedField(13) & FlagLValueReference) != 0;
484 }
485
486 /// Return true if this subprogram is a C++11
487 /// rvalue-reference-qualified non-static member function
488 /// (void foo() &&).
489 unsigned isRValueReference() const {
490 return (getUnsignedField(13) & FlagRValueReference) != 0;
491 }
492
493 unsigned isOptimized() const;
494
495 /// Verify - Verify that a subprogram descriptor is well formed.
496 bool Verify() const;
497
498 /// describes - Return true if this subprogram provides debugging
499 /// information for the function F.
500 bool describes(const Function *F);
501
502 Function *getFunction() const { return getFunctionField(15); }
503 void replaceFunction(Function *F) { replaceFunctionField(15, F); }
504 DIArray getTemplateParams() const { return getFieldAs(16); }
505 DISubprogram getFunctionDeclaration() const {
506 return getFieldAs(17);
507 }
508 MDNode *getVariablesNodes() const;
509 DIArray getVariables() const;
510
511 /// getScopeLineNumber - Get the beginning of the scope of the
512 /// function, not necessarily where the name of the program
513 /// starts.
514 unsigned getScopeLineNumber() const { return getUnsignedField(19); }
515 };
516
517 /// DILexicalBlock - This is a wrapper for a lexical block.
518 class DILexicalBlock : public DIScope {
519 public:
520 explicit DILexicalBlock(const MDNode *N = 0) : DIScope(N) {}
521 DIScope getContext() const { return getFieldAs(2); }
522 unsigned getLineNumber() const { return getUnsignedField(3); }
523 unsigned getColumnNumber() const { return getUnsignedField(4); }
524 unsigned getDiscriminator() const { return getUnsignedField(5); }
525 bool Verify() const;
526 };
527
528 /// DILexicalBlockFile - This is a wrapper for a lexical block with
529 /// a filename change.
530 class DILexicalBlockFile : public DIScope {
531 public:
532 explicit DILexicalBlockFile(const MDNode *N = 0) : DIScope(N) {}
533 DIScope getContext() const {
534 if (getScope().isSubprogram())
535 return getScope();
536 return getScope().getContext();
537 }
538 unsigned getLineNumber() const { return getScope().getLineNumber(); }
539 unsigned getColumnNumber() const { return getScope().getColumnNumber(); }
540 DILexicalBlock getScope() const { return getFieldAs(2); }
541 bool Verify() const;
542 };
543
544 /// DINameSpace - A wrapper for a C++ style name space.
545 class DINameSpace : public DIScope {
546 friend class DIDescriptor;
547 void printInternal(raw_ostream &OS) const;
548
549 public:
550 explicit DINameSpace(const MDNode *N = 0) : DIScope(N) {}
551 DIScope getContext() const { return getFieldAs(2); }
552 StringRef getName() const { return getStringField(3); }
553 unsigned getLineNumber() const { return getUnsignedField(4); }
554 bool Verify() const;
555 };
556
557 /// DIUnspecifiedParameter - This is a wrapper for unspecified parameters.
558 class DIUnspecifiedParameter : public DIDescriptor {
559 public:
560 explicit DIUnspecifiedParameter(const MDNode *N = 0) : DIDescriptor(N) {}
561 bool Verify() const;
562 };
563
564 /// DITemplateTypeParameter - This is a wrapper for template type parameter.
565 class DITemplateTypeParameter : public DIDescriptor {
566 public:
567 explicit DITemplateTypeParameter(const MDNode *N = 0) : DIDescriptor(N) {}
568
569 DIScopeRef getContext() const { return getFieldAs(1); }
570 StringRef getName() const { return getStringField(2); }
571 DITypeRef getType() const { return getFieldAs(3); }
572 StringRef getFilename() const { return getFieldAs(4).getFilename(); }
573 StringRef getDirectory() const {
574 return getFieldAs(4).getDirectory();
575 }
576 unsigned getLineNumber() const { return getUnsignedField(5); }
577 unsigned getColumnNumber() const { return getUnsignedField(6); }
578 bool Verify() const;
579 };
580
581 /// DITemplateValueParameter - This is a wrapper for template value parameter.
582 class DITemplateValueParameter : public DIDescriptor {
583 public:
584 explicit DITemplateValueParameter(const MDNode *N = 0) : DIDescriptor(N) {}
585
586 DIScopeRef getContext() const { return getFieldAs(1); }
587 StringRef getName() const { return getStringField(2); }
588 DITypeRef getType() const { return getFieldAs(3); }
589 Value *getValue() const;
590 StringRef getFilename() const { return getFieldAs(5).getFilename(); }
591 StringRef getDirectory() const {
592 return getFieldAs(5).getDirectory();
593 }
594 unsigned getLineNumber() const { return getUnsignedField(6); }
595 unsigned getColumnNumber() const { return getUnsignedField(7); }
596 bool Verify() const;
597 };
598
599 /// DIGlobalVariable - This is a wrapper for a global variable.
600 class DIGlobalVariable : public DIDescriptor {
601 friend class DIDescriptor;
602 void printInternal(raw_ostream &OS) const;
603
604 public:
605 explicit DIGlobalVariable(const MDNode *N = 0) : DIDescriptor(N) {}
606
607 DIScope getContext() const { return getFieldAs(2); }
608 StringRef getName() const { return getStringField(3); }
609 StringRef getDisplayName() const { return getStringField(4); }
610 StringRef getLinkageName() const { return getStringField(5); }
611 StringRef getFilename() const { return getFieldAs(6).getFilename(); }
612 StringRef getDirectory() const {
613 return getFieldAs(6).getDirectory();
614 }
615
616 unsigned getLineNumber() const { return getUnsignedField(7); }
617 DIType getType() const { return getFieldAs(8); }
618 unsigned isLocalToUnit() const { return getUnsignedField(9); }
619 unsigned isDefinition() const { return getUnsignedField(10); }
620
621 GlobalVariable *getGlobal() const { return getGlobalVariableField(11); }
622 Constant *getConstant() const { return getConstantField(11); }
623 DIDerivedType getStaticDataMemberDeclaration() const {
624 return getFieldAs(12);
625 }
626
627 /// Verify - Verify that a global variable descriptor is well formed.
628 bool Verify() const;
629 };
630
631 /// DIVariable - This is a wrapper for a variable (e.g. parameter, local,
632 /// global etc).
633 class DIVariable : public DIDescriptor {
634 friend class DIDescriptor;
635 void printInternal(raw_ostream &OS) const;
636
637 public:
638 explicit DIVariable(const MDNode *N = 0) : DIDescriptor(N) {}
639
640 DIScope getContext() const { return getFieldAs(1); }
641 StringRef getName() const { return getStringField(2); }
642 DIFile getFile() const { return getFieldAs(3); }
643 unsigned getLineNumber() const { return (getUnsignedField(4) << 8) >> 8; }
644 unsigned getArgNumber() const {
645 unsigned L = getUnsignedField(4);
646 return L >> 24;
647 }
648 DIType getType() const { return getFieldAs(5); }
649
650 /// isArtificial - Return true if this variable is marked as "artificial".
651 bool isArtificial() const {
652 return (getUnsignedField(6) & FlagArtificial) != 0;
653 }
654
655 bool isObjectPointer() const {
656 return (getUnsignedField(6) & FlagObjectPointer) != 0;
657 }
658
659 /// \brief Return true if this variable is represented as a pointer.
660 bool isIndirect() const {
661 return (getUnsignedField(6) & FlagIndirectVariable) != 0;
662 }
663
664 /// getInlinedAt - If this variable is inlined then return inline location.
665 MDNode *getInlinedAt() const;
666
667 /// Verify - Verify that a variable descriptor is well formed.
668 bool Verify() const;
669
670 /// HasComplexAddr - Return true if the variable has a complex address.
671 bool hasComplexAddress() const { return getNumAddrElements() > 0; }
672
673 unsigned getNumAddrElements() const;
674
675 uint64_t getAddrElement(unsigned Idx) const {
676 return getUInt64Field(Idx + 8);
677 }
678
679 /// isBlockByrefVariable - Return true if the variable was declared as
680 /// a "__block" variable (Apple Blocks).
681 bool isBlockByrefVariable() const { return getType().isBlockByrefStruct(); }
682
683 /// isInlinedFnArgument - Return true if this variable provides debugging
684 /// information for an inlined function arguments.
685 bool isInlinedFnArgument(const Function *CurFn);
686
687 void printExtendedName(raw_ostream &OS) const;
688 };
689
690 /// DILocation - This object holds location information. This object
691 /// is not associated with any DWARF tag.
692 class DILocation : public DIDescriptor {
693 public:
694 explicit DILocation(const MDNode *N) : DIDescriptor(N) {}
695
696 unsigned getLineNumber() const { return getUnsignedField(0); }
697 unsigned getColumnNumber() const { return getUnsignedField(1); }
698 DIScope getScope() const { return getFieldAs(2); }
699 DILocation getOrigLocation() const { return getFieldAs(3); }
700 StringRef getFilename() const { return getScope().getFilename(); }
701 StringRef getDirectory() const { return getScope().getDirectory(); }
702 bool Verify() const;
703 bool atSameLineAs(const DILocation &Other) const {
704 return (getLineNumber() == Other.getLineNumber() &&
705 getFilename() == Other.getFilename());
706 }
707 /// getDiscriminator - DWARF discriminators are used to distinguish
708 /// identical file locations for instructions that are on different
709 /// basic blocks. If two instructions are inside the same lexical block
710 /// and are in different basic blocks, we create a new lexical block
711 /// with identical location as the original but with a different
712 /// discriminator value (lib/Transforms/Util/AddDiscriminators.cpp
713 /// for details).
714 unsigned getDiscriminator() const {
715 // Since discriminators are associated with lexical blocks, make
716 // sure this location is a lexical block before retrieving its
717 // value.
718 return getScope().isLexicalBlock()
719 ? getFieldAs(2).getDiscriminator()
720 : 0;
721 }
722 unsigned computeNewDiscriminator(LLVMContext &Ctx);
723 DILocation copyWithNewScope(LLVMContext &Ctx, DILexicalBlock NewScope);
724 };
725
726 class DIObjCProperty : public DIDescriptor {
727 friend class DIDescriptor;
728 void printInternal(raw_ostream &OS) const;
729
730 public:
731 explicit DIObjCProperty(const MDNode *N) : DIDescriptor(N) {}
732
733 StringRef getObjCPropertyName() const { return getStringField(1); }
734 DIFile getFile() const { return getFieldAs(2); }
735 unsigned getLineNumber() const { return getUnsignedField(3); }
736
737 StringRef getObjCPropertyGetterName() const { return getStringField(4); }
738 StringRef getObjCPropertySetterName() const { return getStringField(5); }
739 bool isReadOnlyObjCProperty() const {
740 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_readonly) != 0;
741 }
742 bool isReadWriteObjCProperty() const {
743 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_readwrite) != 0;
744 }
745 bool isAssignObjCProperty() const {
746 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_assign) != 0;
747 }
748 bool isRetainObjCProperty() const {
749 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_retain) != 0;
750 }
751 bool isCopyObjCProperty() const {
752 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_copy) != 0;
753 }
754 bool isNonAtomicObjCProperty() const {
755 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_nonatomic) != 0;
756 }
757
758 DIType getType() const { return getFieldAs(7); }
759
760 /// Verify - Verify that a derived type descriptor is well formed.
761 bool Verify() const;
762 };
763
764 /// \brief An imported module (C++ using directive or similar).
765 class DIImportedEntity : public DIDescriptor {
766 friend class DIDescriptor;
767 void printInternal(raw_ostream &OS) const;
768
769 public:
770 explicit DIImportedEntity(const MDNode *N) : DIDescriptor(N) {}
771 DIScope getContext() const { return getFieldAs(1); }
772 DIDescriptor getEntity() const { return getFieldAs(2); }
773 unsigned getLineNumber() const { return getUnsignedField(3); }
774 StringRef getName() const { return getStringField(4); }
775 bool Verify() const;
776 };
777
778 /// getDISubprogram - Find subprogram that is enclosing this scope.
779 DISubprogram getDISubprogram(const MDNode *Scope);
780
781 /// getDICompositeType - Find underlying composite type.
782 DICompositeType getDICompositeType(DIType T);
783
784 /// getOrInsertFnSpecificMDNode - Return a NameMDNode that is suitable
785 /// to hold function specific information.
786 NamedMDNode *getOrInsertFnSpecificMDNode(Module &M, DISubprogram SP);
787
788 /// getFnSpecificMDNode - Return a NameMDNode, if available, that is
789 /// suitable to hold function specific information.
790 NamedMDNode *getFnSpecificMDNode(const Module &M, DISubprogram SP);
791
792 /// createInlinedVariable - Create a new inlined variable based on current
793 /// variable.
794 /// @param DV Current Variable.
795 /// @param InlinedScope Location at current variable is inlined.
796 DIVariable createInlinedVariable(MDNode *DV, MDNode *InlinedScope,
797 LLVMContext &VMContext);
798
799 /// cleanseInlinedVariable - Remove inlined scope from the variable.
800 DIVariable cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext);
801
802 /// Construct DITypeIdentifierMap by going through retained types of each CU.
803 DITypeIdentifierMap generateDITypeIdentifierMap(const NamedMDNode *CU_Nodes);
804
805 /// Strip debug info in the module if it exists.
806 /// To do this, we remove all calls to the debugger intrinsics and any named
807 /// metadata for debugging. We also remove debug locations for instructions.
808 /// Return true if module is modified.
809 bool StripDebugInfo(Module &M);
810
811 /// Return Debug Info Metadata Version by checking module flags.
812 unsigned getDebugMetadataVersionFromModule(const Module &M);
813
814 /// DebugInfoFinder tries to list all debug info MDNodes used in a module. To
815 /// list debug info MDNodes used by an instruction, DebugInfoFinder uses
816 /// processDeclare, processValue and processLocation to handle DbgDeclareInst,
817 /// DbgValueInst and DbgLoc attached to instructions. processModule will go
818 /// through all DICompileUnits in llvm.dbg.cu and list debug info MDNodes
819 /// used by the CUs.
820 class DebugInfoFinder {
821 public:
822 DebugInfoFinder() : TypeMapInitialized(false) {}
823
824 /// processModule - Process entire module and collect debug info
825 /// anchors.
826 void processModule(const Module &M);
827
828 /// processDeclare - Process DbgDeclareInst.
829 void processDeclare(const Module &M, const DbgDeclareInst *DDI);
830 /// Process DbgValueInst.
831 void processValue(const Module &M, const DbgValueInst *DVI);
832 /// processLocation - Process DILocation.
833 void processLocation(const Module &M, DILocation Loc);
834
835 /// Clear all lists.
836 void reset();
837
838 private:
839 /// Initialize TypeIdentifierMap.
840 void InitializeTypeMap(const Module &M);
841
842 /// processType - Process DIType.
843 void processType(DIType DT);
844
845 /// processLexicalBlock - Process DILexicalBlock.
846 void processLexicalBlock(DILexicalBlock LB);
847
848 /// processSubprogram - Process DISubprogram.
849 void processSubprogram(DISubprogram SP);
850
851 void processScope(DIScope Scope);
852
853 /// addCompileUnit - Add compile unit into CUs.
854 bool addCompileUnit(DICompileUnit CU);
855
856 /// addGlobalVariable - Add global variable into GVs.
857 bool addGlobalVariable(DIGlobalVariable DIG);
858
859 // addSubprogram - Add subprogram into SPs.
860 bool addSubprogram(DISubprogram SP);
861
862 /// addType - Add type into Tys.
863 bool addType(DIType DT);
864
865 bool addScope(DIScope Scope);
866
867 public:
868 typedef SmallVectorImpl::const_iterator iterator;
869 iterator compile_unit_begin() const { return CUs.begin(); }
870 iterator compile_unit_end() const { return CUs.end(); }
871 iterator subprogram_begin() const { return SPs.begin(); }
872 iterator subprogram_end() const { return SPs.end(); }
873 iterator global_variable_begin() const { return GVs.begin(); }
874 iterator global_variable_end() const { return GVs.end(); }
875 iterator type_begin() const { return TYs.begin(); }
876 iterator type_end() const { return TYs.end(); }
877 iterator scope_begin() const { return Scopes.begin(); }
878 iterator scope_end() const { return Scopes.end(); }
879
880 unsigned compile_unit_count() const { return CUs.size(); }
881 unsigned global_variable_count() const { return GVs.size(); }
882 unsigned subprogram_count() const { return SPs.size(); }
883 unsigned type_count() const { return TYs.size(); }
884 unsigned scope_count() const { return Scopes.size(); }
885
886 private:
887 SmallVector CUs; // Compile Units
888 SmallVector SPs; // Subprograms
889 SmallVector GVs; // Global Variables;
890 SmallVector TYs; // Types
891 SmallVector Scopes; // Scopes
892 SmallPtrSet NodesSeen;
893 DITypeIdentifierMap TypeIdentifierMap;
894 /// Specify if TypeIdentifierMap is initialized.
895 bool TypeMapInitialized;
896 };
897 } // end namespace llvm
898
899 #endif
1616
1717 #include "llvm/ADT/ArrayRef.h"
1818 #include "llvm/ADT/StringRef.h"
19 #include "llvm/DebugInfo.h"
19 #include "llvm/IR/DebugInfo.h"
2020 #include "llvm/IR/ValueHandle.h"
2121 #include "llvm/Support/DataTypes.h"
2222
0 //===- DebugInfo.h - Debug Information Helpers ------------------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines a bunch of datatypes that are useful for creating and
10 // walking debug info in LLVM IR form. They essentially provide wrappers around
11 // the information in the global variables that's needed when constructing the
12 // DWARF information.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_IR_DEBUGINFO_H
17 #define LLVM_IR_DEBUGINFO_H
18
19 #include "llvm/ADT/DenseMap.h"
20 #include "llvm/ADT/SmallPtrSet.h"
21 #include "llvm/ADT/SmallVector.h"
22 #include "llvm/ADT/StringRef.h"
23 #include "llvm/IR/Metadata.h"
24 #include "llvm/Support/Casting.h"
25 #include "llvm/Support/Dwarf.h"
26
27 namespace llvm {
28 class BasicBlock;
29 class Constant;
30 class Function;
31 class GlobalVariable;
32 class Module;
33 class Type;
34 class Value;
35 class DbgDeclareInst;
36 class DbgValueInst;
37 class Instruction;
38 class MDNode;
39 class MDString;
40 class NamedMDNode;
41 class LLVMContext;
42 class raw_ostream;
43
44 class DIFile;
45 class DISubprogram;
46 class DILexicalBlock;
47 class DILexicalBlockFile;
48 class DIVariable;
49 class DIType;
50 class DIScope;
51 class DIObjCProperty;
52
53 /// Maps from type identifier to the actual MDNode.
54 typedef DenseMap DITypeIdentifierMap;
55
56 /// DIDescriptor - A thin wraper around MDNode to access encoded debug info.
57 /// This should not be stored in a container, because the underlying MDNode
58 /// may change in certain situations.
59 class DIDescriptor {
60 // Befriends DIRef so DIRef can befriend the protected member
61 // function: getFieldAs.
62 template friend class DIRef;
63
64 public:
65 enum {
66 FlagPrivate = 1 << 0,
67 FlagProtected = 1 << 1,
68 FlagFwdDecl = 1 << 2,
69 FlagAppleBlock = 1 << 3,
70 FlagBlockByrefStruct = 1 << 4,
71 FlagVirtual = 1 << 5,
72 FlagArtificial = 1 << 6,
73 FlagExplicit = 1 << 7,
74 FlagPrototyped = 1 << 8,
75 FlagObjcClassComplete = 1 << 9,
76 FlagObjectPointer = 1 << 10,
77 FlagVector = 1 << 11,
78 FlagStaticMember = 1 << 12,
79 FlagIndirectVariable = 1 << 13,
80 FlagLValueReference = 1 << 14,
81 FlagRValueReference = 1 << 15
82 };
83
84 protected:
85 const MDNode *DbgNode;
86
87 StringRef getStringField(unsigned Elt) const;
88 unsigned getUnsignedField(unsigned Elt) const {
89 return (unsigned)getUInt64Field(Elt);
90 }
91 uint64_t getUInt64Field(unsigned Elt) const;
92 int64_t getInt64Field(unsigned Elt) const;
93 DIDescriptor getDescriptorField(unsigned Elt) const;
94
95 template DescTy getFieldAs(unsigned Elt) const {
96 return DescTy(getDescriptorField(Elt));
97 }
98
99 GlobalVariable *getGlobalVariableField(unsigned Elt) const;
100 Constant *getConstantField(unsigned Elt) const;
101 Function *getFunctionField(unsigned Elt) const;
102 void replaceFunctionField(unsigned Elt, Function *F);
103
104 public:
105 explicit DIDescriptor(const MDNode *N = 0) : DbgNode(N) {}
106
107 bool Verify() const;
108
109 operator MDNode *() const { return const_cast(DbgNode); }
110 MDNode *operator->() const { return const_cast(DbgNode); }
111
112 // An explicit operator bool so that we can do testing of DI values
113 // easily.
114 // FIXME: This operator bool isn't actually protecting anything at the
115 // moment due to the conversion operator above making DIDescriptor nodes
116 // implicitly convertable to bool.
117 LLVM_EXPLICIT operator bool() const { return DbgNode != 0; }
118
119 bool operator==(DIDescriptor Other) const { return DbgNode == Other.DbgNode; }
120 bool operator!=(DIDescriptor Other) const { return !operator==(Other); }
121
122 uint16_t getTag() const {
123 return getUnsignedField(0) & ~LLVMDebugVersionMask;
124 }
125
126 bool isDerivedType() const;
127 bool isCompositeType() const;
128 bool isBasicType() const;
129 bool isVariable() const;
130 bool isSubprogram() const;
131 bool isGlobalVariable() const;
132 bool isScope() const;
133 bool isFile() const;
134 bool isCompileUnit() const;
135 bool isNameSpace() const;
136 bool isLexicalBlockFile() const;
137 bool isLexicalBlock() const;
138 bool isSubrange() const;
139 bool isEnumerator() const;
140 bool isType() const;
141 bool isUnspecifiedParameter() const;
142 bool isTemplateTypeParameter() const;
143 bool isTemplateValueParameter() const;
144 bool isObjCProperty() const;
145 bool isImportedEntity() const;
146
147 /// print - print descriptor.
148 void print(raw_ostream &OS) const;
149
150 /// dump - print descriptor to dbgs() with a newline.
151 void dump() const;
152 };
153
154 /// DISubrange - This is used to represent ranges, for array bounds.
155 class DISubrange : public DIDescriptor {
156 friend class DIDescriptor;
157 void printInternal(raw_ostream &OS) const;
158
159 public:
160 explicit DISubrange(const MDNode *N = 0) : DIDescriptor(N) {}
161
162 int64_t getLo() const { return getInt64Field(1); }
163 int64_t getCount() const { return getInt64Field(2); }
164 bool Verify() const;
165 };
166
167 /// DIArray - This descriptor holds an array of descriptors.
168 class DIArray : public DIDescriptor {
169 public:
170 explicit DIArray(const MDNode *N = 0) : DIDescriptor(N) {}
171
172 unsigned getNumElements() const;
173 DIDescriptor getElement(unsigned Idx) const {
174 return getDescriptorField(Idx);
175 }
176 };
177
178 /// DIEnumerator - A wrapper for an enumerator (e.g. X and Y in 'enum {X,Y}').
179 /// FIXME: it seems strange that this doesn't have either a reference to the
180 /// type/precision or a file/line pair for location info.
181 class DIEnumerator : public DIDescriptor {
182 friend class DIDescriptor;
183 void printInternal(raw_ostream &OS) const;
184
185 public:
186 explicit DIEnumerator(const MDNode *N = 0) : DIDescriptor(N) {}
187
188 StringRef getName() const { return getStringField(1); }
189 int64_t getEnumValue() const { return getInt64Field(2); }
190 bool Verify() const;
191 };
192
193 template class DIRef;
194 typedef DIRef DIScopeRef;
195 typedef DIRef DITypeRef;
196
197 /// DIScope - A base class for various scopes.
198 class DIScope : public DIDescriptor {
199 protected:
200 friend class DIDescriptor;
201 void printInternal(raw_ostream &OS) const;
202
203 public:
204 explicit DIScope(const MDNode *N = 0) : DIDescriptor(N) {}
205
206 /// Gets the parent scope for this scope node or returns a
207 /// default constructed scope.
208 DIScopeRef getContext() const;
209 /// If the scope node has a name, return that, else return an empty string.
210 StringRef getName() const;
211 StringRef getFilename() const;
212 StringRef getDirectory() const;
213
214 /// Generate a reference to this DIScope. Uses the type identifier instead
215 /// of the actual MDNode if possible, to help type uniquing.
216 DIScopeRef getRef() const;
217 };
218
219 /// Represents reference to a DIDescriptor, abstracts over direct and
220 /// identifier-based metadata references.
221 template class DIRef {
222 template
223 friend DescTy DIDescriptor::getFieldAs(unsigned Elt) const;
224 friend DIScopeRef DIScope::getContext() const;
225 friend DIScopeRef DIScope::getRef() const;
226
227 /// Val can be either a MDNode or a MDString, in the latter,
228 /// MDString specifies the type identifier.
229 const Value *Val;
230 explicit DIRef(const Value *V);
231
232 public:
233 T resolve(const DITypeIdentifierMap &Map) const;
234 StringRef getName() const;
235 operator Value *() const { return const_cast(Val); }
236 };
237
238 template
239 T DIRef::resolve(const DITypeIdentifierMap &Map) const {
240 if (!Val)
241 return T();
242
243 if (const MDNode *MD = dyn_cast(Val))
244 return T(MD);
245
246 const MDString *MS = cast(Val);
247 // Find the corresponding MDNode.
248 DITypeIdentifierMap::const_iterator Iter = Map.find(MS);
249 assert(Iter != Map.end() && "Identifier not in the type map?");
250 assert(DIDescriptor(Iter->second).isType() &&
251 "MDNode in DITypeIdentifierMap should be a DIType.");
252 return T(Iter->second);
253 }
254
255 template StringRef DIRef::getName() const {
256 if (!Val)
257 return StringRef();
258
259 if (const MDNode *MD = dyn_cast(Val))
260 return T(MD).getName();
261
262 const MDString *MS = cast(Val);
263 return MS->getString();
264 }
265
266 /// Specialize getFieldAs to handle fields that are references to DIScopes.
267 template <> DIScopeRef DIDescriptor::getFieldAs(unsigned Elt) const;
268 /// Specialize DIRef constructor for DIScopeRef.
269 template <> DIRef::DIRef(const Value *V);
270
271 /// Specialize getFieldAs to handle fields that are references to DITypes.
272 template <> DITypeRef DIDescriptor::getFieldAs(unsigned Elt) const;
273 /// Specialize DIRef constructor for DITypeRef.
274 template <> DIRef::DIRef(const Value *V);
275
276 /// DIType - This is a wrapper for a type.
277 /// FIXME: Types should be factored much better so that CV qualifiers and
278 /// others do not require a huge and empty descriptor full of zeros.
279 class DIType : public DIScope {
280 protected:
281 friend class DIDescriptor;
282 void printInternal(raw_ostream &OS) const;
283
284 public:
285 explicit DIType(const MDNode *N = 0) : DIScope(N) {}
286
287 /// Verify - Verify that a type descriptor is well formed.
288 bool Verify() const;
289
290 DIScopeRef getContext() const { return getFieldAs(2); }
291 StringRef getName() const { return getStringField(3); }
292 unsigned getLineNumber() const { return getUnsignedField(4); }
293 uint64_t getSizeInBits() const { return getUInt64Field(5); }
294 uint64_t getAlignInBits() const { return getUInt64Field(6); }
295 // FIXME: Offset is only used for DW_TAG_member nodes. Making every type
296 // carry this is just plain insane.
297 uint64_t getOffsetInBits() const { return getUInt64Field(7); }
298 unsigned getFlags() const { return getUnsignedField(8); }
299 bool isPrivate() const { return (getFlags() & FlagPrivate) != 0; }
300 bool isProtected() const { return (getFlags() & FlagProtected) != 0; }
301 bool isForwardDecl() const { return (getFlags() & FlagFwdDecl) != 0; }
302 // isAppleBlock - Return true if this is the Apple Blocks extension.
303 bool isAppleBlockExtension() const {
304 return (getFlags() & FlagAppleBlock) != 0;
305 }
306 bool isBlockByrefStruct() const {
307 return (getFlags() & FlagBlockByrefStruct) != 0;
308 }
309 bool isVirtual() const { return (getFlags() & FlagVirtual) != 0; }
310 bool isArtificial() const { return (getFlags() & FlagArtificial) != 0; }
311 bool isObjectPointer() const { return (getFlags() & FlagObjectPointer) != 0; }
312 bool isObjcClassComplete() const {
313 return (getFlags() & FlagObjcClassComplete) != 0;
314 }
315 bool isVector() const { return (getFlags() & FlagVector) != 0; }
316 bool isStaticMember() const { return (getFlags() & FlagStaticMember) != 0; }
317 bool isLValueReference() const {
318 return (getFlags() & FlagLValueReference) != 0;
319 }
320 bool isRValueReference() const {
321 return (getFlags() & FlagRValueReference) != 0;
322 }
323 bool isValid() const { return DbgNode && isType(); }
324
325 /// replaceAllUsesWith - Replace all uses of debug info referenced by
326 /// this descriptor.
327 void replaceAllUsesWith(DIDescriptor &D);
328 void replaceAllUsesWith(MDNode *D);
329 };
330
331 /// DIBasicType - A basic type, like 'int' or 'float'.
332 class DIBasicType : public DIType {
333 public:
334 explicit DIBasicType(const MDNode *N = 0) : DIType(N) {}
335
336 unsigned getEncoding() const { return getUnsignedField(9); }
337
338 /// Verify - Verify that a basic type descriptor is well formed.
339 bool Verify() const;
340 };
341
342 /// DIDerivedType - A simple derived type, like a const qualified type,
343 /// a typedef, a pointer or reference, et cetera. Or, a data member of
344 /// a class/struct/union.
345 class DIDerivedType : public DIType {
346 friend class DIDescriptor;
347 void printInternal(raw_ostream &OS) const;
348
349 public:
350 explicit DIDerivedType(const MDNode *N = 0) : DIType(N) {}
351
352 DITypeRef getTypeDerivedFrom() const { return getFieldAs(9); }
353
354 /// getObjCProperty - Return property node, if this ivar is
355 /// associated with one.
356 MDNode *getObjCProperty() const;
357
358 DITypeRef getClassType() const {
359 assert(getTag() == dwarf::DW_TAG_ptr_to_member_type);
360 return getFieldAs(10);
361 }
362
363 Constant *getConstant() const {
364 assert((getTag() == dwarf::DW_TAG_member) && isStaticMember());
365 return getConstantField(10);
366 }
367
368 /// Verify - Verify that a derived type descriptor is well formed.
369 bool Verify() const;
370 };
371
372 /// DICompositeType - This descriptor holds a type that can refer to multiple
373 /// other types, like a function or struct.
374 /// DICompositeType is derived from DIDerivedType because some
375 /// composite types (such as enums) can be derived from basic types
376 // FIXME: Make this derive from DIType directly & just store the
377 // base type in a single DIType field.
378 class DICompositeType : public DIDerivedType {
379 friend class DIDescriptor;
380 void printInternal(raw_ostream &OS) const;
381
382 public:
383 explicit DICompositeType(const MDNode *N = 0) : DIDerivedType(N) {}
384
385 DIArray getTypeArray() const { return getFieldAs(10); }
386 void setTypeArray(DIArray Elements, DIArray TParams = DIArray());
387 unsigned getRunTimeLang() const { return getUnsignedField(11); }
388 DITypeRef getContainingType() const { return getFieldAs(12); }
389 void setContainingType(DICompositeType ContainingType);
390 DIArray getTemplateParams() const { return getFieldAs(13); }
391 MDString *getIdentifier() const;
392
393 /// Verify - Verify that a composite type descriptor is well formed.
394 bool Verify() const;
395 };
396
397 /// DIFile - This is a wrapper for a file.
398 class DIFile : public DIScope {
399 friend class DIDescriptor;
400
401 public:
402 explicit DIFile(const MDNode *N = 0) : DIScope(N) {}
403 MDNode *getFileNode() const;
404 bool Verify() const;
405 };
406
407 /// DICompileUnit - A wrapper for a compile unit.
408 class DICompileUnit : public DIScope {
409 friend class DIDescriptor;
410 void printInternal(raw_ostream &OS) const;
411
412 public:
413 explicit DICompileUnit(const MDNode *N = 0) : DIScope(N) {}
414
415 unsigned getLanguage() const { return getUnsignedField(2); }
416 StringRef getProducer() const { return getStringField(3); }
417
418 bool isOptimized() const { return getUnsignedField(4) != 0; }
419 StringRef getFlags() const { return getStringField(5); }
420 unsigned getRunTimeVersion() const { return getUnsignedField(6); }
421
422 DIArray getEnumTypes() const;
423 DIArray getRetainedTypes() const;
424 DIArray getSubprograms() const;
425 DIArray getGlobalVariables() const;
426 DIArray getImportedEntities() const;
427
428 StringRef getSplitDebugFilename() const { return getStringField(12); }
429 unsigned getEmissionKind() const { return getUnsignedField(13); }
430
431 /// Verify - Verify that a compile unit is well formed.
432 bool Verify() const;
433 };
434
435 /// DISubprogram - This is a wrapper for a subprogram (e.g. a function).
436 class DISubprogram : public DIScope {
437 friend class DIDescriptor;
438 void printInternal(raw_ostream &OS) const;
439
440 public:
441 explicit DISubprogram(const MDNode *N = 0) : DIScope(N) {}
442
443 DIScopeRef getContext() const { return getFieldAs(2); }
444 StringRef getName() const { return getStringField(3); }
445 StringRef getDisplayName() const { return getStringField(4); }
446 StringRef getLinkageName() const { return getStringField(5); }
447 unsigned getLineNumber() const { return getUnsignedField(6); }
448 DICompositeType getType() const { return getFieldAs(7); }
449
450 /// isLocalToUnit - Return true if this subprogram is local to the current
451 /// compile unit, like 'static' in C.
452 unsigned isLocalToUnit() const { return getUnsignedField(8); }
453 unsigned isDefinition() const { return getUnsignedField(9); }
454
455 unsigned getVirtuality() const { return getUnsignedField(10); }
456 unsigned getVirtualIndex() const { return getUnsignedField(11); }
457
458 DITypeRef getContainingType() const { return getFieldAs(12); }
459
460 unsigned getFlags() const { return getUnsignedField(13); }
461
462 unsigned isArtificial() const {
463 return (getUnsignedField(13) & FlagArtificial) != 0;
464 }
465 /// isPrivate - Return true if this subprogram has "private"
466 /// access specifier.
467 bool isPrivate() const { return (getUnsignedField(13) & FlagPrivate) != 0; }
468 /// isProtected - Return true if this subprogram has "protected"
469 /// access specifier.
470 bool isProtected() const {
471 return (getUnsignedField(13) & FlagProtected) != 0;
472 }
473 /// isExplicit - Return true if this subprogram is marked as explicit.
474 bool isExplicit() const { return (getUnsignedField(13) & FlagExplicit) != 0; }
475 /// isPrototyped - Return true if this subprogram is prototyped.
476 bool isPrototyped() const {
477 return (getUnsignedField(13) & FlagPrototyped) != 0;
478 }
479
480 /// Return true if this subprogram is a C++11 reference-qualified
481 /// non-static member function (void foo() &).
482 unsigned isLValueReference() const {
483 return (getUnsignedField(13) & FlagLValueReference) != 0;
484 }
485
486 /// Return true if this subprogram is a C++11
487 /// rvalue-reference-qualified non-static member function
488 /// (void foo() &&).
489 unsigned isRValueReference() const {
490 return (getUnsignedField(13) & FlagRValueReference) != 0;
491 }
492
493 unsigned isOptimized() const;
494
495 /// Verify - Verify that a subprogram descriptor is well formed.
496 bool Verify() const;
497
498 /// describes - Return true if this subprogram provides debugging
499 /// information for the function F.
500 bool describes(const Function *F);
501
502 Function *getFunction() const { return getFunctionField(15); }
503 void replaceFunction(Function *F) { replaceFunctionField(15, F); }
504 DIArray getTemplateParams() const { return getFieldAs(16); }
505 DISubprogram getFunctionDeclaration() const {
506 return getFieldAs(17);
507 }
508 MDNode *getVariablesNodes() const;
509 DIArray getVariables() const;
510
511 /// getScopeLineNumber - Get the beginning of the scope of the
512 /// function, not necessarily where the name of the program
513 /// starts.
514 unsigned getScopeLineNumber() const { return getUnsignedField(19); }
515 };
516
517 /// DILexicalBlock - This is a wrapper for a lexical block.
518 class DILexicalBlock : public DIScope {
519 public:
520 explicit DILexicalBlock(const MDNode *N = 0) : DIScope(N) {}
521 DIScope getContext() const { return getFieldAs(2); }
522 unsigned getLineNumber() const { return getUnsignedField(3); }
523 unsigned getColumnNumber() const { return getUnsignedField(4); }
524 unsigned getDiscriminator() const { return getUnsignedField(5); }
525 bool Verify() const;
526 };
527
528 /// DILexicalBlockFile - This is a wrapper for a lexical block with
529 /// a filename change.
530 class DILexicalBlockFile : public DIScope {
531 public:
532 explicit DILexicalBlockFile(const MDNode *N = 0) : DIScope(N) {}
533 DIScope getContext() const {
534 if (getScope().isSubprogram())
535 return getScope();
536 return getScope().getContext();
537 }
538 unsigned getLineNumber() const { return getScope().getLineNumber(); }
539 unsigned getColumnNumber() const { return getScope().getColumnNumber(); }
540 DILexicalBlock getScope() const { return getFieldAs(2); }
541 bool Verify() const;
542 };
543
544 /// DINameSpace - A wrapper for a C++ style name space.
545 class DINameSpace : public DIScope {
546 friend class DIDescriptor;
547 void printInternal(raw_ostream &OS) const;
548
549 public:
550 explicit DINameSpace(const MDNode *N = 0) : DIScope(N) {}
551 DIScope getContext() const { return getFieldAs(2); }
552 StringRef getName() const { return getStringField(3); }
553 unsigned getLineNumber() const { return getUnsignedField(4); }
554 bool Verify() const;
555 };
556
557 /// DIUnspecifiedParameter - This is a wrapper for unspecified parameters.
558 class DIUnspecifiedParameter : public DIDescriptor {
559 public:
560 explicit DIUnspecifiedParameter(const MDNode *N = 0) : DIDescriptor(N) {}
561 bool Verify() const;
562 };
563
564 /// DITemplateTypeParameter - This is a wrapper for template type parameter.
565 class DITemplateTypeParameter : public DIDescriptor {
566 public:
567 explicit DITemplateTypeParameter(const MDNode *N = 0) : DIDescriptor(N) {}
568
569 DIScopeRef getContext() const { return getFieldAs(1); }
570 StringRef getName() const { return getStringField(2); }
571 DITypeRef getType() const { return getFieldAs(3); }
572 StringRef getFilename() const { return getFieldAs(4).getFilename(); }
573 StringRef getDirectory() const {
574 return getFieldAs(4).getDirectory();
575 }
576 unsigned getLineNumber() const { return getUnsignedField(5); }
577 unsigned getColumnNumber() const { return getUnsignedField(6); }
578 bool Verify() const;
579 };
580
581 /// DITemplateValueParameter - This is a wrapper for template value parameter.
582 class DITemplateValueParameter : public DIDescriptor {
583 public:
584 explicit DITemplateValueParameter(const MDNode *N = 0) : DIDescriptor(N) {}
585
586 DIScopeRef getContext() const { return getFieldAs(1); }
587 StringRef getName() const { return getStringField(2); }
588 DITypeRef getType() const { return getFieldAs(3); }
589 Value *getValue() const;
590 StringRef getFilename() const { return getFieldAs(5).getFilename(); }
591 StringRef getDirectory() const {
592 return getFieldAs(5).getDirectory();
593 }
594 unsigned getLineNumber() const { return getUnsignedField(6); }
595 unsigned getColumnNumber() const { return getUnsignedField(7); }
596 bool Verify() const;
597 };
598
599 /// DIGlobalVariable - This is a wrapper for a global variable.
600 class DIGlobalVariable : public DIDescriptor {
601 friend class DIDescriptor;
602 void printInternal(raw_ostream &OS) const;
603
604 public:
605 explicit DIGlobalVariable(const MDNode *N = 0) : DIDescriptor(N) {}
606
607 DIScope getContext() const { return getFieldAs(2); }
608 StringRef getName() const { return getStringField(3); }
609 StringRef getDisplayName() const { return getStringField(4); }
610 StringRef getLinkageName() const { return getStringField(5); }
611 StringRef getFilename() const { return getFieldAs(6).getFilename(); }
612 StringRef getDirectory() const {
613 return getFieldAs(6).getDirectory();
614 }
615
616 unsigned getLineNumber() const { return getUnsignedField(7); }
617 DIType getType() const { return getFieldAs(8); }
618 unsigned isLocalToUnit() const { return getUnsignedField(9); }
619 unsigned isDefinition() const { return getUnsignedField(10); }
620
621 GlobalVariable *getGlobal() const { return getGlobalVariableField(11); }
622 Constant *getConstant() const { return getConstantField(11); }
623 DIDerivedType getStaticDataMemberDeclaration() const {
624 return getFieldAs(12);
625 }
626
627 /// Verify - Verify that a global variable descriptor is well formed.
628 bool Verify() const;
629 };
630
631 /// DIVariable - This is a wrapper for a variable (e.g. parameter, local,
632 /// global etc).
633 class DIVariable : public DIDescriptor {
634 friend class DIDescriptor;
635 void printInternal(raw_ostream &OS) const;
636
637 public:
638 explicit DIVariable(const MDNode *N = 0) : DIDescriptor(N) {}
639
640 DIScope getContext() const { return getFieldAs(1); }
641 StringRef getName() const { return getStringField(2); }
642 DIFile getFile() const { return getFieldAs(3); }
643 unsigned getLineNumber() const { return (getUnsignedField(4) << 8) >> 8; }
644 unsigned getArgNumber() const {
645 unsigned L = getUnsignedField(4);
646 return L >> 24;
647 }
648 DIType getType() const { return getFieldAs(5); }
649
650 /// isArtificial - Return true if this variable is marked as "artificial".
651 bool isArtificial() const {
652 return (getUnsignedField(6) & FlagArtificial) != 0;
653 }
654
655 bool isObjectPointer() const {
656 return (getUnsignedField(6) & FlagObjectPointer) != 0;
657 }
658
659 /// \brief Return true if this variable is represented as a pointer.
660 bool isIndirect() const {
661 return (getUnsignedField(6) & FlagIndirectVariable) != 0;
662 }
663
664 /// getInlinedAt - If this variable is inlined then return inline location.
665 MDNode *getInlinedAt() const;
666
667 /// Verify - Verify that a variable descriptor is well formed.
668 bool Verify() const;
669
670 /// HasComplexAddr - Return true if the variable has a complex address.
671 bool hasComplexAddress() const { return getNumAddrElements() > 0; }
672
673 unsigned getNumAddrElements() const;
674
675 uint64_t getAddrElement(unsigned Idx) const {
676 return getUInt64Field(Idx + 8);
677 }
678
679 /// isBlockByrefVariable - Return true if the variable was declared as
680 /// a "__block" variable (Apple Blocks).
681 bool isBlockByrefVariable() const { return getType().isBlockByrefStruct(); }
682
683 /// isInlinedFnArgument - Return true if this variable provides debugging
684 /// information for an inlined function arguments.
685 bool isInlinedFnArgument(const Function *CurFn);
686
687 void printExtendedName(raw_ostream &OS) const;
688 };
689
690 /// DILocation - This object holds location information. This object
691 /// is not associated with any DWARF tag.
692 class DILocation : public DIDescriptor {
693 public:
694 explicit DILocation(const MDNode *N) : DIDescriptor(N) {}
695
696 unsigned getLineNumber() const { return getUnsignedField(0); }
697 unsigned getColumnNumber() const { return getUnsignedField(1); }
698 DIScope getScope() const { return getFieldAs(2); }
699 DILocation getOrigLocation() const { return getFieldAs(3); }
700 StringRef getFilename() const { return getScope().getFilename(); }
701 StringRef getDirectory() const { return getScope().getDirectory(); }
702 bool Verify() const;
703 bool atSameLineAs(const DILocation &Other) const {
704 return (getLineNumber() == Other.getLineNumber() &&
705 getFilename() == Other.getFilename());
706 }
707 /// getDiscriminator - DWARF discriminators are used to distinguish
708 /// identical file locations for instructions that are on different
709 /// basic blocks. If two instructions are inside the same lexical block
710 /// and are in different basic blocks, we create a new lexical block
711 /// with identical location as the original but with a different
712 /// discriminator value (lib/Transforms/Util/AddDiscriminators.cpp
713 /// for details).
714 unsigned getDiscriminator() const {
715 // Since discriminators are associated with lexical blocks, make
716 // sure this location is a lexical block before retrieving its
717 // value.
718 return getScope().isLexicalBlock()
719 ? getFieldAs(2).getDiscriminator()
720 : 0;
721 }
722 unsigned computeNewDiscriminator(LLVMContext &Ctx);
723 DILocation copyWithNewScope(LLVMContext &Ctx, DILexicalBlock NewScope);
724 };
725
726 class DIObjCProperty : public DIDescriptor {
727 friend class DIDescriptor;
728 void printInternal(raw_ostream &OS) const;
729
730 public:
731 explicit DIObjCProperty(const MDNode *N) : DIDescriptor(N) {}
732
733 StringRef getObjCPropertyName() const { return getStringField(1); }
734 DIFile getFile() const { return getFieldAs(2); }
735 unsigned getLineNumber() const { return getUnsignedField(3); }
736
737 StringRef getObjCPropertyGetterName() const { return getStringField(4); }
738 StringRef getObjCPropertySetterName() const { return getStringField(5); }
739 bool isReadOnlyObjCProperty() const {
740 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_readonly) != 0;
741 }
742 bool isReadWriteObjCProperty() const {
743 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_readwrite) != 0;
744 }
745 bool isAssignObjCProperty() const {
746 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_assign) != 0;
747 }
748 bool isRetainObjCProperty() const {
749 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_retain) != 0;
750 }
751 bool isCopyObjCProperty() const {
752 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_copy) != 0;
753 }
754 bool isNonAtomicObjCProperty() const {
755 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_nonatomic) != 0;
756 }
757
758 DIType getType() const { return getFieldAs(7); }
759
760 /// Verify - Verify that a derived type descriptor is well formed.
761 bool Verify() const;
762 };
763
764 /// \brief An imported module (C++ using directive or similar).
765 class DIImportedEntity : public DIDescriptor {
766 friend class DIDescriptor;
767 void printInternal(raw_ostream &OS) const;
768
769 public:
770 explicit DIImportedEntity(const MDNode *N) : DIDescriptor(N) {}
771 DIScope getContext() const { return getFieldAs(1); }
772 DIDescriptor getEntity() const { return getFieldAs(2); }
773 unsigned getLineNumber() const { return getUnsignedField(3); }
774 StringRef getName() const { return getStringField(4); }
775 bool Verify() const;
776 };
777
778 /// getDISubprogram - Find subprogram that is enclosing this scope.
779 DISubprogram getDISubprogram(const MDNode *Scope);
780
781 /// getDICompositeType - Find underlying composite type.
782 DICompositeType getDICompositeType(DIType T);
783
784 /// getOrInsertFnSpecificMDNode - Return a NameMDNode that is suitable
785 /// to hold function specific information.
786 NamedMDNode *getOrInsertFnSpecificMDNode(Module &M, DISubprogram SP);
787
788 /// getFnSpecificMDNode - Return a NameMDNode, if available, that is
789 /// suitable to hold function specific information.
790 NamedMDNode *getFnSpecificMDNode(const Module &M, DISubprogram SP);
791
792 /// createInlinedVariable - Create a new inlined variable based on current
793 /// variable.
794 /// @param DV Current Variable.
795 /// @param InlinedScope Location at current variable is inlined.
796 DIVariable createInlinedVariable(MDNode *DV, MDNode *InlinedScope,
797 LLVMContext &VMContext);
798
799 /// cleanseInlinedVariable - Remove inlined scope from the variable.
800 DIVariable cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext);
801
802 /// Construct DITypeIdentifierMap by going through retained types of each CU.
803 DITypeIdentifierMap generateDITypeIdentifierMap(const NamedMDNode *CU_Nodes);
804
805 /// Strip debug info in the module if it exists.
806 /// To do this, we remove all calls to the debugger intrinsics and any named
807 /// metadata for debugging. We also remove debug locations for instructions.
808 /// Return true if module is modified.
809 bool StripDebugInfo(Module &M);
810
811 /// Return Debug Info Metadata Version by checking module flags.
812 unsigned getDebugMetadataVersionFromModule(const Module &M);
813
814 /// DebugInfoFinder tries to list all debug info MDNodes used in a module. To
815 /// list debug info MDNodes used by an instruction, DebugInfoFinder uses
816 /// processDeclare, processValue and processLocation to handle DbgDeclareInst,
817 /// DbgValueInst and DbgLoc attached to instructions. processModule will go
818 /// through all DICompileUnits in llvm.dbg.cu and list debug info MDNodes
819 /// used by the CUs.
820 class DebugInfoFinder {
821 public:
822 DebugInfoFinder() : TypeMapInitialized(false) {}
823
824 /// processModule - Process entire module and collect debug info
825 /// anchors.
826 void processModule(const Module &M);
827
828 /// processDeclare - Process DbgDeclareInst.
829 void processDeclare(const Module &M, const DbgDeclareInst *DDI);
830 /// Process DbgValueInst.
831 void processValue(const Module &M, const DbgValueInst *DVI);
832 /// processLocation - Process DILocation.
833 void processLocation(const Module &M, DILocation Loc);
834
835 /// Clear all lists.
836 void reset();
837
838 private:
839 /// Initialize TypeIdentifierMap.
840 void InitializeTypeMap(const Module &M);
841
842 /// processType - Process DIType.
843 void processType(DIType DT);
844
845 /// processLexicalBlock - Process DILexicalBlock.
846 void processLexicalBlock(DILexicalBlock LB);
847
848 /// processSubprogram - Process DISubprogram.
849 void processSubprogram(DISubprogram SP);
850
851 void processScope(DIScope Scope);
852
853 /// addCompileUnit - Add compile unit into CUs.
854 bool addCompileUnit(DICompileUnit CU);
855
856 /// addGlobalVariable - Add global variable into GVs.
857 bool addGlobalVariable(DIGlobalVariable DIG);
858
859 // addSubprogram - Add subprogram into SPs.
860 bool addSubprogram(DISubprogram SP);
861
862 /// addType - Add type into Tys.
863 bool addType(DIType DT);
864
865 bool addScope(DIScope Scope);
866
867 public:
868 typedef SmallVectorImpl::const_iterator iterator;
869 iterator compile_unit_begin() const { return CUs.begin(); }
870 iterator compile_unit_end() const { return CUs.end(); }
871 iterator subprogram_begin() const { return SPs.begin(); }
872 iterator subprogram_end() const { return SPs.end(); }
873 iterator global_variable_begin() const { return GVs.begin(); }
874 iterator global_variable_end() const { return GVs.end(); }
875 iterator type_begin() const { return TYs.begin(); }
876 iterator type_end() const { return TYs.end(); }
877 iterator scope_begin() const { return Scopes.begin(); }
878 iterator scope_end() const { return Scopes.end(); }
879
880 unsigned compile_unit_count() const { return CUs.size(); }
881 unsigned global_variable_count() const { return GVs.size(); }
882 unsigned subprogram_count() const { return SPs.size(); }
883 unsigned type_count() const { return TYs.size(); }
884 unsigned scope_count() const { return Scopes.size(); }
885
886 private:
887 SmallVector CUs; // Compile Units
888 SmallVector SPs; // Subprograms
889 SmallVector GVs; // Global Variables;
890 SmallVector TYs; // Types
891 SmallVector Scopes; // Scopes
892 SmallPtrSet NodesSeen;
893 DITypeIdentifierMap TypeIdentifierMap;
894 /// Specify if TypeIdentifierMap is initialized.
895 bool TypeMapInitialized;
896 };
897 } // end namespace llvm
898
899 #endif
1616
1717 #include "llvm/Analysis/Passes.h"
1818 #include "llvm/ADT/Statistic.h"
19 #include "llvm/DebugInfo.h"
19 #include "llvm/IR/DebugInfo.h"
2020 #include "llvm/IR/Function.h"
2121 #include "llvm/Pass.h"
2222 #include "llvm/Support/ErrorHandling.h"
2727 #include "llvm/CodeGen/MachineJumpTableInfo.h"
2828 #include "llvm/CodeGen/MachineLoopInfo.h"
2929 #include "llvm/CodeGen/MachineModuleInfo.h"
30 #include "llvm/DebugInfo.h"
3130 #include "llvm/IR/DataLayout.h"
31 #include "llvm/IR/DebugInfo.h"
3232 #include "llvm/IR/Mangler.h"
3333 #include "llvm/IR/Module.h"
3434 #include "llvm/IR/Operator.h"
2222 #include "llvm/ADT/Triple.h"
2323 #include "llvm/CodeGen/MachineFunction.h"
2424 #include "llvm/CodeGen/MachineModuleInfo.h"
25 #include "llvm/DebugInfo.h"
2625 #include "llvm/IR/Constants.h"
2726 #include "llvm/IR/DIBuilder.h"
2827 #include "llvm/IR/DataLayout.h"
28 #include "llvm/IR/DebugInfo.h"
2929 #include "llvm/IR/Instructions.h"
3030 #include "llvm/IR/Module.h"
3131 #include "llvm/IR/ValueHandle.h"
2323 #include "llvm/ADT/StringMap.h"
2424 #include "llvm/CodeGen/AsmPrinter.h"
2525 #include "llvm/CodeGen/LexicalScopes.h"
26 #include "llvm/DebugInfo.h"
26 #include "llvm/IR/DebugInfo.h"
2727 #include "llvm/IR/DebugLoc.h"
2828 #include "llvm/MC/MachineLocation.h"
2929 #include "llvm/Support/Allocator.h"
1919 #include "llvm/ADT/Optional.h"
2020 #include "llvm/ADT/OwningPtr.h"
2121 #include "llvm/ADT/StringMap.h"
22 #include "llvm/DebugInfo.h"
2322 #include "llvm/IR/DIBuilder.h"
23 #include "llvm/IR/DebugInfo.h"
2424 #include "llvm/MC/MCExpr.h"
2525 #include "llvm/MC/MCSection.h"
2626
2121 #include "llvm/CodeGen/LexicalScopes.h"
2222 #include "llvm/CodeGen/MachineFunction.h"
2323 #include "llvm/CodeGen/MachineModuleInfo.h"
24 #include "llvm/DebugInfo.h"
24 #include "llvm/IR/DebugInfo.h"
2525 #include "llvm/IR/DebugLoc.h"
2626 #include "llvm/MC/MCStreamer.h"
2727 #include "llvm/Target/TargetLoweringObjectFile.h"
1717 #include "llvm/CodeGen/LexicalScopes.h"
1818 #include "llvm/CodeGen/MachineFunction.h"
1919 #include "llvm/CodeGen/MachineInstr.h"
20 #include "llvm/DebugInfo.h"
20 #include "llvm/IR/DebugInfo.h"
2121 #include "llvm/IR/Function.h"
2222 #include "llvm/Support/Debug.h"
2323 #include "llvm/Support/ErrorHandling.h"
3030 #include "llvm/CodeGen/MachineRegisterInfo.h"
3131 #include "llvm/CodeGen/Passes.h"
3232 #include "llvm/CodeGen/VirtRegMap.h"
33 #include "llvm/DebugInfo.h"
3433 #include "llvm/IR/Constants.h"
34 #include "llvm/IR/DebugInfo.h"
3535 #include "llvm/IR/Metadata.h"
3636 #include "llvm/IR/Value.h"
3737 #include "llvm/Support/CommandLine.h"
2424 #include "llvm/CodeGen/MachineModuleInfo.h"
2525 #include "llvm/CodeGen/MachineRegisterInfo.h"
2626 #include "llvm/CodeGen/Passes.h"
27 #include "llvm/DebugInfo.h"
2827 #include "llvm/IR/DataLayout.h"
28 #include "llvm/IR/DebugInfo.h"
2929 #include "llvm/IR/Function.h"
3030 #include "llvm/MC/MCAsmInfo.h"
3131 #include "llvm/MC/MCContext.h"
2020 #include "llvm/CodeGen/MachineModuleInfo.h"
2121 #include "llvm/CodeGen/MachineRegisterInfo.h"
2222 #include "llvm/CodeGen/PseudoSourceValue.h"
23 #include "llvm/DebugInfo.h"
2423 #include "llvm/IR/Constants.h"
24 #include "llvm/IR/DebugInfo.h"
2525 #include "llvm/IR/Function.h"
2626 #include "llvm/IR/InlineAsm.h"
2727 #include "llvm/IR/LLVMContext.h"
4848 #include "llvm/CodeGen/MachineInstrBuilder.h"
4949 #include "llvm/CodeGen/MachineModuleInfo.h"
5050 #include "llvm/CodeGen/MachineRegisterInfo.h"
51 #include "llvm/DebugInfo.h"
5251 #include "llvm/IR/DataLayout.h"
52 #include "llvm/IR/DebugInfo.h"
5353 #include "llvm/IR/Function.h"
5454 #include "llvm/IR/GlobalVariable.h"
5555 #include "llvm/IR/Instructions.h"
2020 #include "llvm/CodeGen/MachineInstrBuilder.h"
2121 #include "llvm/CodeGen/MachineModuleInfo.h"
2222 #include "llvm/CodeGen/MachineRegisterInfo.h"
23 #include "llvm/DebugInfo.h"
2423 #include "llvm/IR/DataLayout.h"
24 #include "llvm/IR/DebugInfo.h"
2525 #include "llvm/IR/DerivedTypes.h"
2626 #include "llvm/IR/Function.h"
2727 #include "llvm/IR/Instructions.h"
1717 #include "llvm/CodeGen/Analysis.h"
1818 #include "llvm/CodeGen/MachineFunction.h"
1919 #include "llvm/CodeGen/MachineJumpTableInfo.h"
20 #include "llvm/DebugInfo.h"
2120 #include "llvm/IR/CallingConv.h"
2221 #include "llvm/IR/Constants.h"
2322 #include "llvm/IR/DataLayout.h"
23 #include "llvm/IR/DebugInfo.h"
2424 #include "llvm/IR/DerivedTypes.h"
2525 #include "llvm/IR/Function.h"
2626 #include "llvm/IR/LLVMContext.h"
2222 #include "llvm/CodeGen/MachineConstantPool.h"
2323 #include "llvm/CodeGen/MachineFrameInfo.h"
2424 #include "llvm/CodeGen/MachineModuleInfo.h"
25 #include "llvm/DebugInfo.h"
2625 #include "llvm/IR/CallingConv.h"
2726 #include "llvm/IR/Constants.h"
2827 #include "llvm/IR/DataLayout.h"
28 #include "llvm/IR/DebugInfo.h"
2929 #include "llvm/IR/DerivedTypes.h"
3030 #include "llvm/IR/Function.h"
3131 #include "llvm/IR/GlobalAlias.h"
3333 #include "llvm/CodeGen/MachineRegisterInfo.h"
3434 #include "llvm/CodeGen/SelectionDAG.h"
3535 #include "llvm/CodeGen/StackMaps.h"
36 #include "llvm/DebugInfo.h"
3736 #include "llvm/IR/CallingConv.h"
3837 #include "llvm/IR/Constants.h"
3938 #include "llvm/IR/DataLayout.h"
39 #include "llvm/IR/DebugInfo.h"
4040 #include "llvm/IR/DerivedTypes.h"
4141 #include "llvm/IR/Function.h"
4242 #include "llvm/IR/GlobalVariable.h"
1616 #include "llvm/CodeGen/MachineConstantPool.h"
1717 #include "llvm/CodeGen/MachineFunction.h"
1818 #include "llvm/CodeGen/MachineModuleInfo.h"
19 #include "llvm/DebugInfo.h"
19 #include "llvm/IR/DebugInfo.h"
2020 #include "llvm/IR/Function.h"
2121 #include "llvm/IR/Intrinsics.h"
2222 #include "llvm/Support/Debug.h"
3131 #include "llvm/CodeGen/ScheduleHazardRecognizer.h"
3232 #include "llvm/CodeGen/SchedulerRegistry.h"
3333 #include "llvm/CodeGen/SelectionDAG.h"
34 #include "llvm/DebugInfo.h"
3534 #include "llvm/IR/Constants.h"
35 #include "llvm/IR/DebugInfo.h"
3636 #include "llvm/IR/Function.h"
3737 #include "llvm/IR/InlineAsm.h"
3838 #include "llvm/IR/Instructions.h"
1717 #include "llvm/CodeGen/MachineConstantPool.h"
1818 #include "llvm/CodeGen/MachineFunction.h"
1919 #include "llvm/CodeGen/MachineModuleInfo.h"
20 #include "llvm/DebugInfo.h"
2120 #include "llvm/IR/Constants.h"
21 #include "llvm/IR/DebugInfo.h"
2222 #include "llvm/Support/Debug.h"
2323 #include "llvm/Support/GraphWriter.h"
2424 #include "llvm/Support/raw_ostream.h"
4343 #include "llvm/CodeGen/PseudoSourceValue.h"
4444 #include "llvm/CodeGen/SlotIndexes.h"
4545 #include "llvm/CodeGen/StackProtector.h"
46 #include "llvm/DebugInfo.h"
46 #include "llvm/IR/DebugInfo.h"
4747 #include "llvm/IR/Dominators.h"
4848 #include "llvm/IR/Function.h"
4949 #include "llvm/IR/Instructions.h"
1414 #define EVENT_LISTENER_COMMON_H
1515
1616 #include "llvm/ADT/DenseMap.h"
17 #include "llvm/DebugInfo.h"
17 #include "llvm/IR/DebugInfo.h"
1818 #include "llvm/IR/Metadata.h"
1919 #include "llvm/IR/ValueHandle.h"
2020 #include "llvm/Support/Path.h"
1515 #include "llvm/ExecutionEngine/JITEventListener.h"
1616
1717 #define DEBUG_TYPE "amplifier-jit-event-listener"
18 #include "llvm/DebugInfo.h"
18 #include "llvm/IR/DebugInfo.h"
1919 #include "llvm/IR/Function.h"
2020 #include "llvm/IR/Metadata.h"
2121 #include "llvm/ADT/DenseMap.h"
2525 #include "llvm/CodeGen/MachineJumpTableInfo.h"
2626 #include "llvm/CodeGen/MachineModuleInfo.h"
2727 #include "llvm/CodeGen/MachineRelocation.h"
28 #include "llvm/DebugInfo.h"
2928 #include "llvm/ExecutionEngine/GenericValue.h"
3029 #include "llvm/ExecutionEngine/JITEventListener.h"
3130 #include "llvm/ExecutionEngine/JITMemoryManager.h"
3231 #include "llvm/IR/Constants.h"
3332 #include "llvm/IR/DataLayout.h"
33 #include "llvm/IR/DebugInfo.h"
3434 #include "llvm/IR/DerivedTypes.h"
3535 #include "llvm/IR/Module.h"
3636 #include "llvm/IR/ValueHandle.h"
1515 #include "llvm/ExecutionEngine/JITEventListener.h"
1616
1717 #define DEBUG_TYPE "oprofile-jit-event-listener"
18 #include "llvm/DebugInfo.h"
18 #include "llvm/IR/DebugInfo.h"
1919 #include "llvm/IR/Function.h"
2020 #include "llvm/ADT/OwningPtr.h"
2121 #include "llvm/CodeGen/MachineFunction.h"
1818 #include "llvm/ADT/STLExtras.h"
1919 #include "llvm/ADT/SmallString.h"
2020 #include "llvm/ADT/StringExtras.h"
21 #include "llvm/DebugInfo.h"
2221 #include "llvm/IR/AssemblyAnnotationWriter.h"
2322 #include "llvm/IR/CFG.h"
2423 #include "llvm/IR/CallingConv.h"
2524 #include "llvm/IR/Constants.h"
25 #include "llvm/IR/DebugInfo.h"
2626 #include "llvm/IR/DerivedTypes.h"
2727 #include "llvm/IR/IRPrintingPasses.h"
2828 #include "llvm/IR/InlineAsm.h"
1111 //===----------------------------------------------------------------------===//
1212
1313 #include "llvm/IR/AutoUpgrade.h"
14 #include "llvm/DebugInfo.h"
1514 #include "llvm/IR/CFG.h"
1615 #include "llvm/IR/CallSite.h"
1716 #include "llvm/IR/Constants.h"
17 #include "llvm/IR/DebugInfo.h"
1818 #include "llvm/IR/DiagnosticInfo.h"
1919 #include "llvm/IR/Function.h"
2020 #include "llvm/IR/IRBuilder.h"
1212
1313 #include "llvm/IR/DIBuilder.h"
1414 #include "llvm/ADT/STLExtras.h"
15 #include "llvm/DebugInfo.h"
1615 #include "llvm/IR/Constants.h"
16 #include "llvm/IR/DebugInfo.h"
1717 #include "llvm/IR/IntrinsicInst.h"
1818 #include "llvm/IR/Module.h"
1919 #include "llvm/Support/Debug.h"
1111 //
1212 //===----------------------------------------------------------------------===//
1313
14 #include "llvm/DebugInfo.h"
14 #include "llvm/IR/DebugInfo.h"
1515 #include "LLVMContextImpl.h"
1616 #include "llvm/ADT/STLExtras.h"
1717 #include "llvm/ADT/SmallPtrSet.h"
99 #include "llvm/IR/DebugLoc.h"
1010 #include "LLVMContextImpl.h"
1111 #include "llvm/ADT/DenseMapInfo.h"
12 #include "llvm/DebugInfo.h"
12 #include "llvm/IR/DebugInfo.h"
1313 using namespace llvm;
1414
1515 //===----------------------------------------------------------------------===//
5050 #include "llvm/ADT/SmallPtrSet.h"
5151 #include "llvm/ADT/SmallVector.h"
5252 #include "llvm/ADT/StringExtras.h"
53 #include "llvm/DebugInfo.h"
5453 #include "llvm/IR/CFG.h"
5554 #include "llvm/IR/CallSite.h"
5655 #include "llvm/IR/CallingConv.h"
5756 #include "llvm/IR/ConstantRange.h"
5857 #include "llvm/IR/Constants.h"
5958 #include "llvm/IR/DataLayout.h"
59 #include "llvm/IR/DebugInfo.h"
6060 #include "llvm/IR/DerivedTypes.h"
6161 #include "llvm/IR/Dominators.h"
6262 #include "llvm/IR/InlineAsm.h"
1717 #include "llvm/ADT/SmallString.h"
1818 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
1919 #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
20 #include "llvm/DebugInfo.h"
20 #include "llvm/IR/DebugInfo.h"
2121 #include "llvm/IR/Mangler.h"
2222 #include "llvm/MC/MCAsmInfo.h"
2323 #include "llvm/MC/MCInst.h"
2727 #include "llvm/CodeGen/MachineFunctionPass.h"
2828 #include "llvm/CodeGen/MachineJumpTableInfo.h"
2929 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
30 #include "llvm/DebugInfo.h"
3130 #include "llvm/IR/Constants.h"
3231 #include "llvm/IR/DataLayout.h"
32 #include "llvm/IR/DebugInfo.h"
3333 #include "llvm/IR/Mangler.h"
3434 #include "llvm/IR/Module.h"
3535 #include "llvm/IR/Type.h"
2424 #include "llvm/CodeGen/MachineInstrBuilder.h"
2525 #include "llvm/CodeGen/MachineRegisterInfo.h"
2626 #include "llvm/CodeGen/ValueTypes.h"
27 #include "llvm/DebugInfo.h"
2827 #include "llvm/IR/Constants.h"
28 #include "llvm/IR/DebugInfo.h"
2929 #include "llvm/IR/Function.h"
3030 #include "llvm/IR/Type.h"
3131 #include "llvm/Support/CommandLine.h"
2424 #include "llvm/CodeGen/MachineFunction.h"
2525 #include "llvm/CodeGen/MachineInstrBuilder.h"
2626 #include "llvm/CodeGen/ValueTypes.h"
27 #include "llvm/DebugInfo.h"
2827 #include "llvm/IR/Constants.h"
28 #include "llvm/IR/DebugInfo.h"
2929 #include "llvm/IR/Function.h"
3030 #include "llvm/IR/Type.h"
3131 #include "llvm/Support/CommandLine.h"
2424 #include "llvm/CodeGen/MachineInstrBuilder.h"
2525 #include "llvm/CodeGen/MachineRegisterInfo.h"
2626 #include "llvm/CodeGen/ValueTypes.h"
27 #include "llvm/DebugInfo.h"
2827 #include "llvm/IR/Constants.h"
28 #include "llvm/IR/DebugInfo.h"
2929 #include "llvm/IR/Function.h"
3030 #include "llvm/IR/Type.h"
3131 #include "llvm/Support/CommandLine.h"
2727 #include "llvm/CodeGen/MachineFrameInfo.h"
2828 #include "llvm/CodeGen/MachineModuleInfo.h"
2929 #include "llvm/CodeGen/MachineRegisterInfo.h"
30 #include "llvm/DebugInfo.h"
30 #include "llvm/IR/DebugInfo.h"
3131 #include "llvm/IR/DerivedTypes.h"
3232 #include "llvm/IR/Function.h"
3333 #include "llvm/IR/GlobalVariable.h"
3232 #include "llvm/CodeGen/MachineInstrBuilder.h"
3333 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
3434 #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
35 #include "llvm/DebugInfo.h"
3635 #include "llvm/IR/Constants.h"
36 #include "llvm/IR/DebugInfo.h"
3737 #include "llvm/IR/DerivedTypes.h"
3838 #include "llvm/IR/Mangler.h"
3939 #include "llvm/IR/Module.h"
2121 #include "llvm/CodeGen/MachineJumpTableInfo.h"
2222 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
2323 #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
24 #include "llvm/DebugInfo.h"
2524 #include "llvm/IR/CallingConv.h"
25 #include "llvm/IR/DebugInfo.h"
2626 #include "llvm/IR/DerivedTypes.h"
2727 #include "llvm/IR/Mangler.h"
2828 #include "llvm/IR/Module.h"
2727 #include "llvm/CodeGen/MachineInstr.h"
2828 #include "llvm/CodeGen/MachineJumpTableInfo.h"
2929 #include "llvm/CodeGen/MachineModuleInfo.h"
30 #include "llvm/DebugInfo.h"
3130 #include "llvm/IR/Constants.h"
3231 #include "llvm/IR/DataLayout.h"
32 #include "llvm/IR/DebugInfo.h"
3333 #include "llvm/IR/DerivedTypes.h"
3434 #include "llvm/IR/Mangler.h"
3535 #include "llvm/IR/Module.h"
2222 #include "llvm/ADT/SmallVector.h"
2323 #include "llvm/ADT/Statistic.h"
2424 #include "llvm/ADT/StringExtras.h"
25 #include "llvm/DebugInfo.h"
2625 #include "llvm/IR/CallSite.h"
2726 #include "llvm/IR/CallingConv.h"
2827 #include "llvm/IR/Constant.h"
2928 #include "llvm/IR/DIBuilder.h"
29 #include "llvm/IR/DebugInfo.h"
3030 #include "llvm/IR/DerivedTypes.h"
3131 #include "llvm/IR/Instructions.h"
3232 #include "llvm/IR/IntrinsicInst.h"
2222 #include "llvm/Transforms/IPO.h"
2323 #include "llvm/ADT/DenseMap.h"
2424 #include "llvm/ADT/SmallPtrSet.h"
25 #include "llvm/DebugInfo.h"
2625 #include "llvm/IR/Constants.h"
26 #include "llvm/IR/DebugInfo.h"
2727 #include "llvm/IR/DerivedTypes.h"
2828 #include "llvm/IR/Instructions.h"
2929 #include "llvm/IR/Module.h"
1919
2020 #include "llvm/IR/ValueMap.h"
2121 #include "DebugIR.h"
22 #include "llvm/DebugInfo.h"
2322 #include "llvm/IR/AssemblyAnnotationWriter.h"
2423 #include "llvm/IR/DIBuilder.h"
2524 #include "llvm/IR/DataLayout.h"
25 #include "llvm/IR/DebugInfo.h"
2626 #include "llvm/IR/Instruction.h"
2727 #include "llvm/IR/LLVMContext.h"
2828 #include "llvm/IR/Module.h"
2323 #include "llvm/ADT/StringExtras.h"
2424 #include "llvm/ADT/StringMap.h"
2525 #include "llvm/ADT/UniqueVector.h"
26 #include "llvm/DebugInfo.h"
26 #include "llvm/IR/DebugInfo.h"
2727 #include "llvm/IR/DebugLoc.h"
2828 #include "llvm/IR/IRBuilder.h"
2929 #include "llvm/IR/InstIterator.h"
3131 #include "llvm/Analysis/Loads.h"
3232 #include "llvm/Analysis/PtrUseVisitor.h"
3333 #include "llvm/Analysis/ValueTracking.h"
34 #include "llvm/DebugInfo.h"
3534 #include "llvm/IR/Constants.h"
3635 #include "llvm/IR/DIBuilder.h"
3736 #include "llvm/IR/DataLayout.h"
37 #include "llvm/IR/DebugInfo.h"
3838 #include "llvm/IR/DerivedTypes.h"
3939 #include "llvm/IR/Dominators.h"
4040 #include "llvm/IR/Function.h"
3232 #include "llvm/ADT/StringRef.h"
3333 #include "llvm/Analysis/LoopInfo.h"
3434 #include "llvm/Analysis/PostDominators.h"
35 #include "llvm/DebugInfo.h"
3635 #include "llvm/IR/Constants.h"
36 #include "llvm/IR/DebugInfo.h"
3737 #include "llvm/IR/Dominators.h"
3838 #include "llvm/IR/Function.h"
3939 #include "llvm/IR/InstIterator.h"
2525 #include "llvm/ADT/Statistic.h"
2626 #include "llvm/Analysis/Loads.h"
2727 #include "llvm/Analysis/ValueTracking.h"
28 #include "llvm/DebugInfo.h"
2928 #include "llvm/IR/CallSite.h"
3029 #include "llvm/IR/Constants.h"
3130 #include "llvm/IR/DIBuilder.h"
3231 #include "llvm/IR/DataLayout.h"
32 #include "llvm/IR/DebugInfo.h"
3333 #include "llvm/IR/DerivedTypes.h"
3434 #include "llvm/IR/Dominators.h"
3535 #include "llvm/IR/Function.h"
5454 #define DEBUG_TYPE "add-discriminators"
5555
5656 #include "llvm/Transforms/Scalar.h"
57 #include "llvm/DebugInfo.h"
5857 #include "llvm/IR/BasicBlock.h"
5958 #include "llvm/IR/Constants.h"
6059 #include "llvm/IR/DIBuilder.h"
60 #include "llvm/IR/DebugInfo.h"
6161 #include "llvm/IR/Instructions.h"
6262 #include "llvm/IR/LLVMContext.h"
6363 #include "llvm/IR/Module.h"
1616 #include "llvm/ADT/SmallVector.h"
1717 #include "llvm/Analysis/ConstantFolding.h"
1818 #include "llvm/Analysis/InstructionSimplify.h"
19 #include "llvm/DebugInfo.h"
2019 #include "llvm/IR/CFG.h"
2120 #include "llvm/IR/Constants.h"
21 #include "llvm/IR/DebugInfo.h"
2222 #include "llvm/IR/DerivedTypes.h"
2323 #include "llvm/IR/Function.h"
2424 #include "llvm/IR/GlobalVariable.h"
1616 #include "llvm/ADT/StringExtras.h"
1717 #include "llvm/Analysis/CallGraph.h"
1818 #include "llvm/Analysis/InstructionSimplify.h"
19 #include "llvm/DebugInfo.h"
2019 #include "llvm/IR/Attributes.h"
2120 #include "llvm/IR/CallSite.h"
2221 #include "llvm/IR/Constants.h"
2322 #include "llvm/IR/DataLayout.h"
23 #include "llvm/IR/DebugInfo.h"
2424 #include "llvm/IR/DerivedTypes.h"
2525 #include "llvm/IR/IRBuilder.h"
2626 #include "llvm/IR/Instructions.h"
1919 #include "llvm/Analysis/InstructionSimplify.h"
2020 #include "llvm/Analysis/MemoryBuiltins.h"
2121 #include "llvm/Analysis/ValueTracking.h"
22 #include "llvm/DebugInfo.h"
2322 #include "llvm/IR/CFG.h"
2423 #include "llvm/IR/Constants.h"
2524 #include "llvm/IR/DIBuilder.h"
2625 #include "llvm/IR/DataLayout.h"
26 #include "llvm/IR/DebugInfo.h"
2727 #include "llvm/IR/DerivedTypes.h"
2828 #include "llvm/IR/Dominators.h"
2929 #include "llvm/IR/GetElementPtrTypeIterator.h"
3535 #include "llvm/Analysis/AliasSetTracker.h"
3636 #include "llvm/Analysis/InstructionSimplify.h"
3737 #include "llvm/Analysis/ValueTracking.h"
38 #include "llvm/DebugInfo.h"
3938 #include "llvm/IR/CFG.h"
4039 #include "llvm/IR/Constants.h"
4140 #include "llvm/IR/DIBuilder.h"
41 #include "llvm/IR/DebugInfo.h"
4242 #include "llvm/IR/DerivedTypes.h"
4343 #include "llvm/IR/Dominators.h"
4444 #include "llvm/IR/Function.h"
1717
1818 #include "llvm/IR/LLVMContext.h"
1919 #include "llvm/Bitcode/ReaderWriter.h"
20 #include "llvm/DebugInfo.h"
2120 #include "llvm/IR/AssemblyAnnotationWriter.h"
21 #include "llvm/IR/DebugInfo.h"
2222 #include "llvm/IR/IntrinsicInst.h"
2323 #include "llvm/IR/Module.h"
2424 #include "llvm/IR/Type.h"
1212 //===----------------------------------------------------------------------===//
1313 #include "BreakpointPrinter.h"
1414 #include "llvm/ADT/StringSet.h"
15 #include "llvm/DebugInfo.h"
15 #include "llvm/IR/DebugInfo.h"
1616 #include "llvm/IR/Module.h"
1717 #include "llvm/Pass.h"
1818 #include "llvm/Support/raw_ostream.h"
1111
1212 #include "llvm/CodeGen/MachineCodeInfo.h"
1313 #include "llvm/Config/config.h"
14 #include "llvm/DebugInfo.h"
1514 #include "llvm/ExecutionEngine/JIT.h"
1615 #include "llvm/ExecutionEngine/JITEventListener.h"
1716 #include "llvm/IR/DIBuilder.h"
17 #include "llvm/IR/DebugInfo.h"
1818 #include "llvm/IR/IRBuilder.h"
1919 #include "llvm/IR/Instructions.h"
2020 #include "llvm/IR/Module.h"
1414 #include "llvm/ADT/Triple.h"
1515 #include "../lib/Transforms/Instrumentation/DebugIR.h"
1616 #include "llvm/Config/config.h"
17 #include "llvm/DebugInfo.h"
1817 #include "llvm/IR/DIBuilder.h"
18 #include "llvm/IR/DebugInfo.h"
1919 #include "llvm/IR/Module.h"
2020 #include "llvm/Support/FileSystem.h"
2121 #include "llvm/Support/Host.h"