[llvm] r243858 - AsmPrinter: Stop inheriting from DIE

Duncan P. N. Exon Smith dexonsmith at apple.com
Sun Aug 2 13:54:50 PDT 2015


Author: dexonsmith
Date: Sun Aug  2 15:54:50 2015
New Revision: 243858

URL: http://llvm.org/viewvc/llvm-project?rev=243858&view=rev
Log:
AsmPrinter: Stop inheriting from DIE

Change `DIELoc` and `DIEBlock` to stop inheriting from `DIE`, instead
inheriting from `DIEValueList` to share the value storage API.  This
awkward bit of code-sharing was also fairly confusing: neither `DIELoc`
nor `DIEBlock` represents a `DIE`, so why would they inherit from it?

Aside from the API cleanup, this should improve debug info memory usage
in the backend, since it shaves five pointers off of every `DIELoc` and
`DIEBlock`.  I haven't bothered to measure the savings, though.

Modified:
    llvm/trunk/include/llvm/CodeGen/DIE.h

Modified: llvm/trunk/include/llvm/CodeGen/DIE.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DIE.h?rev=243858&r1=243857&r2=243858&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/DIE.h (original)
+++ llvm/trunk/include/llvm/CodeGen/DIE.h Sun Aug  2 15:54:50 2015
@@ -630,7 +630,6 @@ public:
 class DIE : IntrusiveBackListNode, public DIEValueList {
   friend class IntrusiveBackList<DIE>;
 
-protected:
   /// Offset - Offset in debug info section.
   ///
   unsigned Offset;
@@ -650,10 +649,7 @@ protected:
 
   DIE *Parent = nullptr;
 
-protected:
-  DIE() : Offset(0), Size(0) {}
-
-private:
+  DIE() = delete;
   explicit DIE(dwarf::Tag Tag) : Offset(0), Size(0), Tag(Tag) {}
 
 public:
@@ -723,7 +719,7 @@ public:
 //===--------------------------------------------------------------------===//
 /// DIELoc - Represents an expression location.
 //
-class DIELoc : public DIE {
+class DIELoc : public DIEValueList {
   mutable unsigned Size; // Size in bytes excluding size header.
 
 public:
@@ -759,7 +755,7 @@ public:
 //===--------------------------------------------------------------------===//
 /// DIEBlock - Represents a block of values.
 //
-class DIEBlock : public DIE {
+class DIEBlock : public DIEValueList {
   mutable unsigned Size; // Size in bytes excluding size header.
 
 public:





More information about the llvm-commits mailing list