llvm.org GIT mirror llvm / 0917b70
DI: Fold constant arguments into a single MDString This patch addresses the first stage of PR17891 by folding constant arguments together into a single MDString. Integers are stringified and a `\0` character is used as a separator. Part of PR17891. Note: I've attached my testcases upgrade scripts to the PR. If I've just broken your out-of-tree testcases, they might help. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218914 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan P. N. Exon Smith 4 years ago
354 changed file(s) with 6839 addition(s) and 6740 deletion(s). Raw diff Collapse all Expand all
185185 ...
186186 }
187187
188 The first field of a descriptor is always an
189 ``i32`` containing a tag value identifying the content of the descriptor.
190 The remaining fields are specific to the descriptor. The values of tags are
191 loosely bound to the tag values of DWARF information entries. However, that
192 does not restrict the use of the information supplied to DWARF targets.
188 Most of the string and integer fields in descriptors are packed into a single,
189 null-separated ``mdstring``. The first field of the header is always an
190 ``i32`` containing the DWARF tag value identifying the content of the
191 descriptor.
192
193 For clarity of definition in this document, these header fields are described
194 below split inside an imaginary ``DIHeader`` construct. This is invalid
195 assembly syntax. In valid IR, these fields are stringified and concatenated,
196 separated by ``\00``.
193197
194198 The details of the various descriptors follow.
195199
199203 .. code-block:: llvm
200204
201205 !0 = metadata !{
202 i32, ;; Tag = 17 (DW_TAG_compile_unit)
206 DIHeader(
207 i32, ;; Tag = 17 (DW_TAG_compile_unit)
208 i32, ;; DWARF language identifier (ex. DW_LANG_C89)
209 mdstring, ;; Producer (ex. "4.0.1 LLVM (LLVM research group)")
210 i1, ;; True if this is optimized.
211 mdstring, ;; Flags
212 i32, ;; Runtime version
213 mdstring, ;; Split debug filename
214 i32 ;; Debug info emission kind (1 = Full Debug Info, 2 = Line Tables Only)
215 ),
203216 metadata, ;; Source directory (including trailing slash) & file pair
204 i32, ;; DWARF language identifier (ex. DW_LANG_C89)
205 metadata ;; Producer (ex. "4.0.1 LLVM (LLVM research group)")
206 i1, ;; True if this is optimized.
207 metadata, ;; Flags
208 i32 ;; Runtime version
209 metadata ;; List of enums types
210 metadata ;; List of retained types
211 metadata ;; List of subprograms
212 metadata ;; List of global variables
217 metadata, ;; List of enums types
218 metadata, ;; List of retained types
219 metadata, ;; List of subprograms
220 metadata, ;; List of global variables
213221 metadata ;; List of imported entities
214 metadata ;; Split debug filename
215 i32 ;; Debug info emission kind (1 = Full Debug Info, 2 = Line Tables Only)
216222 }
217223
218224 These descriptors contain a source language ID for the file (we use the DWARF
235241 .. code-block:: llvm
236242
237243 !0 = metadata !{
238 i32, ;; Tag = 41 (DW_TAG_file_type)
239 metadata, ;; Source directory (including trailing slash) & file pair
244 DIHeader(
245 i32 ;; Tag = 41 (DW_TAG_file_type)
246 ),
247 metadata ;; Source directory (including trailing slash) & file pair
240248 }
241249
242250 These descriptors contain information for a file. Global variables and top
254262 .. code-block:: llvm
255263
256264 !1 = metadata !{
257 i32, ;; Tag = 52 (DW_TAG_variable)
258 i32, ;; Unused field.
265 DIHeader(
266 i32, ;; Tag = 52 (DW_TAG_variable)
267 mdstring, ;; Name
268 mdstring, ;; Display name (fully qualified C++ name)
269 mdstring, ;; MIPS linkage name (for C++)
270 i32, ;; Line number where defined
271 i1, ;; True if the global is local to compile unit (static)
272 i1 ;; True if the global is defined in the compile unit (not extern)
273 ),
259274 metadata, ;; Reference to context descriptor
260 metadata, ;; Name
261 metadata, ;; Display name (fully qualified C++ name)
262 metadata, ;; MIPS linkage name (for C++)
263275 metadata, ;; Reference to file where defined
264 i32, ;; Line number where defined
265276 metadata, ;; Reference to type descriptor
266 i1, ;; True if the global is local to compile unit (static)
267 i1, ;; True if the global is defined in the compile unit (not extern)
268277 {}*, ;; Reference to the global variable
269278 metadata, ;; The static member declaration, if any
270279 }
281290 .. code-block:: llvm
282291
283292 !2 = metadata !{
284 i32, ;; Tag = 46 (DW_TAG_subprogram)
293 DIHeader(
294 i32, ;; Tag = 46 (DW_TAG_subprogram)
295 mdstring, ;; Name
296 mdstring, ;; Display name (fully qualified C++ name)
297 mdstring, ;; MIPS linkage name (for C++)
298 i32, ;; Line number where defined
299 i1, ;; True if the global is local to compile unit (static)
300 i1, ;; True if the global is defined in the compile unit (not extern)
301 i32, ;; Virtuality, e.g. dwarf::DW_VIRTUALITY__virtual
302 i32, ;; Index into a virtual function
303 i32, ;; Flags - Artificial, Private, Protected, Explicit, Prototyped.
304 i1, ;; isOptimized
305 i32 ;; Line number where the scope of the subprogram begins
306 ),
285307 metadata, ;; Source directory (including trailing slash) & file pair
286308 metadata, ;; Reference to context descriptor
287 metadata, ;; Name
288 metadata, ;; Display name (fully qualified C++ name)
289 metadata, ;; MIPS linkage name (for C++)
290 i32, ;; Line number where defined
291309 metadata, ;; Reference to type descriptor
292 i1, ;; True if the global is local to compile unit (static)
293 i1, ;; True if the global is defined in the compile unit (not extern)
294 i32, ;; Virtuality, e.g. dwarf::DW_VIRTUALITY__virtual
295 i32, ;; Index into a virtual function
296310 metadata, ;; indicates which base type contains the vtable pointer for the
297311 ;; derived class
298 i32, ;; Flags - Artificial, Private, Protected, Explicit, Prototyped.
299 i1, ;; isOptimized
300312 {}*, ;; Reference to the LLVM function
301313 metadata, ;; Lists function template parameters
302314 metadata, ;; Function declaration descriptor
303 metadata, ;; List of function variables
304 i32 ;; Line number where the scope of the subprogram begins
315 metadata ;; List of function variables
305316 }
306317
307318 These descriptors provide debug information about functions, methods and
314325 .. code-block:: llvm
315326
316327 !3 = metadata !{
317 i32, ;; Tag = 11 (DW_TAG_lexical_block)
328 DIHeader(
329 i32, ;; Tag = 11 (DW_TAG_lexical_block)
330 i32, ;; Line number
331 i32, ;; Column number
332 i32 ;; Unique ID to identify blocks from a template function
333 ),
318334 metadata, ;; Source directory (including trailing slash) & file pair
319 metadata, ;; Reference to context descriptor
320 i32, ;; Line number
321 i32, ;; Column number
322 i32 ;; Unique ID to identify blocks from a template function
335 metadata ;; Reference to context descriptor
323336 }
324337
325338 This descriptor provides debug information about nested blocks within a
329342 .. code-block:: llvm
330343
331344 !3 = metadata !{
332 i32, ;; Tag = 11 (DW_TAG_lexical_block)
345 DIHeader(
346 i32, ;; Tag = 11 (DW_TAG_lexical_block)
347 i32 ;; DWARF path discriminator value
348 ),
333349 metadata, ;; Source directory (including trailing slash) & file pair
334350 metadata ;; Reference to the scope we're annotating with a file change
335 i32, ;; DWARF path discriminator value
336351 }
337352
338353 This descriptor provides a wrapper around a lexical scope to handle file
346361 .. code-block:: llvm
347362
348363 !4 = metadata !{
349 i32, ;; Tag = 36 (DW_TAG_base_type)
364 DIHeader(
365 i32, ;; Tag = 36 (DW_TAG_base_type)
366 mdstring, ;; Name (may be "" for anonymous types)
367 i32, ;; Line number where defined (may be 0)
368 i64, ;; Size in bits
369 i64, ;; Alignment in bits
370 i64, ;; Offset in bits
371 i32, ;; Flags
372 i32 ;; DWARF type encoding
373 ),
350374 metadata, ;; Source directory (including trailing slash) & file pair (may be null)
351 metadata, ;; Reference to context
352 metadata, ;; Name (may be "" for anonymous types)
353 i32, ;; Line number where defined (may be 0)
354 i64, ;; Size in bits
355 i64, ;; Alignment in bits
356 i64, ;; Offset in bits
357 i32, ;; Flags
358 i32 ;; DWARF type encoding
375 metadata ;; Reference to context
359376 }
360377
361378 These descriptors define primitive types used in the code. Example ``int``,
389406 .. code-block:: llvm
390407
391408 !5 = metadata !{
392 i32, ;; Tag (see below)
409 DIHeader(
410 i32, ;; Tag (see below)
411 mdstring, ;; Name (may be "" for anonymous types)
412 i32, ;; Line number where defined (may be 0)
413 i64, ;; Size in bits
414 i64, ;; Alignment in bits
415 i64, ;; Offset in bits
416 i32 ;; Flags to encode attributes, e.g. private
417 ),
393418 metadata, ;; Source directory (including trailing slash) & file pair (may be null)
394419 metadata, ;; Reference to context
395 metadata, ;; Name (may be "" for anonymous types)
396 i32, ;; Line number where defined (may be 0)
397 i64, ;; Size in bits
398 i64, ;; Alignment in bits
399 i64, ;; Offset in bits
400 i32, ;; Flags to encode attributes, e.g. private
401420 metadata, ;; Reference to type derived from
402 metadata, ;; (optional) Name of the Objective C property associated with
403 ;; Objective-C an ivar, or the type of which this
404 ;; pointer-to-member is pointing to members of.
405 metadata, ;; (optional) Name of the Objective C property getter selector.
406 metadata, ;; (optional) Name of the Objective C property setter selector.
407 i32 ;; (optional) Objective C property attributes.
421 metadata ;; (optional) Objective C property node
408422 }
409423
410424 These descriptors are used to define types derived from other types. The value
452466 .. code-block:: llvm
453467
454468 !6 = metadata !{
455 i32, ;; Tag (see below)
469 DIHeader(
470 i32, ;; Tag (see below)
471 mdstring, ;; Name (may be "" for anonymous types)
472 i32, ;; Line number where defined (may be 0)
473 i64, ;; Size in bits
474 i64, ;; Alignment in bits
475 i64, ;; Offset in bits
476 i32, ;; Flags
477 i32 ;; Runtime languages
478 ),
456479 metadata, ;; Source directory (including trailing slash) & file pair (may be null)
457480 metadata, ;; Reference to context
458 metadata, ;; Name (may be "" for anonymous types)
459 i32, ;; Line number where defined (may be 0)
460 i64, ;; Size in bits
461 i64, ;; Alignment in bits
462 i64, ;; Offset in bits
463 i32, ;; Flags
464481 metadata, ;; Reference to type derived from
465482 metadata, ;; Reference to array of member descriptors
466 i32, ;; Runtime languages
467483 metadata, ;; Base type containing the vtable pointer for this type
468484 metadata, ;; Template parameters
469 metadata ;; A unique identifier for type uniquing purpose (may be null)
485 mdstring ;; A unique identifier for type uniquing purpose (may be null)
470486 }
471487
472488 These descriptors are used to define types that are composed of 0 or more
528544 .. code-block:: llvm
529545
530546 !42 = metadata !{
531 i32, ;; Tag = 33 (DW_TAG_subrange_type)
532 i64, ;; Low value
533 i64 ;; High value
547 DIHeader(
548 i32, ;; Tag = 33 (DW_TAG_subrange_type)
549 i64, ;; Low value
550 i64 ;; High value
551 )
534552 }
535553
536554 These descriptors are used to define ranges of array subscripts for an array
547565 .. code-block:: llvm
548566
549567 !6 = metadata !{
550 i32, ;; Tag = 40 (DW_TAG_enumerator)
551 metadata, ;; Name
552 i64 ;; Value
568 DIHeader(
569 i32, ;; Tag = 40 (DW_TAG_enumerator)
570 mdstring, ;; Name
571 i64 ;; Value
572 )
553573 }
554574
555575 These descriptors are used to define members of an enumeration :ref:`composite
561581 .. code-block:: llvm
562582
563583 !7 = metadata !{
564 i32, ;; Tag (see below)
584 DIHeader(
585 i32, ;; Tag (see below)
586 mdstring, ;; Name
587 i32, ;; 24 bit - Line number where defined
588 ;; 8 bit - Argument number. 1 indicates 1st argument.
589 i32 ;; flags
590 ),
565591 metadata, ;; Context
566 metadata, ;; Name
567592 metadata, ;; Reference to file where defined
568 i32, ;; 24 bit - Line number where defined
569 ;; 8 bit - Argument number. 1 indicates 1st argument.
570593 metadata, ;; Reference to the type descriptor
571 i32, ;; flags
572594 metadata ;; (optional) Reference to inline location
573 metadata ;; (optional) Reference to a complex expression.
574595 }
575596
576597 These descriptors are used to define variables local to a sub program. The
2424 #include "llvm/IR/Metadata.h"
2525 #include "llvm/Support/Casting.h"
2626 #include "llvm/Support/Dwarf.h"
27 #include "llvm/Support/ErrorHandling.h"
28 #include
2729
2830 namespace llvm {
2931 class BasicBlock;
5456 /// Maps from type identifier to the actual MDNode.
5557 typedef DenseMap DITypeIdentifierMap;
5658
59 class DIHeaderFieldIterator
60 : public std::iterator
61 const StringRef *, StringRef> {
62 StringRef Header;
63 StringRef Current;
64
65 public:
66 DIHeaderFieldIterator() {}
67 DIHeaderFieldIterator(StringRef Header)
68 : Header(Header), Current(Header.slice(0, Header.find('\0'))) {}
69 StringRef operator*() const { return Current; }
70 const StringRef * operator->() const { return &Current; }
71 DIHeaderFieldIterator &operator++() {
72 increment();
73 return *this;
74 }
75 DIHeaderFieldIterator operator++(int) {
76 DIHeaderFieldIterator X(*this);
77 increment();
78 return X;
79 }
80 bool operator==(const DIHeaderFieldIterator &X) const {
81 return Current.data() == X.Current.data();
82 }
83 bool operator!=(const DIHeaderFieldIterator &X) const {
84 return !(*this == X);
85 }
86
87 StringRef getHeader() const { return Header; }
88 StringRef getCurrent() const { return Current; }
89 StringRef getPrefix() const {
90 if (Current.begin() == Header.begin())
91 return StringRef();
92 return Header.slice(0, Current.begin() - Header.begin() - 1);
93 }
94 StringRef getSuffix() const {
95 if (Current.end() == Header.end())
96 return StringRef();
97 return Header.slice(Current.end() - Header.begin() + 1, StringRef::npos);
98 }
99
100 private:
101 void increment() {
102 assert(Current.data() != nullptr && "Cannot increment past the end");
103 StringRef Suffix = getSuffix();
104 Current = Suffix.slice(0, Suffix.find('\0'));
105 }
106 };
107
57108 /// DIDescriptor - A thin wraper around MDNode to access encoded debug info.
58109 /// This should not be stored in a container, because the underlying MDNode
59110 /// may change in certain situations.
125176 bool operator==(DIDescriptor Other) const { return DbgNode == Other.DbgNode; }
126177 bool operator!=(DIDescriptor Other) const { return !operator==(Other); }
127178
128 uint16_t getTag() const {
129 return getUnsignedField(0) & ~LLVMDebugVersionMask;
130 }
179 StringRef getHeader() const {
180 return getStringField(0);
181 }
182
183 size_t getNumHeaderFields() const {
184 return std::distance(DIHeaderFieldIterator(getHeader()),
185 DIHeaderFieldIterator());
186 }
187
188 StringRef getHeaderField(unsigned Index) const {
189 // Since callers expect an empty string for out-of-range accesses, we can't
190 // use std::advance() here.
191 for (DIHeaderFieldIterator I(getHeader()), E; I != E; ++I, --Index)
192 if (!Index)
193 return *I;
194 return StringRef();
195 }
196
197 template T getHeaderFieldAs(unsigned Index) const {
198 T Int;
199 if (getHeaderField(Index).getAsInteger(0, Int))
200 return 0;
201 return Int;
202 }
203
204 uint16_t getTag() const { return getHeaderFieldAs(0); }
131205
132206 bool isDerivedType() const;
133207 bool isCompositeType() const;
171245 public:
172246 explicit DISubrange(const MDNode *N = nullptr) : DIDescriptor(N) {}
173247
174 int64_t getLo() const { return getInt64Field(1); }
175 int64_t getCount() const { return getInt64Field(2); }
248 int64_t getLo() const { return getHeaderFieldAs(1); }
249 int64_t getCount() const { return getHeaderFieldAs(2); }
176250 bool Verify() const;
177251 };
178252
200274 public:
201275 explicit DIEnumerator(const MDNode *N = nullptr) : DIDescriptor(N) {}
202276
203 StringRef getName() const { return getStringField(1); }
204 int64_t getEnumValue() const { return getInt64Field(2); }
277 StringRef getName() const { return getHeaderField(1); }
278 int64_t getEnumValue() const { return getHeaderFieldAs(2); }
205279 bool Verify() const;
206280 };
207281
317391 bool Verify() const;
318392
319393 DIScopeRef getContext() const { return getFieldAs(2); }
320 StringRef getName() const { return getStringField(3); }
321 unsigned getLineNumber() const { return getUnsignedField(4); }
322 uint64_t getSizeInBits() const { return getUInt64Field(5); }
323 uint64_t getAlignInBits() const { return getUInt64Field(6); }
394 StringRef getName() const { return getHeaderField(1); }
395 unsigned getLineNumber() const {
396 return getHeaderFieldAs(2);
397 }
398 uint64_t getSizeInBits() const {
399 return getHeaderFieldAs(3);
400 }
401 uint64_t getAlignInBits() const {
402 return getHeaderFieldAs(4);
403 }
324404 // FIXME: Offset is only used for DW_TAG_member nodes. Making every type
325405 // carry this is just plain insane.
326 uint64_t getOffsetInBits() const { return getUInt64Field(7); }
327 unsigned getFlags() const { return getUnsignedField(8); }
406 uint64_t getOffsetInBits() const {
407 return getHeaderFieldAs(5);
408 }
409 unsigned getFlags() const { return getHeaderFieldAs(6); }
328410 bool isPrivate() const {
329411 return (getFlags() & FlagAccessibility) == FlagPrivate;
330412 }
364446 public:
365447 explicit DIBasicType(const MDNode *N = nullptr) : DIType(N) {}
366448
367 unsigned getEncoding() const { return getUnsignedField(9); }
449 unsigned getEncoding() const { return getHeaderFieldAs(7); }
368450
369451 /// Verify - Verify that a basic type descriptor is well formed.
370452 bool Verify() const;
380462 public:
381463 explicit DIDerivedType(const MDNode *N = nullptr) : DIType(N) {}
382464
383 DITypeRef getTypeDerivedFrom() const { return getFieldAs(9); }
465 DITypeRef getTypeDerivedFrom() const { return getFieldAs(3); }
384466
385467 /// getObjCProperty - Return property node, if this ivar is
386468 /// associated with one.
388470
389471 DITypeRef getClassType() const {
390472 assert(getTag() == dwarf::DW_TAG_ptr_to_member_type);
391 return getFieldAs(10);
473 return getFieldAs(4);
392474 }
393475
394476 Constant *getConstant() const {
395477 assert((getTag() == dwarf::DW_TAG_member) && isStaticMember());
396 return getConstantField(10);
478 return getConstantField(4);
397479 }
398480
399481 /// Verify - Verify that a derived type descriptor is well formed.
416498
417499 DIArray getElements() const {
418500 assert(!isSubroutineType() && "no elements for DISubroutineType");
419 return getFieldAs(10);
501 return getFieldAs(4);
420502 }
421503 template
422504 void setArrays(DITypedArray Elements, DIArray TParams = DIArray()) {
423 assert((!TParams || DbgNode->getNumOperands() == 15) &&
505 assert((!TParams || DbgNode->getNumOperands() == 8) &&
424506 "If you're setting the template parameters this should include a slot "
425507 "for that!");
426508 setArraysHelper(Elements, TParams);
427509 }
428 unsigned getRunTimeLang() const { return getUnsignedField(11); }
429 DITypeRef getContainingType() const { return getFieldAs(12); }
510 unsigned getRunTimeLang() const {
511 return getHeaderFieldAs(7);
512 }
513 DITypeRef getContainingType() const { return getFieldAs(5); }
430514 void setContainingType(DICompositeType ContainingType);
431 DIArray getTemplateParams() const { return getFieldAs(13); }
515 DIArray getTemplateParams() const { return getFieldAs(6); }
432516 MDString *getIdentifier() const;
433517
434518 /// Verify - Verify that a composite type descriptor is well formed.
439523 public:
440524 explicit DISubroutineType(const MDNode *N = nullptr) : DICompositeType(N) {}
441525 DITypedArray getTypeArray() const {
442 return getFieldAs>(10);
526 return getFieldAs>(4);
443527 }
444528 };
445529
462546 explicit DICompileUnit(const MDNode *N = nullptr) : DIScope(N) {}
463547
464548 dwarf::SourceLanguage getLanguage() const {
465 return static_cast(getUnsignedField(2));
466 }
467 StringRef getProducer() const { return getStringField(3); }
468
469 bool isOptimized() const { return getUnsignedField(4) != 0; }
470 StringRef getFlags() const { return getStringField(5); }
471 unsigned getRunTimeVersion() const { return getUnsignedField(6); }
549 return static_cast(getHeaderFieldAs(1));
550 }
551 StringRef getProducer() const { return getHeaderField(2); }
552
553 bool isOptimized() const { return getHeaderFieldAs(3) != 0; }
554 StringRef getFlags() const { return getHeaderField(4); }
555 unsigned getRunTimeVersion() const { return getHeaderFieldAs(5); }
472556
473557 DIArray getEnumTypes() const;
474558 DIArray getRetainedTypes() const;
476560 DIArray getGlobalVariables() const;
477561 DIArray getImportedEntities() const;
478562
479 StringRef getSplitDebugFilename() const { return getStringField(12); }
480 unsigned getEmissionKind() const { return getUnsignedField(13); }
563 StringRef getSplitDebugFilename() const { return getHeaderField(6); }
564 unsigned getEmissionKind() const { return getHeaderFieldAs(7); }
481565
482566 /// Verify - Verify that a compile unit is well formed.
483567 bool Verify() const;
491575 public:
492576 explicit DISubprogram(const MDNode *N = nullptr) : DIScope(N) {}
493577
494 DIScopeRef getContext() const { return getFieldAs(2); }
495 StringRef getName() const { return getStringField(3); }
496 StringRef getDisplayName() const { return getStringField(4); }
497 StringRef getLinkageName() const { return getStringField(5); }
498 unsigned getLineNumber() const { return getUnsignedField(6); }
499 DISubroutineType getType() const { return getFieldAs(7); }
578 StringRef getName() const { return getHeaderField(1); }
579 StringRef getDisplayName() const { return getHeaderField(2); }
580 StringRef getLinkageName() const { return getHeaderField(3); }
581 unsigned getLineNumber() const { return getHeaderFieldAs(4); }
500582
501583 /// isLocalToUnit - Return true if this subprogram is local to the current
502584 /// compile unit, like 'static' in C.
503 unsigned isLocalToUnit() const { return getUnsignedField(8); }
504 unsigned isDefinition() const { return getUnsignedField(9); }
505
506 unsigned getVirtuality() const { return getUnsignedField(10); }
507 unsigned getVirtualIndex() const { return getUnsignedField(11); }
508
509 DITypeRef getContainingType() const { return getFieldAs(12); }
510
511 unsigned getFlags() const { return getUnsignedField(13); }
512
513 unsigned isArtificial() const {
514 return (getUnsignedField(13) & FlagArtificial) != 0;
515 }
585 unsigned isLocalToUnit() const { return getHeaderFieldAs(5); }
586 unsigned isDefinition() const { return getHeaderFieldAs(6); }
587
588 unsigned getVirtuality() const { return getHeaderFieldAs(7); }
589 unsigned getVirtualIndex() const { return getHeaderFieldAs(8); }
590
591 unsigned getFlags() const { return getHeaderFieldAs(9); }
592
593 unsigned isOptimized() const { return getHeaderFieldAs(10); }
594
595 /// getScopeLineNumber - Get the beginning of the scope of the
596 /// function, not necessarily where the name of the program
597 /// starts.
598 unsigned getScopeLineNumber() const { return getHeaderFieldAs(11); }
599
600 DIScopeRef getContext() const { return getFieldAs(2); }
601 DISubroutineType getType() const { return getFieldAs(3); }
602
603 DITypeRef getContainingType() const { return getFieldAs(4); }
604
605 /// Verify - Verify that a subprogram descriptor is well formed.
606 bool Verify() const;
607
608 /// describes - Return true if this subprogram provides debugging
609 /// information for the function F.
610 bool describes(const Function *F);
611
612 Function *getFunction() const { return getFunctionField(5); }
613 void replaceFunction(Function *F) { replaceFunctionField(5, F); }
614 DIArray getTemplateParams() const { return getFieldAs(6); }
615 DISubprogram getFunctionDeclaration() const {
616 return getFieldAs(7);
617 }
618 MDNode *getVariablesNodes() const;
619 DIArray getVariables() const;
620
621 unsigned isArtificial() const { return (getFlags() & FlagArtificial) != 0; }
516622 /// isPrivate - Return true if this subprogram has "private"
517623 /// access specifier.
518624 bool isPrivate() const {
529635 return (getFlags() & FlagAccessibility) == FlagPublic;
530636 }
531637 /// isExplicit - Return true if this subprogram is marked as explicit.
532 bool isExplicit() const { return (getUnsignedField(13) & FlagExplicit) != 0; }
638 bool isExplicit() const { return (getFlags() & FlagExplicit) != 0; }
533639 /// isPrototyped - Return true if this subprogram is prototyped.
534 bool isPrototyped() const {
535 return (getUnsignedField(13) & FlagPrototyped) != 0;
536 }
640 bool isPrototyped() const { return (getFlags() & FlagPrototyped) != 0; }
537641
538642 /// Return true if this subprogram is a C++11 reference-qualified
539643 /// non-static member function (void foo() &).
540644 unsigned isLValueReference() const {
541 return (getUnsignedField(13) & FlagLValueReference) != 0;
645 return (getFlags() & FlagLValueReference) != 0;
542646 }
543647
544648 /// Return true if this subprogram is a C++11
545649 /// rvalue-reference-qualified non-static member function
546650 /// (void foo() &&).
547651 unsigned isRValueReference() const {
548 return (getUnsignedField(13) & FlagRValueReference) != 0;
549 }
550
551 unsigned isOptimized() const;
552
553 /// Verify - Verify that a subprogram descriptor is well formed.
554 bool Verify() const;
555
556 /// describes - Return true if this subprogram provides debugging
557 /// information for the function F.
558 bool describes(const Function *F);
559
560 Function *getFunction() const { return getFunctionField(15); }
561 void replaceFunction(Function *F) { replaceFunctionField(15, F); }
562 DIArray getTemplateParams() const { return getFieldAs(16); }
563 DISubprogram getFunctionDeclaration() const {
564 return getFieldAs(17);
565 }
566 MDNode *getVariablesNodes() const;
567 DIArray getVariables() const;
568
569 /// getScopeLineNumber - Get the beginning of the scope of the
570 /// function, not necessarily where the name of the program
571 /// starts.
572 unsigned getScopeLineNumber() const { return getUnsignedField(19); }
652 return (getFlags() & FlagRValueReference) != 0;
653 }
654
573655 };
574656
575657 /// DILexicalBlock - This is a wrapper for a lexical block.
577659 public:
578660 explicit DILexicalBlock(const MDNode *N = nullptr) : DIScope(N) {}
579661 DIScope getContext() const { return getFieldAs(2); }
580 unsigned getLineNumber() const { return getUnsignedField(3); }
581 unsigned getColumnNumber() const { return getUnsignedField(4); }
662 unsigned getLineNumber() const {
663 return getHeaderFieldAs(1);
664 }
665 unsigned getColumnNumber() const {
666 return getHeaderFieldAs(2);
667 }
582668 bool Verify() const;
583669 };
584670
595681 unsigned getLineNumber() const { return getScope().getLineNumber(); }
596682 unsigned getColumnNumber() const { return getScope().getColumnNumber(); }
597683 DILexicalBlock getScope() const { return getFieldAs(2); }
598 unsigned getDiscriminator() const { return getUnsignedField(3); }
684 unsigned getDiscriminator() const { return getHeaderFieldAs(1); }
599685 bool Verify() const;
600686 };
601687
606692
607693 public:
608694 explicit DINameSpace(const MDNode *N = nullptr) : DIScope(N) {}
695 StringRef getName() const { return getHeaderField(1); }
696 unsigned getLineNumber() const { return getHeaderFieldAs(2); }
609697 DIScope getContext() const { return getFieldAs(2); }
610 StringRef getName() const { return getStringField(3); }
611 unsigned getLineNumber() const { return getUnsignedField(4); }
612698 bool Verify() const;
613699 };
614700
618704 explicit DITemplateTypeParameter(const MDNode *N = nullptr)
619705 : DIDescriptor(N) {}
620706
707 StringRef getName() const { return getHeaderField(1); }
708 unsigned getLineNumber() const { return getHeaderFieldAs(2); }
709 unsigned getColumnNumber() const { return getHeaderFieldAs(3); }
710
621711 DIScopeRef getContext() const { return getFieldAs(1); }
622 StringRef getName() const { return getStringField(2); }
623 DITypeRef getType() const { return getFieldAs(3); }
712 DITypeRef getType() const { return getFieldAs(2); }
713 StringRef getFilename() const { return getFieldAs(3).getFilename(); }
714 StringRef getDirectory() const {
715 return getFieldAs(3).getDirectory();
716 }
717 bool Verify() const;
718 };
719
720 /// DITemplateValueParameter - This is a wrapper for template value parameter.
721 class DITemplateValueParameter : public DIDescriptor {
722 public:
723 explicit DITemplateValueParameter(const MDNode *N = nullptr)
724 : DIDescriptor(N) {}
725
726 StringRef getName() const { return getHeaderField(1); }
727 unsigned getLineNumber() const { return getHeaderFieldAs(2); }
728 unsigned getColumnNumber() const { return getHeaderFieldAs(3); }
729
730 DIScopeRef getContext() const { return getFieldAs(1); }
731 DITypeRef getType() const { return getFieldAs(2); }
732 Value *getValue() const;
624733 StringRef getFilename() const { return getFieldAs(4).getFilename(); }
625734 StringRef getDirectory() const {
626735 return getFieldAs(4).getDirectory();
627736 }
628 unsigned getLineNumber() const { return getUnsignedField(5); }
629 unsigned getColumnNumber() const { return getUnsignedField(6); }
630 bool Verify() const;
631 };
632
633 /// DITemplateValueParameter - This is a wrapper for template value parameter.
634 class DITemplateValueParameter : public DIDescriptor {
635 public:
636 explicit DITemplateValueParameter(const MDNode *N = nullptr)
637 : DIDescriptor(N) {}
638
639 DIScopeRef getContext() const { return getFieldAs(1); }
640 StringRef getName() const { return getStringField(2); }
641 DITypeRef getType() const { return getFieldAs(3); }
642 Value *getValue() const;
643 StringRef getFilename() const { return getFieldAs(5).getFilename(); }
644 StringRef getDirectory() const {
645 return getFieldAs(5).getDirectory();
646 }
647 unsigned getLineNumber() const { return getUnsignedField(6); }
648 unsigned getColumnNumber() const { return getUnsignedField(7); }
649737 bool Verify() const;
650738 };
651739
657745 public:
658746 explicit DIGlobalVariable(const MDNode *N = nullptr) : DIDescriptor(N) {}
659747
660 DIScope getContext() const { return getFieldAs(2); }
661 StringRef getName() const { return getStringField(3); }
662 StringRef getDisplayName() const { return getStringField(4); }
663 StringRef getLinkageName() const { return getStringField(5); }
664 StringRef getFilename() const { return getFieldAs(6).getFilename(); }
748 StringRef getName() const { return getHeaderField(1); }
749 StringRef getDisplayName() const { return getHeaderField(2); }
750 StringRef getLinkageName() const { return getHeaderField(3); }
751 unsigned getLineNumber() const { return getHeaderFieldAs(4); }
752 unsigned isLocalToUnit() const { return getHeaderFieldAs(5); }
753 unsigned isDefinition() const { return getHeaderFieldAs(6); }
754
755 DIScope getContext() const { return getFieldAs(1); }
756 StringRef getFilename() const { return getFieldAs(2).getFilename(); }
665757 StringRef getDirectory() const {
666 return getFieldAs(6).getDirectory();
667 }
668
669 unsigned getLineNumber() const { return getUnsignedField(7); }
670 DITypeRef getType() const { return getFieldAs(8); }
671 unsigned isLocalToUnit() const { return getUnsignedField(9); }
672 unsigned isDefinition() const { return getUnsignedField(10); }
673
674 GlobalVariable *getGlobal() const { return getGlobalVariableField(11); }
675 Constant *getConstant() const { return getConstantField(11); }
758 return getFieldAs(2).getDirectory();
759 }
760 DITypeRef getType() const { return getFieldAs(3); }
761
762 GlobalVariable *getGlobal() const { return getGlobalVariableField(4); }
763 Constant *getConstant() const { return getConstantField(4); }
676764 DIDerivedType getStaticDataMemberDeclaration() const {
677 return getFieldAs(12);
765 return getFieldAs(5);
678766 }
679767
680768 /// Verify - Verify that a global variable descriptor is well formed.
690778 public:
691779 explicit DIVariable(const MDNode *N = nullptr) : DIDescriptor(N) {}
692780
781 StringRef getName() const { return getHeaderField(1); }
782 unsigned getLineNumber() const {
783 // FIXME: Line number and arg number shouldn't be merged together like this.
784 return (getHeaderFieldAs(2) << 8) >> 8;
785 }
786 unsigned getArgNumber() const { return getHeaderFieldAs(2) >> 24; }
787
693788 DIScope getContext() const { return getFieldAs(1); }
694 StringRef getName() const { return getStringField(2); }
695 DIFile getFile() const { return getFieldAs(3); }
696 unsigned getLineNumber() const { return (getUnsignedField(4) << 8) >> 8; }
697 unsigned getArgNumber() const {
698 unsigned L = getUnsignedField(4);
699 return L >> 24;
700 }
701 DITypeRef getType() const { return getFieldAs(5); }
789 DIFile getFile() const { return getFieldAs(2); }
790 DITypeRef getType() const { return getFieldAs(3); }
702791
703792 /// isArtificial - Return true if this variable is marked as "artificial".
704793 bool isArtificial() const {
705 return (getUnsignedField(6) & FlagArtificial) != 0;
794 return (getHeaderFieldAs(3) & FlagArtificial) != 0;
706795 }
707796
708797 bool isObjectPointer() const {
709 return (getUnsignedField(6) & FlagObjectPointer) != 0;
798 return (getHeaderFieldAs(3) & FlagObjectPointer) != 0;
710799 }
711800
712801 /// \brief Return true if this variable is represented as a pointer.
713802 bool isIndirect() const {
714 return (getUnsignedField(6) & FlagIndirectVariable) != 0;
803 return (getHeaderFieldAs(3) & FlagIndirectVariable) != 0;
715804 }
716805
717806 /// getInlinedAt - If this variable is inlined then return inline location.
751840 unsigned getNumElements() const {
752841 if (!DbgNode)
753842 return 0;
754 unsigned N = DbgNode->getNumOperands();
843 unsigned N = getNumHeaderFields();
755844 assert(N > 0 && "missing tag");
756845 return N - 1;
757846 }
811900 public:
812901 explicit DIObjCProperty(const MDNode *N) : DIDescriptor(N) {}
813902
814 StringRef getObjCPropertyName() const { return getStringField(1); }
815 DIFile getFile() const { return getFieldAs(2); }
816 unsigned getLineNumber() const { return getUnsignedField(3); }
817
818 StringRef getObjCPropertyGetterName() const { return getStringField(4); }
819 StringRef getObjCPropertySetterName() const { return getStringField(5); }
903 StringRef getObjCPropertyName() const { return getHeaderField(1); }
904 DIFile getFile() const { return getFieldAs(1); }
905 unsigned getLineNumber() const { return getHeaderFieldAs(2); }
906
907 StringRef getObjCPropertyGetterName() const { return getHeaderField(3); }
908 StringRef getObjCPropertySetterName() const { return getHeaderField(4); }
909 unsigned getAttributes() const { return getHeaderFieldAs(5); }
820910 bool isReadOnlyObjCProperty() const {
821 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_readonly) != 0;
911 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_readonly) != 0;
822912 }
823913 bool isReadWriteObjCProperty() const {
824 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_readwrite) != 0;
914 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_readwrite) != 0;
825915 }
826916 bool isAssignObjCProperty() const {
827 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_assign) != 0;
917 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_assign) != 0;
828918 }
829919 bool isRetainObjCProperty() const {
830 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_retain) != 0;
920 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_retain) != 0;
831921 }
832922 bool isCopyObjCProperty() const {
833 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_copy) != 0;
923 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_copy) != 0;
834924 }
835925 bool isNonAtomicObjCProperty() const {
836 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_nonatomic) != 0;
926 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_nonatomic) != 0;
837927 }
838928
839929 /// Objective-C doesn't have an ODR, so there is no benefit in storing
840930 /// the type as a DITypeRef here.
841 DIType getType() const { return getFieldAs(7); }
931 DIType getType() const { return getFieldAs(2); }
842932
843933 /// Verify - Verify that a derived type descriptor is well formed.
844934 bool Verify() const;
853943 explicit DIImportedEntity(const MDNode *N) : DIDescriptor(N) {}
854944 DIScope getContext() const { return getFieldAs(1); }
855945 DIScopeRef getEntity() const { return getFieldAs(2); }
856 unsigned getLineNumber() const { return getUnsignedField(3); }
857 StringRef getName() const { return getStringField(4); }
946 unsigned getLineNumber() const { return getHeaderFieldAs(1); }
947 StringRef getName() const { return getHeaderField(2); }
858948 bool Verify() const;
859949 };
860950
3030
3131
3232 enum LLVMConstants : uint32_t {
33 DEBUG_METADATA_VERSION = 1 // Current debug info version number.
33 DEBUG_METADATA_VERSION = 2 // Current debug info version number.
3434 };
3535
3636 //===----------------------------------------------------------------------===//
17121712 // it is not a static member.
17131713 if (!IsStaticMember)
17141714 addConstantValue(*VariableDIE, CI, GTy);
1715 } else if (const ConstantExpr *CE = getMergedGlobalExpr(GV->getOperand(11))) {
1715 } else if (const ConstantExpr *CE = getMergedGlobalExpr(GV.getConstant())) {
17161716 addToAccelTable = true;
17171717 // GV is a merged global.
17181718 DIELoc *Loc = new (DIEValueAllocator) DIELoc();
16421642 if (isDebugValue() && MO.isMetadata()) {
16431643 // Pretty print DBG_VALUE instructions.
16441644 const MDNode *MD = MO.getMetadata();
1645 if (MD->getNumOperands() >= 2)
1646 if (const MDString *MDS = dyn_cast(MD->getOperand(2)))
1647 OS << "!\"" << MDS->getString() << '\"';
1648 else
1649 MO.print(OS, TM);
1645 DIDescriptor DI(MD);
1646 DIVariable DIV(MD);
1647
1648 if (DI.isVariable() && !DIV.getName().empty())
1649 OS << "!\"" << DIV.getName() << '\"';
16501650 else
16511651 MO.print(OS, TM);
16521652 } else if (TM && (isInsertSubreg() || isRegSequence()) && MO.isImm()) {
23392339 return;
23402340
23412341 Value *Op = Node->getOperand(0);
2342 if (!Op || !isa<ConstantInt>(Op) || cast(Op)->getBitWidth() < 32)
2342 if (!Op || !isa<MDString>(Op))
23432343 return;
23442344
23452345 DIDescriptor Desc(Node);
2222 using namespace llvm;
2323 using namespace llvm::dwarf;
2424
25 static Constant *GetTagConstant(LLVMContext &VMContext, unsigned Tag) {
26 assert((Tag & LLVMDebugVersionMask) == 0 &&
27 "Tag too large for debug encoding!");
28 return ConstantInt::get(Type::getInt32Ty(VMContext), Tag | LLVMDebugVersion);
25 namespace {
26 class HeaderBuilder {
27 SmallVector Chars;
28
29 public:
30 explicit HeaderBuilder(Twine T) { T.toVector(Chars); }
31 HeaderBuilder(const HeaderBuilder &X) : Chars(X.Chars) {}
32 HeaderBuilder(HeaderBuilder &&X) : Chars(std::move(X.Chars)) {}
33
34 template HeaderBuilder &concat(Twineable &&X) {
35 Chars.push_back(0);
36 Twine(X).toVector(Chars);
37 return *this;
38 }
39
40 MDString *get(LLVMContext &Context) const {
41 return MDString::get(Context, StringRef(Chars.begin(), Chars.size()));
42 }
43
44 static HeaderBuilder get(unsigned Tag) {
45 return HeaderBuilder("0x" + Twine::utohexstr(Tag));
46 }
47 };
2948 }
3049
3150 DIBuilder::DIBuilder(Module &m)
105124 "Invalid Language tag");
106125 assert(!Filename.empty() &&
107126 "Unable to create compile unit without filename");
108 Value *TElts[] = { GetTagConstant(VMContext, DW_TAG_base_type) };
127 Value *TElts[] = {HeaderBuilder::get(DW_TAG_base_type).get(VMContext)};
109128 TempEnumTypes = MDNode::getTemporary(VMContext, TElts);
110129
111130 TempRetainTypes = MDNode::getTemporary(VMContext, TElts);
116135
117136 TempImportedModules = MDNode::getTemporary(VMContext, TElts);
118137
119 Value *Elts[] = {
120 GetTagConstant(VMContext, dwarf::DW_TAG_compile_unit),
121 createFilePathPair(VMContext, Filename, Directory),
122 ConstantInt::get(Type::getInt32Ty(VMContext), Lang),
123 MDString::get(VMContext, Producer),
124 ConstantInt::get(Type::getInt1Ty(VMContext), isOptimized),
125 MDString::get(VMContext, Flags),
126 ConstantInt::get(Type::getInt32Ty(VMContext), RunTimeVer),
127 TempEnumTypes,
128 TempRetainTypes,
129 TempSubprograms,
130 TempGVs,
131 TempImportedModules,
132 MDString::get(VMContext, SplitName),
133 ConstantInt::get(Type::getInt32Ty(VMContext), Kind)
134 };
138 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_compile_unit)
139 .concat(Lang)
140 .concat(Producer)
141 .concat(isOptimized)
142 .concat(Flags)
143 .concat(RunTimeVer)
144 .concat(SplitName)
145 .concat(Kind)
146 .get(VMContext),
147 createFilePathPair(VMContext, Filename, Directory),
148 TempEnumTypes, TempRetainTypes, TempSubprograms, TempGVs,
149 TempImportedModules};
135150
136151 MDNode *CUNode = MDNode::get(VMContext, Elts);
137152
153168 Value *NS, unsigned Line, StringRef Name,
154169 SmallVectorImpl> &AllImportedModules) {
155170 const MDNode *R;
156 if (Name.empty()) {
157 Value *Elts[] = {
158 GetTagConstant(C, Tag),
159 Context,
160 NS,
161 ConstantInt::get(Type::getInt32Ty(C), Line),
162 };
163 R = MDNode::get(C, Elts);
164 } else {
165 Value *Elts[] = {
166 GetTagConstant(C, Tag),
167 Context,
168 NS,
169 ConstantInt::get(Type::getInt32Ty(C), Line),
170 MDString::get(C, Name)
171 };
172 R = MDNode::get(C, Elts);
173 }
171 Value *Elts[] = {HeaderBuilder::get(Tag).concat(Line).concat(Name).get(C),
172 Context, NS};
173 R = MDNode::get(C, Elts);
174174 DIImportedEntity M(R);
175175 assert(M.Verify() && "Imported module should be valid");
176176 AllImportedModules.push_back(TrackingVH(M));
207207 }
208208
209209 DIFile DIBuilder::createFile(StringRef Filename, StringRef Directory) {
210 Value *Elts[] = {
211 GetTagConstant(VMContext, dwarf::DW_TAG_file_type),
212 createFilePathPair(VMContext, Filename, Directory)
213 };
210 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_file_type).get(VMContext),
211 createFilePathPair(VMContext, Filename, Directory)};
214212 return DIFile(MDNode::get(VMContext, Elts));
215213 }
216214
217215 DIEnumerator DIBuilder::createEnumerator(StringRef Name, int64_t Val) {
218216 assert(!Name.empty() && "Unable to create enumerator without name");
219217 Value *Elts[] = {
220 GetTagConstant(VMContext, dwarf::DW_TAG_enumerator),
221 MDString::get(VMContext, Name),
222 ConstantInt::get(Type::getInt64Ty(VMContext), Val)
223 };
218 HeaderBuilder::get(dwarf::DW_TAG_enumerator).concat(Name).concat(Val).get(
219 VMContext)};
224220 return DIEnumerator(MDNode::get(VMContext, Elts));
225221 }
226222
229225 // Unspecified types are encoded in DIBasicType format. Line number, filename,
230226 // size, alignment, offset and flags are always empty here.
231227 Value *Elts[] = {
232 GetTagConstant(VMContext, dwarf::DW_TAG_unspecified_type),
233 nullptr, // Filename
234 nullptr, // Unused
235 MDString::get(VMContext, Name),
236 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
237 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
238 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
239 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
240 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags;
241 ConstantInt::get(Type::getInt32Ty(VMContext), 0) // Encoding
228 HeaderBuilder::get(dwarf::DW_TAG_unspecified_type)
229 .concat(Name)
230 .concat(0)
231 .concat(0)
232 .concat(0)
233 .concat(0)
234 .concat(0)
235 .concat(0)
236 .get(VMContext),
237 nullptr, // Filename
238 nullptr // Unused
242239 };
243240 return DIBasicType(MDNode::get(VMContext, Elts));
244241 }
254251 // Basic types are encoded in DIBasicType format. Line number, filename,
255252 // offset and flags are always empty here.
256253 Value *Elts[] = {
257 GetTagConstant(VMContext, dwarf::DW_TAG_base_type),
258 nullptr, // File/directory name
259 nullptr, // Unused
260 MDString::get(VMContext, Name),
261 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
262 ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
263 ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
264 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
265 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags;
266 ConstantInt::get(Type::getInt32Ty(VMContext), Encoding)
254 HeaderBuilder::get(dwarf::DW_TAG_base_type)
255 .concat(Name)
256 .concat(0) // Line
257 .concat(SizeInBits)
258 .concat(AlignInBits)
259 .concat(0) // Offset
260 .concat(0) // Flags
261 .concat(Encoding)
262 .get(VMContext),
263 nullptr, // Filename
264 nullptr // Unused
267265 };
268266 return DIBasicType(MDNode::get(VMContext, Elts));
269267 }
270268
271269 DIDerivedType DIBuilder::createQualifiedType(unsigned Tag, DIType FromTy) {
272270 // Qualified types are encoded in DIDerivedType format.
273 Value *Elts[] = {
274 GetTagConstant(VMContext, Tag),
275 nullptr, // Filename
276 nullptr, // Unused
277 MDString::get(VMContext, StringRef()), // Empty name.
278 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
279 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
280 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
281 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
282 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags
283 FromTy.getRef()
284 };
271 Value *Elts[] = {HeaderBuilder::get(Tag)
272 .concat(StringRef()) // Name
273 .concat(0) // Line
274 .concat(0) // Size
275 .concat(0) // Align
276 .concat(0) // Offset
277 .concat(0) // Flags
278 .get(VMContext),
279 nullptr, // Filename
280 nullptr, // Unused
281 FromTy.getRef()};
285282 return DIDerivedType(MDNode::get(VMContext, Elts));
286283 }
287284
289286 DIBuilder::createPointerType(DIType PointeeTy, uint64_t SizeInBits,
290287 uint64_t AlignInBits, StringRef Name) {
291288 // Pointer types are encoded in DIDerivedType format.
292 Value *Elts[] = {
293 GetTagConstant(VMContext, dwarf::DW_TAG_pointer_type),
294 nullptr, // Filename
295 nullptr, // Unused
296 MDString::get(VMContext, Name),
297 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
298 ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
299 ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
300 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
301 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags
302 PointeeTy.getRef()
303 };
289 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_pointer_type)
290 .concat(Name)
291 .concat(0) // Line
292 .concat(SizeInBits)
293 .concat(AlignInBits)
294 .concat(0) // Offset
295 .concat(0) // Flags
296 .get(VMContext),
297 nullptr, // Filename
298 nullptr, // Unused
299 PointeeTy.getRef()};
304300 return DIDerivedType(MDNode::get(VMContext, Elts));
305301 }
306302
307303 DIDerivedType DIBuilder::createMemberPointerType(DIType PointeeTy,
308304 DIType Base) {
309305 // Pointer types are encoded in DIDerivedType format.
310 Value *Elts[] = {
311 GetTagConstant(VMContext, dwarf::DW_TAG_ptr_to_member_type),
312 nullptr, // Filename
313 nullptr, // Unused
314 nullptr,
315 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
316 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
317 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
318 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
319 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags
320 PointeeTy.getRef(),
321 Base.getRef()
322 };
306 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_ptr_to_member_type)
307 .concat(StringRef())
308 .concat(0) // Line
309 .concat(0) // Size
310 .concat(0) // Align
311 .concat(0) // Offset
312 .concat(0) // Flags
313 .get(VMContext),
314 nullptr, // Filename
315 nullptr, // Unused
316 PointeeTy.getRef(), Base.getRef()};
323317 return DIDerivedType(MDNode::get(VMContext, Elts));
324318 }
325319
326320 DIDerivedType DIBuilder::createReferenceType(unsigned Tag, DIType RTy) {
327321 assert(RTy.isType() && "Unable to create reference type");
328322 // References are encoded in DIDerivedType format.
329 Value *Elts[] = {
330 GetTagConstant(VMContext, Tag),
331 nullptr, // Filename
332 nullptr, // TheCU,
333 nullptr, // Name
334 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
335 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
336 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
337 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
338 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags
339 RTy.getRef()
340 };
323 Value *Elts[] = {HeaderBuilder::get(Tag)
324 .concat(StringRef()) // Name
325 .concat(0) // Line
326 .concat(0) // Size
327 .concat(0) // Align
328 .concat(0) // Offset
329 .concat(0) // Flags
330 .get(VMContext),
331 nullptr, // Filename
332 nullptr, // TheCU,
333 RTy.getRef()};
341334 return DIDerivedType(MDNode::get(VMContext, Elts));
342335 }
343336
344337 DIDerivedType DIBuilder::createTypedef(DIType Ty, StringRef Name, DIFile File,
345338 unsigned LineNo, DIDescriptor Context) {
346339 // typedefs are encoded in DIDerivedType format.
347 Value *Elts[] = {
348 GetTagConstant(VMContext, dwarf::DW_TAG_typedef),
349 File.getFileNode(),
350 DIScope(getNonCompileUnitScope(Context)).getRef(),
351 MDString::get(VMContext, Name),
352 ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
353 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
354 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
355 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
356 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags
357 Ty.getRef()
358 };
340 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_typedef)
341 .concat(Name)
342 .concat(LineNo)
343 .concat(0) // Size
344 .concat(0) // Align
345 .concat(0) // Offset
346 .concat(0) // Flags
347 .get(VMContext),
348 File.getFileNode(),
349 DIScope(getNonCompileUnitScope(Context)).getRef(),
350 Ty.getRef()};
359351 return DIDerivedType(MDNode::get(VMContext, Elts));
360352 }
361353
363355 // typedefs are encoded in DIDerivedType format.
364356 assert(Ty.isType() && "Invalid type!");
365357 assert(FriendTy.isType() && "Invalid friend type!");
366 Value *Elts[] = {
367 GetTagConstant(VMContext, dwarf::DW_TAG_friend),
368 nullptr,
369 Ty.getRef(),
370 nullptr, // Name
371 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
372 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
373 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
374 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
375 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags
376 FriendTy.getRef()
377 };
358 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_friend)
359 .concat(StringRef()) // Name
360 .concat(0) // Line
361 .concat(0) // Size
362 .concat(0) // Align
363 .concat(0) // Offset
364 .concat(0) // Flags
365 .get(VMContext),
366 nullptr, Ty.getRef(), FriendTy.getRef()};
378367 return DIDerivedType(MDNode::get(VMContext, Elts));
379368 }
380369
383372 unsigned Flags) {
384373 assert(Ty.isType() && "Unable to create inheritance");
385374 // TAG_inheritance is encoded in DIDerivedType format.
386 Value *Elts[] = {
387 GetTagConstant(VMContext, dwarf::DW_TAG_inheritance),
388 nullptr,
389 Ty.getRef(),
390 nullptr, // Name
391 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
392 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
393 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
394 ConstantInt::get(Type::getInt64Ty(VMContext), BaseOffset),
395 ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
396 BaseTy.getRef()
397 };
375 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_inheritance)
376 .concat(StringRef()) // Name
377 .concat(0) // Line
378 .concat(0) // Size
379 .concat(0) // Align
380 .concat(BaseOffset)
381 .concat(Flags)
382 .get(VMContext),
383 nullptr, Ty.getRef(), BaseTy.getRef()};
398384 return DIDerivedType(MDNode::get(VMContext, Elts));
399385 }
400386
405391 uint64_t OffsetInBits, unsigned Flags,
406392 DIType Ty) {
407393 // TAG_member is encoded in DIDerivedType format.
408 Value *Elts[] = {
409 GetTagConstant(VMContext, dwarf::DW_TAG_member),
410 File.getFileNode(),
411 DIScope(getNonCompileUnitScope(Scope)).getRef(),
412 MDString::get(VMContext, Name),
413 ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
414 ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
415 ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
416 ConstantInt::get(Type::getInt64Ty(VMContext), OffsetInBits),
417 ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
418 Ty.getRef()
419 };
394 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_member)
395 .concat(Name)
396 .concat(LineNumber)
397 .concat(SizeInBits)
398 .concat(AlignInBits)
399 .concat(OffsetInBits)
400 .concat(Flags)
401 .get(VMContext),
402 File.getFileNode(),
403 DIScope(getNonCompileUnitScope(Scope)).getRef(),
404 Ty.getRef()};
420405 return DIDerivedType(MDNode::get(VMContext, Elts));
421406 }
422407
427412 llvm::Value *Val) {
428413 // TAG_member is encoded in DIDerivedType format.
429414 Flags |= DIDescriptor::FlagStaticMember;
430 Value *Elts[] = {
431 GetTagConstant(VMContext, dwarf::DW_TAG_member),
432 File.getFileNode(),
433 DIScope(getNonCompileUnitScope(Scope)).getRef(),
434 MDString::get(VMContext, Name),
435 ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
436 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
437 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
438 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
439 ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
440 Ty.getRef(),
441 Val
442 };
415 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_member)
416 .concat(Name)
417 .concat(LineNumber)
418 .concat(0) // Size
419 .concat(0) // Align
420 .concat(0) // Offset
421 .concat(Flags)
422 .get(VMContext),
423 File.getFileNode(),
424 DIScope(getNonCompileUnitScope(Scope)).getRef(), Ty.getRef(),
425 Val};
443426 return DIDerivedType(MDNode::get(VMContext, Elts));
444427 }
445428
450433 uint64_t OffsetInBits, unsigned Flags,
451434 DIType Ty, MDNode *PropertyNode) {
452435 // TAG_member is encoded in DIDerivedType format.
453 Value *Elts[] = {
454 GetTagConstant(VMContext, dwarf::DW_TAG_member),
455 File.getFileNode(),
456 getNonCompileUnitScope(File),
457 MDString::get(VMContext, Name),
458 ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
459 ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
460 ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
461 ConstantInt::get(Type::getInt64Ty(VMContext), OffsetInBits),
462 ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
463 Ty,
464 PropertyNode
465 };
436 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_member)
437 .concat(Name)
438 .concat(LineNumber)
439 .concat(SizeInBits)
440 .concat(AlignInBits)
441 .concat(OffsetInBits)
442 .concat(Flags)
443 .get(VMContext),
444 File.getFileNode(), getNonCompileUnitScope(File), Ty,
445 PropertyNode};
466446 return DIDerivedType(MDNode::get(VMContext, Elts));
467447 }
468448
470450 DIBuilder::createObjCProperty(StringRef Name, DIFile File, unsigned LineNumber,
471451 StringRef GetterName, StringRef SetterName,
472452 unsigned PropertyAttributes, DIType Ty) {
473 Value *Elts[] = {
474 GetTagConstant(VMContext, dwarf::DW_TAG_APPLE_property),
475 MDString::get(VMContext, Name),
476 File,
477 ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
478 MDString::get(VMContext, GetterName),
479 MDString::get(VMContext, SetterName),
480 ConstantInt::get(Type::getInt32Ty(VMContext), PropertyAttributes),
481 Ty
482 };
453 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_APPLE_property)
454 .concat(Name)
455 .concat(LineNumber)
456 .concat(GetterName)
457 .concat(SetterName)
458 .concat(PropertyAttributes)
459 .get(VMContext),
460 File, Ty};
483461 return DIObjCProperty(MDNode::get(VMContext, Elts));
484462 }
485463
487465 DIBuilder::createTemplateTypeParameter(DIDescriptor Context, StringRef Name,
488466 DIType Ty, MDNode *File, unsigned LineNo,
489467 unsigned ColumnNo) {
490 Value *Elts[] = {
491 GetTagConstant(VMContext, dwarf::DW_TAG_template_type_parameter),
492 DIScope(getNonCompileUnitScope(Context)).getRef(),
493 MDString::get(VMContext, Name),
494 Ty.getRef(),
495 File,
496 ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
497 ConstantInt::get(Type::getInt32Ty(VMContext), ColumnNo)
498 };
468 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_template_type_parameter)
469 .concat(Name)
470 .concat(LineNo)
471 .concat(ColumnNo)
472 .get(VMContext),
473 DIScope(getNonCompileUnitScope(Context)).getRef(),
474 Ty.getRef(), File};
499475 return DITemplateTypeParameter(MDNode::get(VMContext, Elts));
500476 }
501477
506482 unsigned LineNo,
507483 unsigned ColumnNo) {
508484 Value *Elts[] = {
509 GetTagConstant(VMContext, Tag),
510 DIScope(getNonCompileUnitScope(Context)).getRef(),
511 MDString::get(VMContext, Name),
512 Ty.getRef(),
513 Val,
514 File,
515 ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
516 ConstantInt::get(Type::getInt32Ty(VMContext), ColumnNo)
517 };
485 HeaderBuilder::get(Tag).concat(Name).concat(LineNo).concat(ColumnNo).get(
486 VMContext),
487 DIScope(getNonCompileUnitScope(Context)).getRef(), Ty.getRef(), Val,
488 File};
518489 return DITemplateValueParameter(MDNode::get(VMContext, Elts));
519490 }
520491
562533 "createClassType should be called with a valid Context");
563534 // TAG_class_type is encoded in DICompositeType format.
564535 Value *Elts[] = {
565 GetTagConstant(VMContext, dwarf::DW_TAG_class_type),
566 File.getFileNode(),
567 DIScope(getNonCompileUnitScope(Context)).getRef(),
568 MDString::get(VMContext, Name),
569 ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
570 ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
571 ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
572 ConstantInt::get(Type::getInt32Ty(VMContext), OffsetInBits),
573 ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
574 DerivedFrom.getRef(),
575 Elements,
576 ConstantInt::get(Type::getInt32Ty(VMContext), 0),
577 VTableHolder.getRef(),
578 TemplateParams,
579 UniqueIdentifier.empty() ? nullptr
580 : MDString::get(VMContext, UniqueIdentifier)
581 };
536 HeaderBuilder::get(dwarf::DW_TAG_class_type)
537 .concat(Name)
538 .concat(LineNumber)
539 .concat(SizeInBits)
540 .concat(AlignInBits)
541 .concat(OffsetInBits)
542 .concat(Flags)
543 .concat(0)
544 .get(VMContext),
545 File.getFileNode(), DIScope(getNonCompileUnitScope(Context)).getRef(),
546 DerivedFrom.getRef(), Elements, VTableHolder.getRef(), TemplateParams,
547 UniqueIdentifier.empty() ? nullptr
548 : MDString::get(VMContext, UniqueIdentifier)};
582549 DICompositeType R(MDNode::get(VMContext, Elts));
583550 assert(R.isCompositeType() &&
584551 "createClassType should return a DICompositeType");
599566 StringRef UniqueIdentifier) {
600567 // TAG_structure_type is encoded in DICompositeType format.
601568 Value *Elts[] = {
602 GetTagConstant(VMContext, dwarf::DW_TAG_structure_type),
603 File.getFileNode(),
604 DIScope(getNonCompileUnitScope(Context)).getRef(),
605 MDString::get(VMContext, Name),
606 ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
607 ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
608 ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
609 ConstantInt::get(Type::getInt32Ty(VMContext), 0),
610 ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
611 DerivedFrom.getRef(),
612 Elements,
613 ConstantInt::get(Type::getInt32Ty(VMContext), RunTimeLang),
614 VTableHolder.getRef(),
615 nullptr,
616 UniqueIdentifier.empty() ? nullptr
617 : MDString::get(VMContext, UniqueIdentifier)
618 };
569 HeaderBuilder::get(dwarf::DW_TAG_structure_type)
570 .concat(Name)
571 .concat(LineNumber)
572 .concat(SizeInBits)
573 .concat(AlignInBits)
574 .concat(0)
575 .concat(Flags)
576 .concat(RunTimeLang)
577 .get(VMContext),
578 File.getFileNode(), DIScope(getNonCompileUnitScope(Context)).getRef(),
579 DerivedFrom.getRef(), Elements, VTableHolder.getRef(), nullptr,
580 UniqueIdentifier.empty() ? nullptr
581 : MDString::get(VMContext, UniqueIdentifier)};
619582 DICompositeType R(MDNode::get(VMContext, Elts));
620583 assert(R.isCompositeType() &&
621584 "createStructType should return a DICompositeType");
633596 StringRef UniqueIdentifier) {
634597 // TAG_union_type is encoded in DICompositeType format.
635598 Value *Elts[] = {
636 GetTagConstant(VMContext, dwarf::DW_TAG_union_type),
637 File.getFileNode(),
638 DIScope(getNonCompileUnitScope(Scope)).getRef(),
639 MDString::get(VMContext, Name),
640 ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
641 ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
642 ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
643 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
644 ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
645 nullptr,
646 Elements,
647 ConstantInt::get(Type::getInt32Ty(VMContext), RunTimeLang),
648 nullptr,
649 nullptr,
650 UniqueIdentifier.empty() ? nullptr
651 : MDString::get(VMContext, UniqueIdentifier)
652 };
599 HeaderBuilder::get(dwarf::DW_TAG_union_type)
600 .concat(Name)
601 .concat(LineNumber)
602 .concat(SizeInBits)
603 .concat(AlignInBits)
604 .concat(0) // Offset
605 .concat(Flags)
606 .concat(RunTimeLang)
607 .get(VMContext),
608 File.getFileNode(), DIScope(getNonCompileUnitScope(Scope)).getRef(),
609 nullptr, Elements, nullptr, nullptr,
610 UniqueIdentifier.empty() ? nullptr
611 : MDString::get(VMContext, UniqueIdentifier)};
653612 DICompositeType R(MDNode::get(VMContext, Elts));
654613 if (!UniqueIdentifier.empty())
655614 retainType(R);
661620 unsigned Flags) {
662621 // TAG_subroutine_type is encoded in DICompositeType format.
663622 Value *Elts[] = {
664 GetTagConstant(VMContext, dwarf::DW_TAG_subroutine_type),
665 Constant::getNullValue(Type::getInt32Ty(VMContext)),
666 nullptr,
667 MDString::get(VMContext, ""),
668 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
669 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
670 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
671 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
672 ConstantInt::get(Type::getInt32Ty(VMContext), Flags), // Flags
673 nullptr,
674 ParameterTypes,
675 ConstantInt::get(Type::getInt32Ty(VMContext), 0),
676 nullptr,
677 nullptr,
678 nullptr // Type Identifer
623 HeaderBuilder::get(dwarf::DW_TAG_subroutine_type)
624 .concat(StringRef())
625 .concat(0) // Line
626 .concat(0) // Size
627 .concat(0) // Align
628 .concat(0) // Offset
629 .concat(Flags) // Flags
630 .concat(0)
631 .get(VMContext),
632 nullptr, nullptr, nullptr, ParameterTypes, nullptr, nullptr,
633 nullptr // Type Identifer
679634 };
680635 return DISubroutineType(MDNode::get(VMContext, Elts));
681636 }
686641 DIType UnderlyingType, StringRef UniqueIdentifier) {
687642 // TAG_enumeration_type is encoded in DICompositeType format.
688643 Value *Elts[] = {
689 GetTagConstant(VMContext, dwarf::DW_TAG_enumeration_type),
690 File.getFileNode(),
691 DIScope(getNonCompileUnitScope(Scope)).getRef(),
692 MDString::get(VMContext, Name),
693 ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
694 ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
695 ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
696 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Offset
697 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags
698 UnderlyingType.getRef(),
699 Elements,
700 ConstantInt::get(Type::getInt32Ty(VMContext), 0),
701 nullptr,
702 nullptr,
703 UniqueIdentifier.empty() ? nullptr
704 : MDString::get(VMContext, UniqueIdentifier)
705 };
644 HeaderBuilder::get(dwarf::DW_TAG_enumeration_type)
645 .concat(Name)
646 .concat(LineNumber)
647 .concat(SizeInBits)
648 .concat(AlignInBits)
649 .concat(0) // Offset
650 .concat(0) // Flags
651 .concat(0)
652 .get(VMContext),
653 File.getFileNode(), DIScope(getNonCompileUnitScope(Scope)).getRef(),
654 UnderlyingType.getRef(), Elements, nullptr, nullptr,
655 UniqueIdentifier.empty() ? nullptr
656 : MDString::get(VMContext, UniqueIdentifier)};
706657 DICompositeType CTy(MDNode::get(VMContext, Elts));
707658 AllEnumTypes.push_back(CTy);
708659 if (!UniqueIdentifier.empty())
714665 DIType Ty, DIArray Subscripts) {
715666 // TAG_array_type is encoded in DICompositeType format.
716667 Value *Elts[] = {
717 GetTagConstant(VMContext, dwarf::DW_TAG_array_type),
718 nullptr, // Filename/Directory,
719 nullptr, // Unused
720 MDString::get(VMContext, ""),
721 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
722 ConstantInt::get(Type::getInt64Ty(VMContext), Size),
723 ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
724 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Offset
725 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags
726 Ty.getRef(),
727 Subscripts,
728 ConstantInt::get(Type::getInt32Ty(VMContext), 0),
729 nullptr,
730 nullptr,
731 nullptr // Type Identifer
668 HeaderBuilder::get(dwarf::DW_TAG_array_type)
669 .concat(StringRef())
670 .concat(0) // Line
671 .concat(Size)
672 .concat(AlignInBits)
673 .concat(0) // Offset
674 .concat(0) // Flags
675 .concat(0)
676 .get(VMContext),
677 nullptr, // Filename/Directory,
678 nullptr, // Unused
679 Ty.getRef(), Subscripts, nullptr, nullptr,
680 nullptr // Type Identifer
732681 };
733682 return DICompositeType(MDNode::get(VMContext, Elts));
734683 }
737686 DIType Ty, DIArray Subscripts) {
738687 // A vector is an array type with the FlagVector flag applied.
739688 Value *Elts[] = {
740 GetTagConstant(VMContext, dwarf::DW_TAG_array_type),
741 nullptr, // Filename/Directory,
742 nullptr, // Unused
743 MDString::get(VMContext, ""),
744 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
745 ConstantInt::get(Type::getInt64Ty(VMContext), Size),
746 ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
747 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Offset
748 ConstantInt::get(Type::getInt32Ty(VMContext), DIType::FlagVector),
749 Ty.getRef(),
750 Subscripts,
751 ConstantInt::get(Type::getInt32Ty(VMContext), 0),
752 nullptr,
753 nullptr,
754 nullptr // Type Identifer
689 HeaderBuilder::get(dwarf::DW_TAG_array_type)
690 .concat("")
691 .concat(0) // Line
692 .concat(Size)
693 .concat(AlignInBits)
694 .concat(0) // Offset
695 .concat(DIType::FlagVector)
696 .concat(0)
697 .get(VMContext),
698 nullptr, // Filename/Directory,
699 nullptr, // Unused
700 Ty.getRef(), Subscripts, nullptr, nullptr,
701 nullptr // Type Identifer
755702 };
756703 return DICompositeType(MDNode::get(VMContext, Elts));
704 }
705
706 static HeaderBuilder setTypeFlagsInHeader(StringRef Header,
707 unsigned FlagsToSet) {
708 DIHeaderFieldIterator I(Header);
709 std::advance(I, 6);
710
711 unsigned Flags;
712 if (I->getAsInteger(0, Flags))
713 Flags = 0;
714 Flags |= FlagsToSet;
715
716 return HeaderBuilder(Twine(I.getPrefix())).concat(Flags).concat(
717 I.getSuffix());
718 }
719
720 static DIType createTypeWithFlags(LLVMContext &Context, DIType Ty,
721 unsigned FlagsToSet) {
722 SmallVector Elts;
723 MDNode *N = Ty;
724 assert(N && "Unexpected input DIType!");
725 // Update header field.
726 Elts.push_back(setTypeFlagsInHeader(Ty.getHeader(), FlagsToSet).get(Context));
727 for (unsigned I = 1, E = N->getNumOperands(); I != E; ++I)
728 Elts.push_back(N->getOperand(I));
729
730 return DIType(MDNode::get(Context, Elts));
757731 }
758732
759733 DIType DIBuilder::createArtificialType(DIType Ty) {
760734 if (Ty.isArtificial())
761735 return Ty;
762
763 SmallVector Elts;
764 MDNode *N = Ty;
765 assert (N && "Unexpected input DIType!");
766 for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i)
767 Elts.push_back(N->getOperand(i));
768
769 unsigned CurFlags = Ty.getFlags();
770 CurFlags = CurFlags | DIType::FlagArtificial;
771
772 // Flags are stored at this slot.
773 // FIXME: Add an enum for this magic value.
774 Elts[8] = ConstantInt::get(Type::getInt32Ty(VMContext), CurFlags);
775
776 return DIType(MDNode::get(VMContext, Elts));
736 return createTypeWithFlags(VMContext, Ty, DIType::FlagArtificial);
777737 }
778738
779739 DIType DIBuilder::createObjectPointerType(DIType Ty) {
780740 if (Ty.isObjectPointer())
781741 return Ty;
782
783 SmallVector Elts;
784 MDNode *N = Ty;
785 assert (N && "Unexpected input DIType!");
786 for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i)
787 Elts.push_back(N->getOperand(i));
788
789 unsigned CurFlags = Ty.getFlags();
790 CurFlags = CurFlags | (DIType::FlagObjectPointer | DIType::FlagArtificial);
791
792 // Flags are stored at this slot.
793 // FIXME: Add an enum for this magic value.
794 Elts[8] = ConstantInt::get(Type::getInt32Ty(VMContext), CurFlags);
795
796 return DIType(MDNode::get(VMContext, Elts));
742 unsigned Flags = DIType::FlagObjectPointer | DIType::FlagArtificial;
743 return createTypeWithFlags(VMContext, Ty, Flags);
797744 }
798745
799746 void DIBuilder::retainType(DIType T) {
811758 StringRef UniqueIdentifier) {
812759 // Create a temporary MDNode.
813760 Value *Elts[] = {
814 GetTagConstant(VMContext, Tag),
815 F.getFileNode(),
816 DIScope(getNonCompileUnitScope(Scope)).getRef(),
817 MDString::get(VMContext, Name),
818 ConstantInt::get(Type::getInt32Ty(VMContext), Line),
819 ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
820 ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
821 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Offset
822 ConstantInt::get(Type::getInt32Ty(VMContext), DIDescriptor::FlagFwdDecl),
823 nullptr,
824 DIArray(),
825 ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang),
826 nullptr,
827 nullptr, //TemplateParams
828 UniqueIdentifier.empty() ? nullptr
829 : MDString::get(VMContext, UniqueIdentifier)
830 };
761 HeaderBuilder::get(Tag)
762 .concat(Name)
763 .concat(Line)
764 .concat(SizeInBits)
765 .concat(AlignInBits)
766 .concat(0) // Offset
767 .concat(DIDescriptor::FlagFwdDecl)
768 .concat(RuntimeLang)
769 .get(VMContext),
770 F.getFileNode(), DIScope(getNonCompileUnitScope(Scope)).getRef(), nullptr,
771 DIArray(), nullptr,
772 nullptr, // TemplateParams
773 UniqueIdentifier.empty() ? nullptr
774 : MDString::get(VMContext, UniqueIdentifier)};
831775 MDNode *Node = MDNode::get(VMContext, Elts);
832776 DICompositeType RetTy(Node);
833777 assert(RetTy.isCompositeType() &&
843787 StringRef UniqueIdentifier) {
844788 // Create a temporary MDNode.
845789 Value *Elts[] = {
846 GetTagConstant(VMContext, Tag),
847 F.getFileNode(),
848 DIScope(getNonCompileUnitScope(Scope)).getRef(),
849 MDString::get(VMContext, Name),
850 ConstantInt::get(Type::getInt32Ty(VMContext), Line),
851 ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
852 ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
853 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Offset
854 ConstantInt::get(Type::getInt32Ty(VMContext), DIDescriptor::FlagFwdDecl),
855 nullptr,
856 DIArray(),
857 ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang),
858 nullptr,
859 nullptr, //TemplateParams
860 UniqueIdentifier.empty() ? nullptr
861 : MDString::get(VMContext, UniqueIdentifier)
862 };
790 HeaderBuilder::get(Tag)
791 .concat(Name)
792 .concat(Line)
793 .concat(SizeInBits)
794 .concat(AlignInBits)
795 .concat(0) // Offset
796 .concat(DIDescriptor::FlagFwdDecl)
797 .concat(RuntimeLang)
798 .get(VMContext),
799 F.getFileNode(), DIScope(getNonCompileUnitScope(Scope)).getRef(), nullptr,
800 DIArray(), nullptr,
801 nullptr, // TemplateParams
802 UniqueIdentifier.empty() ? nullptr
803 : MDString::get(VMContext, UniqueIdentifier)};
863804 MDNode *Node = MDNode::getTemporary(VMContext, Elts);
864805 DICompositeType RetTy(Node);
865806 assert(RetTy.isCompositeType() &&
885826 }
886827
887828 DISubrange DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Count) {
888 Value *Elts[] = {
889 GetTagConstant(VMContext, dwarf::DW_TAG_subrange_type),
890 ConstantInt::get(Type::getInt64Ty(VMContext), Lo),
891 ConstantInt::get(Type::getInt64Ty(VMContext), Count)
892 };
829 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_subrange_type)
830 .concat(Lo)
831 .concat(Count)
832 .get(VMContext)};
893833
894834 return DISubrange(MDNode::get(VMContext, Elts));
895835 }
900840 unsigned LineNumber, DITypeRef Ty, bool isLocalToUnit,
901841 Value *Val, MDNode *Decl, bool isDefinition,
902842 std::function)> CreateFunc) {
903 Value *Elts[] = {
904 GetTagConstant(VMContext, dwarf::DW_TAG_variable),
905 Constant::getNullValue(Type::getInt32Ty(VMContext)),
906 getNonCompileUnitScope(Context),
907 MDString::get(VMContext, Name),
908 MDString::get(VMContext, Name),
909 MDString::get(VMContext, LinkageName),
910 F,
911 ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
912 Ty,
913 ConstantInt::get(Type::getInt32Ty(VMContext), isLocalToUnit),
914 ConstantInt::get(Type::getInt32Ty(VMContext), isDefinition),
915 Val,
916 DIDescriptor(Decl)
917 };
843 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_variable)
844 .concat(Name)
845 .concat(Name)
846 .concat(LinkageName)
847 .concat(LineNumber)
848 .concat(isLocalToUnit)
849 .concat(isDefinition)
850 .get(VMContext),
851 getNonCompileUnitScope(Context), F, Ty, Val,
852 DIDescriptor(Decl)};
918853
919854 return DIGlobalVariable(CreateFunc(Elts));
920855 }
958893 DIDescriptor Context(getNonCompileUnitScope(Scope));
959894 assert((!Context || Context.isScope()) &&
960895 "createLocalVariable should be called with a valid Context");
961 Value *Elts[] = {
962 GetTagConstant(VMContext, Tag),
963 getNonCompileUnitScope(Scope),
964 MDString::get(VMContext, Name),
965 File,
966 ConstantInt::get(Type::getInt32Ty(VMContext), (LineNo | (ArgNo << 24))),
967 Ty,
968 ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
969 Constant::getNullValue(Type::getInt32Ty(VMContext))
970 };
896 Value *Elts[] = {HeaderBuilder::get(Tag)
897 .concat(Name)
898 .concat(LineNo | (ArgNo << 24))
899 .concat(Flags)
900 .get(VMContext),
901 getNonCompileUnitScope(Scope), File, Ty};
971902 MDNode *Node = MDNode::get(VMContext, Elts);
972903 if (AlwaysPreserve) {
973904 // The optimizer may remove local variable. If there is an interest
984915 }
985916
986917 DIExpression DIBuilder::createExpression(ArrayRef Addr) {
987 SmallVector Elts;
988 Elts.push_back(GetTagConstant(VMContext, DW_TAG_expression));
989
990 llvm::Type *Int64Ty = Type::getInt64Ty(VMContext);
918 auto Header = HeaderBuilder::get(DW_TAG_expression);
991919 for (int64_t I : Addr)
992 Elts.push_back(ConstantInt::get(Int64Ty, I));
993
920 Header.concat(I);
921 Value *Elts[] = {Header.get(VMContext)};
994922 return DIExpression(MDNode::get(VMContext, Elts));
995923 }
996924
1024952 std::function)> CreateFunc) {
1025953 assert(Ty.getTag() == dwarf::DW_TAG_subroutine_type &&
1026954 "function types should be subroutines");
1027 Value *TElts[] = { GetTagConstant(VMContext, DW_TAG_base_type) };
1028 Value *Elts[] = {
1029 GetTagConstant(VMContext, dwarf::DW_TAG_subprogram),
1030 File.getFileNode(),
1031 DIScope(getNonCompileUnitScope(Context)).getRef(),
1032 MDString::get(VMContext, Name),
1033 MDString::get(VMContext, Name),
1034 MDString::get(VMContext, LinkageName),
1035 ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
1036 Ty,
1037 ConstantInt::get(Type::getInt1Ty(VMContext), isLocalToUnit),
1038 ConstantInt::get(Type::getInt1Ty(VMContext), isDefinition),
1039 ConstantInt::get(Type::getInt32Ty(VMContext), 0),
1040 ConstantInt::get(Type::getInt32Ty(VMContext), 0),
1041 nullptr,
1042 ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
1043 ConstantInt::get(Type::getInt1Ty(VMContext), isOptimized),
1044 Fn,
1045 TParams,
1046 Decl,
1047 MDNode::getTemporary(VMContext, TElts),
1048 ConstantInt::get(Type::getInt32Ty(VMContext), ScopeLine)
1049 };
955 Value *TElts[] = {HeaderBuilder::get(DW_TAG_base_type).get(VMContext)};
956 Value *Elts[] = {
957 HeaderBuilder::get(dwarf::DW_TAG_subprogram)
958 .concat(Name)
959 .concat(Name)
960 .concat(LinkageName)
961 .concat(LineNo)
962 .concat(isLocalToUnit)
963 .concat(isDefinition)
964 .concat(0)
965 .concat(0)
966 .concat(Flags)
967 .concat(isOptimized)
968 .concat(ScopeLine)
969 .get(VMContext),
970 File.getFileNode(), DIScope(getNonCompileUnitScope(Context)).getRef(), Ty,
971 nullptr, Fn, TParams, Decl, MDNode::getTemporary(VMContext, TElts)};
1050972
1051973 DISubprogram S(CreateFunc(Elts));
1052974 assert(S.isSubprogram() &&
11041026 assert(getNonCompileUnitScope(Context) &&
11051027 "Methods should have both a Context and a context that isn't "
11061028 "the compile unit.");
1107 Value *Elts[] = {
1108 GetTagConstant(VMContext, dwarf::DW_TAG_subprogram),
1109 F.getFileNode(),
1110 DIScope(Context).getRef(),
1111 MDString::get(VMContext, Name),
1112 MDString::get(VMContext, Name),
1113 MDString::get(VMContext, LinkageName),
1114 ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
1115 Ty,
1116 ConstantInt::get(Type::getInt1Ty(VMContext), isLocalToUnit),
1117 ConstantInt::get(Type::getInt1Ty(VMContext), isDefinition),
1118 ConstantInt::get(Type::getInt32Ty(VMContext), VK),
1119 ConstantInt::get(Type::getInt32Ty(VMContext), VIndex),
1120 VTableHolder.getRef(),
1121 ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
1122 ConstantInt::get(Type::getInt1Ty(VMContext), isOptimized),
1123 Fn,
1124 TParam,
1125 Constant::getNullValue(Type::getInt32Ty(VMContext)),
1126 nullptr,
1127 // FIXME: Do we want to use different scope/lines?
1128 ConstantInt::get(Type::getInt32Ty(VMContext), LineNo)
1129 };
1029 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_subprogram)
1030 .concat(Name)
1031 .concat(Name)
1032 .concat(LinkageName)
1033 .concat(LineNo)
1034 .concat(isLocalToUnit)
1035 .concat(isDefinition)
1036 .concat(VK)
1037 .concat(VIndex)
1038 .concat(Flags)
1039 .concat(isOptimized)
1040 .concat(LineNo)
1041 // FIXME: Do we want to use different scope/lines?
1042 .get(VMContext),
1043 F.getFileNode(), DIScope(Context).getRef(), Ty,
1044 VTableHolder.getRef(), Fn, TParam, nullptr, nullptr};
11301045 MDNode *Node = MDNode::get(VMContext, Elts);
11311046 if (isDefinition)
11321047 AllSubprograms.push_back(Node);
11371052
11381053 DINameSpace DIBuilder::createNameSpace(DIDescriptor Scope, StringRef Name,
11391054 DIFile File, unsigned LineNo) {
1140 Value *Elts[] = {
1141 GetTagConstant(VMContext, dwarf::DW_TAG_namespace),
1142 File.getFileNode(),
1143 getNonCompileUnitScope(Scope),
1144 MDString::get(VMContext, Name),
1145 ConstantInt::get(Type::getInt32Ty(VMContext), LineNo)
1146 };
1055 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_namespace)
1056 .concat(Name)
1057 .concat(LineNo)
1058 .get(VMContext),
1059 File.getFileNode(), getNonCompileUnitScope(Scope)};
11471060 DINameSpace R(MDNode::get(VMContext, Elts));
11481061 assert(R.Verify() &&
11491062 "createNameSpace should return a verifiable DINameSpace");
11531066 DILexicalBlockFile DIBuilder::createLexicalBlockFile(DIDescriptor Scope,
11541067 DIFile File,
11551068 unsigned Discriminator) {
1156 Value *Elts[] = {
1157 GetTagConstant(VMContext, dwarf::DW_TAG_lexical_block),
1158 File.getFileNode(),
1159 Scope,
1160 ConstantInt::get(Type::getInt32Ty(VMContext), Discriminator),
1161 };
1069 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_lexical_block)
1070 .concat(Discriminator)
1071 .get(VMContext),
1072 File.getFileNode(), Scope};
11621073 DILexicalBlockFile R(MDNode::get(VMContext, Elts));
11631074 assert(
11641075 R.Verify() &&
11771088
11781089 // Defeat MDNode uniquing for lexical blocks by using unique id.
11791090 static unsigned int unique_id = 0;
1180 Value *Elts[] = {
1181 GetTagConstant(VMContext, dwarf::DW_TAG_lexical_block),
1182 File.getFileNode(),
1183 getNonCompileUnitScope(Scope),
1184 ConstantInt::get(Type::getInt32Ty(VMContext), Line),
1185 ConstantInt::get(Type::getInt32Ty(VMContext), Col),
1186 ConstantInt::get(Type::getInt32Ty(VMContext), unique_id++)
1187 };
1091 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_lexical_block)
1092 .concat(Line)
1093 .concat(Col)
1094 .concat(unique_id++)
1095 .get(VMContext),
1096 File.getFileNode(), getNonCompileUnitScope(Scope)};
11881097 DILexicalBlock R(MDNode::get(VMContext, Elts));
11891098 assert(R.Verify() &&
11901099 "createLexicalBlock should return a verifiable DILexicalBlock");
137137 }
138138 }
139139
140 /// getInlinedAt - If this variable is inlined then return inline location.
141 MDNode *DIVariable::getInlinedAt() const { return getNodeField(DbgNode, 7); }
140 static unsigned DIVariableInlinedAtIndex = 4;
141 MDNode *DIVariable::getInlinedAt() const {
142 return getNodeField(DbgNode, DIVariableInlinedAtIndex);
143 }
142144
143145 /// Return the size reported by the variable's type.
144146 unsigned DIVariable::getSizeInBits(const DITypeIdentifierMap &Map) {
155157
156158 uint64_t DIExpression::getElement(unsigned Idx) const {
157159 unsigned I = Idx + 1;
158 if (I < DbgNode->getNumOperands())
159 if (auto *CI = dyn_cast_or_null(DbgNode->getOperand(I)))
160 return CI->getZExtValue();
161
162 assert(false && "non-existing complex address element requested");
163 return 0;
160 assert(I < getNumHeaderFields() &&
161 "non-existing complex address element requested");
162 return getHeaderFieldAs(I);
164163 }
165164
166165 bool DIExpression::isVariablePiece() const {
322321 /// lexical block with an extra file.
323322 bool DIDescriptor::isLexicalBlockFile() const {
324323 return DbgNode && getTag() == dwarf::DW_TAG_lexical_block &&
325 (DbgNode->getNumOperands() == 4);
324 DbgNode->getNumOperands() == 3 && getNumHeaderFields() == 2;
326325 }
327326
328327 /// isLexicalBlock - Return true if the specified tag is DW_TAG_lexical_block.
329328 bool DIDescriptor::isLexicalBlock() const {
330329 return DbgNode && getTag() == dwarf::DW_TAG_lexical_block &&
331 (DbgNode->getNumOperands() > 3);
330 DbgNode->getNumOperands() == 3 && getNumHeaderFields() == 4;
332331 }
333332
334333 /// isSubrange - Return true if the specified tag is DW_TAG_subrange_type.
412411 if (getFilename().empty())
413412 return false;
414413
415 return DbgNode->getNumOperands() == 14;
414 return DbgNode->getNumOperands() == 7 && getNumHeaderFields() == 8;
416415 }
417416
418417 /// Verify - Verify that an ObjC property is well formed.
421420 return false;
422421
423422 // Don't worry about the rest of the strings for now.
424 return DbgNode->getNumOperands() == 8;
423 return DbgNode->getNumOperands() == 3 && getNumHeaderFields() == 6;
425424 }
426425
427426 /// Check if a field at position Elt of a MDNode is a MDNode.
506505
507506 /// Verify - Verify that a basic type descriptor is well formed.
508507 bool DIBasicType::Verify() const {
509 return isBasicType() && DbgNode->getNumOperands() == 10;
508 return isBasicType() && DbgNode->getNumOperands() == 3 &&
509 getNumHeaderFields() == 8;
510510 }
511511
512512 /// Verify - Verify that a derived type descriptor is well formed.
513513 bool DIDerivedType::Verify() const {
514 // Make sure DerivedFrom @ field 9 is TypeRef.
515 if (!fieldIsTypeRef(DbgNode, 9))
514 // Make sure DerivedFrom @ field 3 is TypeRef.
515 if (!fieldIsTypeRef(DbgNode, 3))
516516 return false;
517517 if (getTag() == dwarf::DW_TAG_ptr_to_member_type)
518 // Make sure ClassType @ field 10 is a TypeRef.
519 if (!fieldIsTypeRef(DbgNode, 10))
518 // Make sure ClassType @ field 4 is a TypeRef.
519 if (!fieldIsTypeRef(DbgNode, 4))
520520 return false;
521521
522 return isDerivedType() && DbgNode->getNumOperands() >= 10 &&
523 DbgNode->getNumOperands() <= 14;
522 return isDerivedType() && DbgNode->getNumOperands() >= 4 &&
523 DbgNode->getNumOperands() <= 8 && getNumHeaderFields() >= 7 &&
524 getNumHeaderFields() <= 8;
524525 }
525526
526527 /// Verify - Verify that a composite type descriptor is well formed.
528529 if (!isCompositeType())
529530 return false;
530531
531 // Make sure DerivedFrom @ field 9 and ContainingType @ field 12 are TypeRef.
532 if (!fieldIsTypeRef(DbgNode, 9))
533 return false;
534 if (!fieldIsTypeRef(DbgNode, 12))
535 return false;
536
537 // Make sure the type identifier at field 14 is MDString, it can be null.
538 if (!fieldIsMDString(DbgNode, 14))
532 // Make sure DerivedFrom @ field 3 and ContainingType @ field 5 are TypeRef.
533 if (!fieldIsTypeRef(DbgNode, 3))
534 return false;
535 if (!fieldIsTypeRef(DbgNode, 5))
536 return false;
537
538 // Make sure the type identifier at field 7 is MDString, it can be null.
539 if (!fieldIsMDString(DbgNode, 7))
539540 return false;
540541
541542 // A subroutine type can't be both & and &&.
542543 if (isLValueReference() && isRValueReference())
543544 return false;
544545
545 return DbgNode->getNumOperands() == 15;
546 return DbgNode->getNumOperands() == 8 && getNumHeaderFields() == 8;
546547 }
547548
548549 /// Verify - Verify that a subprogram descriptor is well formed.
550551 if (!isSubprogram())
551552 return false;
552553
553 // Make sure context @ field 2 is a ScopeRef and type @ field 7 is a MDNode.
554 // Make sure context @ field 2 is a ScopeRef and type @ field 3 is a MDNode.
554555 if (!fieldIsScopeRef(DbgNode, 2))
555556 return false;
556 if (!fieldIsMDNode(DbgNode, 7))
557 return false;
558 // Containing type @ field 12.
559 if (!fieldIsTypeRef(DbgNode, 12))
557 if (!fieldIsMDNode(DbgNode, 3))
558 return false;
559 // Containing type @ field 4.
560 if (!fieldIsTypeRef(DbgNode, 4))
560561 return false;
561562
562563 // A subprogram can't be both & and &&.
563564 if (isLValueReference() && isRValueReference())
564565 return false;
565566
566 return DbgNode->getNumOperands() == 20;
567 return DbgNode->getNumOperands() == 9 && getNumHeaderFields() == 12;
567568 }
568569
569570 /// Verify - Verify that a global variable descriptor is well formed.
573574
574575 if (getDisplayName().empty())
575576 return false;
576 // Make sure context @ field 2 is an MDNode.
577 if (!fieldIsMDNode(DbgNode, 2))
578 return false;
579 // Make sure that type @ field 8 is a DITypeRef.
580 if (!fieldIsTypeRef(DbgNode, 8))
581 return false;
582 // Make sure StaticDataMemberDeclaration @ field 12 is MDNode.
583 if (!fieldIsMDNode(DbgNode, 12))
584 return false;
585
586 return DbgNode->getNumOperands() == 13;
577 // Make sure context @ field 1 is an MDNode.
578 if (!fieldIsMDNode(DbgNode, 1))
579 return false;
580 // Make sure that type @ field 3 is a DITypeRef.
581 if (!fieldIsTypeRef(DbgNode, 3))
582 return false;
583 // Make sure StaticDataMemberDeclaration @ field 5 is MDNode.
584 if (!fieldIsMDNode(DbgNode, 5))
585 return false;
586
587 return DbgNode->getNumOperands() == 6 && getNumHeaderFields() == 7;
587588 }
588589
589590 /// Verify - Verify that a variable descriptor is well formed.
594595 // Make sure context @ field 1 is an MDNode.
595596 if (!fieldIsMDNode(DbgNode, 1))
596597 return false;
597 // Make sure that type @ field 5 is a DITypeRef.
598 if (!fieldIsTypeRef(DbgNode, 5))
598 // Make sure that type @ field 3 is a DITypeRef.
599 if (!fieldIsTypeRef(DbgNode, 3))
600 return false;
601
602 // Check the number of header fields, which is common between complex and
603 // simple variables.
604 if (getNumHeaderFields() != 4)
599605 return false;
600606
601607 // Variable without an inline location.
602 if (DbgNode->getNumOperands() == 7)
608 if (DbgNode->getNumOperands() == 4)
603609 return true;
604610
605 return DbgNode->getNumOperands() == 8;
611 // Variable with an inline location.
612 return getInlinedAt() != nullptr && DbgNode->getNumOperands() == 5;
606613 }
607614
608615 /// Verify - Verify that a variable descriptor is well formed.
611618 if (!DbgNode)
612619 return true;
613620
614 return isExpression();
621 return isExpression() && DbgNode->getNumOperands() == 1;
615622 }
616623
617624 /// Verify - Verify that a location descriptor is well formed.
626633 bool DINameSpace::Verify() const {
627634 if (!isNameSpace())
628635 return false;
629 return DbgNode->getNumOperands() == 5;
636 return DbgNode->getNumOperands() == 3 && getNumHeaderFields() == 3;
630637 }
631638
632639 /// \brief Retrieve the MDNode for the directory/file pair.
639646
640647 /// \brief Verify that the enumerator descriptor is well formed.
641648 bool DIEnumerator::Verify() const {
642 return isEnumerator() && DbgNode->getNumOperands() == 3;
649 return isEnumerator() && DbgNode->getNumOperands() == 1 &&
650 getNumHeaderFields() == 3;
643651 }
644652
645653 /// \brief Verify that the subrange descriptor is well formed.
646654 bool DISubrange::Verify() const {
647 return isSubrange() && DbgNode->getNumOperands() == 3;
655 return isSubrange() && DbgNode->getNumOperands() == 1 &&
656 getNumHeaderFields() == 3;
648657 }
649658
650659 /// \brief Verify that the lexical block descriptor is well formed.
651660 bool DILexicalBlock::Verify() const {
652 return isLexicalBlock() && DbgNode->getNumOperands() == 6;
661 return isLexicalBlock() && DbgNode->getNumOperands() == 3 &&
662 getNumHeaderFields() == 4;
653663 }
654664
655665 /// \brief Verify that the file-scoped lexical block descriptor is well formed.
656666 bool DILexicalBlockFile::Verify() const {
657 return isLexicalBlockFile() && DbgNode->getNumOperands() == 4;
667 return isLexicalBlockFile() && DbgNode->getNumOperands() == 3 &&
668 getNumHeaderFields() == 2;
658669 }
659670
660671 /// \brief Verify that the template type parameter descriptor is well formed.
661672 bool DITemplateTypeParameter::Verify() const {
662 return isTemplateTypeParameter() && DbgNode->getNumOperands() == 7;
673 return isTemplateTypeParameter() && DbgNode->getNumOperands() == 4 &&
674 getNumHeaderFields() == 4;
663675 }
664676
665677 /// \brief Verify that the template value parameter descriptor is well formed.
666678 bool DITemplateValueParameter::Verify() const {
667 return isTemplateValueParameter() && DbgNode->getNumOperands() == 8;
679 return isTemplateValueParameter() && DbgNode->getNumOperands() == 5 &&
680 getNumHeaderFields() == 4;
668681 }
669682
670683 /// \brief Verify that the imported module descriptor is well formed.
671684 bool DIImportedEntity::Verify() const {
672 return isImportedEntity() &&
673 (DbgNode->getNumOperands() == 4 || DbgNode->getNumOperands() == 5);
685 return isImportedEntity() && DbgNode->getNumOperands() == 3 &&
686 getNumHeaderFields() == 3;
674687 }
675688
676689 /// getObjCProperty - Return property node, if this ivar is associated with one.
677690 MDNode *DIDerivedType::getObjCProperty() const {
678 return getNodeField(DbgNode, 10);
691 return getNodeField(DbgNode, 4);
679692 }
680693
681694 MDString *DICompositeType::getIdentifier() const {
682 return cast_or_null(getField(DbgNode, 14));
695 return cast_or_null(getField(DbgNode, 7));
683696 }
684697
685698 #ifndef NDEBUG
703716 if (Elements) {
704717 #ifndef NDEBUG
705718 // Check that the new list of members contains all the old members as well.
706 if (const MDNode *El = cast_or_null(N->getOperand(10)))
719 if (const MDNode *El = cast_or_null(N->getOperand(4)))
707720 VerifySubsetOf(El, Elements);
708721 #endif
709 N->replaceOperandWith(10, Elements);
722 N->replaceOperandWith(4, Elements);
710723 }
711724 if (TParams)
712 N->replaceOperandWith(13, TParams);
725 N->replaceOperandWith(6, TParams);
713726 DbgNode = N;
714727 }
715728
727740 /// \brief Set the containing type.
728741 void DICompositeType::setContainingType(DICompositeType ContainingType) {
729742 TrackingVH N(*this);
730 N->replaceOperandWith(12, ContainingType.getRef());
743 N->replaceOperandWith(5, ContainingType.getRef());
731744 DbgNode = N;
732745 }
733746
756769 return false;
757770 }
758771
759 unsigned DISubprogram::isOptimized() const {
760 assert(DbgNode && "Invalid subprogram descriptor!");
761 if (DbgNode->getNumOperands() == 15)
762 return getUnsignedField(14);
763 return 0;
764 }
765
766772 MDNode *DISubprogram::getVariablesNodes() const {
767 return getNodeField(DbgNode, 18);
773 return getNodeField(DbgNode, 8);
768774 }
769775
770776 DIArray DISubprogram::getVariables() const {
771 return DIArray(getNodeField(DbgNode, 18));
777 return DIArray(getNodeField(DbgNode, 8));
772778 }
773779
774780 Value *DITemplateValueParameter::getValue() const {
775 return getField(DbgNode, 4);
781 return getField(DbgNode, 3);
776782 }
777783
778784 // If the current node has a parent scope then return that,
825831 }
826832
827833 DIArray DICompileUnit::getEnumTypes() const {
828 if (!DbgNode || DbgNode->getNumOperands() < 13)
834 if (!DbgNode || DbgNode->getNumOperands() < 7)
829835 return DIArray();
830836
831 return DIArray(getNodeField(DbgNode, 7));
837 return DIArray(getNodeField(DbgNode, 2));
832838 }
833839
834840 DIArray DICompileUnit::getRetainedTypes() const {
835 if (!DbgNode || DbgNode->getNumOperands() < 13)
841 if (!DbgNode || DbgNode->getNumOperands() < 7)
836842 return DIArray();
837843
838 return DIArray(getNodeField(DbgNode, 8));
844 return DIArray(getNodeField(DbgNode, 3));
839845 }
840846
841847 DIArray DICompileUnit::getSubprograms() const {
842 if (!DbgNode || DbgNode->getNumOperands() < 13)
848 if (!DbgNode || DbgNode->getNumOperands() < 7)
843849 return DIArray();
844850
845 return DIArray(getNodeField(DbgNode, 9));
851 return DIArray(getNodeField(DbgNode, 4));
846852 }
847853
848854 DIArray DICompileUnit::getGlobalVariables() const {
849 if (!DbgNode || DbgNode->getNumOperands() < 13)
855 if (!DbgNode || DbgNode->getNumOperands() < 7)
850856 return DIArray();
851857
852 return DIArray(getNodeField(DbgNode, 10));
858 return DIArray(getNodeField(DbgNode, 5));
853859 }
854860
855861 DIArray DICompileUnit::getImportedEntities() const {
856 if (!DbgNode || DbgNode->getNumOperands() < 13)
862 if (!DbgNode || DbgNode->getNumOperands() < 7)
857863 return DIArray();
858864
859 return DIArray(getNodeField(DbgNode, 11));
865 return DIArray(getNodeField(DbgNode, 6));
860866 }
861867
862868 /// copyWithNewScope - Return a copy of this location, replacing the
929935 /// @param InlinedScope Location at current variable is inlined.
930936 DIVariable llvm::createInlinedVariable(MDNode *DV, MDNode *InlinedScope,
931937 LLVMContext &VMContext) {
932 SmallVector Elts;
933 // Insert inlined scope as 7th element.
934 for (unsigned i = 0, e = DV->getNumOperands(); i != e; ++i)
935 i == 7 ? Elts.push_back(InlinedScope) : Elts.push_back(DV->getOperand(i));
936 return DIVariable(MDNode::get(VMContext, Elts));
938 assert(DIVariable(DV).Verify() && "Expected a DIVariable");
939 if (!InlinedScope)
940 return cleanseInlinedVariable(DV, VMContext);
941
942 // Insert inlined scope.
943 SmallVector Elts;
944 for (unsigned I = 0, E = DIVariableInlinedAtIndex; I != E; ++I)
945 Elts.push_back(DV->getOperand(I));
946 Elts.push_back(InlinedScope);
947
948 DIVariable Inlined(MDNode::get(VMContext, Elts));
949 assert(Inlined.Verify() && "Expected to create a DIVariable");
950 return Inlined;
937951 }
938952
939953 /// cleanseInlinedVariable - Remove inlined scope from the variable.
940954 DIVariable llvm::cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext) {
941 SmallVector Elts;
942 // Insert inlined scope as 7th element.
943 for (unsigned i = 0, e = DV->getNumOperands(); i != e; ++i)
944 i == 7 ? Elts.push_back(Constant::getNullValue(Type::getInt32Ty(VMContext)))
945 : Elts.push_back(DV->getOperand(i));
946 return DIVariable(MDNode::get(VMContext, Elts));
955 assert(DIVariable(DV).Verify() && "Expected a DIVariable");
956 if (!DIVariable(DV).getInlinedAt())
957 return DIVariable(DV);
958
959 // Remove inlined scope.
960 SmallVector Elts;
961 for (unsigned I = 0, E = DIVariableInlinedAtIndex; I != E; ++I)
962 Elts.push_back(DV->getOperand(I));
963
964 DIVariable Cleansed(MDNode::get(VMContext, Elts));
965 assert(Cleansed.Verify() && "Expected to create a DIVariable");
966 return Cleansed;
947967 }
948968
949969 /// getDISubprogram - Find subprogram that is enclosing this scope.
7878 DebugLoc DebugLoc::getFnDebugLoc(const LLVMContext &Ctx) const {
7979 const MDNode *Scope = getScopeNode(Ctx);
8080 DISubprogram SP = getDISubprogram(Scope);
81 if (SP.isSubprogram()) {
82 // Check for number of operands since the compatibility is
83 // cheap here. FIXME: Name the magic constant.
84 if (SP->getNumOperands() > 19)
85 return DebugLoc::get(SP.getScopeLineNumber(), 0, SP);
86 else
87 return DebugLoc::get(SP.getLineNumber(), 0, SP);
88 }
81 if (SP.isSubprogram())
82 return DebugLoc::get(SP.getScopeLineNumber(), 0, SP);
8983
9084 return DebugLoc();
9185 }
352352 // sure that an assert is hit if the location of the subprogram array
353353 // changes. This is just to make sure that this is updated if such an
354354 // event occurs.
355 assert(DIC->getNumOperands() >= 10 &&
356 SPs == DIC->getOperand(9) &&
357 "DICompileUnits is expected to store Subprograms in operand "
358 "9.");
359 DIC->replaceOperandWith(9, MDNode::get(C, LiveSubprograms));
355 assert(DIC->getNumOperands() >= 5 && SPs == DIC->getOperand(4) &&
356 "DICompileUnits is expected to store Subprograms in operand 4.");
357 DIC->replaceOperandWith(4, MDNode::get(C, LiveSubprograms));
360358 Changed = true;
361359 }
362360
365363 // make sure that an assert is hit if the location of the subprogram array
366364 // changes. This is just to make sure that this index is updated if such
367365 // an event occurs.
368 assert(DIC->getNumOperands() >= 11 &&
369 GVs == DIC->getOperand(10) &&
370 "DICompileUnits is expected to store Global Variables in operand "
371 "10.");
372 DIC->replaceOperandWith(10, MDNode::get(C, LiveGlobalVariables));
366 assert(
367 DIC->getNumOperands() >= 6 && GVs == DIC->getOperand(5) &&
368 "DICompileUnits is expected to store Global Variables in operand 5.");
369 DIC->replaceOperandWith(5, MDNode::get(C, LiveGlobalVariables));
373370 Changed = true;
374371 }
375372
1111
1212 define i32 @main() nounwind readonly {
1313 %diff1 = alloca i64 ; [#uses=2]
14 call void @llvm.dbg.declare(metadata !{i64* %diff1}, metadata !0, metadata !{i32 786690})
14 call void @llvm.dbg.declare(metadata !{i64* %diff1}, metadata !0, metadata !{metadata !"0x102"})
1515 store i64 72, i64* %diff1, align 8
1616 %v1 = load %struct.test** @TestArrayPtr, align 8 ; <%struct.test*> [#uses=1]
1717 %v2 = ptrtoint %struct.test* %v1 to i64 ; [#uses=1]
2323 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
2424
2525 !7 = metadata !{metadata !1}
26 !6 = metadata !{i32 786449, metadata !8, i32 12, metadata !"clang version 3.0 (trunk 131941)", i1 true, metadata !"", i32 0, metadata !9, metadata !9, metadata !7, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
27 !0 = metadata !{i32 786688, metadata !1, metadata !"c", metadata !2, i32 2, metadata !5, i32 0, null} ; [ DW_TAG_auto_variable ]
28 !1 = metadata !{i32 786478, metadata !8, metadata !2, metadata !"main", metadata !"main", metadata !"", i32 1, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 ()* @main, null, null, null, i32 1} ; [ DW_TAG_subprogram ]
29 !2 = metadata !{i32 786473, metadata !8} ; [ DW_TAG_file_type ]
30 !3 = metadata !{i32 786453, metadata !8, metadata !2, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !4, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
26 !6 = metadata !{metadata !"0x11\0012\00clang version 3.0 (trunk 131941)\001\00\000\00\000", metadata !8, metadata !9, metadata !9, metadata !7, null, null} ; [ DW_TAG_compile_unit ]
27 !0 = metadata !{metadata !"0x100\00c\002\000", metadata !1, metadata !2, metadata !5} ; [ DW_TAG_auto_variable ]
28 !1 = metadata !{metadata !"0x2e\00main\00main\00\001\000\001\000\006\00256\000\001", metadata !8, metadata !2, metadata !3, null, i32 ()* @main, null, null, null} ; [ DW_TAG_subprogram ]
29 !2 = metadata !{metadata !"0x29", metadata !8} ; [ DW_TAG_file_type ]
30 !3 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", metadata !8, metadata !2, null, metadata !4, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
3131 !4 = metadata !{metadata !5}
32 !5 = metadata !{i32 786468, null, metadata !6, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
32 !5 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", null, metadata !6} ; [ DW_TAG_base_type ]
3333 !8 = metadata !{metadata !"/d/j/debug-test.c", metadata !"/Volumes/Data/b"}
3434 !9 = metadata !{i32 0}
22
33 define void @Foo(i32 %a, i32 %b) {
44 entry:
5 call void @llvm.dbg.value(metadata !{ i32* %1 }, i64 16, metadata !2, metadata !{i32 786690})
5 call void @llvm.dbg.value(metadata !{ i32* %1 }, i64 16, metadata !2, metadata !{metadata !"0x102"})
66 ; CHECK: call void @llvm.dbg.value(metadata !{i32* %1}, i64 16, metadata ![[ID2:[0-9]+]], metadata {{.*}})
77 %0 = add i32 %a, 1 ; [#uses=1]
88 %two = add i32 %b, %0 ; [#uses=0]
99 %1 = alloca i32 ; [#uses=1]
1010
11 call void @llvm.dbg.declare(metadata !{i32* %1}, metadata !{i32* %1}, metadata !{i32 786690})
11 call void @llvm.dbg.declare(metadata !{i32* %1}, metadata !{i32* %1}, metadata !{metadata !"0x102"})
1212 ; CHECK: call void @llvm.dbg.declare(metadata !{i32* %1}, metadata !{i32* %1}, metadata {{.*}})
13 call void @llvm.dbg.declare(metadata !{i32 %two}, metadata !{i32 %0}, metadata !{i32 786690})
13 call void @llvm.dbg.declare(metadata !{i32 %two}, metadata !{i32 %0}, metadata !{metadata !"0x102"})
1414 ; CHECK: call void @llvm.dbg.declare(metadata !{i32 %two}, metadata !{i32 %0}, metadata {{.*}})
15 call void @llvm.dbg.declare(metadata !{i32 %0}, metadata !{i32* %1, i32 %0}, metadata !{i32 786690})
15 call void @llvm.dbg.declare(metadata !{i32 %0}, metadata !{i32* %1, i32 %0}, metadata !{metadata !"0x102"})
1616 ; CHECK: call void @llvm.dbg.declare(metadata !{i32 %0}, metadata !{i32* %1, i32 %0}, metadata {{.*}})
17 call void @llvm.dbg.declare(metadata !{i32* %1}, metadata !{i32 %b, i32 %0}, metadata !{i32 786690})
17 call void @llvm.dbg.declare(metadata !{i32* %1}, metadata !{i32 %b, i32 %0}, metadata !{metadata !"0x102"})
1818 ; CHECK: call void @llvm.dbg.declare(metadata !{i32* %1}, metadata !{i32 %b, i32 %0}, metadata {{.*}})
19 call void @llvm.dbg.declare(metadata !{i32 %a}, metadata !{i32 %a, metadata !"foo"}, metadata !{i32 786690})
19 call void @llvm.dbg.declare(metadata !{i32 %a}, metadata !{i32 %a, metadata !"foo"}, metadata !{metadata !"0x102"})
2020 ; CHECK: call void @llvm.dbg.declare(metadata !{i32 %a}, metadata !{i32 %a, metadata !"foo"}, metadata {{.*}})
21 call void @llvm.dbg.declare(metadata !{i32 %b}, metadata !{metadata !0, i32 %two}, metadata !{i32 786690})
21 call void @llvm.dbg.declare(metadata !{i32 %b}, metadata !{metadata !0, i32 %two}, metadata !{metadata !"0x102"})
2222 ; CHECK: call void @llvm.dbg.declare(metadata !{i32 %b}, metadata !{metadata ![[ID0:[0-9]+]], i32 %two}, metadata {{.*}})
2323
24 call void @llvm.dbg.value(metadata !{ i32 %a }, i64 0, metadata !1, metadata !{i32 786690})
24 call void @llvm.dbg.value(metadata !{ i32 %a }, i64 0, metadata !1, metadata !{metadata !"0x102"})
2525 ; CHECK: call void @llvm.dbg.value(metadata !{i32 %a}, i64 0, metadata ![[ID1:[0-9]+]], metadata {{.*}})
26 call void @llvm.dbg.value(metadata !{ i32 %0 }, i64 25, metadata !0, metadata !{i32 786690})
26 call void @llvm.dbg.value(metadata !{ i32 %0 }, i64 25, metadata !0, metadata !{metadata !"0x102"})
2727 ; CHECK: call void @llvm.dbg.value(metadata !{i32 %0}, i64 25, metadata ![[ID0]], metadata {{.*}})
28 call void @llvm.dbg.value(metadata !{ i32* %1 }, i64 16, metadata !3, metadata !{i32 786690})
28 call void @llvm.dbg.value(metadata !{ i32* %1 }, i64 16, metadata !3, metadata !{metadata !"0x102"})
2929 ; CHECK: call void @llvm.dbg.value(metadata !{i32* %1}, i64 16, metadata ![[ID3:[0-9]+]], metadata {{.*}})
30 call void @llvm.dbg.value(metadata !3, i64 12, metadata !2, metadata !{i32 786690})
30 call void @llvm.dbg.value(metadata !3, i64 12, metadata !2, metadata !{metadata !"0x102"})
3131 ; CHECK: call void @llvm.dbg.value(metadata ![[ID3]], i64 12, metadata ![[ID2]], metadata {{.*}})
3232
3333 ret void, !foo !0, !bar !1
4040 !1 = metadata !{i32 4, metadata !"foo"}
4141 !2 = metadata !{metadata !"bar"}
4242 !3 = metadata !{metadata !"foo"}
43 !4 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
43 !4 = metadata !{i32 1, metadata !"Debug Info Version", i32 2}
4444
4545 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
4646 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
13571357 (* End-of-file checks for things like metdata and attributes.
13581358 * CHECK: attributes #0 = {{.*}}uwtable{{.*}}
13591359 * CHECK: !llvm.module.flags = !{!0}
1360 * CHECK: !0 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
1360 * CHECK: !0 = metadata !{i32 1, metadata !"Debug Info Version", i32 2}
13611361 * CHECK: !1 = metadata !{i32 1, metadata !"metadata test"}
13621362 * CHECK: !2 = metadata !{i32 2, i32 3, metadata !3, metadata !3}
13631363 *)
1111 !llvm.dbg.cu = !{!0}
1212 !llvm.module.flags = !{!9}
1313
14 !0 = metadata !{i32 786449, metadata !1, i32 12, metadata !"clang version 3.5 (trunk 195495) (llvm/trunk 195495:195504M)", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [/Users/manmanren/llvm_gmail/release/../llvm/tools/clang/test/CodeGen/debug-info-version.c] [DW_LANG_C99]
14 !0 = metadata !{metadata !"0x11\0012\00clang version 3.5 (trunk 195495) (llvm/trunk 195495:195504M)\000\00\000\00\000", metadata !1, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2} ; [ DW_TAG_compile_unit ] [/Users/manmanren/llvm_gmail/release/../llvm/tools/clang/test/CodeGen/debug-info-version.c] [DW_LANG_C99]
1515 !1 = metadata !{metadata !"../llvm/tools/clang/test/CodeGen/debug-info-version.c", metadata !"/Users/manmanren/llvm_gmail/release"}
1616 !2 = metadata !{i32 0}
1717 !3 = metadata !{metadata !4}
18 !4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"main", metadata !"main", metadata !"", i32 3, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 ()* @main, null, null, metadata !2, i32 3} ; [ DW_TAG_subprogram ] [line 3] [def] [main]
19 !5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/Users/manmanren/llvm_gmail/release/../llvm/tools/clang/test/CodeGen/debug-info-version.c]
20 !6 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
18 !4 = metadata !{metadata !"0x2e\00main\00main\00\003\000\001\000\006\00256\000\003", metadata !1, metadata !5, metadata !6, null, i32 ()* @main, null, null, metadata !2} ; [ DW_TAG_subprogram ] [line 3] [def] [main]
19 !5 = metadata !{metadata !"0x29", metadata !1} ; [ DW_TAG_file_type ] [/Users/manmanren/llvm_gmail/release/../llvm/tools/clang/test/CodeGen/debug-info-version.c]
20 !6 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
2121 !7 = metadata !{metadata !8}
22 !8 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
22 !8 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
2323 !9 = metadata !{i32 2, metadata !"Dwarf Version", i32 2}
2424 !12 = metadata !{i32 4, i32 0, metadata !4, null}
2525
55
66 ; CHECK: call void @foo(), !dbg ![[LOC:[0-9]+]], !attach ![[CALL:[0-9]+]]
77 ; CHECK: ![[LOC]] = metadata !{i32 104, i32 105, metadata ![[SCOPE:[0-9]+]], metadata ![[SCOPE]]}
8 ; CHECK: ![[SCOPE]] = metadata !{i32 458769, metadata ![[FILE:[0-9]+]], i32 0, metadata !"me", i1 true, metadata !"", i32 0, metadata ![[LIST:[0-9]+]], metadata ![[LIST]], null, null, null, metadata !""}
8 ; CHECK: ![[SCOPE]] = metadata !{metadata !"0x11\000\00me\001\00\000\00\000", metadata ![[FILE:[0-9]+]], metadata ![[LIST:[0-9]+]], metadata ![[LIST]], null, null, null}
99 ; CHECK: ![[FILE]] = metadata !{metadata !"source.c", metadata !"/dir"}
1010 ; CHECK: ![[LIST]] = metadata !{i32 0}
1111 ; CHECK: ![[CALL]] = metadata !{metadata !"the call to foo"}
3030 !3 = metadata !{metadata !"noise"}
3131 !4 = metadata !{metadata !"filler"}
3232
33 !9 = metadata !{i32 458769, metadata !15, i32 0, metadata !"me", i1 true, metadata !"", i32 0, metadata !16, metadata !16, null, null, null, metadata !""}
33 !9 = metadata !{metadata !"0x11\000\00me\001\00\000\00\000", metadata !15, metadata !16, metadata !16, null, null, null} ; [ DW_TAG_compile_unit ]
3434 !10 = metadata !{i32 100, i32 101, metadata !9, metadata !9}
3535 !11 = metadata !{i32 102, i32 103, metadata !9, metadata !9}
3636 !12 = metadata !{i32 104, i32 105, metadata !9, metadata !9}
3838 !14 = metadata !{i32 108, i32 109, metadata !9, metadata !9}
3939 !15 = metadata !{metadata !"source.c", metadata !"/dir"}
4040 !16 = metadata !{i32 0}
41 !17 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
41 !17 = metadata !{i32 1, metadata !"Debug Info Version", i32 2}
1515 %add53 = add nsw i64 %n1, 0, !dbg !52
1616 %add55 = add nsw i64 %n1, 0, !dbg !53
1717 %mul63 = mul nsw i64 %add53, -20995, !dbg !54
18 tail call void @llvm.dbg.value(metadata !{i64 %mul63}, i64 0, metadata !30, metadata !{i32 786690}), !dbg !55
18 tail call void @llvm.dbg.value(metadata !{i64 %mul63}, i64 0, metadata !30, metadata !{metadata !"0x102"}), !dbg !55
1919 %mul65 = mul nsw i64 %add55, -3196, !dbg !56
2020 %add67 = add nsw i64 0, %mul65, !dbg !57
2121 %add80 = add i64 0, 1024, !dbg !58
4343 !llvm.module.flags = !{!36, !37}
4444 !llvm.ident = !{!38}
4545
46 !0 = metadata !{i32 786449, metadata !1, i32 12, metadata !"clang version 3.6.0 ", i1 true, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !"", i32 1} ; [] [] []
46 !0 = metadata !{metadata !"0x11\0012\00clang version 3.6.0 \001\00\000\00\001", metadata !1, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2} ; [ DW_TAG_compile_unit ] [] [] []
4747 !1 = metadata !{metadata !"test.c", metadata !""}
4848 !2 = metadata !{}
4949 !3 = metadata !{metadata !4}
50 !4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"", metadata !"", metadata !"", i32 140, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, void ()* @test, null, null, metadata !12, i32 141} ; [] [] [def] [scope 141] []
51 !5 = metadata !{i32 786473, metadata !1} ; [] []
52 !6 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, null, null, null} ; [] [] [from ]
50 !4 = metadata !{metadata !"0x2e\00\00\00\00140\000\001\000\006\00256\001\00141", metadata !1, metadata !5, metadata !6, null, void ()* @test, null, null, metadata !12} ; [ DW_TAG_subprogram ] [] [] [def] [scope 141] []
51 !5 = metadata !{metadata !"0x29", metadata !1} ; [ DW_TAG_file_type ] [] []
52 !6 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !7, null, null, null} ; [ DW_TAG_subroutine_type ] [] [] [from ]
5353 !7 = metadata !{null, metadata !8}
54 !8 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !9} ; [] [] []
55 !9 = metadata !{i32 786454, metadata !10, null, metadata !"", i32 30, i64 0, i64 0, i64 0, i32 0, metadata !11} ; [] [] [] [from int]
54 !8 = metadata !{metadata !"0xf\00\000\0064\0064\000\000", null, null, metadata !9} ; [ DW_TAG_pointer_type ] [] [] []
55 !9 = metadata !{metadata !"0x16\00\0030\000\000\000\000", metadata !10, null, metadata !11} ; [ DW_TAG_typedef ] [] [] [] [from int]
5656 !10 = metadata !{metadata !"", metadata !""}
57 !11 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [] [int] []
57 !11 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [] [int] []
5858 !12 = metadata !{metadata !13, metadata !14, metadata !18, metadata !19, metadata !20, metadata !21, metadata !22, metadata !23, metadata !24, metadata !25, metadata !26, metadata !27, metadata !28, metadata !29, metadata !30, metadata !31, metadata !32, metadata !33, metadata !34, metadata !35}
59 !13 = metadata !{i32 786689, metadata !4, metadata !"", metadata !5, i32 16777356, metadata !8, i32 0, i32 0} ; [] [data] []
60 !14 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 142, metadata !15, i32 0, i32 0} ; [] [] []
61 !15 = metadata !{i32 786454, metadata !16, null, metadata !"", i32 183, i64 0, i64 0, i64 0, i32 0, metadata !17} ; [] [INT32] [] [from long int]
59 !13 = metadata !{metadata !"0x101\00\0016777356\000", metadata !4, metadata !5, metadata !8} ; [ DW_TAG_arg_variable ] [] [data] []
60 !14 = metadata !{metadata !"0x100\00\00142\000", metadata !4, metadata !5, metadata !15} ; [ DW_TAG_auto_variable ] [] [] []
61 !15 = metadata !{metadata !"0x16\00\00183\000\000\000\000", metadata !16, null, metadata !17} ; [ DW_TAG_typedef ] [] [INT32] [] [from long int]
6262 !16 = metadata !{metadata !"", metadata !""}
63 !17 = metadata !{i32 786468, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, i32 5} ; [] [long int] []
64 !18 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 142, metadata !15, i32 0, i32 0} ; [] [] []
65 !19 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 142, metadata !15, i32 0, i32 0} ; [] [] []
66 !20 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 142, metadata !15, i32 0, i32 0} ; [] [] []
67 !21 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 142, metadata !15, i32 0, i32 0} ; [] [] []
68 !22 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 142, metadata !15, i32 0, i32 0} ; [] [] []
69 !23 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 142, metadata !15, i32 0, i32 0} ; [] [] []
70 !24 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 142, metadata !15, i32 0, i32 0} ; [ ] [] []
71 !25 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 143, metadata !15, i32 0, i32 0} ; [ ] [] []
72 !26 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 143, metadata !15, i32 0, i32 0} ; [ ] [] []
73 !27 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 143, metadata !15, i32 0, i32 0} ; [ ] [] []
74 !28 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 143, metadata !15, i32 0, i32 0} ; [ ] [] []
75 !29 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 144, metadata !15, i32 0, i32 0} ; [ ] [] []
76 !30 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 144, metadata !15, i32 0, i32 0} ; [ ] [] []
77 !31 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 144, metadata !15, i32 0, i32 0} ; [ ] [] []
78 !32 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 144, metadata !15, i32 0, i32 0} ; [ ] [] []
79 !33 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 144, metadata !15, i32 0, i32 0} ; [ ] [] []
80 !34 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 145, metadata !8, i32 0, i32 0} ; [ ] [] []
81 !35 = metadata !{i32 786688, metadata !4, metadata !"", metadata !5, i32 146, metadata !11, i32 0, i32 0} ; [ ] [] []
63 !17 = metadata !{metadata !"0x24\00\000\0064\0064\000\000\005", null, null} ; [ DW_TAG_base_type ] [] [long int] []
64 !18 = metadata !{metadata !"0x100\00\00142\000", metadata !4, metadata !5, metadata !15} ; [ DW_TAG_auto_variable ] [] [] []
65 !19 = metadata !{metadata !"0x100\00\00142\000", metadata !4, metadata !5, metadata !15} ; [ DW_TAG_auto_variable ] [] [] []
66 !20 = metadata !{metadata !"0x100\00\00142\000", metadata !4, metadata !5, metadata !15} ; [ DW_TAG_auto_variable ] [] [] []
67 !21 = metadata !{metadata !"0x100\00\00142\000", metadata !4, metadata !5, metadata !15} ; [ DW_TAG_auto_variable ] [] [] []
68 !22 = metadata !{metadata !"0x100\00\00142\000", metadata !4, metadata !5, metadata !15} ; [ DW_TAG_auto_variable ] [] [] []
69 !23 = metadata !{metadata !"0x100\00\00142\000", metadata !4, metadata !5, metadata !15} ; [ DW_TAG_auto_variable ] [] [] []
70 !24 = metadata !{metadata !"0x100\00\00142\000", metadata !4, metadata !5, metadata !15} ; [ DW_TAG_auto_variable ] [ ] [] []
71 !25 = metadata !{metadata !"0x100\00\00143\000", metadata !4, metadata !5, metadata !15} ; [ DW_TAG_auto_variable ] [ ] [] []
72 !26 = metadata !{metadata !"0x100\00\00143\000", metadata !4, metadata !5, metadata !15} ; [ DW_TAG_auto_variable ] [ ] [] []
73 !27 = metadata !{metadata !"0x100\00\00143\000", metadata !4, metadata !5, metadata !15} ; [ DW_TAG_auto_variable ] [ ] [] []
74 !28 = metadata !{metadata !"0x100\00\00143\000", metadata !4, metadata !5, metadata !15} ; [ DW_TAG_auto_variable ] [ ] [] []
75 !29 = metadata !{metadata !"0x100\00\00144\000", metadata !4, metadata !5, metadata !15} ; [ DW_TAG_auto_variable ] [ ] [] []
76 !30 = metadata !{metadata !"0x100\00\00144\000", metadata !4, metadata !5, metadata !15} ; [ DW_TAG_auto_variable ] [ ] [] []
77 !31 = metadata !{metadata !"0x100\00\00144\000", metadata !4, metadata !5, metadata !15} ; [ DW_TAG_auto_variable ] [ ] [] []
78 !32 = metadata !{metadata !"0x100\00\00144\000", metadata !4, metadata !5, metadata !15} ; [ DW_TAG_auto_variable ] [ ] [] []
79 !33 = metadata !{metadata !"0x100\00\00144\000", metadata !4, metadata !5, metadata !15} ; [ DW_TAG_auto_variable ] [ ] [] []
80 !34 = metadata !{metadata !"0x100\00\00145\000", metadata !4, metadata !5, metadata !8} ; [ DW_TAG_auto_variable ] [ ] [] []
81 !35 = metadata !{metadata !"0x100\00\00146\000", metadata !4, metadata !5, metadata !11} ; [ DW_TAG_auto_variable ] [ ] [] []
8282 !36 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
83 !37 = metadata !{i32 2, metadata !"Debug Info Version", i32 1}
83 !37 = metadata !{i32 2, metadata !"Debug Info Version", i32 2}
8484 !38 = metadata !{metadata !"clang version 3.6.0 "}
8585 !39 = metadata !{i32 154, i32 8, metadata !40, null}
86 !40 = metadata !{i32 786443, metadata !1, metadata !41, i32 154, i32 8, i32 2, i32 5} ; [ ] []
87 !41 = metadata !{i32 786443, metadata !1, metadata !42, i32 154, i32 8, i32 1, i32 4} ; [ ] []
88 !42 = metadata !{i32 786443, metadata !1, metadata !4, i32 154, i32 3, i32 0, i32 0} ; [ ] []
86 !40 = metadata !{metadata !"0xb\00154\008\002", metadata !1, metadata !41} ; [ DW_TAG_lexical_block ] [ ] []
87 !41 = metadata !{metadata !"0xb\00154\008\001", metadata !1, metadata !42} ; [ DW_TAG_lexical_block ] [ ] []
88 !42 = metadata !{metadata !"0xb\00154\003\000", metadata !1, metadata !4} ; [ DW_TAG_lexical_block ] [ ] []
8989 !43 = metadata !{i32 157, i32 5, metadata !44, null}
90 !44 = metadata !{i32 786443, metadata !1, metadata !42, i32 154, i32 42, i32 0, i32 1} ; [ ] []
90 !44 = metadata !{metadata !"0xb\00154\0042\000", metadata !1, metadata !42} ; [ DW_TAG_lexical_block ] [ ] []
9191 !45 = metadata !{i32 159, i32 5, metadata !44, null}
9292 !46 = metadata !{metadata !47, metadata !47, i64 0}
9393 !47 = metadata !{metadata !"int", metadata !48, i64 0}
1010 unreachable
1111
1212 if.else295: ; preds = %entry
13 call void @llvm.dbg.declare(metadata !{i32* %do_tab_convert}, metadata !16, metadata !{i32 786690}), !dbg !18
13 call void @llvm.dbg.declare(metadata !{i32* %do_tab_convert}, metadata !16, metadata !{metadata !"0x102"}), !dbg !18
1414 store i32 0, i32* %do_tab_convert, align 4, !dbg !19
1515 unreachable
1616 }
2020 !llvm.dbg.gv = !{!0}
2121 !llvm.dbg.sp = !{!1, !7, !10, !11, !12}
2222
23 !0 = metadata !{i32 589876, i32 0, metadata !1, metadata !"vsplive", metadata !"vsplive", metadata !"", metadata !2, i32 617, metadata !6, i32 1, i32 1, null, null} ; [ DW_TAG_variable ]
24 !1 = metadata !{i32 589870, metadata !20, metadata !2, metadata !"drt_vsprintf", metadata !"drt_vsprintf", metadata !"", i32 616, metadata !4, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
25 !2 = metadata !{i32 589865, metadata !20} ; [ DW_TAG_file_type ]
26 !3 = metadata !{i32 589841, metadata !20, i32 12, metadata !"clang version 3.0 (http://llvm.org/git/clang.git git:/git/puzzlebox/clang.git/ c4d1aea01c4444eb81bdbf391f1be309127c3cf1)", i1 true, metadata !"", i32 0, metadata !21, metadata !21, null, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
27 !4 = metadata !{i32 589845, metadata !20, metadata !2, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !5, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
23 !0 = metadata !{metadata !"0x34\00vsplive\00vsplive\00\00617\001\001", metadata !1, metadata !2, metadata !6, null, null} ; [ DW_TAG_variable ]
24 !1 = metadata !{metadata !"0x2e\00drt_vsprintf\00drt_vsprintf\00\00616\000\001\000\006\00256\000\000", metadata !20, metadata !2, metadata !4, null, null, null, null, null} ; [ DW_TAG_subprogram ]
25 !2 = metadata !{metadata !"0x29", metadata !20} ; [ DW_TAG_file_type ]
26 !3 = metadata !{metadata !"0x11\0012\00clang version 3.0 (http://llvm.org/git/clang.git git:/git/puzzlebox/clang.git/ c4d1aea01c4444eb81bdbf391f1be309127c3cf1)\001\00\000\00\000", metadata !20, metadata !21, metadata !21, null, null, null} ; [ DW_TAG_compile_unit ]
27 !4 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", metadata !20, metadata !2, null, metadata !5, i32 0} ; [ DW_TAG_subroutine_type ]
2828 !5 = metadata !{metadata !6}
29 !6 = metadata !{i32 589860, null, metadata !3, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
30 !7 = metadata !{i32 589870, metadata !20, metadata !2, metadata !"putc_mem", metadata !"putc_mem", metadata !"", i32 30, metadata !8, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 false, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
31 !8 = metadata !{i32 589845, metadata !20, metadata !2, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !9, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
29 !6 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", null, metadata !3} ; [ DW_TAG_base_type ]
30 !7 = metadata !{metadata !"0x2e\00putc_mem\00putc_mem\00\0030\001\001\000\006\00256\000\000", metadata !20, metadata !2, metadata !8, null, null, null, null, null} ; [ DW_TAG_subprogram ]
31 !8 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", metadata !20, metadata !2, null, metadata !9, i32 0} ; [ DW_TAG_subroutine_type ]
3232 !9 = metadata !{null}
33 !10 = metadata !{i32 589870, metadata !20, metadata !2, metadata !"print_double", metadata !"print_double", metadata !"", i32 203, metadata !4, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 false, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
34 !11 = metadata !{i32 589870, metadata !20, metadata !2, metadata !"print_number", metadata !"print_number", metadata !"", i32 75, metadata !4, i1 true, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
35 !12 = metadata !{i32 589870, metadata !20, metadata !2, metadata !"get_flags", metadata !"get_flags", metadata !"", i32 508, metadata !8, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 false, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
33 !10 = metadata !{metadata !"0x2e\00print_double\00print_double\00\00203\001\001\000\006\00256\000\000", metadata !20, metadata !2, metadata !4, null, null, null, null, null} ; [ DW_TAG_subprogram ]
34 !11 = metadata !{metadata !"0x2e\00print_number\00print_number\00\0075\001\001\000\006\00256\000\000", metadata !20, metadata !2, metadata !4, i32 0, null, null, null, null} ; [ DW_TAG_subprogram ]
35 !12 = metadata !{metadata !"0x2e\00get_flags\00get_flags\00\00508\001\001\000\006\00256\000\000", metadata !20, metadata !2, metadata !8, null, null, null, null, null} ; [ DW_TAG_subprogram ]
3636 !13 = metadata !{i32 653, i32 5, metadata !14, null}
37 !14 = metadata !{i32 589835, metadata !20, metadata !15, i32 652, i32 35, i32 2} ; [ DW_TAG_lexical_block ]
38 !15 = metadata !{i32 589835, metadata !20, metadata !1, i32 616, i32 1, i32 0} ; [ DW_TAG_lexical_block ]
39 !16 = metadata !{i32 590080, metadata !17, metadata !"do_tab_convert", metadata !2, i32 853, metadata !6, i32 0, null} ; [ DW_TAG_auto_variable ]
40 !17 = metadata !{i32 589835, metadata !20, metadata !14, i32 850, i32 12, i32 33} ; [ DW_TAG_lexical_block ]
37 !14 = metadata !{metadata !"0xb\00652\0035\002", metadata !20, metadata !15} ; [ DW_TAG_lexical_block ]
38 !15 = metadata !{metadata !"0xb\00616\001\000", metadata !20, metadata !1} ; [ DW_TAG_lexical_block ]
39 !16 = metadata !{metadata !"0x100\00do_tab_convert\00853\000", metadata !17, metadata !2, metadata !6} ; [ DW_TAG_auto_variable ]
40 !17 = metadata !{metadata !"0xb\00850\0012\0033", metadata !20, metadata !14} ; [ DW_TAG_lexical_block ]
4141 !18 = metadata !{i32 853, i32 11, metadata !17, null}
4242 !19 = metadata !{i32 853, i32 29, metadata !17, null}
4343 !20 = metadata !{metadata !"print.i", metadata !"/Volumes/Ebi/echeng/radars/r9146594"}
88 br label %do.body, !dbg !0
99
1010 do.body: ; preds = %entry
11 call void @llvm.dbg.declare(metadata !{i32* %count_}, metadata !4, metadata !{i32 786690})
11 call void @llvm.dbg.declare(metadata !{i32* %count_}, metadata !4, metadata !{metadata !"0x102"})
1212 %conv = ptrtoint i32* %count_ to i32, !dbg !0 ; [#uses=1]
1313 %call = call i32 @foo(i32 %conv) ssp, !dbg !0 ; [#uses=0]
1414 br label %do.end, !dbg !0
2222 declare i32 @foo(i32) ssp
2323
2424 !0 = metadata !{i32 5, i32 2, metadata !1, null}
25 !1 = metadata !{i32 458763, null, metadata !2, i32 1, i32 1, i32 0}; [DW_TAG_lexical_block ]
26 !2 = metadata !{i32 458798, i32 0, metadata !3, metadata !"bar", metadata !"bar", metadata !"bar", i32 4, null, i1 false, i1 true, i32 0, i32 0, null, i32 0, i32 0, null, null, null, null, i32 0}; [DW_TAG_subprogram ]
27 !3 = metadata !{i32 458769, metadata !8, i32 12, metadata !"clang 1.1", i1 true, metadata !"", i32 0, null, metadata !9, null, null, null, metadata !""}; [DW_TAG_compile_unit ]
28 !4 = metadata !{i32 459008, metadata !5, metadata !"count_", metadata !3, i32 5, metadata !6}; [ DW_TAG_auto_variable ]
29 !5 = metadata !{i32 458763, null, metadata !1, i32 1, i32 1, i32 0}; [DW_TAG_lexical_block ]
30 !6 = metadata !{i32 458788, null, metadata !3, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5}; [DW_TAG_base_type ]
25 !1 = metadata !{metadata !"0xb\001\001\000", null, metadata !2}; [DW_TAG_lexical_block ]
26 !2 = metadata !{metadata !"0x2e\00bar\00bar\00bar\004\000\001\000\006\000\000\000", i32 0, metadata !3, null, null, null, null, null, null}; [DW_TAG_subprogram ]
27 !3 = metadata !{metadata !"0x11\0012\00clang 1.1\001\00\000\00\000", metadata !8, null, metadata !9, null, null, null}; [DW_TAG_compile_unit ]
28 !4 = metadata !{metadata !"0x100\00count_\005\000", metadata !5, metadata !3, metadata !6}; [ DW_TAG_auto_variable ]
29 !5 = metadata !{metadata !"0xb\001\001\000", null, metadata !1}; [DW_TAG_lexical_block ]
30 !6 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", null, metadata !3}; [DW_TAG_base_type ]
3131 !7 = metadata !{i32 6, i32 1, metadata !2, null}
3232 !8 = metadata !{metadata !"genmodes.i", metadata !"/Users/yash/Downloads"}
3333 !9 = metadata !{i32 0}
44
55 define hidden i32 @__addvsi3(i32 %a, i32 %b) nounwind {
66 entry:
7 tail call void @llvm.dbg.value(metadata !{i32 %b}, i64 0, metadata !0, metadata !{i32 786690})
7 tail call void @llvm.dbg.value(metadata !{i32 %b}, i64 0, metadata !0, metadata !{metadata !"0x102"})
88 %0 = add nsw i32 %b, %a, !dbg !9 ; [#uses=1]
99 ret i32 %0, !dbg !11
1010 }
1313
1414 !llvm.dbg.cu = !{!3}
1515 !llvm.module.flags = !{!15}
16 !0 = metadata !{i32 524545, metadata !1, metadata !"b", metadata !2, i32 93, metadata !6, i32 0, null} ; [ DW_TAG_arg_variable ]
17 !1 = metadata !{i32 524334, metadata !12, null, metadata !"__addvsi3", metadata !"__addvsi3", metadata !"__addvsi3", i32 94, metadata !4, i1 false, i1 true, i32 0, i32 0, null, i32 0, i32 0, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
18 !2 = metadata !{i32 524329, metadata !12} ; [ DW_TAG_file_type ]
16 !0 = metadata !{metadata !"0x101\00b\0093\000", metadata !1, metadata !2, metadata !6} ; [ DW_TAG_arg_variable ]
17 !1 = metadata !{metadata !"0x2e\00__addvsi3\00__addvsi3\00__addvsi3\0094\000\001\000\006\000\000\000", metadata !12, null, metadata !4, null, null, null, null, null} ; [ DW_TAG_subprogram ]
18 !2 = metadata !{metadata !"0x29", metadata !12} ; [ DW_TAG_file_type ]
1919 !12 = metadata !{metadata !"libgcc2.c", metadata !"/Users/bwilson/local/nightly/test-2010-04-14/build/llvmgcc.roots/llvmgcc~obj/src/gcc"}
20 !3 = metadata !{i32 524305, metadata !12, i32 1, metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build 00)", i1 true, metadata !"", i32 0, metadata !13, metadata !13, metadata !14, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
21 !4 = metadata !{i32 524309, metadata !12, metadata !2, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !5, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
20 !3 = metadata !{metadata !"0x11\001\004.2.1 (Based on Apple Inc. build 5658) (LLVM build 00)\001\00\000\00\000", metadata !12, metadata !13, metadata !13, metadata !14, null, null} ; [ DW_TAG_compile_unit ]
21 !4 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", metadata !12, metadata !2, null, metadata !5, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
2222 !5 = metadata !{metadata !6, metadata !6, metadata !6}
23 !6 = metadata !{i32 524310, metadata !12, null, metadata !"SItype", i32 152, i64 0, i64 0, i64 0, i32 0, metadata !8} ; [ DW_TAG_typedef ]
24 !7 = metadata !{i32 524329, metadata !"libgcc2.h", metadata !"/Users/bwilson/local/nightly/test-2010-04-14/build/llvmgcc.roots/llvmgcc~obj/src/gcc", metadata !3} ; [ DW_TAG_file_type ]
25 !8 = metadata !{i32 524324, metadata !12, metadata !2, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
23 !6 = metadata !{metadata !"0x16\00SItype\00152\000\000\000\000", metadata !12, null, metadata !8} ; [ DW_TAG_typedef ]
24 !7 = metadata !{metadata !"0x29", metadata !"libgcc2.h", metadata !"/Users/bwilson/local/nightly/test-2010-04-14/build/llvmgcc.roots/llvmgcc~obj/src/gcc", metadata !3} ; [ DW_TAG_file_type ]
25 !8 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", metadata !12, metadata !2} ; [ DW_TAG_base_type ]
2626 !9 = metadata !{i32 95, i32 0, metadata !10, null}
27 !10 = metadata !{i32 524299, metadata !12, metadata !1, i32 94, i32 0, i32 0} ; [ DW_TAG_lexical_block ]
27 !10 = metadata !{metadata !"0xb\0094\000\000", metadata !12, metadata !1} ; [ DW_TAG_lexical_block ]
2828 !11 = metadata !{i32 100, i32 0, metadata !10, null}
2929 !13 = metadata !{i32 0}
3030 !14 = metadata !{metadata !1}
31 !15 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
31 !15 = metadata !{i32 1, metadata !"Debug Info Version", i32 2}
66
77 define void @x0(i8* nocapture %buf, i32 %nbytes) nounwind optsize {
88 entry:
9 tail call void @llvm.dbg.value(metadata !{i8* %buf}, i64 0, metadata !0, metadata !{i32 786690}), !dbg !15
10 tail call void @llvm.dbg.value(metadata !{i32 %nbytes}, i64 0, metadata !8, metadata !{i32 786690}), !dbg !16
9 tail call void @llvm.dbg.value(metadata !{i8* %buf}, i64 0, metadata !0, metadata !{metadata !"0x102"}), !dbg !15
10 tail call void @llvm.dbg.value(metadata !{i32 %nbytes}, i64 0, metadata !8, metadata !{metadata !"0x102"}), !dbg !16
1111 %tmp = load i32* @length, !dbg !17 ; [#uses=3]
1212 %cmp = icmp eq i32 %tmp, -1, !dbg !17 ; [#uses=1]
1313 %cmp.not = xor i1 %cmp, true ; [#uses=1]
1414 %cmp3 = icmp ult i32 %tmp, %nbytes, !dbg !17 ; [#uses=1]
1515 %or.cond = and i1 %cmp.not, %cmp3 ; [#uses=1]
16 tail call void @llvm.dbg.value(metadata !{i32 %tmp}, i64 0, metadata !8, metadata !{i32 786690}), !dbg !17
16 tail call void @llvm.dbg.value(metadata !{i32 %tmp}, i64 0, metadata !8, metadata !{metadata !"0x102"}), !dbg !17
1717 %nbytes.addr.0 = select i1 %or.cond, i32 %tmp, i32 %nbytes ; [#uses=1]
18 tail call void @llvm.dbg.value(metadata !18, i64 0, metadata !10, metadata !{i32 786690}), !dbg !19
18 tail call void @llvm.dbg.value(metadata !18, i64 0, metadata !10, metadata !{metadata !"0x102"}), !dbg !19
1919 br label %while.cond, !dbg !20
2020
2121 while.cond: ; preds = %while.body, %entry
4646 !llvm.dbg.lv.fn = !{!0, !8, !10, !12}
4747 !llvm.dbg.gv = !{!14}
4848
49 !0 = metadata !{i32 524545, metadata !1, metadata !"buf", metadata !2, i32 4, metadata !6} ; [ DW_TAG_arg_variable ]
50 !1 = metadata !{i32 524334, metadata !26, null, metadata !"x0", metadata !"x0", metadata !"x0", i32 5, metadata !4, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
51 !2 = metadata !{i32 524329, metadata !26} ; [ DW_TAG_file_type ]
52 !3 = metadata !{i32 524305, i32 0, i32 12, metadata !"t.c", metadata !".", metadata !"clang 2.0", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
53 !4 = metadata !{i32 524309, metadata !26, metadata !2, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !5, i32 0, null} ; [ DW_TAG_subroutine_type ]
49 !0 = metadata !{metadata !"0x101\00buf\004\000", metadata !1, metadata !2, metadata !6} ; [ DW_TAG_arg_variable ]
50 !1 = metadata !{metadata !"0x2e\00x0\00x0\00x0\005\000\001\000\006\000\000\000", metadata !26, null, metadata !4, null, null, null, null, null} ; [ DW_TAG_subprogram ]
51 !2 = metadata !{metadata !"0x29", metadata !26} ; [ DW_TAG_file_type ]
52 !3 = metadata !{metadata !"0x11\0012\00clang 2.0\001\00\00\00\00", metadata !26, null, null, null, null, null} ; [ DW_TAG_compile_unit ]
53 !4 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", metadata !26, metadata !2, null, metadata !5, null} ; [ DW_TAG_subroutine_type ]
5454 !5 = metadata !{null}
55 !6 = metadata !{i32 524303, metadata !26, metadata !2, metadata !"", i32 0, i64 32, i64 32, i64 0, i32 0, metadata !7} ; [ DW_TAG_pointer_type ]
56 !7 = metadata !{i32 524324, metadata !26, metadata !2, metadata !"unsigned char", i32 0, i64 8, i64 8, i64 0, i32 0, i32 8} ; [ DW_TAG_base_type ]
57 !8 = metadata !{i32 524545, metadata !1, metadata !"nbytes", metadata !2, i32 4, metadata !9} ; [ DW_TAG_arg_variable ]
58 !9 = metadata !{i32 524324, metadata !26, metadata !2, metadata !"unsigned long", i32 0, i64 32, i64 32, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ]
59 !10 = metadata !{i32 524544, metadata !11, metadata !"nread", metadata !2, i32 6, metadata !9} ; [ DW_TAG_auto_variable ]
60 !11 = metadata !{i32 524299, metadata !26, metadata !1, i32 5, i32 1, i32 0} ; [ DW_TAG_lexical_block ]
61 !12 = metadata !{i32 524544, metadata !11, metadata !"c", metadata !2, i32 7, metadata !13} ; [ DW_TAG_auto_variable ]
62 !13 = metadata !{i32 524324, metadata !26, metadata !2, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
63 !14 = metadata !{i32 524340, i32 0, metadata !2, metadata !"length", metadata !"length", metadata !"length", metadata !2, i32 1, metadata !13, i1 false, i1 true, i32* @length} ; [ DW_TAG_variable ]
55 !6 = metadata !{metadata !"0xf\00\000\0032\0032\000\000", metadata !26, metadata !2, metadata !7} ; [ DW_TAG_pointer_type ]
56 !7 = metadata !{metadata !"0x24\00unsigned char\000\008\008\000\000\008", metadata !26, metadata !2} ; [ DW_TAG_base_type ]
57 !8 = metadata !{metadata !"0x101\00nbytes\004\000", metadata !1, metadata !2, metadata !9} ; [ DW_TAG_arg_variable ]
58 !9 = metadata !{metadata !"0x24\00unsigned long\000\0032\0032\000\000\007", metadata !26, metadata !2} ; [ DW_TAG_base_type ]
59 !10 = metadata !{metadata !"0x100\00nread\006\000", metadata !11, metadata !2, metadata !9} ; [ DW_TAG_auto_variable ]
60 !11 = metadata !{metadata !"0xb\005\001\000", metadata !26, metadata !1} ; [ DW_TAG_lexical_block ]
61 !12 = metadata !{metadata !"0x100\00c\007\000", metadata !11, metadata !2, metadata !13} ; [ DW_TAG_auto_variable ]
62 !13 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", metadata !26, metadata !2} ; [ DW_TAG_base_type ]
63 !14 = metadata !{metadata !"0x34\00length\00length\00length\001\000\001", metadata !2, metadata !2, metadata !13, i32* @length} ; [ DW_TAG_variable ]
6464 !15 = metadata !{i32 4, i32 24, metadata !1, null}
6565 !16 = metadata !{i32 4, i32 43, metadata !1, null}
6666 !17 = metadata !{i32 9, i32 2, metadata !11, null}
6868 !19 = metadata !{i32 10, i32 2, metadata !11, null}
6969 !20 = metadata !{i32 11, i32 2, metadata !11, null}
7070 !21 = metadata !{i32 12, i32 3, metadata !22, null}
71 !22 = metadata !{i32 524299, metadata !26, metadata !11, i32 11, i32 45, i32 0} ; [ DW_TAG_lexical_block ]
71 !22 = metadata !{metadata !"0xb\0011\0045\000", metadata !26, metadata !11} ; [ DW_TAG_lexical_block ]
7272 !23 = metadata !{i32 13, i32 3, metadata !22, null}
7373 !24 = metadata !{i32 14, i32 2, metadata !22, null}
7474 !25 = metadata !{i32 15, i32 1, metadata !11, null}
55 define i32 @_Z3fooi4SVal(i32 %i, %struct.SVal* noalias %location) nounwind ssp {
66 entry:
77 %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
8 call void @llvm.dbg.value(metadata !{i32 %i}, i64 0, metadata !23, metadata !{i32 786690}), !dbg !24
9 call void @llvm.dbg.value(metadata !{%struct.SVal* %location}, i64 0, metadata !25, metadata !{i32 786690}), !dbg !24
8 call void @llvm.dbg.value(metadata !{i32 %i}, i64 0, metadata !23, metadata !{metadata !"0x102"}), !dbg !24
9 call void @llvm.dbg.value(metadata !{%struct.SVal* %location}, i64 0, metadata !25, metadata !{metadata !"0x102"}), !dbg !24
1010 %0 = icmp ne i32 %i, 0, !dbg !27 ; [#uses=1]
1111 br i1 %0, label %bb, label %bb1, !dbg !27
1212
3333 define linkonce_odr void @_ZN4SValC1Ev(%struct.SVal* %this) nounwind ssp align 2 {
3434 entry:
3535 %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
36 call void @llvm.dbg.value(metadata !{%struct.SVal* %this}, i64 0, metadata !31, metadata !{i32 786690}), !dbg !34
36 call void @llvm.dbg.value(metadata !{%struct.SVal* %this}, i64 0, metadata !31, metadata !{metadata !"0x102"}), !dbg !34
3737 %0 = getelementptr inbounds %struct.SVal* %this, i32 0, i32 0, !dbg !34 ; [#uses=1]
3838 store i8* null, i8** %0, align 8, !dbg !34
3939 %1 = getelementptr inbounds %struct.SVal* %this, i32 0, i32 1, !dbg !34 ; [#uses=1]
5151 %0 = alloca %struct.SVal ; <%struct.SVal*> [#uses=3]
5252 %v = alloca %struct.SVal ; <%struct.SVal*> [#uses=4]
5353 %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
54 call void @llvm.dbg.declare(metadata !{%struct.SVal* %v}, metadata !38, metadata !{i32 786690}), !dbg !41
54 call void @llvm.dbg.declare(metadata !{%struct.SVal* %v}, metadata !38, metadata !{metadata !"0x102"}), !dbg !41
5555 call void @_ZN4SValC1Ev(%struct.SVal* %v) nounwind, !dbg !41
5656 %1 = getelementptr inbounds %struct.SVal* %v, i32 0, i32 1, !dbg !42 ; [#uses=1]
5757 store i32 1, i32* %1, align 8, !dbg !42
6464 %7 = load i32* %6, align 8, !dbg !43 ; [#uses=1]
6565 store i32 %7, i32* %5, align 8, !dbg !43
6666 %8 = call i32 @_Z3fooi4SVal(i32 2, %struct.SVal* noalias %0) nounwind, !dbg !43 ; [#uses=0]
67 call void @llvm.dbg.value(metadata !{i32 %8}, i64 0, metadata !44, metadata !{i32 786690}), !dbg !43
67 call void @llvm.dbg.value(metadata !{i32 %8}, i64 0, metadata !44, metadata !{metadata !"0x102"}), !dbg !43
6868 br label %return, !dbg !45
6969
7070 return: ; preds = %entry
7676 !llvm.dbg.cu = !{!3}
7777 !llvm.module.flags = !{!49}
7878
79 !0 = metadata !{i32 786478, metadata !48, metadata !1, metadata !"SVal", metadata !"SVal", metadata !"", i32 11, metadata !14, i1 false, i1 false, i32 0, i32 0, null, i1 false, i1 false, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
80 !1 = metadata !{i32 786451, metadata !48, null, metadata !"SVal", i32 1, i64 128, i64 64, i64 0, i32 0, null, metadata !4, i32 0, null, null, null} ; [ DW_TAG_structure_type ] [SVal] [line 1, size 128, align 64, offset 0] [def] [from ]
81 !2 = metadata !{i32 786473, metadata !48} ; [ DW_TAG_file_type ]
82 !3 = metadata !{i32 786449, metadata !48, i32 4, metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 false, metadata !"", i32 0, metadata !47, metadata !47, metadata !46, metadata !47, metadata !47, metadata !"", i32 1} ; [ DW_TAG_compile_unit ]
79 !0 = metadata !{metadata !"0x2e\00SVal\00SVal\00\0011\000\000\000\006\000\000\000", metadata !48, metadata !1, metadata !14, null, null, null, null, null} ; [ DW_TAG_subprogram ]
80 !1 = metadata !{metadata !"0x13\00SVal\001\00128\0064\000\000\000", metadata !48, null, null, metadata !4, null, null, null} ; [ DW_TAG_structure_type ] [SVal] [line 1, size 128, align 64, offset 0] [def] [from ]
81 !2 = metadata !{metadata !"0x29", metadata !48} ; [ DW_TAG_file_type ]
82 !3 = metadata !{metadata !"0x11\004\004.2.1 (Based on Apple Inc. build 5658) (LLVM build)\000\00\000\00\001", metadata !48, metadata !47, metadata !47, metadata !46, metadata !47, metadata !47} ; [ DW_TAG_compile_unit ]
8383 !4 = metadata !{metadata !5, metadata !7, metadata !0, metadata !9}
84 !5 = metadata !{i32 786445, metadata !48, metadata !1, metadata !"Data", i32 7, i64 64, i64 64, i64 0, i32 0, metadata !6} ; [ DW_TAG_member ]
85 !6 = metadata !{i32 786447, metadata !48, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, null} ; [ DW_TAG_pointer_type ]
86 !7 = metadata !{i32 786445, metadata !48, metadata !1, metadata !"Kind", i32 8, i64 32, i64 32, i64 64, i32 0, metadata !8} ; [ DW_TAG_member ]
87 !8 = metadata !{i32 786468, metadata !48, null, metadata !"unsigned int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ]
88 !9 = metadata !{i32 786478, metadata !48, metadata !1, metadata !"~SVal", metadata !"~SVal", metadata !"", i32 12, metadata !10, i1 false, i1 false, i32 0, i32 0, null, i1 false, i1 false, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
89 !10 = metadata !{i32 786453, metadata !48, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !11, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
84 !5 = metadata !{metadata !"0xd\00Data\007\0064\0064\000\000", metadata !48, metadata !1, metadata !6} ; [ DW_TAG_member ]
85 !6 = metadata !{metadata !"0xf\00\000\0064\0064\000\000", metadata !48, null, null} ; [ DW_TAG_pointer_type ]
86 !7 = metadata !{metadata !"0xd\00Kind\008\0032\0032\0064\000", metadata !48, metadata !1, metadata !8} ; [ DW_TAG_member ]
87 !8 = metadata !{metadata !"0x24\00unsigned int\000\0032\0032\000\000\007", metadata !48, null} ; [ DW_TAG_base_type ]
88 !9 = metadata !{metadata !"0x2e\00~SVal\00~SVal\00\0012\000\000\000\006\000\000\000", metadata !48, metadata !1, metadata !10, null, null, null, null, null} ; [ DW_TAG_subprogram ]
89 !10 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", metadata !48, null, null, metadata !11, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
9090 !11 = metadata !{null, metadata !12, metadata !13}
91 !12 = metadata !{i32 786447, metadata !48, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 64, metadata !1} ; [ DW_TAG_pointer_type ]
92 !13 = metadata !{i32 786468, metadata !48, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
93 !14 = metadata !{i32 786453, metadata !48, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !15, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
91 !12 = metadata !{metadata !"0xf\00\000\0064\0064\000\0064", metadata !48, null, metadata !1} ; [ DW_TAG_pointer_type ]
92 !13 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", metadata !48, null} ; [ DW_TAG_base_type ]
93 !14 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", metadata !48, null, null, metadata !15, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
9494 !15 = metadata !{null, metadata !12}
95 !16 = metadata !{i32 786478, metadata !48, metadata !1, metadata !"SVal", metadata !"SVal", metadata !"_ZN4SValC1Ev", i32 11, metadata !14, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, void (%struct.SVal*)* @_ZN4SValC1Ev, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
96 !17 = metadata !{i32 786478, metadata !48, metadata !2, metadata !"foo", metadata !"foo", metadata !"_Z3fooi4SVal", i32 16, metadata !18, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32, %struct.SVal*)* @_Z3fooi4SVal, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
97 !18 = metadata !{i32 786453, metadata !48, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !19, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
95 !16 = metadata !{metadata !"0x2e\00SVal\00SVal\00_ZN4SValC1Ev\0011\000\001\000\006\000\000\000", metadata !48, metadata !1, metadata !14, null, void (%struct.SVal*)* @_ZN4SValC1Ev, null, null, null} ; [ DW_TAG_subprogram ]
96 !17 = metadata !{metadata !"0x2e\00foo\00foo\00_Z3fooi4SVal\0016\000\001\000\006\000\000\000", metadata !48, metadata !2, metadata !18, null, i32 (i32, %struct.SVal*)* @_Z3fooi4SVal, null, null, null} ; [ DW_TAG_subprogram ]
97 !18 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", metadata !48, null, null, metadata !19, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
9898 !19 = metadata !{metadata !13, metadata !13, metadata !1}
99 !20 = metadata !{i32 786478, metadata !48, metadata !2, metadata !"main", metadata !"main", metadata !"main", i32 23, metadata !21, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @main, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
100 !21 = metadata !{i32 786453, metadata !48, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !22, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
99 !20 = metadata !{metadata !"0x2e\00main\00main\00main\0023\000\001\000\006\000\000\000", metadata !48, metadata !2, metadata !21, null, i32 ()* @main, null, null, null} ; [ DW_TAG_subprogram ]
100 !21 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", metadata !48, null, null, metadata !22, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
101101 !22 = metadata !{metadata !13}
102 !23 = metadata !{i32 786689, metadata !17, metadata !"i", metadata !2, i32 16, metadata !13, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
102 !23 = metadata !{metadata !"0x101\00i\0016\000", metadata !17, metadata !2, metadata !13} ; [ DW_TAG_arg_variable ]
103103 !24 = metadata !{i32 16, i32 0, metadata !17, null}
104 !25 = metadata !{i32 786689, metadata !17, metadata !"location", metadata !2, i32 16, metadata !26, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
105 !26 = metadata !{i32 786448, metadata !48, metadata !2, metadata !"SVal", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !1} ; [ DW_TAG_reference_type ]
104 !25 = metadata !{metadata !"0x101\00location\0016\000", metadata !17, metadata !2, metadata !26} ; [ DW_TAG_arg_variable ]
105 !26 = metadata !{metadata !"0x10\00SVal\000\0064\0064\000\000", metadata !48, metadata !2, metadata !1} ; [ DW_TAG_reference_type ]
106106 !27 = metadata !{i32 17, i32 0, metadata !28, null}
107 !28 = metadata !{i32 786443, metadata !2, metadata !17, i32 16, i32 0, i32 2} ; [ DW_TAG_lexical_block ]
107 !28 = metadata !{metadata !"0xb\0016\000\002", metadata !2, metadata !17} ; [ DW_TAG_lexical_block ]
108108 !29 = metadata !{i32 18, i32 0, metadata !28, null}
109109 !30 = metadata !{i32 20, i32 0, metadata !28, null}
110 !31 = metadata !{i32 786689, metadata !16, metadata !"this", metadata !2, i32 11, metadata !32, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
111 !32 = metadata !{i32 786470, metadata !48, metadata !2, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 64, metadata !33} ; [ DW_TAG_const_type ]
112 !33 = metadata !{i32 786447, metadata !48, metadata !2, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !1} ; [ DW_TAG_pointer_type ]
110 !31 = metadata !{metadata !"0x101\00this\0011\000", metadata !16, metadata !2, metadata !32} ; [ DW_TAG_arg_variable ]
111 !32 = metadata !{metadata !"0x26\00\000\0064\0064\000\0064", metadata !48, metadata !2, metadata !33} ; [ DW_TAG_const_type ]
112 !33 = metadata !{metadata !"0xf\00\000\0064\0064\000\000", metadata !48, metadata !2, metadata !1} ; [ DW_TAG_pointer_type ]
113113 !34 = metadata !{i32 11, i32 0, metadata !16, null}
114114 !35 = metadata !{i32 11, i32 0, metadata !36, null}
115 !36 = metadata !{i32 786443, metadata !48, metadata !37, i32 11, i32 0, i32 1} ; [ DW_TAG_lexical_block ]
116 !37 = metadata !{i32 786443, metadata !48, metadata !16, i32 11, i32 0, i32 0} ; [ DW_TAG_lexical_block ]
117 !38 = metadata !{i32 786688, metadata !39, metadata !"v", metadata !2, i32 24, metadata !1, i32 0, i32 0} ; [ DW_TAG_auto_variable ]
118 !39 = metadata !{i32 786443, metadata !48, metadata !40, i32 23, i32 0, i32 4} ; [ DW_TAG_lexical_block ]
119 !40 = metadata !{i32 786443, metadata !48, metadata !20, i32 23, i32 0, i32 3} ; [ DW_TAG_lexical_block ]
115 !36 = metadata !{metadata !"0xb\0011\000\001", metadata !48, metadata !37} ; [ DW_TAG_lexical_block ]
116 !37 = metadata !{metadata !"0xb\0011\000\000", metadata !48, metadata !16} ; [ DW_TAG_lexical_block ]
117 !38 = metadata !{metadata !"0x100\00v\0024\000", metadata !39, metadata !2, metadata !1} ; [ DW_TAG_auto_variable ]
118 !39 = metadata !{metadata !"0xb\0023\000\004", metadata !48, metadata !40} ; [ DW_TAG_lexical_block ]
119 !40 = metadata !{metadata !"0xb\0023\000\003", metadata !48, metadata !20} ; [ DW_TAG_lexical_block ]
120120 !41 = metadata !{i32 24, i32 0, metadata !39, null}
121121 !42 = metadata !{i32 25, i32 0, metadata !39, null}
122122 !43 = metadata !{i32 26, i32 0, metadata !39, null}
123 !44 = metadata !{i32 786688, metadata !39, metadata !"k", metadata !2, i32 26, metadata !13, i32 0, i32 0} ; [ DW_TAG_auto_variable ]
123 !44 = metadata !{metadata !"0x100\00k\0026\000", metadata !39, metadata !2, metadata !13} ; [ DW_TAG_auto_variable ]
124124 !45 = metadata !{i32 27, i32 0, metadata !39, null}
125125 !46 = metadata !{metadata !16, metadata !17, metadata !20}
126126 !47 = metadata !{}
127127 !48 = metadata !{metadata !"small.cc", metadata !"/Users/manav/R8248330"}
128 !49 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
128 !49 = metadata !{i32 1, metadata !"Debug Info Version", i32 2}
2929
3030 define zeroext i8 @get1(i8 zeroext %a) nounwind optsize {
3131 entry:
32 tail call void @llvm.dbg.value(metadata !{i8 %a}, i64 0, metadata !10, metadata !{i32 786690}), !dbg !30
32 tail call void @llvm.dbg.value(metadata !{i8 %a}, i64 0, metadata !10, metadata !{metadata !"0x102"}), !dbg !30
3333 %0 = load i8* @x1, align 4, !dbg !30
34 tail call void @llvm.dbg.value(metadata !{i8 %0}, i64 0, metadata !11, metadata !{i32 786690}), !dbg !30
34 tail call void @llvm.dbg.value(metadata !{i8 %0}, i64 0, metadata !11, metadata !{metadata !"0x102"}), !dbg !30
3535 store i8 %a, i8* @x1, align 4, !dbg !30
3636 ret i8 %0, !dbg !31
3737 }
4040
4141 define zeroext i8 @get2(i8 zeroext %a) nounwind optsize {
4242 entry:
43 tail call void @llvm.dbg.value(metadata !{i8 %a}, i64 0, metadata !18, metadata !{i32 786690}), !dbg !32
43 tail call void @llvm.dbg.value(metadata !{i8 %a}, i64 0, metadata !18, metadata !{metadata !"0x102"}), !dbg !32
4444 %0 = load i8* @x2, align 4, !dbg !32
45 tail call void @llvm.dbg.value(metadata !{i8 %0}, i64 0, metadata !19, metadata !{i32 786690}), !dbg !32
45 tail call void @llvm.dbg.value(metadata !{i8 %0}, i64 0, metadata !19, metadata !{metadata !"0x102"}), !dbg !32
4646 store i8 %a, i8* @x2, align 4, !dbg !32
4747 ret i8 %0, !dbg !33
4848 }
4949
5050 define zeroext i8 @get3(i8 zeroext %a) nounwind optsize {
5151 entry:
52 tail call void @llvm.dbg.value(metadata !{i8 %a}, i64 0, metadata !21, metadata !{i32 786690}), !dbg !34
52 tail call void @llvm.dbg.value(metadata !{i8 %a}, i64 0, metadata !21, metadata !{metadata !"0x102"}), !dbg !34
5353 %0 = load i8* @x3, align 4, !dbg !34
54 tail call void @llvm.dbg.value(metadata !{i8 %0}, i64 0, metadata !22, metadata !{i32 786690}), !dbg !34
54 tail call void @llvm.dbg.value(metadata !{i8 %0}, i64 0, metadata !22, metadata !{metadata !"0x102"}), !dbg !34
5555 store i8 %a, i8* @x3, align 4, !dbg !34
5656 ret i8 %0, !dbg !35
5757 }
5858
5959 define zeroext i8 @get4(i8 zeroext %a) nounwind optsize {
6060 entry:
61 tail call void @llvm.dbg.value(metadata !{i8 %a}, i64 0, metadata !24, metadata !{i32 786690}), !dbg !36
61 tail call void @llvm.dbg.value(metadata !{i8 %a}, i64 0, metadata !24, metadata !{metadata !"0x102"}), !dbg !36
6262 %0 = load i8* @x4, align 4, !dbg !36
63 tail call void @llvm.dbg.value(metadata !{i8 %0}, i64 0, metadata !25, metadata !{i32 786690}), !dbg !36
63 tail call void @llvm.dbg.value(metadata !{i8 %0}, i64 0, metadata !25, metadata !{metadata !"0x102"}), !dbg !36
6464 store i8 %a, i8* @x4, align 4, !dbg !36
6565 ret i8 %0, !dbg !37
6666 }
6767
6868 define zeroext i8 @get5(i8 zeroext %a) nounwind optsize {
6969 entry:
70 tail call void @llvm.dbg.value(metadata !{i8 %a}, i64 0, metadata !27, metadata !{i32 786690}), !dbg !38
70 tail call void @llvm.dbg.value(metadata !{i8 %a}, i64 0, metadata !27, metadata !{metadata !"0x102"}), !dbg !38
7171 %0 = load i8* @x5, align 4, !dbg !38
72 tail call void @llvm.dbg.value(metadata !{i8 %0}, i64 0, metadata !28, metadata !{i32 786690}), !dbg !38
72 tail call void @llvm.dbg.value(metadata !{i8 %0}, i64 0, metadata !28, metadata !{metadata !"0x102"}), !dbg !38
7373 store i8 %a, i8* @x5, align 4, !dbg !38