AsmPrinter: Stop inheriting from DIE
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sun, 2 Aug 2015 20:54:50 +0000 (20:54 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sun, 2 Aug 2015 20:54:50 +0000 (20:54 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243858 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/DIE.h

index ccfbee6ef2a71ee648df7ecc9f57802443f7e9f3..2e6d4aa6d196891717e280dee1e0769a782202fd 100644 (file)
@@ -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: