[llvm] r301499 - Revert "Turn DISubprogram into a variable-length node."

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 26 16:49:30 PDT 2017


Author: adrian
Date: Wed Apr 26 18:49:30 2017
New Revision: 301499

URL: http://llvm.org/viewvc/llvm-project?rev=301499&view=rev
Log:
Revert "Turn DISubprogram into a variable-length node."

This reverts commit r301498 while investigating bot breakage.

Modified:
    llvm/trunk/include/llvm/IR/DebugInfoMetadata.h
    llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
    llvm/trunk/lib/IR/DebugInfoMetadata.cpp
    llvm/trunk/tools/opt/BreakpointPrinter.cpp

Modified: llvm/trunk/include/llvm/IR/DebugInfoMetadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfoMetadata.h?rev=301499&r1=301498&r2=301499&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfoMetadata.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfoMetadata.h Wed Apr 26 18:49:30 2017
@@ -1614,7 +1614,11 @@ public:
   DIScopeRef getScope() const { return DIScopeRef(getRawScope()); }
 
   StringRef getName() const { return getStringOperand(2); }
-  StringRef getLinkageName() const { return getStringOperand(3); }
+  StringRef getDisplayName() const { return getStringOperand(3); }
+  StringRef getLinkageName() const { return getStringOperand(4); }
+
+  MDString *getRawName() const { return getOperandAs<MDString>(2); }
+  MDString *getRawLinkageName() const { return getOperandAs<MDString>(4); }
 
   DISubroutineType *getType() const {
     return cast_or_null<DISubroutineType>(getRawType());
@@ -1626,7 +1630,7 @@ public:
   DICompileUnit *getUnit() const {
     return cast_or_null<DICompileUnit>(getRawUnit());
   }
-  void replaceUnit(DICompileUnit *CU) { replaceOperandWith(5, CU); }
+  void replaceUnit(DICompileUnit *CU) { replaceOperandWith(7, CU); }
   DITemplateParameterArray getTemplateParams() const {
     return cast_or_null<MDTuple>(getRawTemplateParams());
   }
@@ -1641,21 +1645,13 @@ public:
   }
 
   Metadata *getRawScope() const { return getOperand(1); }
-  MDString *getRawName() const { return getOperandAs<MDString>(2); }
-  MDString *getRawLinkageName() const { return getOperandAs<MDString>(3); }
-  Metadata *getRawType() const { return getOperand(4); }
-  Metadata *getRawUnit() const { return getOperand(5); }
-  Metadata *getRawDeclaration() const { return getOperand(6); }
-  Metadata *getRawVariables() const { return getOperand(7); }
-  Metadata *getRawContainingType() const {
-    return getNumOperands() > 8 ? getOperand(8) : nullptr;
-  }
-  Metadata *getRawTemplateParams() const {
-    return getNumOperands() > 9 ? getOperand(9) : nullptr;
-  }
-  Metadata *getRawThrownTypes() const {
-    return getNumOperands() > 10 ? getOperand(10) : nullptr;
-  }
+  Metadata *getRawType() const { return getOperand(5); }
+  Metadata *getRawContainingType() const { return getOperand(6); }
+  Metadata *getRawUnit() const { return getOperand(7); }
+  Metadata *getRawTemplateParams() const { return getOperand(8); }
+  Metadata *getRawDeclaration() const { return getOperand(9); }
+  Metadata *getRawVariables() const { return getOperand(10); }
+  Metadata *getRawThrownTypes() const { return getOperand(11); }
 
   /// Check if this subprogram describes the given function.
   ///

Modified: llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp?rev=301499&r1=301498&r2=301499&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp Wed Apr 26 18:49:30 2017
@@ -474,8 +474,8 @@ class MetadataLoader::MetadataLoaderImpl
     for (auto CU_SP : CUSubprograms)
       if (auto *SPs = dyn_cast_or_null<MDTuple>(CU_SP.second))
         for (auto &Op : SPs->operands())
-          if (auto *SP = dyn_cast_or_null<DISubprogram>(Op))
-            SP->replaceUnit(CU_SP.first);
+          if (auto *SP = dyn_cast_or_null<MDNode>(Op))
+            SP->replaceOperandWith(7, CU_SP.first);
     CUSubprograms.clear();
   }
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=301499&r1=301498&r2=301499&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Apr 26 18:49:30 2017
@@ -820,7 +820,7 @@ static bool emitDebugValueComment(const
 
   const DILocalVariable *V = MI->getDebugVariable();
   if (auto *SP = dyn_cast<DISubprogram>(V->getScope())) {
-    StringRef Name = SP->getName();
+    StringRef Name = SP->getDisplayName();
     if (!Name.empty())
       OS << Name << ":";
   }

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp?rev=301499&r1=301498&r2=301499&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp Wed Apr 26 18:49:30 2017
@@ -237,7 +237,7 @@ TypeIndex CodeViewDebug::getFuncIdForSub
 
   // The display name includes function template arguments. Drop them to match
   // MSVC.
-  StringRef DisplayName = SP->getName().split('<').first;
+  StringRef DisplayName = SP->getDisplayName().split('<').first;
 
   const DIScope *Scope = SP->getScope().resolve();
   TypeIndex TI;
@@ -657,7 +657,7 @@ void CodeViewDebug::emitInlineeLinesSubs
 
     OS.AddBlankLine();
     unsigned FileId = maybeRecordFile(SP->getFile());
-    OS.AddComment("Inlined function " + SP->getName() + " starts at " +
+    OS.AddComment("Inlined function " + SP->getDisplayName() + " starts at " +
                   SP->getFilename() + Twine(':') + Twine(SP->getLine()));
     OS.AddBlankLine();
     // The filechecksum table uses 8 byte entries for now, and file ids start at
@@ -759,9 +759,9 @@ void CodeViewDebug::emitDebugInfoForFunc
 
   // If we have a display name, build the fully qualified name by walking the
   // chain of scopes.
-  if (!SP->getName().empty())
+  if (!SP->getDisplayName().empty())
     FuncName =
-        getFullyQualifiedName(SP->getScope().resolve(), SP->getName());
+        getFullyQualifiedName(SP->getScope().resolve(), SP->getDisplayName());
 
   // If our DISubprogram name is empty, use the mangled name.
   if (FuncName.empty())

Modified: llvm/trunk/lib/IR/DebugInfoMetadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfoMetadata.cpp?rev=301499&r1=301498&r2=301499&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfoMetadata.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfoMetadata.cpp Wed Apr 26 18:49:30 2017
@@ -214,10 +214,6 @@ void GenericDINode::recalculateHash() {
 #define DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(CLASS, OPS)                   \
   return storeImpl(new (array_lengthof(OPS)) CLASS(Context, Storage, OPS),     \
                    Storage, Context.pImpl->CLASS##s)
-#define DEFINE_GETIMPL_STORE_N(CLASS, ARGS, OPS, NUM_OPS)                      \
-  return storeImpl(new (NUM_OPS)                                               \
-                       CLASS(Context, Storage, UNWRAP_ARGS(ARGS), OPS),        \
-                   Storage, Context.pImpl->CLASS##s)
 
 DISubrange *DISubrange::getImpl(LLVMContext &Context, int64_t Count, int64_t Lo,
                                 StorageType Storage, bool ShouldCreate) {
@@ -453,22 +449,13 @@ DISubprogram *DISubprogram::getImpl(
                      IsDefinition, ScopeLine, ContainingType, Virtuality,
                      VirtualIndex, ThisAdjustment, Flags, IsOptimized, Unit,
                      TemplateParams, Declaration, Variables, ThrownTypes));
-  SmallVector<Metadata *, 11> Ops = {
-      File,        Scope,     Name,           LinkageName,    Type,       Unit,
-      Declaration, Variables, ContainingType, TemplateParams, ThrownTypes};
-  if (!ThrownTypes) {
-    Ops.pop_back();
-    if (!TemplateParams) {
-      Ops.pop_back();
-      if (!ContainingType)
-        Ops.pop_back();
-    }
-  }
-  DEFINE_GETIMPL_STORE_N(DISubprogram,
-                         (Line, ScopeLine, Virtuality, VirtualIndex,
-                          ThisAdjustment, Flags, IsLocalToUnit, IsDefinition,
-                          IsOptimized),
-                         Ops, Ops.size());
+  Metadata *Ops[] = {File,           Scope,       Name,           Name,
+                     LinkageName,    Type,        ContainingType, Unit,
+                     TemplateParams, Declaration, Variables,      ThrownTypes};
+  DEFINE_GETIMPL_STORE(DISubprogram, (Line, ScopeLine, Virtuality, VirtualIndex,
+                                      ThisAdjustment, Flags, IsLocalToUnit,
+                                      IsDefinition, IsOptimized),
+                       Ops);
 }
 
 bool DISubprogram::describes(const Function *F) const {

Modified: llvm/trunk/tools/opt/BreakpointPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/BreakpointPrinter.cpp?rev=301499&r1=301498&r2=301499&view=diff
==============================================================================
--- llvm/trunk/tools/opt/BreakpointPrinter.cpp (original)
+++ llvm/trunk/tools/opt/BreakpointPrinter.cpp Wed Apr 26 18:49:30 2017
@@ -51,7 +51,7 @@ struct BreakpointPrinter : public Module
         if (!SP)
           continue;
         getContextName(SP->getScope().resolve(), Name);
-        Name = Name + SP->getName().str();
+        Name = Name + SP->getDisplayName().str();
         if (!Name.empty() && Processed.insert(Name).second) {
           Out << Name << "\n";
         }




More information about the llvm-commits mailing list