llvm.org GIT mirror llvm / 32e192a
Revert "DI: Fold constant arguments into a single MDString" This reverts commit r218914 while I investigate some bots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218918 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan P. N. Exon Smith 4 years ago
354 changed file(s) with 6740 addition(s) and 6839 deletion(s). Raw diff Collapse all Expand all
185185 ...
186186 }
187187
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``.
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.
197193
198194 The details of the various descriptors follow.
199195
203199 .. code-block:: llvm
204200
205201 !0 = metadata !{
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 ),
202 i32, ;; Tag = 17 (DW_TAG_compile_unit)
216203 metadata, ;; Source directory (including trailing slash) & file pair
217 metadata, ;; List of enums types
218 metadata, ;; List of retained types
219 metadata, ;; List of subprograms
220 metadata, ;; List of global variables
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
221213 metadata ;; List of imported entities
214 metadata ;; Split debug filename
215 i32 ;; Debug info emission kind (1 = Full Debug Info, 2 = Line Tables Only)
222216 }
223217
224218 These descriptors contain a source language ID for the file (we use the DWARF
241235 .. code-block:: llvm
242236
243237 !0 = metadata !{
244 DIHeader(
245 i32 ;; Tag = 41 (DW_TAG_file_type)
246 ),
247 metadata ;; Source directory (including trailing slash) & file pair
238 i32, ;; Tag = 41 (DW_TAG_file_type)
239 metadata, ;; Source directory (including trailing slash) & file pair
248240 }
249241
250242 These descriptors contain information for a file. Global variables and top
262254 .. code-block:: llvm
263255
264256 !1 = metadata !{
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 ),
257 i32, ;; Tag = 52 (DW_TAG_variable)
258 i32, ;; Unused field.
274259 metadata, ;; Reference to context descriptor
260 metadata, ;; Name
261 metadata, ;; Display name (fully qualified C++ name)
262 metadata, ;; MIPS linkage name (for C++)
275263 metadata, ;; Reference to file where defined
264 i32, ;; Line number where defined
276265 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)
277268 {}*, ;; Reference to the global variable
278269 metadata, ;; The static member declaration, if any
279270 }
290281 .. code-block:: llvm
291282
292283 !2 = metadata !{
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 ),
284 i32, ;; Tag = 46 (DW_TAG_subprogram)
307285 metadata, ;; Source directory (including trailing slash) & file pair
308286 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
309291 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
310296 metadata, ;; indicates which base type contains the vtable pointer for the
311297 ;; derived class
298 i32, ;; Flags - Artificial, Private, Protected, Explicit, Prototyped.
299 i1, ;; isOptimized
312300 {}*, ;; Reference to the LLVM function
313301 metadata, ;; Lists function template parameters
314302 metadata, ;; Function declaration descriptor
315 metadata ;; List of function variables
303 metadata, ;; List of function variables
304 i32 ;; Line number where the scope of the subprogram begins
316305 }
317306
318307 These descriptors provide debug information about functions, methods and
325314 .. code-block:: llvm
326315
327316 !3 = metadata !{
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 ),
317 i32, ;; Tag = 11 (DW_TAG_lexical_block)
334318 metadata, ;; Source directory (including trailing slash) & file pair
335 metadata ;; Reference to context descriptor
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
336323 }
337324
338325 This descriptor provides debug information about nested blocks within a
342329 .. code-block:: llvm
343330
344331 !3 = metadata !{
345 DIHeader(
346 i32, ;; Tag = 11 (DW_TAG_lexical_block)
347 i32 ;; DWARF path discriminator value
348 ),
332 i32, ;; Tag = 11 (DW_TAG_lexical_block)
349333 metadata, ;; Source directory (including trailing slash) & file pair
350334 metadata ;; Reference to the scope we're annotating with a file change
335 i32, ;; DWARF path discriminator value
351336 }
352337
353338 This descriptor provides a wrapper around a lexical scope to handle file
361346 .. code-block:: llvm
362347
363348 !4 = metadata !{
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 ),
349 i32, ;; Tag = 36 (DW_TAG_base_type)
374350 metadata, ;; Source directory (including trailing slash) & file pair (may be null)
375 metadata ;; Reference to context
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
376359 }
377360
378361 These descriptors define primitive types used in the code. Example ``int``,
406389 .. code-block:: llvm
407390
408391 !5 = metadata !{
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 ),
392 i32, ;; Tag (see below)
418393 metadata, ;; Source directory (including trailing slash) & file pair (may be null)
419394 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
420401 metadata, ;; Reference to type derived from
421 metadata ;; (optional) Objective C property node
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.
422408 }
423409
424410 These descriptors are used to define types derived from other types. The value
466452 .. code-block:: llvm
467453
468454 !6 = metadata !{
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 ),
455 i32, ;; Tag (see below)
479456 metadata, ;; Source directory (including trailing slash) & file pair (may be null)
480457 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
481464 metadata, ;; Reference to type derived from
482465 metadata, ;; Reference to array of member descriptors
466 i32, ;; Runtime languages
483467 metadata, ;; Base type containing the vtable pointer for this type
484468 metadata, ;; Template parameters
485 mdstring ;; A unique identifier for type uniquing purpose (may be null)
469 metadata ;; A unique identifier for type uniquing purpose (may be null)
486470 }
487471
488472 These descriptors are used to define types that are composed of 0 or more
544528 .. code-block:: llvm
545529
546530 !42 = metadata !{
547 DIHeader(
548 i32, ;; Tag = 33 (DW_TAG_subrange_type)
549 i64, ;; Low value
550 i64 ;; High value
551 )
531 i32, ;; Tag = 33 (DW_TAG_subrange_type)
532 i64, ;; Low value
533 i64 ;; High value
552534 }
553535
554536 These descriptors are used to define ranges of array subscripts for an array
565547 .. code-block:: llvm
566548
567549 !6 = metadata !{
568 DIHeader(
569 i32, ;; Tag = 40 (DW_TAG_enumerator)
570 mdstring, ;; Name
571 i64 ;; Value
572 )
550 i32, ;; Tag = 40 (DW_TAG_enumerator)
551 metadata, ;; Name
552 i64 ;; Value
573553 }
574554
575555 These descriptors are used to define members of an enumeration :ref:`composite
581561 .. code-block:: llvm
582562
583563 !7 = metadata !{
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 ),
564 i32, ;; Tag (see below)
591565 metadata, ;; Context
566 metadata, ;; Name
592567 metadata, ;; Reference to file where defined
568 i32, ;; 24 bit - Line number where defined
569 ;; 8 bit - Argument number. 1 indicates 1st argument.
593570 metadata, ;; Reference to the type descriptor
571 i32, ;; flags
594572 metadata ;; (optional) Reference to inline location
573 metadata ;; (optional) Reference to a complex expression.
595574 }
596575
597576 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
2927
3028 namespace llvm {
3129 class BasicBlock;
5654 /// Maps from type identifier to the actual MDNode.
5755 typedef DenseMap DITypeIdentifierMap;
5856
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
10857 /// DIDescriptor - A thin wraper around MDNode to access encoded debug info.
10958 /// This should not be stored in a container, because the underlying MDNode
11059 /// may change in certain situations.
176125 bool operator==(DIDescriptor Other) const { return DbgNode == Other.DbgNode; }
177126 bool operator!=(DIDescriptor Other) const { return !operator==(Other); }
178127
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); }
128 uint16_t getTag() const {
129 return getUnsignedField(0) & ~LLVMDebugVersionMask;
130 }
205131
206132 bool isDerivedType() const;
207133 bool isCompositeType() const;
245171 public:
246172 explicit DISubrange(const MDNode *N = nullptr) : DIDescriptor(N) {}
247173
248 int64_t getLo() const { return getHeaderFieldAs(1); }
249 int64_t getCount() const { return getHeaderFieldAs(2); }
174 int64_t getLo() const { return getInt64Field(1); }
175 int64_t getCount() const { return getInt64Field(2); }
250176 bool Verify() const;
251177 };
252178
274200 public:
275201 explicit DIEnumerator(const MDNode *N = nullptr) : DIDescriptor(N) {}
276202
277 StringRef getName() const { return getHeaderField(1); }
278 int64_t getEnumValue() const { return getHeaderFieldAs(2); }
203 StringRef getName() const { return getStringField(1); }
204 int64_t getEnumValue() const { return getInt64Field(2); }
279205 bool Verify() const;
280206 };
281207
391317 bool Verify() const;
392318
393319 DIScopeRef getContext() const { return getFieldAs(2); }
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 }
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); }
404324 // FIXME: Offset is only used for DW_TAG_member nodes. Making every type
405325 // carry this is just plain insane.
406 uint64_t getOffsetInBits() const {
407 return getHeaderFieldAs(5);
408 }
409 unsigned getFlags() const { return getHeaderFieldAs(6); }
326 uint64_t getOffsetInBits() const { return getUInt64Field(7); }
327 unsigned getFlags() const { return getUnsignedField(8); }
410328 bool isPrivate() const {
411329 return (getFlags() & FlagAccessibility) == FlagPrivate;
412330 }
446364 public:
447365 explicit DIBasicType(const MDNode *N = nullptr) : DIType(N) {}
448366
449 unsigned getEncoding() const { return getHeaderFieldAs(7); }
367 unsigned getEncoding() const { return getUnsignedField(9); }
450368
451369 /// Verify - Verify that a basic type descriptor is well formed.
452370 bool Verify() const;
462380 public:
463381 explicit DIDerivedType(const MDNode *N = nullptr) : DIType(N) {}
464382
465 DITypeRef getTypeDerivedFrom() const { return getFieldAs(3); }
383 DITypeRef getTypeDerivedFrom() const { return getFieldAs(9); }
466384
467385 /// getObjCProperty - Return property node, if this ivar is
468386 /// associated with one.
470388
471389 DITypeRef getClassType() const {
472390 assert(getTag() == dwarf::DW_TAG_ptr_to_member_type);
473 return getFieldAs(4);
391 return getFieldAs(10);
474392 }
475393
476394 Constant *getConstant() const {
477395 assert((getTag() == dwarf::DW_TAG_member) && isStaticMember());
478 return getConstantField(4);
396 return getConstantField(10);
479397 }
480398
481399 /// Verify - Verify that a derived type descriptor is well formed.
498416
499417 DIArray getElements() const {
500418 assert(!isSubroutineType() && "no elements for DISubroutineType");
501 return getFieldAs(4);
419 return getFieldAs(10);
502420 }
503421 template
504422 void setArrays(DITypedArray Elements, DIArray TParams = DIArray()) {
505 assert((!TParams || DbgNode->getNumOperands() == 8) &&
423 assert((!TParams || DbgNode->getNumOperands() == 15) &&
506424 "If you're setting the template parameters this should include a slot "
507425 "for that!");
508426 setArraysHelper(Elements, TParams);
509427 }
510 unsigned getRunTimeLang() const {
511 return getHeaderFieldAs(7);
512 }
513 DITypeRef getContainingType() const { return getFieldAs(5); }
428 unsigned getRunTimeLang() const { return getUnsignedField(11); }
429 DITypeRef getContainingType() const { return getFieldAs(12); }
514430 void setContainingType(DICompositeType ContainingType);
515 DIArray getTemplateParams() const { return getFieldAs(6); }
431 DIArray getTemplateParams() const { return getFieldAs(13); }
516432 MDString *getIdentifier() const;
517433
518434 /// Verify - Verify that a composite type descriptor is well formed.
523439 public:
524440 explicit DISubroutineType(const MDNode *N = nullptr) : DICompositeType(N) {}
525441 DITypedArray getTypeArray() const {
526 return getFieldAs>(4);
442 return getFieldAs>(10);
527443 }
528444 };
529445
546462 explicit DICompileUnit(const MDNode *N = nullptr) : DIScope(N) {}
547463
548464 dwarf::SourceLanguage getLanguage() const {
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); }
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); }
556472
557473 DIArray getEnumTypes() const;
558474 DIArray getRetainedTypes() const;
560476 DIArray getGlobalVariables() const;
561477 DIArray getImportedEntities() const;
562478
563 StringRef getSplitDebugFilename() const { return getHeaderField(6); }
564 unsigned getEmissionKind() const { return getHeaderFieldAs(7); }
479 StringRef getSplitDebugFilename() const { return getStringField(12); }
480 unsigned getEmissionKind() const { return getUnsignedField(13); }
565481
566482 /// Verify - Verify that a compile unit is well formed.
567483 bool Verify() const;
575491 public:
576492 explicit DISubprogram(const MDNode *N = nullptr) : DIScope(N) {}
577493
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); }
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); }
582500
583501 /// isLocalToUnit - Return true if this subprogram is local to the current
584502 /// compile unit, like 'static' in C.
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; }
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 }
622516 /// isPrivate - Return true if this subprogram has "private"
623517 /// access specifier.
624518 bool isPrivate() const {
635529 return (getFlags() & FlagAccessibility) == FlagPublic;
636530 }
637531 /// isExplicit - Return true if this subprogram is marked as explicit.
638 bool isExplicit() const { return (getFlags() & FlagExplicit) != 0; }
532 bool isExplicit() const { return (getUnsignedField(13) & FlagExplicit) != 0; }
639533 /// isPrototyped - Return true if this subprogram is prototyped.
640 bool isPrototyped() const { return (getFlags() & FlagPrototyped) != 0; }
534 bool isPrototyped() const {
535 return (getUnsignedField(13) & FlagPrototyped) != 0;
536 }
641537
642538 /// Return true if this subprogram is a C++11 reference-qualified
643539 /// non-static member function (void foo() &).
644540 unsigned isLValueReference() const {
645 return (getFlags() & FlagLValueReference) != 0;
541 return (getUnsignedField(13) & FlagLValueReference) != 0;
646542 }
647543
648544 /// Return true if this subprogram is a C++11
649545 /// rvalue-reference-qualified non-static member function
650546 /// (void foo() &&).
651547 unsigned isRValueReference() const {
652 return (getFlags() & FlagRValueReference) != 0;
653 }
654
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); }
655573 };
656574
657575 /// DILexicalBlock - This is a wrapper for a lexical block.
659577 public:
660578 explicit DILexicalBlock(const MDNode *N = nullptr) : DIScope(N) {}
661579 DIScope getContext() const { return getFieldAs(2); }
662 unsigned getLineNumber() const {
663 return getHeaderFieldAs(1);
664 }
665 unsigned getColumnNumber() const {
666 return getHeaderFieldAs(2);
667 }
580 unsigned getLineNumber() const { return getUnsignedField(3); }
581 unsigned getColumnNumber() const { return getUnsignedField(4); }
668582 bool Verify() const;
669583 };
670584
681595 unsigned getLineNumber() const { return getScope().getLineNumber(); }
682596 unsigned getColumnNumber() const { return getScope().getColumnNumber(); }
683597 DILexicalBlock getScope() const { return getFieldAs(2); }
684 unsigned getDiscriminator() const { return getHeaderFieldAs(1); }
598 unsigned getDiscriminator() const { return getUnsignedField(3); }
685599 bool Verify() const;
686600 };
687601
692606
693607 public:
694608 explicit DINameSpace(const MDNode *N = nullptr) : DIScope(N) {}
695 StringRef getName() const { return getHeaderField(1); }
696 unsigned getLineNumber() const { return getHeaderFieldAs(2); }
697609 DIScope getContext() const { return getFieldAs(2); }
610 StringRef getName() const { return getStringField(3); }
611 unsigned getLineNumber() const { return getUnsignedField(4); }
698612 bool Verify() const;
699613 };
700614
704618 explicit DITemplateTypeParameter(const MDNode *N = nullptr)
705619 : DIDescriptor(N) {}
706620
707 StringRef getName() const { return getHeaderField(1); }
708 unsigned getLineNumber() const { return getHeaderFieldAs(2); }
709 unsigned getColumnNumber() const { return getHeaderFieldAs(3); }
710
711621 DIScopeRef getContext() const { return getFieldAs(1); }
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;
622 StringRef getName() const { return getStringField(2); }
623 DITypeRef getType() const { return getFieldAs(3); }
733624 StringRef getFilename() const { return getFieldAs(4).getFilename(); }
734625 StringRef getDirectory() const {
735626 return getFieldAs(4).getDirectory();
736627 }
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); }
737649 bool Verify() const;
738650 };
739651
745657 public:
746658 explicit DIGlobalVariable(const MDNode *N = nullptr) : DIDescriptor(N) {}
747659
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(); }
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(); }
757665 StringRef getDirectory() const {
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); }
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); }
764676 DIDerivedType getStaticDataMemberDeclaration() const {
765 return getFieldAs(5);
677 return getFieldAs(12);
766678 }
767679
768680 /// Verify - Verify that a global variable descriptor is well formed.
778690 public:
779691 explicit DIVariable(const MDNode *N = nullptr) : DIDescriptor(N) {}
780692
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
788693 DIScope getContext() const { return getFieldAs(1); }
789 DIFile getFile() const { return getFieldAs(2); }
790 DITypeRef getType() const { return getFieldAs(3); }
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); }
791702
792703 /// isArtificial - Return true if this variable is marked as "artificial".
793704 bool isArtificial() const {
794 return (getHeaderFieldAs(3) & FlagArtificial) != 0;
705 return (getUnsignedField(6) & FlagArtificial) != 0;
795706 }
796707
797708 bool isObjectPointer() const {
798 return (getHeaderFieldAs(3) & FlagObjectPointer) != 0;
709 return (getUnsignedField(6) & FlagObjectPointer) != 0;
799710 }
800711
801712 /// \brief Return true if this variable is represented as a pointer.
802713 bool isIndirect() const {
803 return (getHeaderFieldAs(3) & FlagIndirectVariable) != 0;
714 return (getUnsignedField(6) & FlagIndirectVariable) != 0;
804715 }
805716
806717 /// getInlinedAt - If this variable is inlined then return inline location.
840751 unsigned getNumElements() const {
841752 if (!DbgNode)
842753 return 0;
843 unsigned N = getNumHeaderFields();
754 unsigned N = DbgNode->getNumOperands();
844755 assert(N > 0 && "missing tag");
845756 return N - 1;
846757 }
900811 public:
901812 explicit DIObjCProperty(const MDNode *N) : DIDescriptor(N) {}
902813
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); }
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); }
910820 bool isReadOnlyObjCProperty() const {
911 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_readonly) != 0;
821 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_readonly) != 0;
912822 }
913823 bool isReadWriteObjCProperty() const {
914 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_readwrite) != 0;
824 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_readwrite) != 0;
915825 }
916826 bool isAssignObjCProperty() const {
917 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_assign) != 0;
827 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_assign) != 0;
918828 }
919829 bool isRetainObjCProperty() const {
920 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_retain) != 0;
830 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_retain) != 0;
921831 }
922832 bool isCopyObjCProperty() const {
923 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_copy) != 0;
833 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_copy) != 0;
924834 }
925835 bool isNonAtomicObjCProperty() const {
926 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_nonatomic) != 0;
836 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_nonatomic) != 0;
927837 }
928838
929839 /// Objective-C doesn't have an ODR, so there is no benefit in storing
930840 /// the type as a DITypeRef here.
931 DIType getType() const { return getFieldAs(2); }
841 DIType getType() const { return getFieldAs(7); }
932842
933843 /// Verify - Verify that a derived type descriptor is well formed.
934844 bool Verify() const;
943853 explicit DIImportedEntity(const MDNode *N) : DIDescriptor(N) {}
944854 DIScope getContext() const { return getFieldAs(1); }
945855 DIScopeRef getEntity() const { return getFieldAs(2); }
946 unsigned getLineNumber() const { return getHeaderFieldAs(1); }
947 StringRef getName() const { return getHeaderField(2); }
856 unsigned getLineNumber() const { return getUnsignedField(3); }
857 StringRef getName() const { return getStringField(4); }
948858 bool Verify() const;
949859 };
950860
3030
3131
3232 enum LLVMConstants : uint32_t {
33 DEBUG_METADATA_VERSION = 2 // Current debug info version number.
33 DEBUG_METADATA_VERSION = 1 // 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.getConstant())) {
1715 } else if (const ConstantExpr *CE = getMergedGlobalExpr(GV->getOperand(11))) {
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 DIDescriptor DI(MD);
1646 DIVariable DIV(MD);
1647
1648 if (DI.isVariable() && !DIV.getName().empty())
1649 OS << "!\"" << DIV.getName() << '\"';
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);
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<MDString>(Op))
2342 if (!Op || !isa<ConstantInt>(Op) || cast(Op)->getBitWidth() < 32)
23432343 return;
23442344
23452345 DIDescriptor Desc(Node);
2222 using namespace llvm;
2323 using namespace llvm::dwarf;
2424
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 };
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);
4829 }
4930
5031 DIBuilder::DIBuilder(Module &m)
124105 "Invalid Language tag");
125106 assert(!Filename.empty() &&
126107 "Unable to create compile unit without filename");
127 Value *TElts[] = {HeaderBuilder::get(DW_TAG_base_type).get(VMContext)};
108 Value *TElts[] = { GetTagConstant(VMContext, DW_TAG_base_type) };
128109 TempEnumTypes = MDNode::getTemporary(VMContext, TElts);
129110
130111 TempRetainTypes = MDNode::getTemporary(VMContext, TElts);
135116
136117 TempImportedModules = MDNode::getTemporary(VMContext, TElts);
137118
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};
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 };
150135
151136 MDNode *CUNode = MDNode::get(VMContext, Elts);
152137
168153 Value *NS, unsigned Line, StringRef Name,
169154 SmallVectorImpl> &AllImportedModules) {
170155 const MDNode *R;
171 Value *Elts[] = {HeaderBuilder::get(Tag).concat(Line).concat(Name).get(C),
172 Context, NS};
173 R = MDNode::get(C, Elts);
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 }
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[] = {HeaderBuilder::get(dwarf::DW_TAG_file_type).get(VMContext),
211 createFilePathPair(VMContext, Filename, Directory)};
210 Value *Elts[] = {
211 GetTagConstant(VMContext, dwarf::DW_TAG_file_type),
212 createFilePathPair(VMContext, Filename, Directory)
213 };
212214 return DIFile(MDNode::get(VMContext, Elts));
213215 }
214216
215217 DIEnumerator DIBuilder::createEnumerator(StringRef Name, int64_t Val) {
216218 assert(!Name.empty() && "Unable to create enumerator without name");
217219 Value *Elts[] = {
218 HeaderBuilder::get(dwarf::DW_TAG_enumerator).concat(Name).concat(Val).get(
219 VMContext)};
220 GetTagConstant(VMContext, dwarf::DW_TAG_enumerator),
221 MDString::get(VMContext, Name),
222 ConstantInt::get(Type::getInt64Ty(VMContext), Val)
223 };
220224 return DIEnumerator(MDNode::get(VMContext, Elts));
221225 }
222226
225229 // Unspecified types are encoded in DIBasicType format. Line number, filename,
226230 // size, alignment, offset and flags are always empty here.
227231 Value *Elts[] = {
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
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
239242 };
240243 return DIBasicType(MDNode::get(VMContext, Elts));
241244 }
251254 // Basic types are encoded in DIBasicType format. Line number, filename,
252255 // offset and flags are always empty here.
253256 Value *Elts[] = {
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
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)
265267 };
266268 return DIBasicType(MDNode::get(VMContext, Elts));
267269 }
268270
269271 DIDerivedType DIBuilder::createQualifiedType(unsigned Tag, DIType FromTy) {
270272 // Qualified types are encoded in DIDerivedType format.
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()};
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 };
282285 return DIDerivedType(MDNode::get(VMContext, Elts));
283286 }
284287
286289 DIBuilder::createPointerType(DIType PointeeTy, uint64_t SizeInBits,
287290 uint64_t AlignInBits, StringRef Name) {
288291 // Pointer types are encoded in DIDerivedType format.
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()};
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 };
300304 return DIDerivedType(MDNode::get(VMContext, Elts));
301305 }
302306
303307 DIDerivedType DIBuilder::createMemberPointerType(DIType PointeeTy,
304308 DIType Base) {
305309 // Pointer types are encoded in DIDerivedType format.
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()};
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 };
317323 return DIDerivedType(MDNode::get(VMContext, Elts));
318324 }
319325
320326 DIDerivedType DIBuilder::createReferenceType(unsigned Tag, DIType RTy) {
321327 assert(RTy.isType() && "Unable to create reference type");
322328 // References are encoded in DIDerivedType format.
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()};
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 };
334341 return DIDerivedType(MDNode::get(VMContext, Elts));
335342 }
336343
337344 DIDerivedType DIBuilder::createTypedef(DIType Ty, StringRef Name, DIFile File,
338345 unsigned LineNo, DIDescriptor Context) {
339346 // typedefs are encoded in DIDerivedType format.
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()};
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 };
351359 return DIDerivedType(MDNode::get(VMContext, Elts));
352360 }
353361
355363 // typedefs are encoded in DIDerivedType format.
356364 assert(Ty.isType() && "Invalid type!");
357365 assert(FriendTy.isType() && "Invalid friend type!");
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()};
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 };
367378 return DIDerivedType(MDNode::get(VMContext, Elts));
368379 }
369380
372383 unsigned Flags) {
373384 assert(Ty.isType() && "Unable to create inheritance");
374385 // TAG_inheritance is encoded in DIDerivedType format.
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()};
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 };
384398 return DIDerivedType(MDNode::get(VMContext, Elts));
385399 }
386400
391405 uint64_t OffsetInBits, unsigned Flags,
392406 DIType Ty) {
393407 // TAG_member is encoded in DIDerivedType format.
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()};
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 };
405420 return DIDerivedType(MDNode::get(VMContext, Elts));
406421 }
407422
412427 llvm::Value *Val) {
413428 // TAG_member is encoded in DIDerivedType format.
414429 Flags |= DIDescriptor::FlagStaticMember;
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};
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 };
426443 return DIDerivedType(MDNode::get(VMContext, Elts));
427444 }
428445
433450 uint64_t OffsetInBits, unsigned Flags,
434451 DIType Ty, MDNode *PropertyNode) {
435452 // TAG_member is encoded in DIDerivedType format.
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};
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 };
446466 return DIDerivedType(MDNode::get(VMContext, Elts));
447467 }
448468
450470 DIBuilder::createObjCProperty(StringRef Name, DIFile File, unsigned LineNumber,
451471 StringRef GetterName, StringRef SetterName,
452472 unsigned PropertyAttributes, DIType Ty) {
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};
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 };
461483 return DIObjCProperty(MDNode::get(VMContext, Elts));
462484 }
463485
465487 DIBuilder::createTemplateTypeParameter(DIDescriptor Context, StringRef Name,
466488 DIType Ty, MDNode *File, unsigned LineNo,
467489 unsigned ColumnNo) {
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};
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 };
475499 return DITemplateTypeParameter(MDNode::get(VMContext, Elts));
476500 }
477501
482506 unsigned LineNo,
483507 unsigned ColumnNo) {
484508 Value *Elts[] = {
485 HeaderBuilder::get(Tag).concat(Name).concat(LineNo).concat(ColumnNo).get(
486 VMContext),
487 DIScope(getNonCompileUnitScope(Context)).getRef(), Ty.getRef(), Val,
488 File};
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 };
489518 return DITemplateValueParameter(MDNode::get(VMContext, Elts));
490519 }
491520
533562 "createClassType should be called with a valid Context");
534563 // TAG_class_type is encoded in DICompositeType format.
535564 Value *Elts[] = {
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)};
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 };
549582 DICompositeType R(MDNode::get(VMContext, Elts));
550583 assert(R.isCompositeType() &&
551584 "createClassType should return a DICompositeType");
566599 StringRef UniqueIdentifier) {
567600 // TAG_structure_type is encoded in DICompositeType format.
568601 Value *Elts[] = {
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)};
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 };
582619 DICompositeType R(MDNode::get(VMContext, Elts));
583620 assert(R.isCompositeType() &&
584621 "createStructType should return a DICompositeType");
596633 StringRef UniqueIdentifier) {
597634 // TAG_union_type is encoded in DICompositeType format.
598635 Value *Elts[] = {
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)};
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 };
612653 DICompositeType R(MDNode::get(VMContext, Elts));
613654 if (!UniqueIdentifier.empty())
614655 retainType(R);
620661 unsigned Flags) {
621662 // TAG_subroutine_type is encoded in DICompositeType format.
622663 Value *Elts[] = {
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
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
634679 };
635680 return DISubroutineType(MDNode::get(VMContext, Elts));
636681 }
641686 DIType UnderlyingType, StringRef UniqueIdentifier) {
642687 // TAG_enumeration_type is encoded in DICompositeType format.
643688 Value *Elts[] = {
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)};
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 };
657706 DICompositeType CTy(MDNode::get(VMContext, Elts));
658707 AllEnumTypes.push_back(CTy);
659708 if (!UniqueIdentifier.empty())
665714 DIType Ty, DIArray Subscripts) {
666715 // TAG_array_type is encoded in DICompositeType format.
667716 Value *Elts[] = {
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
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
681732 };
682733 return DICompositeType(MDNode::get(VMContext, Elts));
683734 }
686737 DIType Ty, DIArray Subscripts) {
687738 // A vector is an array type with the FlagVector flag applied.
688739 Value *Elts[] = {
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
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
702755 };
703756 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));
731757 }
732758
733759 DIType DIBuilder::createArtificialType(DIType Ty) {
734760 if (Ty.isArtificial())
735761 return Ty;
736 return createTypeWithFlags(VMContext, Ty, DIType::FlagArtificial);
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));
737777 }
738778
739779 DIType DIBuilder::createObjectPointerType(DIType Ty) {
740780 if (Ty.isObjectPointer())
741781 return Ty;
742 unsigned Flags = DIType::FlagObjectPointer | DIType::FlagArtificial;
743 return createTypeWithFlags(VMContext, Ty, Flags);
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));
744797 }
745798
746799 void DIBuilder::retainType(DIType T) {
758811 StringRef UniqueIdentifier) {
759812 // Create a temporary MDNode.
760813 Value *Elts[] = {
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)};
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 };
775831 MDNode *Node = MDNode::get(VMContext, Elts);
776832 DICompositeType RetTy(Node);
777833 assert(RetTy.isCompositeType() &&
787843 StringRef UniqueIdentifier) {
788844 // Create a temporary MDNode.
789845 Value *Elts[] = {
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)};
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 };
804863 MDNode *Node = MDNode::getTemporary(VMContext, Elts);
805864 DICompositeType RetTy(Node);
806865 assert(RetTy.isCompositeType() &&
826885 }
827886
828887 DISubrange DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Count) {
829 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_subrange_type)
830 .concat(Lo)
831 .concat(Count)
832 .get(VMContext)};
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 };
833893
834894 return DISubrange(MDNode::get(VMContext, Elts));
835895 }
840900 unsigned LineNumber, DITypeRef Ty, bool isLocalToUnit,
841901 Value *Val, MDNode *Decl, bool isDefinition,
842902 std::function)> CreateFunc) {
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)};
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 };
853918
854919 return DIGlobalVariable(CreateFunc(Elts));
855920 }
893958 DIDescriptor Context(getNonCompileUnitScope(Scope));
894959 assert((!Context || Context.isScope()) &&
895960 "createLocalVariable should be called with a valid Context");
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};
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 };
902971 MDNode *Node = MDNode::get(VMContext, Elts);
903972 if (AlwaysPreserve) {
904973 // The optimizer may remove local variable. If there is an interest
915984 }
916985
917986 DIExpression DIBuilder::createExpression(ArrayRef Addr) {
918 auto Header = HeaderBuilder::get(DW_TAG_expression);
987 SmallVector Elts;
988 Elts.push_back(GetTagConstant(VMContext, DW_TAG_expression));
989
990 llvm::Type *Int64Ty = Type::getInt64Ty(VMContext);
919991 for (int64_t I : Addr)
920 Header.concat(I);
921 Value *Elts[] = {Header.get(VMContext)};
992 Elts.push_back(ConstantInt::get(Int64Ty, I));
993
922994 return DIExpression(MDNode::get(VMContext, Elts));
923995 }
924996
9521024 std::function)> CreateFunc) {
9531025 assert(Ty.getTag() == dwarf::DW_TAG_subroutine_type &&
9541026 "function types should be subroutines");
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)};
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 };
9721050
9731051 DISubprogram S(CreateFunc(Elts));
9741052 assert(S.isSubprogram() &&
10261104 assert(getNonCompileUnitScope(Context) &&
10271105 "Methods should have both a Context and a context that isn't "
10281106 "the compile unit.");
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};
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 };
10451130 MDNode *Node = MDNode::get(VMContext, Elts);
10461131 if (isDefinition)
10471132 AllSubprograms.push_back(Node);
10521137
10531138 DINameSpace DIBuilder::createNameSpace(DIDescriptor Scope, StringRef Name,
10541139 DIFile File, unsigned LineNo) {
1055 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_namespace)
1056 .concat(Name)
1057 .concat(LineNo)
1058 .get(VMContext),
1059 File.getFileNode(), getNonCompileUnitScope(Scope)};
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 };
10601147 DINameSpace R(MDNode::get(VMContext, Elts));
10611148 assert(R.Verify() &&
10621149 "createNameSpace should return a verifiable DINameSpace");
10661153 DILexicalBlockFile DIBuilder::createLexicalBlockFile(DIDescriptor Scope,
10671154 DIFile File,
10681155 unsigned Discriminator) {
1069 Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_lexical_block)
1070 .concat(Discriminator)
1071 .get(VMContext),
1072 File.getFileNode(), Scope};
1156 Value *Elts[] = {
1157 GetTagConstant(VMContext, dwarf::DW_TAG_lexical_block),
1158 File.getFileNode(),
1159 Scope,
1160 ConstantInt::get(Type::getInt32Ty(VMContext), Discriminator),
1161 };
10731162 DILexicalBlockFile R(MDNode::get(VMContext, Elts));
10741163 assert(
10751164 R.Verify() &&
10881177
10891178 // Defeat MDNode uniquing for lexical blocks by using unique id.
10901179 static unsigned int unique_id = 0;
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)};
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 };
10971188 DILexicalBlock R(MDNode::get(VMContext, Elts));
10981189 assert(R.Verify() &&
10991190 "createLexicalBlock should return a verifiable DILexicalBlock");
137137 }
138138 }
139139
140 static unsigned DIVariableInlinedAtIndex = 4;
141 MDNode *DIVariable::getInlinedAt() const {
142 return getNodeField(DbgNode, DIVariableInlinedAtIndex);
143 }
140 /// getInlinedAt - If this variable is inlined then return inline location.
141 MDNode *DIVariable::getInlinedAt() const { return getNodeField(DbgNode, 7); }
144142
145143 /// Return the size reported by the variable's type.
146144 unsigned DIVariable::getSizeInBits(const DITypeIdentifierMap &Map) {
157155
158156 uint64_t DIExpression::getElement(unsigned Idx) const {
159157 unsigned I = Idx + 1;
160 assert(I < getNumHeaderFields() &&
161 "non-existing complex address element requested");
162 return getHeaderFieldAs(I);
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;
163164 }
164165
165166 bool DIExpression::isVariablePiece() const {
321322 /// lexical block with an extra file.
322323 bool DIDescriptor::isLexicalBlockFile() const {
323324 return DbgNode && getTag() == dwarf::DW_TAG_lexical_block &&
324 DbgNode->getNumOperands() == 3 && getNumHeaderFields() == 2;
325 (DbgNode->getNumOperands() == 4);
325326 }
326327
327328 /// isLexicalBlock - Return true if the specified tag is DW_TAG_lexical_block.
328329 bool DIDescriptor::isLexicalBlock() const {
329330 return DbgNode && getTag() == dwarf::DW_TAG_lexical_block &&
330 DbgNode->getNumOperands() == 3 && getNumHeaderFields() == 4;
331 (DbgNode->getNumOperands() > 3);
331332 }
332333
333334 /// isSubrange - Return true if the specified tag is DW_TAG_subrange_type.
411412 if (getFilename().empty())
412413 return false;
413414
414 return DbgNode->getNumOperands() == 7 && getNumHeaderFields() == 8;
415 return DbgNode->getNumOperands() == 14;
415416 }
416417
417418 /// Verify - Verify that an ObjC property is well formed.
420421 return false;
421422
422423 // Don't worry about the rest of the strings for now.
423 return DbgNode->getNumOperands() == 3 && getNumHeaderFields() == 6;
424 return DbgNode->getNumOperands() == 8;
424425 }
425426
426427 /// Check if a field at position Elt of a MDNode is a MDNode.
505506
506507 /// Verify - Verify that a basic type descriptor is well formed.
507508 bool DIBasicType::Verify() const {
508 return isBasicType() && DbgNode->getNumOperands() == 3 &&
509 getNumHeaderFields() == 8;
509 return isBasicType() && DbgNode->getNumOperands() == 10;
510510 }
511511
512512 /// Verify - Verify that a derived type descriptor is well formed.
513513 bool DIDerivedType::Verify() const {
514 // Make sure DerivedFrom @ field 3 is TypeRef.
515 if (!fieldIsTypeRef(DbgNode, 3))
514 // Make sure DerivedFrom @ field 9 is TypeRef.
515 if (!fieldIsTypeRef(DbgNode, 9))
516516 return false;
517517 if (getTag() == dwarf::DW_TAG_ptr_to_member_type)
518 // Make sure ClassType @ field 4 is a TypeRef.
519 if (!fieldIsTypeRef(DbgNode, 4))
518 // Make sure ClassType @ field 10 is a TypeRef.
519 if (!fieldIsTypeRef(DbgNode, 10))
520520 return false;
521521
522 return isDerivedType() && DbgNode->getNumOperands() >= 4 &&
523 DbgNode->getNumOperands() <= 8 && getNumHeaderFields() >= 7 &&
524 getNumHeaderFields() <= 8;
522 return isDerivedType() && DbgNode->getNumOperands() >= 10 &&
523 DbgNode->getNumOperands() <= 14;
525524 }
526525
527526 /// Verify - Verify that a composite type descriptor is well formed.
529528 if (!isCompositeType())
530529 return false;
531530
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))
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))
540539 return false;
541540
542541 // A subroutine type can't be both & and &&.
543542 if (isLValueReference() && isRValueReference())
544543 return false;
545544
546 return DbgNode->getNumOperands() == 8 && getNumHeaderFields() == 8;
545 return DbgNode->getNumOperands() == 15;
547546 }
548547
549548 /// Verify - Verify that a subprogram descriptor is well formed.
551550 if (!isSubprogram())
552551 return false;
553552
554 // Make sure context @ field 2 is a ScopeRef and type @ field 3 is a MDNode.
553 // Make sure context @ field 2 is a ScopeRef and type @ field 7 is a MDNode.
555554 if (!fieldIsScopeRef(DbgNode, 2))
556555 return false;
557 if (!fieldIsMDNode(DbgNode, 3))
558 return false;
559 // Containing type @ field 4.
560 if (!fieldIsTypeRef(DbgNode, 4))
556 if (!fieldIsMDNode(DbgNode, 7))
557 return false;
558 // Containing type @ field 12.
559 if (!fieldIsTypeRef(DbgNode, 12))
561560 return false;
562561
563562 // A subprogram can't be both & and &&.
564563 if (isLValueReference() && isRValueReference())
565564 return false;
566565
567 return DbgNode->getNumOperands() == 9 && getNumHeaderFields() == 12;
566 return DbgNode->getNumOperands() == 20;
568567 }
569568
570569 /// Verify - Verify that a global variable descriptor is well formed.
574573
575574 if (getDisplayName().empty())
576575 return false;
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;
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;
588587 }
589588
590589 /// Verify - Verify that a variable descriptor is well formed.
595594 // Make sure context @ field 1 is an MDNode.
596595 if (!fieldIsMDNode(DbgNode, 1))
597596 return false;
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)
597 // Make sure that type @ field 5 is a DITypeRef.
598 if (!fieldIsTypeRef(DbgNode, 5))
605599 return false;
606600
607601 // Variable without an inline location.
608 if (DbgNode->getNumOperands() == 4)
602 if (DbgNode->getNumOperands() == 7)
609603 return true;
610604
611 // Variable with an inline location.
612 return getInlinedAt() != nullptr && DbgNode->getNumOperands() == 5;
605 return DbgNode->getNumOperands() == 8;
613606 }
614607
615608 /// Verify - Verify that a variable descriptor is well formed.
618611 if (!DbgNode)
619612 return true;
620613
621 return isExpression() && DbgNode->getNumOperands() == 1;
614 return isExpression();
622615 }
623616
624617 /// Verify - Verify that a location descriptor is well formed.
633626 bool DINameSpace::Verify() const {
634627 if (!isNameSpace())
635628 return false;
636 return DbgNode->getNumOperands() == 3 && getNumHeaderFields() == 3;
629 return DbgNode->getNumOperands() == 5;
637630 }
638631
639632 /// \brief Retrieve the MDNode for the directory/file pair.
646639
647640 /// \brief Verify that the enumerator descriptor is well formed.
648641 bool DIEnumerator::Verify() const {
649 return isEnumerator() && DbgNode->getNumOperands() == 1 &&
650 getNumHeaderFields() == 3;
642 return isEnumerator() && DbgNode->getNumOperands() == 3;
651643 }
652644
653645 /// \brief Verify that the subrange descriptor is well formed.
654646 bool DISubrange::Verify() const {
655 return isSubrange() && DbgNode->getNumOperands() == 1 &&
656 getNumHeaderFields() == 3;
647 return isSubrange() && DbgNode->getNumOperands() == 3;
657648 }
658649
659650 /// \brief Verify that the lexical block descriptor is well formed.
660651 bool DILexicalBlock::Verify() const {
661 return isLexicalBlock() && DbgNode->getNumOperands() == 3 &&
662 getNumHeaderFields() == 4;
652 return isLexicalBlock() && DbgNode->getNumOperands() == 6;
663653 }
664654
665655 /// \brief Verify that the file-scoped lexical block descriptor is well formed.
666656 bool DILexicalBlockFile::Verify() const {
667 return isLexicalBlockFile() && DbgNode->getNumOperands() == 3 &&
668 getNumHeaderFields() == 2;
657 return isLexicalBlockFile() && DbgNode->getNumOperands() == 4;
669658 }
670659
671660 /// \brief Verify that the template type parameter descriptor is well formed.
672661 bool DITemplateTypeParameter::Verify() const {
673 return isTemplateTypeParameter() && DbgNode->getNumOperands() == 4 &&
674 getNumHeaderFields() == 4;
662 return isTemplateTypeParameter() && DbgNode->getNumOperands() == 7;
675663 }
676664
677665 /// \brief Verify that the template value parameter descriptor is well formed.
678666 bool DITemplateValueParameter::Verify() const {
679 return isTemplateValueParameter() && DbgNode->getNumOperands() == 5 &&
680 getNumHeaderFields() == 4;
667 return isTemplateValueParameter() && DbgNode->getNumOperands() == 8;
681668 }
682669
683670 /// \brief Verify that the imported module descriptor is well formed.
684671 bool DIImportedEntity::Verify() const {
685 return isImportedEntity() && DbgNode->getNumOperands() == 3 &&
686 getNumHeaderFields() == 3;
672 return isImportedEntity() &&
673 (DbgNode->getNumOperands() == 4 || DbgNode->getNumOperands() == 5);
687674 }
688675
689676 /// getObjCProperty - Return property node, if this ivar is associated with one.
690677 MDNode *DIDerivedType::getObjCProperty() const {
691 return getNodeField(DbgNode, 4);
678 return getNodeField(DbgNode, 10);
692679 }
693680
694681 MDString *DICompositeType::getIdentifier() const {
695 return cast_or_null(getField(DbgNode, 7));
682 return cast_or_null(getField(DbgNode, 14));
696683 }
697684
698685 #ifndef NDEBUG
716703 if (Elements) {
717704 #ifndef NDEBUG
718705 // Check that the new list of members contains all the old members as well.
719 if (const MDNode *El = cast_or_null(N->getOperand(4)))
706 if (const MDNode *El = cast_or_null(N->getOperand(10)))
720707 VerifySubsetOf(El, Elements);
721708 #endif
722 N->replaceOperandWith(4, Elements);
709 N->replaceOperandWith(10, Elements);
723710 }
724711 if (TParams)
725 N->replaceOperandWith(6, TParams);
712 N->replaceOperandWith(13, TParams);
726713 DbgNode = N;
727714 }
728715
740727 /// \brief Set the containing type.
741728 void DICompositeType::setContainingType(DICompositeType ContainingType) {
742729 TrackingVH N(*this);
743 N->replaceOperandWith(5, ContainingType.getRef());
730 N->replaceOperandWith(12, ContainingType.getRef());
744731 DbgNode = N;
745732 }
746733
769756 return false;
770757 }
771758
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
772766 MDNode *DISubprogram::getVariablesNodes() const {
773 return getNodeField(DbgNode, 8);
767 return getNodeField(DbgNode, 18);
774768 }
775769
776770 DIArray DISubprogram::getVariables() const {
777 return DIArray(getNodeField(DbgNode, 8));
771 return DIArray(getNodeField(DbgNode, 18));
778772 }
779773
780774 Value *DITemplateValueParameter::getValue() const {
781 return getField(DbgNode, 3);
775 return getField(DbgNode, 4);
782776 }
783777
784778 // If the current node has a parent scope then return that,
831825 }
832826
833827 DIArray DICompileUnit::getEnumTypes() const {
834 if (!DbgNode || DbgNode->getNumOperands() < 7)
828 if (!DbgNode || DbgNode->getNumOperands() < 13)
835829 return DIArray();
836830
837 return DIArray(getNodeField(DbgNode, 2));
831 return DIArray(getNodeField(DbgNode, 7));
838832 }
839833
840834 DIArray DICompileUnit::getRetainedTypes() const {
841 if (!DbgNode || DbgNode->getNumOperands() < 7)
835 if (!DbgNode || DbgNode->getNumOperands() < 13)
842836 return DIArray();
843837
844 return DIArray(getNodeField(DbgNode, 3));
838 return DIArray(getNodeField(DbgNode, 8));
845839 }
846840
847841 DIArray DICompileUnit::getSubprograms() const {
848 if (!DbgNode || DbgNode->getNumOperands() < 7)
842 if (!DbgNode || DbgNode->getNumOperands() < 13)
849843 return DIArray();
850844
851 return DIArray(getNodeField(DbgNode, 4));
845 return DIArray(getNodeField(DbgNode, 9));
852846 }
853847
854848 DIArray DICompileUnit::getGlobalVariables() const {
855 if (!DbgNode || DbgNode->getNumOperands() < 7)
849 if (!DbgNode || DbgNode->getNumOperands() < 13)
856850 return DIArray();
857851
858 return DIArray(getNodeField(DbgNode, 5));
852 return DIArray(getNodeField(DbgNode, 10));
859853 }
860854
861855 DIArray DICompileUnit::getImportedEntities() const {
862 if (!DbgNode || DbgNode->getNumOperands() < 7)
856 if (!DbgNode || DbgNode->getNumOperands() < 13)
863857 return DIArray();
864858
865 return DIArray(getNodeField(DbgNode, 6));
859 return DIArray(getNodeField(DbgNode, 11));
866860 }
867861
868862 /// copyWithNewScope - Return a copy of this location, replacing the
935929 /// @param InlinedScope Location at current variable is inlined.
936930 DIVariable llvm::createInlinedVariable(MDNode *DV, MDNode *InlinedScope,
937931 LLVMContext &VMContext) {
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;
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));
951937 }
952938
953939 /// cleanseInlinedVariable - Remove inlined scope from the variable.
954940 DIVariable llvm::cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext) {
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;
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));
967947 }
968948
969949 /// 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 return DebugLoc::get(SP.getScopeLineNumber(), 0, SP);
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 }
8389
8490 return DebugLoc();
8591 }
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() >= 5 && SPs == DIC->getOperand(4) &&
356 "DICompileUnits is expected to store Subprograms in operand 4.");
357 DIC->replaceOperandWith(4, MDNode::get(C, LiveSubprograms));
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));
358360 Changed = true;
359361 }
360362
363365 // make sure that an assert is hit if the location of the subprogram array
364366 // changes. This is just to make sure that this index is updated if such
365367 // an event occurs.
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));
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));
370373 Changed = true;
371374 }
372375
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 !{metadata !"0x102"})
14 call void @llvm.dbg.declare(metadata !{i64* %diff1}, metadata !0, metadata !{i32 786690})
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 !{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 ]
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 ]
3131 !4 = metadata !{metadata !5}
32 !5 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", null, metadata !6} ; [ DW_TAG_base_type ]
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 ]
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 !{metadata !"0x102"})
5 call void @llvm.dbg.value(metadata !{ i32* %1 }, i64 16, metadata !2, metadata !{i32 786690})
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 !{metadata !"0x102"})
11 call void @llvm.dbg.declare(metadata !{i32* %1}, metadata !{i32* %1}, metadata !{i32 786690})
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 !{metadata !"0x102"})
13 call void @llvm.dbg.declare(metadata !{i32 %two}, metadata !{i32 %0}, metadata !{i32 786690})
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 !{metadata !"0x102"})
15 call void @llvm.dbg.declare(metadata !{i32 %0}, metadata !{i32* %1, i32 %0}, metadata !{i32 786690})
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 !{metadata !"0x102"})
17 call void @llvm.dbg.declare(metadata !{i32* %1}, metadata !{i32 %b, i32 %0}, metadata !{i32 786690})
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 !{metadata !"0x102"})
19 call void @llvm.dbg.declare(metadata !{i32 %a}, metadata !{i32 %a, metadata !"foo"}, metadata !{i32 786690})
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 !{metadata !"0x102"})
21 call void @llvm.dbg.declare(metadata !{i32 %b}, metadata !{metadata !0, i32 %two}, metadata !{i32 786690})
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 !{metadata !"0x102"})
24 call void @llvm.dbg.value(metadata !{ i32 %a }, i64 0, metadata !1, metadata !{i32 786690})
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 !{metadata !"0x102"})
26 call void @llvm.dbg.value(metadata !{ i32 %0 }, i64 25, metadata !0, metadata !{i32 786690})
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 !{metadata !"0x102"})
28 call void @llvm.dbg.value(metadata !{ i32* %1 }, i64 16, metadata !3, metadata !{i32 786690})
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 !{metadata !"0x102"})
30 call void @llvm.dbg.value(metadata !3, i64 12, metadata !2, metadata !{i32 786690})
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 2}
43 !4 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
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 2}
1360 * CHECK: !0 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
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 !{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]
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]
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 !{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 ]
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 ]
2121 !7 = metadata !{metadata !8}
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]
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]
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 !{metadata !"0x11\000\00me\001\00\000\00\000", metadata ![[FILE:[0-9]+]], metadata ![[LIST:[0-9]+]], metadata ![[LIST]], null, null, null}
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 !""}
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 !{metadata !"0x11\000\00me\001\00\000\00\000", metadata !15, metadata !16, metadata !16, null, null, null} ; [ DW_TAG_compile_unit ]
33 !9 = metadata !{i32 458769, metadata !15, i32 0, metadata !"me", i1 true, metadata !"", i32 0, metadata !16, metadata !16, null, null, null, metadata !""}
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 2}
41 !17 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
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 !{metadata !"0x102"}), !dbg !55
18 tail call void @llvm.dbg.value(metadata !{i64 %mul63}, i64 0, metadata !30, metadata !{i32 786690}), !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 !{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 ] [] [] []
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} ; [] [] []
4747 !1 = metadata !{metadata !"test.c", metadata !""}
4848 !2 = metadata !{}
4949 !3 = metadata !{metadata !4}
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 ]
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 ]
5353 !7 = metadata !{null, metadata !8}
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]
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]
5656 !10 = metadata !{metadata !"", metadata !""}
57 !11 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [] [int] []
57 !11 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [] [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 !{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]
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]
6262 !16 = metadata !{metadata !"", metadata !""}
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 ] [ ] [] []
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} ; [ ] [] []
8282 !36 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
83 !37 = metadata !{i32 2, metadata !"Debug Info Version", i32 2}
83 !37 = metadata !{i32 2, metadata !"Debug Info Version", i32 1}
8484 !38 = metadata !{metadata !"clang version 3.6.0 "}
8585 !39 = metadata !{i32 154, i32 8, metadata !40, null}
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 ] [ ] []
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} ; [ ] []
8989 !43 = metadata !{i32 157, i32 5, metadata !44, null}
90 !44 = metadata !{metadata !"0xb\00154\0042\000", metadata !1, metadata !42} ; [ DW_TAG_lexical_block ] [ ] []
90 !44 = metadata !{i32 786443, metadata !1, metadata !42, i32 154, i32 42, i32 0, i32 1} ; [ ] []
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 !{metadata !"0x102"}), !dbg !18
13 call void @llvm.dbg.declare(metadata !{i32* %do_tab_convert}, metadata !16, metadata !{i32 786690}), !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 !{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 ]
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 ]
2828 !5 = metadata !{metadata !6}
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 ]
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 ]
3232 !9 = metadata !{null}
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 ]
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 ]
3636 !13 = metadata !{i32 653, i32 5, metadata !14, null}
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 ]
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 ]
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 !{metadata !"0x102"})
11 call void @llvm.dbg.declare(metadata !{i32* %count_}, metadata !4, metadata !{i32 786690})
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 !{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 ]
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 ]
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 !{metadata !"0x102"})
7 tail call void @llvm.dbg.value(metadata !{i32 %b}, i64 0, metadata !0, metadata !{i32 786690})
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 !{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 ]
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 ]
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 !{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 ]
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 ]
2222 !5 = metadata !{metadata !6, metadata !6, metadata !6}
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 ]
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 ]
2626 !9 = metadata !{i32 95, i32 0, metadata !10, null}
27 !10 = metadata !{metadata !"0xb\0094\000\000", metadata !12, metadata !1} ; [ DW_TAG_lexical_block ]
27 !10 = metadata !{i32 524299, metadata !12, metadata !1, i32 94, i32 0, i32 0} ; [ 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 2}
31 !15 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
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 !{metadata !"0x102"}), !dbg !15
10 tail call void @llvm.dbg.value(metadata !{i32 %nbytes}, i64 0, metadata !8, metadata !{metadata !"0x102"}), !dbg !16
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
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 !{metadata !"0x102"}), !dbg !17
16 tail call void @llvm.dbg.value(metadata !{i32 %tmp}, i64 0, metadata !8, metadata !{i32 786690}), !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 !{metadata !"0x102"}), !dbg !19
18 tail call void @llvm.dbg.value(metadata !18, i64 0, metadata !10, metadata !{i32 786690}), !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 !{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 ]
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 ]
5454 !5 = metadata !{null}
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 ]
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 ]
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 !{metadata !"0xb\0011\0045\000", metadata !26, metadata !11} ; [ DW_TAG_lexical_block ]
71 !22 = metadata !{i32 524299, metadata !26, metadata !11, i32 11, i32 45, i32 0} ; [ 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 !{metadata !"0x102"}), !dbg !24
9 call void @llvm.dbg.value(metadata !{%struct.SVal* %location}, i64 0, metadata !25, metadata !{metadata !"0x102"}), !dbg !24
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
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 !{metadata !"0x102"}), !dbg !34
36 call void @llvm.dbg.value(metadata !{%struct.SVal* %this}, i64 0, metadata !31, metadata !{i32 786690}), !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 !{metadata !"0x102"}), !dbg !41
54 call void @llvm.dbg.declare(metadata !{%struct.SVal* %v}, metadata !38, metadata !{i32 786690}), !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 !{metadata !"0x102"}), !dbg !43
67 call void @llvm.dbg.value(metadata !{i32 %8}, i64 0, metadata !44, metadata !{i32 786690}), !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 !{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 ]
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 ]
8383 !4 = metadata !{metadata !5, metadata !7, metadata !0, metadata !9}
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 ]
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 ]
9090 !11 = metadata !{null, metadata !12, metadata !13}
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 ]
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 ]
9494 !15 = metadata !{null, metadata !12}
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 ]
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 ]
9898 !19 = metadata !{metadata !13, metadata !13, metadata !1}
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 ]
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 ]
101101 !22 = metadata !{metadata !13}
102 !23 = metadata !{metadata !"0x101\00i\0016\000", metadata !17, metadata !2, metadata !13} ; [ DW_TAG_arg_variable ]
102 !23 = metadata !{i32 786689, metadata !17, metadata !"i", metadata !2, i32 16, metadata !13, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
103103 !24 = metadata !{i32 16, i32 0, metadata !17, null}
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 ]
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 ]
106106 !27 = metadata !{i32 17, i32 0, metadata !28, null}
107 !28 = metadata !{metadata !"0xb\0016\000\002", metadata !2, metadata !17} ; [ DW_TAG_lexical_block ]
107 !28 = metadata !{i32 786443, metadata !2, metadata !17, i32 16, i32 0, i32 2} ; [ 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 !{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 ]
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 ]
113113 !34 = metadata !{i32 11, i32 0, metadata !16, null}
114114 !35 = metadata !{i32 11, i32 0, metadata !36, null}
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 ]
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 ]
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 !{metadata !"0x100\00k\0026\000", metadata !39, metadata !2, metadata !13} ; [ DW_TAG_auto_variable ]
123 !44 = metadata !{i32 786688, metadata !39, metadata !"k", metadata !2, i32 26, metadata !13, i32 0, i32 0} ; [ 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 2}
128 !49 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
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 !{metadata !"0x102"}), !dbg !30
32 tail call void @llvm.dbg.value(metadata !{i8 %a}, i64 0, metadata !10, metadata !{i32 786690}), !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 !{metadata !"0x102"}), !dbg !30
34 tail call void @llvm.dbg.value(metadata !{i8 %0}, i64 0, metadata !11, metadata !{i32 786690}), !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 !{metadata !"0x102"}), !dbg !32
43 tail call void @llvm.dbg.value(metadata !{i8 %a}, i64 0, metadata !18, metadata !{i32 786690}), !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 !{metadata !"0x102"}), !dbg !32
45 tail call void @llvm.dbg.value(metadata !{i8 %0}, i64 0, metadata !19, metadata !{i32 786690}), !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 !{metadata !"0x102"}), !dbg !34
52 tail call void @llvm.dbg.value(metadata !{i8 %a}, i64 0, metadata !21, metadata !{i32 786690}), !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 !{metadata !"0x102"}), !dbg !34
54 tail call void @llvm.dbg.value(metadata !{i8 %0}, i64 0, metadata !22, metadata !{i32 786690}), !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 !{metadata !"0x102"}), !dbg !36
61 tail call void @llvm.dbg.value(metadata !{i8 %a}, i64 0, metadata !24, metadata !{i32 786690}), !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 !{metadata !"0x102"}), !dbg !36
63 tail call void @llvm.dbg.value(metadata !{i8 %0}, i64 0, metadata !25, metadata !{i32 786690}), !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 !{metadata !"0x102"}), !dbg !38
70 tail call void @llvm.dbg.value(metadata !{i8 %a}, i64 0, metadata !27, metadata !{i32 786690}), !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 !{metadata !"0x102"}), !dbg !38
72 tail call void @llvm.dbg.value(metadata !{i8 %0}, i64 0, metadata !28, metadata !{i32 786690}), !dbg !38
7373 store i8 %a, i8* @x5, align 4, !dbg !38
7474 ret i8 %0, !dbg !39
7575 }
7777