mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-26 07:18:15 +00:00
IR: Expose ModuleSlotTracker in Value::print()
Allow callers of `Value::print()` and `Metadata::print()` to pass in a `ModuleSlotTracker`. This allows them to pay only once for calculating module-level slots (such as Metadata). This is related to PR23865, where there was a huge cost for `MachineFunction::print()`. Although I don't have a *particular* user in mind for this new code, I have hit big slowdowns before when running `opt -debug`, and I think this will be useful. Going forward, if someone hits a big slowdown with `print()` statements, they can create a `ModuleSlotTracker` and send it through. Similarly, adding support to `Value::dump()` and `Metadata::dump()` should be trivial. I added unit tests to be sure the `print()` functions actually behave the same way with and without the slot tracker. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240867 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -124,7 +124,11 @@ public:
|
||||
///
|
||||
/// If \c M is provided, metadata nodes will be numbered canonically;
|
||||
/// otherwise, pointer addresses are substituted.
|
||||
/// @{
|
||||
void print(raw_ostream &OS, const Module *M = nullptr) const;
|
||||
void print(raw_ostream &OS, ModuleSlotTracker &MST,
|
||||
const Module *M = nullptr) const;
|
||||
/// @}
|
||||
|
||||
/// \brief Print as operand.
|
||||
///
|
||||
|
||||
@@ -200,7 +200,10 @@ public:
|
||||
void dump() const;
|
||||
|
||||
/// \brief Implement operator<< on Value.
|
||||
/// @{
|
||||
void print(raw_ostream &O) const;
|
||||
void print(raw_ostream &O, ModuleSlotTracker &MST) const;
|
||||
/// @}
|
||||
|
||||
/// \brief Print the name of this Value out to the specified raw_ostream.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user