CodeGen: Push the ModuleSlotTracker through Metadata

For another 1% speedup on the testcase in PR23865, push the
`ModuleSlotTracker` through to metadata-related printing in
`MachineBasicBlock::print()`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240848 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2015-06-26 22:28:47 +00:00
parent bb8cc2f850
commit 8266df7f7f
4 changed files with 37 additions and 17 deletions

View File

@@ -27,8 +27,11 @@
#include <type_traits>
namespace llvm {
class LLVMContext;
class Module;
class ModuleSlotTracker;
template<typename ValueSubClass, typename ItemParentClass>
class SymbolTableListTraits;
@@ -129,7 +132,11 @@ public:
///
/// If \c M is provided, metadata nodes will be numbered canonically;
/// otherwise, pointer addresses are substituted.
/// @{
void printAsOperand(raw_ostream &OS, const Module *M = nullptr) const;
void printAsOperand(raw_ostream &OS, ModuleSlotTracker &MST,
const Module *M = nullptr) const;
/// @}
};
#define HANDLE_METADATA(CLASS) class CLASS;

View File

@@ -41,8 +41,13 @@ public:
/// Construct a slot tracker from a module.
///
/// If \a M is \c nullptr, uses a null slot tracker.
explicit ModuleSlotTracker(const Module *M);
/// If \a M is \c nullptr, uses a null slot tracker. Otherwise, initializes
/// a slot tracker, and initializes all metadata slots. \c
/// ShouldInitializeAllMetadata defaults to true because this is expected to
/// be shared between multiple callers, and otherwise MDNode references will
/// not match up.
explicit ModuleSlotTracker(const Module *M,
bool ShouldInitializeAllMetadata = true);
/// Destructor to clean up storage.
~ModuleSlotTracker();