CodeGen: Push the ModuleSlotTracker through MachineOperands

Push `ModuleSlotTracker` through `MachineOperand`s, dropping the time
for `llc -print-machineinstrs` on the testcase in PR23865 from ~13
seconds to ~9 seconds.  Now `SlotTracker::processFunctionMetadata()`
accounts for only 8% of the runtime, which seems reasonable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240845 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2015-06-26 22:06:47 +00:00
parent 982139fde2
commit a08efbfc8e
6 changed files with 63 additions and 37 deletions

View File

@@ -1105,6 +1105,8 @@ public:
// Debugging support
//
void print(raw_ostream &OS, bool SkipOpers = false) const;
void print(raw_ostream &OS, ModuleSlotTracker &MST,
bool SkipOpers = false) const;
void dump() const;
//===--------------------------------------------------------------------===//

View File

@@ -27,6 +27,7 @@ namespace llvm {
class FoldingSetNodeID;
class MDNode;
class raw_ostream;
class ModuleSlotTracker;
/// MachinePointerInfo - This class contains a discriminated union of
/// information about pointers in memory operands, relating them back to LLVM IR
@@ -200,6 +201,12 @@ public:
///
void Profile(FoldingSetNodeID &ID) const;
/// Support for operator<<.
/// @{
void print(raw_ostream &OS) const;
void print(raw_ostream &OS, ModuleSlotTracker &MST) const;
/// @}
friend bool operator==(const MachineMemOperand &LHS,
const MachineMemOperand &RHS) {
return LHS.getValue() == RHS.getValue() &&
@@ -219,7 +226,10 @@ public:
}
};
raw_ostream &operator<<(raw_ostream &OS, const MachineMemOperand &MRO);
inline raw_ostream &operator<<(raw_ostream &OS, const MachineMemOperand &MRO) {
MRO.print(OS);
return OS;
}
} // End llvm namespace

View File

@@ -27,6 +27,7 @@ class MachineBasicBlock;
class MachineInstr;
class MachineRegisterInfo;
class MDNode;
class ModuleSlotTracker;
class TargetMachine;
class TargetRegisterInfo;
class hash_code;
@@ -218,6 +219,8 @@ public:
void clearParent() { ParentMI = nullptr; }
void print(raw_ostream &os, const TargetRegisterInfo *TRI = nullptr) const;
void print(raw_ostream &os, ModuleSlotTracker &MST,
const TargetRegisterInfo *TRI = nullptr) const;
//===--------------------------------------------------------------------===//
// Accessors that tell you what kind of MachineOperand you're looking at.

View File

@@ -29,8 +29,7 @@ namespace llvm {
/// space), or constant pool.
class PseudoSourceValue {
private:
friend raw_ostream &llvm::operator<<(raw_ostream &OS,
const MachineMemOperand &MMO);
friend class MachineMemOperand; // For printCustom().
/// printCustom - Implement printing for PseudoSourceValue. This is called
/// from Value::print or Value's operator<<.