LCOV - code coverage report
Current view: top level - lib/IR - DebugInfoMetadata.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 293 302 97.0 %
Date: 2018-06-17 00:07:59 Functions: 55 55 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- DebugInfoMetadata.cpp - Implement debug info metadata --------------===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : //
      10             : // This file implements the debug info Metadata classes.
      11             : //
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #include "llvm/IR/DebugInfoMetadata.h"
      15             : #include "LLVMContextImpl.h"
      16             : #include "MetadataImpl.h"
      17             : #include "llvm/ADT/SmallPtrSet.h"
      18             : #include "llvm/ADT/StringSwitch.h"
      19             : #include "llvm/IR/DIBuilder.h"
      20             : #include "llvm/IR/Function.h"
      21             : #include "llvm/IR/Instructions.h"
      22             : 
      23             : using namespace llvm;
      24             : 
      25     1425216 : DILocation::DILocation(LLVMContext &C, StorageType Storage, unsigned Line,
      26     1425216 :                        unsigned Column, ArrayRef<Metadata *> MDs)
      27     2850432 :     : MDNode(C, DILocationKind, Storage, MDs) {
      28             :   assert((MDs.size() == 1 || MDs.size() == 2) &&
      29             :          "Expected a scope and optional inlined-at");
      30             : 
      31             :   // Set line and column.
      32             :   assert(Column < (1u << 16) && "Expected 16-bit column");
      33             : 
      34     1425216 :   SubclassData32 = Line;
      35     1425216 :   SubclassData16 = Column;
      36     1425216 : }
      37             : 
      38             : static void adjustColumn(unsigned &Column) {
      39             :   // Set to unknown on overflow.  We only have 16 bits to play with here.
      40     3483978 :   if (Column >= (1u << 16))
      41             :     Column = 0;
      42             : }
      43             : 
      44     3455278 : DILocation *DILocation::getImpl(LLVMContext &Context, unsigned Line,
      45             :                                 unsigned Column, Metadata *Scope,
      46             :                                 Metadata *InlinedAt, StorageType Storage,
      47             :                                 bool ShouldCreate) {
      48             :   // Fixup column.
      49             :   adjustColumn(Column);
      50             : 
      51     3455278 :   if (Storage == Uniqued) {
      52     2030062 :     if (auto *N =
      53     3292192 :             getUniqued(Context.pImpl->DILocations,
      54     6584384 :                        DILocationInfo::KeyTy(Line, Column, Scope, InlinedAt)))
      55             :       return N;
      56     1262130 :     if (!ShouldCreate)
      57             :       return nullptr;
      58             :   } else {
      59             :     assert(ShouldCreate && "Expected non-uniqued nodes to always be created");
      60             :   }
      61             : 
      62             :   SmallVector<Metadata *, 2> Ops;
      63     1425216 :   Ops.push_back(Scope);
      64     1425216 :   if (InlinedAt)
      65      499248 :     Ops.push_back(InlinedAt);
      66     4275648 :   return storeImpl(new (Ops.size())
      67     1425216 :                        DILocation(Context, Storage, Line, Column, Ops),
      68     2850432 :                    Storage, Context.pImpl->DILocations);
      69             : }
      70             : 
      71      144999 : const DILocation *DILocation::getMergedLocation(const DILocation *LocA,
      72             :                                                 const DILocation *LocB,
      73             :                                                 bool GenerateLocation) {
      74      144999 :   if (!LocA || !LocB)
      75             :     return nullptr;
      76             : 
      77      104954 :   if (LocA == LocB || !LocA->canDiscriminate(*LocB))
      78             :     return LocA;
      79             : 
      80       11777 :   if (!GenerateLocation)
      81             :     return nullptr;
      82             : 
      83             :   SmallPtrSet<DILocation *, 5> InlinedLocationsA;
      84        7019 :   for (DILocation *L = LocA->getInlinedAt(); L; L = L->getInlinedAt())
      85         816 :     InlinedLocationsA.insert(L);
      86             :   const DILocation *Result = LocB;
      87        7870 :   for (DILocation *L = LocB->getInlinedAt(); L; L = L->getInlinedAt()) {
      88             :     Result = L;
      89        1128 :     if (InlinedLocationsA.count(L))
      90             :       break;
      91             :   }
      92             :   return DILocation::get(Result->getContext(), 0, 0, Result->getScope(),
      93             :                          Result->getInlinedAt());
      94             : }
      95             : 
      96        3508 : DINode::DIFlags DINode::getFlag(StringRef Flag) {
      97        3508 :   return StringSwitch<DIFlags>(Flag)
      98             : #define HANDLE_DI_FLAG(ID, NAME) .Case("DIFlag" #NAME, Flag##NAME)
      99             : #include "llvm/IR/DebugInfoFlags.def"
     100        3508 :       .Default(DINode::FlagZero);
     101             : }
     102             : 
     103        9051 : StringRef DINode::getFlagString(DIFlags Flag) {
     104        9051 :   switch (Flag) {
     105             : #define HANDLE_DI_FLAG(ID, NAME)                                               \
     106             :   case Flag##NAME:                                                             \
     107             :     return "DIFlag" #NAME;
     108             : #include "llvm/IR/DebugInfoFlags.def"
     109             :   }
     110           3 :   return "";
     111             : }
     112             : 
     113        7207 : DINode::DIFlags DINode::splitFlags(DIFlags Flags,
     114             :                                    SmallVectorImpl<DIFlags> &SplitFlags) {
     115             :   // Flags that are packed together need to be specially handled, so
     116             :   // that, for example, we emit "DIFlagPublic" and not
     117             :   // "DIFlagPrivate | DIFlagProtected".
     118        7207 :   if (DIFlags A = Flags & FlagAccessibility) {
     119         490 :     if (A == FlagPrivate)
     120          39 :       SplitFlags.push_back(FlagPrivate);
     121         451 :     else if (A == FlagProtected)
     122          63 :       SplitFlags.push_back(FlagProtected);
     123             :     else
     124         388 :       SplitFlags.push_back(FlagPublic);
     125             :     Flags &= ~A;
     126             :   }
     127        7207 :   if (DIFlags R = Flags & FlagPtrToMemberRep) {
     128          14 :     if (R == FlagSingleInheritance)
     129          10 :       SplitFlags.push_back(FlagSingleInheritance);
     130           4 :     else if (R == FlagMultipleInheritance)
     131           2 :       SplitFlags.push_back(FlagMultipleInheritance);
     132             :     else
     133           2 :       SplitFlags.push_back(FlagVirtualInheritance);
     134             :     Flags &= ~R;
     135             :   }
     136        7207 :   if ((Flags & FlagIndirectVirtualBase) == FlagIndirectVirtualBase) {
     137             :     Flags &= ~FlagIndirectVirtualBase;
     138           1 :     SplitFlags.push_back(FlagIndirectVirtualBase);
     139             :   }
     140             : 
     141             : #define HANDLE_DI_FLAG(ID, NAME)                                               \
     142             :   if (DIFlags Bit = Flags & Flag##NAME) {                                      \
     143             :     SplitFlags.push_back(Bit);                                                 \
     144             :     Flags &= ~Bit;                                                             \
     145             :   }
     146             : #include "llvm/IR/DebugInfoFlags.def"
     147        7207 :   return Flags;
     148             : }
     149             : 
     150      146737 : DIScopeRef DIScope::getScope() const {
     151             :   if (auto *T = dyn_cast<DIType>(this))
     152             :     return T->getScope();
     153             : 
     154             :   if (auto *SP = dyn_cast<DISubprogram>(this))
     155             :     return SP->getScope();
     156             : 
     157             :   if (auto *LB = dyn_cast<DILexicalBlockBase>(this))
     158        8657 :     return LB->getScope();
     159             : 
     160             :   if (auto *NS = dyn_cast<DINamespace>(this))
     161       76333 :     return NS->getScope();
     162             : 
     163             :   if (auto *M = dyn_cast<DIModule>(this))
     164          21 :     return M->getScope();
     165             : 
     166             :   assert((isa<DIFile>(this) || isa<DICompileUnit>(this)) &&
     167             :          "Unhandled type of scope.");
     168        4704 :   return nullptr;
     169             : }
     170             : 
     171      105540 : StringRef DIScope::getName() const {
     172             :   if (auto *T = dyn_cast<DIType>(this))
     173             :     return T->getName();
     174             :   if (auto *SP = dyn_cast<DISubprogram>(this))
     175             :     return SP->getName();
     176             :   if (auto *NS = dyn_cast<DINamespace>(this))
     177             :     return NS->getName();
     178             :   if (auto *M = dyn_cast<DIModule>(this))
     179             :     return M->getName();
     180             :   assert((isa<DILexicalBlockBase>(this) || isa<DIFile>(this) ||
     181             :           isa<DICompileUnit>(this)) &&
     182             :          "Unhandled type of scope.");
     183        4716 :   return "";
     184             : }
     185             : 
     186             : #ifndef NDEBUG
     187             : static bool isCanonical(const MDString *S) {
     188             :   return !S || !S->getString().empty();
     189             : }
     190             : #endif
     191             : 
     192          61 : GenericDINode *GenericDINode::getImpl(LLVMContext &Context, unsigned Tag,
     193             :                                       MDString *Header,
     194             :                                       ArrayRef<Metadata *> DwarfOps,
     195             :                                       StorageType Storage, bool ShouldCreate) {
     196             :   unsigned Hash = 0;
     197          61 :   if (Storage == Uniqued) {
     198             :     GenericDINodeInfo::KeyTy Key(Tag, Header, DwarfOps);
     199          62 :     if (auto *N = getUniqued(Context.pImpl->GenericDINodes, Key))
     200          13 :       return N;
     201          36 :     if (!ShouldCreate)
     202             :       return nullptr;
     203          36 :     Hash = Key.getHash();
     204             :   } else {
     205             :     assert(ShouldCreate && "Expected non-uniqued nodes to always be created");
     206             :   }
     207             : 
     208             :   // Use a nullptr for empty headers.
     209             :   assert(isCanonical(Header) && "Expected canonical MDString");
     210          48 :   Metadata *PreOps[] = {Header};
     211          48 :   return storeImpl(new (DwarfOps.size() + 1) GenericDINode(
     212          48 :                        Context, Storage, Hash, Tag, PreOps, DwarfOps),
     213          96 :                    Storage, Context.pImpl->GenericDINodes);
     214             : }
     215             : 
     216          15 : void GenericDINode::recalculateHash() {
     217             :   setHash(GenericDINodeInfo::KeyTy::calculateHash(this));
     218          15 : }
     219             : 
     220             : #define UNWRAP_ARGS_IMPL(...) __VA_ARGS__
     221             : #define UNWRAP_ARGS(ARGS) UNWRAP_ARGS_IMPL ARGS
     222             : #define DEFINE_GETIMPL_LOOKUP(CLASS, ARGS)                                     \
     223             :   do {                                                                         \
     224             :     if (Storage == Uniqued) {                                                  \
     225             :       if (auto *N = getUniqued(Context.pImpl->CLASS##s,                        \
     226             :                                CLASS##Info::KeyTy(UNWRAP_ARGS(ARGS))))         \
     227             :         return N;                                                              \
     228             :       if (!ShouldCreate)                                                       \
     229             :         return nullptr;                                                        \
     230             :     } else {                                                                   \
     231             :       assert(ShouldCreate &&                                                   \
     232             :              "Expected non-uniqued nodes to always be created");               \
     233             :     }                                                                          \
     234             :   } while (false)
     235             : #define DEFINE_GETIMPL_STORE(CLASS, ARGS, OPS)                                 \
     236             :   return storeImpl(new (array_lengthof(OPS))                                   \
     237             :                        CLASS(Context, Storage, UNWRAP_ARGS(ARGS), OPS),        \
     238             :                    Storage, Context.pImpl->CLASS##s)
     239             : #define DEFINE_GETIMPL_STORE_NO_OPS(CLASS, ARGS)                               \
     240             :   return storeImpl(new (0u) CLASS(Context, Storage, UNWRAP_ARGS(ARGS)),        \
     241             :                    Storage, Context.pImpl->CLASS##s)
     242             : #define DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(CLASS, OPS)                   \
     243             :   return storeImpl(new (array_lengthof(OPS)) CLASS(Context, Storage, OPS),     \
     244             :                    Storage, Context.pImpl->CLASS##s)
     245             : #define DEFINE_GETIMPL_STORE_N(CLASS, ARGS, OPS, NUM_OPS)                      \
     246             :   return storeImpl(new (NUM_OPS)                                               \
     247             :                        CLASS(Context, Storage, UNWRAP_ARGS(ARGS), OPS),        \
     248             :                    Storage, Context.pImpl->CLASS##s)
     249             : 
     250        3948 : DISubrange *DISubrange::getImpl(LLVMContext &Context, int64_t Count, int64_t Lo,
     251             :                                 StorageType Storage, bool ShouldCreate) {
     252             :   auto *CountNode = ConstantAsMetadata::get(
     253        3948 :       ConstantInt::getSigned(Type::getInt64Ty(Context), Count));
     254        3948 :   return getImpl(Context, CountNode, Lo, Storage, ShouldCreate);
     255             : }
     256             : 
     257        4025 : DISubrange *DISubrange::getImpl(LLVMContext &Context, Metadata *CountNode,
     258             :                                 int64_t Lo, StorageType Storage,
     259             :                                 bool ShouldCreate) {
     260       12073 :   DEFINE_GETIMPL_LOOKUP(DISubrange, (CountNode, Lo));
     261        3374 :   Metadata *Ops[] = { CountNode };
     262        6748 :   DEFINE_GETIMPL_STORE(DISubrange, (CountNode, Lo), Ops);
     263             : }
     264             : 
     265       19707 : DIEnumerator *DIEnumerator::getImpl(LLVMContext &Context, int64_t Value,
     266             :                                     bool IsUnsigned, MDString *Name,
     267             :                                     StorageType Storage, bool ShouldCreate) {
     268             :   assert(isCanonical(Name) && "Expected canonical MDString");
     269       59119 :   DEFINE_GETIMPL_LOOKUP(DIEnumerator, (Value, IsUnsigned, Name));
     270       19695 :   Metadata *Ops[] = {Name};
     271       39390 :   DEFINE_GETIMPL_STORE(DIEnumerator, (Value, IsUnsigned), Ops);
     272             : }
     273             : 
     274       14054 : DIBasicType *DIBasicType::getImpl(LLVMContext &Context, unsigned Tag,
     275             :                                   MDString *Name, uint64_t SizeInBits,
     276             :                                   uint32_t AlignInBits, unsigned Encoding,
     277             :                                   StorageType Storage, bool ShouldCreate) {
     278             :   assert(isCanonical(Name) && "Expected canonical MDString");
     279       42158 :   DEFINE_GETIMPL_LOOKUP(DIBasicType,
     280             :                         (Tag, Name, SizeInBits, AlignInBits, Encoding));
     281       13668 :   Metadata *Ops[] = {nullptr, nullptr, Name};
     282       27336 :   DEFINE_GETIMPL_STORE(DIBasicType, (Tag, SizeInBits, AlignInBits, Encoding),
     283             :                        Ops);
     284             : }
     285             : 
     286      641913 : DIDerivedType *DIDerivedType::getImpl(
     287             :     LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
     288             :     unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
     289             :     uint32_t AlignInBits, uint64_t OffsetInBits,
     290             :     Optional<unsigned> DWARFAddressSpace, DIFlags Flags, Metadata *ExtraData,
     291             :     StorageType Storage, bool ShouldCreate) {
     292             :   assert(isCanonical(Name) && "Expected canonical MDString");
     293     1511379 :   DEFINE_GETIMPL_LOOKUP(DIDerivedType,
     294             :                         (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
     295             :                          AlignInBits, OffsetInBits, DWARFAddressSpace, Flags,
     296             :                          ExtraData));
     297      473597 :   Metadata *Ops[] = {File, Scope, Name, BaseType, ExtraData};
     298     1420791 :   DEFINE_GETIMPL_STORE(
     299             :       DIDerivedType, (Tag, Line, SizeInBits, AlignInBits, OffsetInBits,
     300             :                       DWARFAddressSpace, Flags), Ops);
     301             : }
     302             : 
     303       49947 : DICompositeType *DICompositeType::getImpl(
     304             :     LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
     305             :     unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
     306             :     uint32_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags,
     307             :     Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder,
     308             :     Metadata *TemplateParams, MDString *Identifier, Metadata *Discriminator,
     309             :     StorageType Storage, bool ShouldCreate) {
     310             :   assert(isCanonical(Name) && "Expected canonical MDString");
     311             : 
     312             :   // Keep this in sync with buildODRType.
     313       62655 :   DEFINE_GETIMPL_LOOKUP(
     314             :       DICompositeType, (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
     315             :                         AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
     316             :                         VTableHolder, TemplateParams, Identifier, Discriminator));
     317             :   Metadata *Ops[] = {File,     Scope,        Name,           BaseType,
     318             :                      Elements, VTableHolder, TemplateParams, Identifier,
     319       49818 :                      Discriminator};
     320       99636 :   DEFINE_GETIMPL_STORE(DICompositeType, (Tag, Line, RuntimeLang, SizeInBits,
     321             :                                          AlignInBits, OffsetInBits, Flags),
     322             :                        Ops);
     323             : }
     324             : 
     325         615 : DICompositeType *DICompositeType::buildODRType(
     326             :     LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name,
     327             :     Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType,
     328             :     uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
     329             :     DIFlags Flags, Metadata *Elements, unsigned RuntimeLang,
     330             :     Metadata *VTableHolder, Metadata *TemplateParams, Metadata *Discriminator) {
     331             :   assert(!Identifier.getString().empty() && "Expected valid identifier");
     332         615 :   if (!Context.isODRUniquingDebugTypes())
     333             :     return nullptr;
     334         314 :   auto *&CT = (*Context.pImpl->DITypeMap)[&Identifier];
     335         157 :   if (!CT)
     336         119 :     return CT = DICompositeType::getDistinct(
     337             :                Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits,
     338             :                AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
     339         119 :                VTableHolder, TemplateParams, &Identifier, Discriminator);
     340             : 
     341             :   // Only mutate CT if it's a forward declaration and the new operands aren't.
     342             :   assert(CT->getRawIdentifier() == &Identifier && "Wrong ODR identifier?");
     343          49 :   if (!CT->isForwardDecl() || (Flags & DINode::FlagFwdDecl))
     344             :     return CT;
     345             : 
     346             :   // Mutate CT in place.  Keep this in sync with getImpl.
     347             :   CT->mutate(Tag, Line, RuntimeLang, SizeInBits, AlignInBits, OffsetInBits,
     348             :              Flags);
     349             :   Metadata *Ops[] = {File,     Scope,        Name,           BaseType,
     350             :                      Elements, VTableHolder, TemplateParams, &Identifier,
     351           4 :                      Discriminator};
     352             :   assert((std::end(Ops) - std::begin(Ops)) == (int)CT->getNumOperands() &&
     353             :          "Mismatched number of operands");
     354          40 :   for (unsigned I = 0, E = CT->getNumOperands(); I != E; ++I)
     355          72 :     if (Ops[I] != CT->getOperand(I))
     356           9 :       CT->setOperand(I, Ops[I]);
     357           4 :   return CT;
     358             : }
     359             : 
     360           4 : DICompositeType *DICompositeType::getODRType(
     361             :     LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name,
     362             :     Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType,
     363             :     uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
     364             :     DIFlags Flags, Metadata *Elements, unsigned RuntimeLang,
     365             :     Metadata *VTableHolder, Metadata *TemplateParams, Metadata *Discriminator) {
     366             :   assert(!Identifier.getString().empty() && "Expected valid identifier");
     367           4 :   if (!Context.isODRUniquingDebugTypes())
     368             :     return nullptr;
     369           6 :   auto *&CT = (*Context.pImpl->DITypeMap)[&Identifier];
     370           3 :   if (!CT)
     371           1 :     CT = DICompositeType::getDistinct(
     372             :         Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits,
     373             :         AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang, VTableHolder,
     374             :         TemplateParams, &Identifier, Discriminator);
     375           3 :   return CT;
     376             : }
     377             : 
     378           5 : DICompositeType *DICompositeType::getODRTypeIfExists(LLVMContext &Context,
     379             :                                                      MDString &Identifier) {
     380             :   assert(!Identifier.getString().empty() && "Expected valid identifier");
     381           5 :   if (!Context.isODRUniquingDebugTypes())
     382             :     return nullptr;
     383           8 :   return Context.pImpl->DITypeMap->lookup(&Identifier);
     384             : }
     385             : 
     386      438684 : DISubroutineType *DISubroutineType::getImpl(LLVMContext &Context, DIFlags Flags,
     387             :                                             uint8_t CC, Metadata *TypeArray,
     388             :                                             StorageType Storage,
     389             :                                             bool ShouldCreate) {
     390     1316034 :   DEFINE_GETIMPL_LOOKUP(DISubroutineType, (Flags, CC, TypeArray));
     391      325879 :   Metadata *Ops[] = {nullptr, nullptr, nullptr, TypeArray};
     392      651758 :   DEFINE_GETIMPL_STORE(DISubroutineType, (Flags, CC), Ops);
     393             : }
     394             : 
     395             : // FIXME: Implement this string-enum correspondence with a .def file and macros,
     396             : // so that the association is explicit rather than implied.
     397             : static const char *ChecksumKindName[DIFile::CSK_Last] = {
     398             :   "CSK_MD5",
     399             :   "CSK_SHA1"
     400             : };
     401             : 
     402          68 : StringRef DIFile::getChecksumKindAsString(ChecksumKind CSKind) {
     403             :   assert(CSKind <= DIFile::CSK_Last && "Invalid checksum kind");
     404             :   // The first space was originally the CSK_None variant, which is now
     405             :   // obsolete, but the space is still reserved in ChecksumKind, so we account
     406             :   // for it here.
     407         136 :   return ChecksumKindName[CSKind - 1];
     408             : }
     409             : 
     410         141 : Optional<DIFile::ChecksumKind> DIFile::getChecksumKind(StringRef CSKindStr) {
     411         141 :   return StringSwitch<Optional<DIFile::ChecksumKind>>(CSKindStr)
     412         141 :       .Case("CSK_MD5", DIFile::CSK_MD5)
     413         141 :       .Case("CSK_SHA1", DIFile::CSK_SHA1)
     414         141 :       .Default(None);
     415             : }
     416             : 
     417       59992 : DIFile *DIFile::getImpl(LLVMContext &Context, MDString *Filename,
     418             :                         MDString *Directory,
     419             :                         Optional<DIFile::ChecksumInfo<MDString *>> CS,
     420             :                         Optional<MDString *> Source, StorageType Storage,
     421             :                         bool ShouldCreate) {
     422             :   assert(isCanonical(Filename) && "Expected canonical MDString");
     423             :   assert(isCanonical(Directory) && "Expected canonical MDString");
     424             :   assert((!CS || isCanonical(CS->Value)) && "Expected canonical MDString");
     425             :   assert((!Source || isCanonical(*Source)) && "Expected canonical MDString");
     426      179902 :   DEFINE_GETIMPL_LOOKUP(DIFile, (Filename, Directory, CS, Source));
     427       31677 :   Metadata *Ops[] = {Filename, Directory, CS ? CS->Value : nullptr,
     428       95031 :                      Source.getValueOr(nullptr)};
     429       63354 :   DEFINE_GETIMPL_STORE(DIFile, (CS, Source), Ops);
     430             : }
     431             : 
     432        5940 : DICompileUnit *DICompileUnit::getImpl(
     433             :     LLVMContext &Context, unsigned SourceLanguage, Metadata *File,
     434             :     MDString *Producer, bool IsOptimized, MDString *Flags,
     435             :     unsigned RuntimeVersion, MDString *SplitDebugFilename,
     436             :     unsigned EmissionKind, Metadata *EnumTypes, Metadata *RetainedTypes,
     437             :     Metadata *GlobalVariables, Metadata *ImportedEntities, Metadata *Macros,
     438             :     uint64_t DWOId, bool SplitDebugInlining, bool DebugInfoForProfiling,
     439             :     bool GnuPubnames, StorageType Storage, bool ShouldCreate) {
     440             :   assert(Storage != Uniqued && "Cannot unique DICompileUnit");
     441             :   assert(isCanonical(Producer) && "Expected canonical MDString");
     442             :   assert(isCanonical(Flags) && "Expected canonical MDString");
     443             :   assert(isCanonical(SplitDebugFilename) && "Expected canonical MDString");
     444             : 
     445             :   Metadata *Ops[] = {
     446             :       File,      Producer,      Flags,           SplitDebugFilename,
     447             :       EnumTypes, RetainedTypes, GlobalVariables, ImportedEntities,
     448        5940 :       Macros};
     449             :   return storeImpl(new (array_lengthof(Ops)) DICompileUnit(
     450             :                        Context, Storage, SourceLanguage, IsOptimized,
     451             :                        RuntimeVersion, EmissionKind, DWOId, SplitDebugInlining,
     452        5940 :                        DebugInfoForProfiling, GnuPubnames, Ops),
     453        5940 :                    Storage);
     454             : }
     455             : 
     456             : Optional<DICompileUnit::DebugEmissionKind>
     457        1793 : DICompileUnit::getEmissionKind(StringRef Str) {
     458        1793 :   return StringSwitch<Optional<DebugEmissionKind>>(Str)
     459        1793 :       .Case("NoDebug", NoDebug)
     460        1793 :       .Case("FullDebug", FullDebug)
     461        1793 :       .Case("LineTablesOnly", LineTablesOnly)
     462        1793 :       .Default(None);
     463             : }
     464             : 
     465        1090 : const char *DICompileUnit::EmissionKindString(DebugEmissionKind EK) {
     466        1090 :   switch (EK) {
     467             :   case NoDebug:        return "NoDebug";
     468         776 :   case FullDebug:      return "FullDebug";
     469         196 :   case LineTablesOnly: return "LineTablesOnly";
     470             :   }
     471           0 :   return nullptr;
     472             : }
     473             : 
     474     1574469 : DISubprogram *DILocalScope::getSubprogram() const {
     475             :   if (auto *Block = dyn_cast<DILexicalBlockBase>(this))
     476      106420 :     return Block->getScope()->getSubprogram();
     477             :   return const_cast<DISubprogram *>(cast<DISubprogram>(this));
     478             : }
     479             : 
     480     3655917 : DILocalScope *DILocalScope::getNonLexicalBlockFileScope() const {
     481             :   if (auto *File = dyn_cast<DILexicalBlockFile>(this))
     482         394 :     return File->getScope()->getNonLexicalBlockFileScope();
     483             :   return const_cast<DILocalScope *>(this);
     484             : }
     485             : 
     486      366905 : DISubprogram *DISubprogram::getImpl(
     487             :     LLVMContext &Context, Metadata *Scope, MDString *Name,
     488             :     MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
     489             :     bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
     490             :     Metadata *ContainingType, unsigned Virtuality, unsigned VirtualIndex,
     491             :     int ThisAdjustment, DIFlags Flags, bool IsOptimized, Metadata *Unit,
     492             :     Metadata *TemplateParams, Metadata *Declaration, Metadata *RetainedNodes,
     493             :     Metadata *ThrownTypes, StorageType Storage, bool ShouldCreate) {
     494             :   assert(isCanonical(Name) && "Expected canonical MDString");
     495             :   assert(isCanonical(LinkageName) && "Expected canonical MDString");
     496      779787 :   DEFINE_GETIMPL_LOOKUP(
     497             :       DISubprogram, (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
     498             :                      IsDefinition, ScopeLine, ContainingType, Virtuality,
     499             :                      VirtualIndex, ThisAdjustment, Flags, IsOptimized, Unit,
     500             :                      TemplateParams, Declaration, RetainedNodes, ThrownTypes));
     501             :   SmallVector<Metadata *, 11> Ops = {
     502             :       File,        Scope,         Name,           LinkageName,    Type,       Unit,
     503      733794 :       Declaration, RetainedNodes, ContainingType, TemplateParams, ThrownTypes};
     504      366897 :   if (!ThrownTypes) {
     505             :     Ops.pop_back();
     506      366862 :     if (!TemplateParams) {
     507             :       Ops.pop_back();
     508      346081 :       if (!ContainingType)
     509             :         Ops.pop_back();
     510             :     }
     511             :   }
     512     1100691 :   DEFINE_GETIMPL_STORE_N(DISubprogram,
     513             :                          (Line, ScopeLine, Virtuality, VirtualIndex,
     514             :                           ThisAdjustment, Flags, IsLocalToUnit, IsDefinition,
     515             :                           IsOptimized),
     516             :                          Ops, Ops.size());
     517             : }
     518             : 
     519       25311 : bool DISubprogram::describes(const Function *F) const {
     520             :   assert(F && "Invalid function");
     521       25311 :   if (F->getSubprogram() == this)
     522             :     return true;
     523             :   StringRef Name = getLinkageName();
     524       14966 :   if (Name.empty())
     525             :     Name = getName();
     526       14966 :   return F->getName() == Name;
     527             : }
     528             : 
     529       28700 : DILexicalBlock *DILexicalBlock::getImpl(LLVMContext &Context, Metadata *Scope,
     530             :                                         Metadata *File, unsigned Line,
     531             :                                         unsigned Column, StorageType Storage,
     532             :                                         bool ShouldCreate) {
     533             :   // Fixup column.
     534             :   adjustColumn(Column);
     535             : 
     536             :   assert(Scope && "Expected scope");
     537       28782 :   DEFINE_GETIMPL_LOOKUP(DILexicalBlock, (Scope, File, Line, Column));
     538       28696 :   Metadata *Ops[] = {File, Scope};
     539       57392 :   DEFINE_GETIMPL_STORE(DILexicalBlock, (Line, Column), Ops);
     540             : }
     541             : 
     542         921 : DILexicalBlockFile *DILexicalBlockFile::getImpl(LLVMContext &Context,
     543             :                                                 Metadata *Scope, Metadata *File,
     544             :                                                 unsigned Discriminator,
     545             :                                                 StorageType Storage,
     546             :                                                 bool ShouldCreate) {
     547             :   assert(Scope && "Expected scope");
     548        2761 :   DEFINE_GETIMPL_LOOKUP(DILexicalBlockFile, (Scope, File, Discriminator));
     549         465 :   Metadata *Ops[] = {File, Scope};
     550         930 :   DEFINE_GETIMPL_STORE(DILexicalBlockFile, (Discriminator), Ops);
     551             : }
     552             : 
     553       20284 : DINamespace *DINamespace::getImpl(LLVMContext &Context, Metadata *Scope,
     554             :                                   MDString *Name, bool ExportSymbols,
     555             :                                   StorageType Storage, bool ShouldCreate) {
     556             :   assert(isCanonical(Name) && "Expected canonical MDString");
     557       60850 :   DEFINE_GETIMPL_LOOKUP(DINamespace, (Scope, Name, ExportSymbols));
     558             :   // The nullptr is for DIScope's File operand. This should be refactored.
     559        4015 :   Metadata *Ops[] = {nullptr, Scope, Name};
     560        8030 :   DEFINE_GETIMPL_STORE(DINamespace, (ExportSymbols), Ops);
     561             : }
     562             : 
     563         190 : DIModule *DIModule::getImpl(LLVMContext &Context, Metadata *Scope,
     564             :                             MDString *Name, MDString *ConfigurationMacros,
     565             :                             MDString *IncludePath, MDString *ISysRoot,
     566             :                             StorageType Storage, bool ShouldCreate) {
     567             :   assert(isCanonical(Name) && "Expected canonical MDString");
     568         568 :   DEFINE_GETIMPL_LOOKUP(
     569             :       DIModule, (Scope, Name, ConfigurationMacros, IncludePath, ISysRoot));
     570         183 :   Metadata *Ops[] = {Scope, Name, ConfigurationMacros, IncludePath, ISysRoot};
     571         366 :   DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(DIModule, Ops);
     572             : }
     573             : 
     574       64299 : DITemplateTypeParameter *DITemplateTypeParameter::getImpl(LLVMContext &Context,
     575             :                                                           MDString *Name,
     576             :                                                           Metadata *Type,
     577             :                                                           StorageType Storage,
     578             :                                                           bool ShouldCreate) {
     579             :   assert(isCanonical(Name) && "Expected canonical MDString");
     580      192893 :   DEFINE_GETIMPL_LOOKUP(DITemplateTypeParameter, (Name, Type));
     581       23245 :   Metadata *Ops[] = {Name, Type};
     582       46490 :   DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(DITemplateTypeParameter, Ops);
     583             : }
     584             : 
     585       25684 : DITemplateValueParameter *DITemplateValueParameter::getImpl(
     586             :     LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *Type,
     587             :     Metadata *Value, StorageType Storage, bool ShouldCreate) {
     588             :   assert(isCanonical(Name) && "Expected canonical MDString");
     589       77048 :   DEFINE_GETIMPL_LOOKUP(DITemplateValueParameter, (Tag, Name, Type, Value));
     590        7776 :   Metadata *Ops[] = {Name, Type, Value};
     591       15552 :   DEFINE_GETIMPL_STORE(DITemplateValueParameter, (Tag), Ops);
     592             : }
     593             : 
     594             : DIGlobalVariable *
     595        5377 : DIGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
     596             :                           MDString *LinkageName, Metadata *File, unsigned Line,
     597             :                           Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
     598             :                           Metadata *StaticDataMemberDeclaration,
     599             :                           uint32_t AlignInBits, StorageType Storage,
     600             :                           bool ShouldCreate) {
     601             :   assert(isCanonical(Name) && "Expected canonical MDString");
     602             :   assert(isCanonical(LinkageName) && "Expected canonical MDString");
     603        6495 :   DEFINE_GETIMPL_LOOKUP(DIGlobalVariable,
     604             :                         (Scope, Name, LinkageName, File, Line, Type,
     605             :                          IsLocalToUnit, IsDefinition,
     606             :                          StaticDataMemberDeclaration, AlignInBits));
     607             :   Metadata *Ops[] = {
     608        5376 :       Scope, Name, File, Type, Name, LinkageName, StaticDataMemberDeclaration};
     609       10752 :   DEFINE_GETIMPL_STORE(DIGlobalVariable,
     610             :                        (Line, IsLocalToUnit, IsDefinition, AlignInBits),
     611             :                        Ops);
     612             : }
     613             : 
     614       86679 : DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, Metadata *Scope,
     615             :                                           MDString *Name, Metadata *File,
     616             :                                           unsigned Line, Metadata *Type,
     617             :                                           unsigned Arg, DIFlags Flags,
     618             :                                           uint32_t AlignInBits,
     619             :                                           StorageType Storage,
     620             :                                           bool ShouldCreate) {
     621             :   // 64K ought to be enough for any frontend.
     622             :   assert(Arg <= UINT16_MAX && "Expected argument number to fit in 16-bits");
     623             : 
     624             :   assert(Scope && "Expected scope");
     625             :   assert(isCanonical(Name) && "Expected canonical MDString");
     626      259989 :   DEFINE_GETIMPL_LOOKUP(DILocalVariable,
     627             :                         (Scope, Name, File, Line, Type, Arg, Flags,
     628             :                          AlignInBits));
     629       86554 :   Metadata *Ops[] = {Scope, Name, File, Type};
     630      173108 :   DEFINE_GETIMPL_STORE(DILocalVariable, (Line, Arg, Flags, AlignInBits), Ops);
     631             : }
     632             : 
     633       21948 : Optional<uint64_t> DIVariable::getSizeInBits() const {
     634             :   // This is used by the Verifier so be mindful of broken types.
     635             :   const Metadata *RawType = getRawType();
     636       42602 :   while (RawType) {
     637             :     // Try to get the size directly.
     638             :     if (auto *T = dyn_cast<DIType>(RawType))
     639       32275 :       if (uint64_t Size = T->getSizeInBits())
     640             :         return Size;
     641             : 
     642       10327 :     if (auto *DT = dyn_cast<DIDerivedType>(RawType)) {
     643             :       // Look at the base type.
     644             :       RawType = DT->getRawBaseType();
     645             :       continue;
     646             :     }
     647             : 
     648             :     // Missing type or size.
     649             :     break;
     650             :   }
     651             : 
     652             :   // Fail gracefully.
     653             :   return None;
     654             : }
     655             : 
     656          26 : DILabel *DILabel::getImpl(LLVMContext &Context, Metadata *Scope,
     657             :                           MDString *Name, Metadata *File, unsigned Line,
     658             :                           StorageType Storage,
     659             :                           bool ShouldCreate) {
     660             :   assert(Scope && "Expected scope");
     661             :   assert(isCanonical(Name) && "Expected canonical MDString");
     662          78 :   DEFINE_GETIMPL_LOOKUP(DILabel,
     663             :                         (Scope, Name, File, Line));
     664          26 :   Metadata *Ops[] = {Scope, Name, File};
     665          52 :   DEFINE_GETIMPL_STORE(DILabel, (Line), Ops);
     666             : }
     667             : 
     668      101098 : DIExpression *DIExpression::getImpl(LLVMContext &Context,
     669             :                                     ArrayRef<uint64_t> Elements,
     670             :                                     StorageType Storage, bool ShouldCreate) {
     671      303292 :   DEFINE_GETIMPL_LOOKUP(DIExpression, (Elements));
     672        4853 :   DEFINE_GETIMPL_STORE_NO_OPS(DIExpression, (Elements));
     673             : }
     674             : 
     675      250080 : unsigned DIExpression::ExprOperand::getSize() const {
     676      250080 :   switch (getOp()) {
     677             :   case dwarf::DW_OP_LLVM_fragment:
     678             :     return 3;
     679      198319 :   case dwarf::DW_OP_constu:
     680             :   case dwarf::DW_OP_plus_uconst:
     681      198319 :     return 2;
     682       49159 :   default:
     683       49159 :     return 1;
     684             :   }
     685             : }
     686             : 
     687       32272 : bool DIExpression::isValid() const {
     688       67531 :   for (auto I = expr_op_begin(), E = expr_op_end(); I != E; ++I) {
     689             :     // Check that there's space for the operand.
     690        3901 :     if (I->get() + I->getSize() > E->get())
     691         914 :       return false;
     692             : 
     693             :     // Check that the operand is valid.
     694        3898 :     switch (I->getOp()) {
     695             :     default:
     696             :       return false;
     697             :     case dwarf::DW_OP_LLVM_fragment:
     698             :       // A fragment operator must appear at the end.
     699         904 :       return I->get() + I->getSize() == E->get();
     700             :     case dwarf::DW_OP_stack_value: {
     701             :       // Must be the last one or followed by a DW_OP_LLVM_fragment.
     702         407 :       if (I->get() + I->getSize() == E->get())
     703             :         break;
     704          73 :       auto J = I;
     705          73 :       if ((++J)->getOp() != dwarf::DW_OP_LLVM_fragment)
     706           0 :         return false;
     707             :       break;
     708             :     }
     709             :     case dwarf::DW_OP_swap: {
     710             :       // Must be more than one implicit element on the stack.
     711             : 
     712             :       // FIXME: A better way to implement this would be to add a local variable
     713             :       // that keeps track of the stack depth and introduce something like a
     714             :       // DW_LLVM_OP_implicit_location as a placeholder for the location this
     715             :       // DIExpression is attached to, or else pass the number of implicit stack
     716             :       // elements into isValid.
     717         224 :       if (getNumElements() == 1)
     718             :         return false;
     719             :       break;
     720             :     }
     721             :     case dwarf::DW_OP_constu:
     722             :     case dwarf::DW_OP_plus_uconst:
     723             :     case dwarf::DW_OP_plus:
     724             :     case dwarf::DW_OP_minus:
     725             :     case dwarf::DW_OP_mul:
     726             :     case dwarf::DW_OP_div:
     727             :     case dwarf::DW_OP_mod:
     728             :     case dwarf::DW_OP_or:
     729             :     case dwarf::DW_OP_and:
     730             :     case dwarf::DW_OP_xor:
     731             :     case dwarf::DW_OP_shl:
     732             :     case dwarf::DW_OP_shr:
     733             :     case dwarf::DW_OP_shra:
     734             :     case dwarf::DW_OP_deref:
     735             :     case dwarf::DW_OP_xderef:
     736             :       break;
     737             :     }
     738             :   }
     739       31358 :   return true;
     740             : }
     741             : 
     742             : Optional<DIExpression::FragmentInfo>
     743      358113 : DIExpression::getFragmentInfo(expr_op_iterator Start, expr_op_iterator End) {
     744      861663 :   for (auto I = Start; I != End; ++I)
     745      150345 :     if (I->getOp() == dwarf::DW_OP_LLVM_fragment) {
     746             :       DIExpression::FragmentInfo Info = {I->getArg(1), I->getArg(0)};
     747             :       return Info;
     748             :     }
     749             :   return None;
     750             : }
     751             : 
     752        9183 : void DIExpression::appendOffset(SmallVectorImpl<uint64_t> &Ops,
     753             :                                 int64_t Offset) {
     754        9183 :   if (Offset > 0) {
     755        4138 :     Ops.push_back(dwarf::DW_OP_plus_uconst);
     756        4138 :     Ops.push_back(Offset);
     757        5045 :   } else if (Offset < 0) {
     758         343 :     Ops.push_back(dwarf::DW_OP_constu);
     759         343 :     Ops.push_back(-Offset);
     760         343 :     Ops.push_back(dwarf::DW_OP_minus);
     761             :   }
     762        9183 : }
     763             : 
     764         195 : bool DIExpression::extractIfOffset(int64_t &Offset) const {
     765         195 :   if (getNumElements() == 0) {
     766         189 :     Offset = 0;
     767         189 :     return true;
     768             :   }
     769             : 
     770           6 :   if (getNumElements() == 2 && Elements[0] == dwarf::DW_OP_plus_uconst) {
     771           6 :     Offset = Elements[1];
     772           6 :     return true;
     773             :   }
     774             : 
     775           0 :   if (getNumElements() == 3 && Elements[0] == dwarf::DW_OP_constu) {
     776           0 :     if (Elements[2] == dwarf::DW_OP_plus) {
     777           0 :       Offset = Elements[1];
     778           0 :       return true;
     779             :     }
     780           0 :     if (Elements[2] == dwarf::DW_OP_minus) {
     781           0 :       Offset = -Elements[1];
     782           0 :       return true;
     783             :     }
     784             :   }
     785             : 
     786             :   return false;
     787             : }
     788             : 
     789        4669 : DIExpression *DIExpression::prepend(const DIExpression *Expr, bool DerefBefore,
     790             :                                     int64_t Offset, bool DerefAfter,
     791             :                                     bool StackValue) {
     792             :   SmallVector<uint64_t, 8> Ops;
     793        4669 :   if (DerefBefore)
     794         588 :     Ops.push_back(dwarf::DW_OP_deref);
     795             :   
     796        4669 :   appendOffset(Ops, Offset);
     797        4669 :   if (DerefAfter)
     798           1 :     Ops.push_back(dwarf::DW_OP_deref);
     799             : 
     800        9338 :   return prependOpcodes(Expr, Ops, StackValue);
     801             : }
     802             : 
     803        9392 : DIExpression *DIExpression::prependOpcodes(const DIExpression *Expr,
     804             :                                            SmallVectorImpl<uint64_t> &Ops,
     805             :                                            bool StackValue) {
     806        9392 :   if (Expr)
     807       22314 :     for (auto Op : Expr->expr_ops()) {
     808             :       // A DW_OP_stack_value comes at the end, but before a DW_OP_LLVM_fragment.
     809        3530 :       if (StackValue) {
     810        2876 :         if (Op.getOp() == dwarf::DW_OP_stack_value)
     811             :           StackValue = false;
     812        1413 :         else if (Op.getOp() == dwarf::DW_OP_LLVM_fragment) {
     813          17 :           Ops.push_back(dwarf::DW_OP_stack_value);
     814             :           StackValue = false;
     815             :         }
     816             :       }
     817        7060 :       Ops.push_back(Op.getOp());
     818        5538 :       for (unsigned I = 0; I < Op.getNumArgs(); ++I)
     819        1004 :         Ops.push_back(Op.getArg(I));
     820             :     }
     821        9392 :   if (StackValue)
     822        3937 :     Ops.push_back(dwarf::DW_OP_stack_value);
     823        9392 :   return DIExpression::get(Expr->getContext(), Ops);
     824             : }
     825             : 
     826         273 : Optional<DIExpression *> DIExpression::createFragmentExpression(
     827             :     const DIExpression *Expr, unsigned OffsetInBits, unsigned SizeInBits) {
     828             :   SmallVector<uint64_t, 8> Ops;
     829             :   // Copy over the expression, but leave off any trailing DW_OP_LLVM_fragment.
     830         273 :   if (Expr) {
     831         571 :     for (auto Op : Expr->expr_ops()) {
     832          29 :       switch (Op.getOp()) {
     833             :       default: break;
     834             :       case dwarf::DW_OP_plus:
     835             :       case dwarf::DW_OP_minus:
     836             :         // We can't safely split arithmetic into multiple fragments because we
     837             :         // can't express carry-over between fragments.
     838             :         //
     839             :         // FIXME: We *could* preserve the lowest fragment of a constant offset
     840             :         // operation if the offset fits into SizeInBits.
     841           4 :         return None;
     842             :       case dwarf::DW_OP_LLVM_fragment: {
     843             :         // Make the new offset point into the existing fragment.
     844             :         uint64_t FragmentOffsetInBits = Op.getArg(0);
     845             :         uint64_t FragmentSizeInBits = Op.getArg(1);
     846             :         (void)FragmentSizeInBits;
     847             :         assert((OffsetInBits + SizeInBits <= FragmentSizeInBits) &&
     848             :                "new fragment outside of original fragment");
     849          21 :         OffsetInBits += FragmentOffsetInBits;
     850          21 :         continue;
     851             :       }
     852             :       }
     853           4 :       Ops.push_back(Op.getOp());
     854          12 :       for (unsigned I = 0; I < Op.getNumArgs(); ++I)
     855           4 :         Ops.push_back(Op.getArg(I));
     856             :     }
     857             :   }
     858         269 :   Ops.push_back(dwarf::DW_OP_LLVM_fragment);
     859         269 :   Ops.push_back(OffsetInBits);
     860         269 :   Ops.push_back(SizeInBits);
     861             :   return DIExpression::get(Expr->getContext(), Ops);
     862             : }
     863             : 
     864        8548 : bool DIExpression::isConstant() const {
     865             :   // Recognize DW_OP_constu C DW_OP_stack_value (DW_OP_LLVM_fragment Len Ofs)?.
     866        8548 :   if (getNumElements() != 3 && getNumElements() != 6)
     867             :     return false;
     868          49 :   if (getElement(0) != dwarf::DW_OP_constu ||
     869             :       getElement(2) != dwarf::DW_OP_stack_value)
     870             :     return false;
     871          34 :   if (getNumElements() == 6 && getElement(3) != dwarf::DW_OP_LLVM_fragment)
     872             :     return false;
     873             :   return true;
     874             : }
     875             : 
     876             : DIGlobalVariableExpression *
     877        5107 : DIGlobalVariableExpression::getImpl(LLVMContext &Context, Metadata *Variable,
     878             :                                     Metadata *Expression, StorageType Storage,
     879             :                                     bool ShouldCreate) {
     880       15137 :   DEFINE_GETIMPL_LOOKUP(DIGlobalVariableExpression, (Variable, Expression));
     881        5104 :   Metadata *Ops[] = {Variable, Expression};
     882       10208 :   DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(DIGlobalVariableExpression, Ops);
     883             : }
     884             : 
     885         123 : DIObjCProperty *DIObjCProperty::getImpl(
     886             :     LLVMContext &Context, MDString *Name, Metadata *File, unsigned Line,
     887             :     MDString *GetterName, MDString *SetterName, unsigned Attributes,
     888             :     Metadata *Type, StorageType Storage, bool ShouldCreate) {
     889             :   assert(isCanonical(Name) && "Expected canonical MDString");
     890             :   assert(isCanonical(GetterName) && "Expected canonical MDString");
     891             :   assert(isCanonical(SetterName) && "Expected canonical MDString");
     892         367 :   DEFINE_GETIMPL_LOOKUP(DIObjCProperty, (Name, File, Line, GetterName,
     893             :                                          SetterName, Attributes, Type));
     894          91 :   Metadata *Ops[] = {Name, File, GetterName, SetterName, Type};
     895         182 :   DEFINE_GETIMPL_STORE(DIObjCProperty, (Line, Attributes), Ops);
     896             : }
     897             : 
     898      105594 : DIImportedEntity *DIImportedEntity::getImpl(LLVMContext &Context, unsigned Tag,
     899             :                                             Metadata *Scope, Metadata *Entity,
     900             :                                             Metadata *File, unsigned Line,
     901             :                                             MDString *Name, StorageType Storage,
     902             :                                             bool ShouldCreate) {
     903             :   assert(isCanonical(Name) && "Expected canonical MDString");
     904      316780 :   DEFINE_GETIMPL_LOOKUP(DIImportedEntity,
     905             :                         (Tag, Scope, Entity, File, Line, Name));
     906      105588 :   Metadata *Ops[] = {Scope, Entity, Name, File};
     907      211176 :   DEFINE_GETIMPL_STORE(DIImportedEntity, (Tag, Line), Ops);
     908             : }
     909             : 
     910        1106 : DIMacro *DIMacro::getImpl(LLVMContext &Context, unsigned MIType,
     911             :                           unsigned Line, MDString *Name, MDString *Value,
     912             :                           StorageType Storage, bool ShouldCreate) {
     913             :   assert(isCanonical(Name) && "Expected canonical MDString");
     914        3318 :   DEFINE_GETIMPL_LOOKUP(DIMacro, (MIType, Line, Name, Value));
     915        1097 :   Metadata *Ops[] = { Name, Value };
     916        2194 :   DEFINE_GETIMPL_STORE(DIMacro, (MIType, Line), Ops);
     917             : }
     918             : 
     919          84 : DIMacroFile *DIMacroFile::getImpl(LLVMContext &Context, unsigned MIType,
     920             :                                   unsigned Line, Metadata *File,
     921             :                                   Metadata *Elements, StorageType Storage,
     922             :                                   bool ShouldCreate) {
     923         216 :   DEFINE_GETIMPL_LOOKUP(DIMacroFile,
     924             :                         (MIType, Line, File, Elements));
     925          82 :   Metadata *Ops[] = { File, Elements };
     926         164 :   DEFINE_GETIMPL_STORE(DIMacroFile, (MIType, Line), Ops);
     927             : }

Generated by: LCOV version 1.13