mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
AsmPrinter: Change DIEValue to be stored by value
Change `DIEValue` to be stored/passed/etc. by value, instead of reference. It's now a discriminated union, with a `Val` field storing the actual type. The classes that used to inherit from `DIEValue` no longer do. There are two categories of these: - Small values fit in a single pointer and are stored by value. - Large values require auxiliary storage, and are stored by reference. The only non-mechanical change is to tools/dsymutil/DwarfLinker.cpp. It was relying on `DIEInteger`s being passed around by reference, so I replaced that assumption with a `PatchLocation` type that stores a safe reference to where the `DIEInteger` lives instead. This commit causes a temporary regression in memory usage, since I've left merging `DIEAbbrevData` into `DIEValue` for a follow-up commit. I measured an increase from 845 MB to 879 MB, around 3.9%. The follow-up drops it lower than the starting point, and I've only recently brought the memory this low anyway, so I'm committing these changes separately to keep them incremental. (I also considered swapping the commits, but the other one first would cause a lot more code churn.) (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238349 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -93,10 +93,6 @@ protected:
|
||||
/// information entries.
|
||||
DenseMap<const MDNode *, DIE *> MDNodeToDieMap;
|
||||
|
||||
/// Tracks the mapping of unit level debug information descriptors to debug
|
||||
/// information entries using a DIEEntry proxy.
|
||||
DenseMap<const MDNode *, DIEEntry *> MDNodeToDIEEntryMap;
|
||||
|
||||
/// A list of all the DIEBlocks in use.
|
||||
std::vector<DIEBlock *> DIEBlocks;
|
||||
|
||||
@@ -111,9 +107,6 @@ protected:
|
||||
// All DIEValues are allocated through this allocator.
|
||||
BumpPtrAllocator DIEValueAllocator;
|
||||
|
||||
// A preallocated DIEValue because 1 is used frequently.
|
||||
DIEInteger *DIEIntegerOne;
|
||||
|
||||
/// The section this unit will be emitted in.
|
||||
MCSection *Section;
|
||||
|
||||
@@ -180,7 +173,7 @@ public:
|
||||
DIE *getDIE(const DINode *D) const;
|
||||
|
||||
/// \brief Returns a fresh newly allocated DIELoc.
|
||||
DIELoc *getDIELoc() { return new (DIEValueAllocator) DIELoc(); }
|
||||
DIELoc *getDIELoc() { return new (DIEValueAllocator) DIELoc; }
|
||||
|
||||
/// \brief Insert DIE into the map.
|
||||
///
|
||||
@@ -233,7 +226,7 @@ public:
|
||||
void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry);
|
||||
|
||||
/// \brief Add a DIE attribute data and value.
|
||||
void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIEEntry *Entry);
|
||||
void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIEEntry Entry);
|
||||
|
||||
void addDIETypeSignature(DIE &Die, const DwarfTypeUnit &Type);
|
||||
|
||||
@@ -369,26 +362,12 @@ private:
|
||||
/// If the DWARF version doesn't handle the language, return -1.
|
||||
int64_t getDefaultLowerBound() const;
|
||||
|
||||
/// \brief Returns the DIE entry for the specified debug variable.
|
||||
DIEEntry *getDIEEntry(const MDNode *N) const {
|
||||
return MDNodeToDIEEntryMap.lookup(N);
|
||||
}
|
||||
|
||||
/// \brief Insert debug information entry into the map.
|
||||
void insertDIEEntry(const MDNode *N, DIEEntry *E) {
|
||||
MDNodeToDIEEntryMap.insert(std::make_pair(N, E));
|
||||
}
|
||||
|
||||
/// \brief Get an anonymous type for index type.
|
||||
DIE *getIndexTyDie();
|
||||
|
||||
/// \brief Set D as anonymous type for index which can be reused later.
|
||||
void setIndexTyDie(DIE *D) { IndexTyDie = D; }
|
||||
|
||||
/// \brief Creates a new DIEEntry to be a proxy for a debug information
|
||||
/// entry.
|
||||
DIEEntry *createDIEEntry(DIE &Entry);
|
||||
|
||||
/// If this is a named finished type then include it in the list of types for
|
||||
/// the accelerator tables.
|
||||
void updateAcceleratorTables(const DIScope *Context, const DIType *Ty,
|
||||
|
Reference in New Issue
Block a user