[llvm-mca] Use a WriteRef to describe register writes in class RegisterFile.
This patch introduces a new class named WriteRef. A WriteRef is used by the
RegisterFile to keep track of register definitions. Internally it wraps a
WriteState, as well as the source index of the defining instruction.
This patch allows the tool to propagate additional information to support future
analysis on data dependencies.
llvm-svn: 335867
diff --git a/llvm/tools/llvm-mca/Instruction.cpp b/llvm/tools/llvm-mca/Instruction.cpp
index f84c781..c8eb63f 100644
--- a/llvm/tools/llvm-mca/Instruction.cpp
+++ b/llvm/tools/llvm-mca/Instruction.cpp
@@ -96,6 +96,13 @@
dbgs() << "{ OpIdx=" << WD.OpIndex << ", Lat=" << WD.Latency << ", RegID "
<< getRegisterID() << ", Cycles Left=" << getCyclesLeft() << " }\n";
}
+
+void WriteRef::dump() const {
+ if (isValid())
+ getWriteState()->dump();
+ else
+ dbgs() << "(null)";
+}
#endif
void Instruction::dispatch(unsigned RCUToken) {
@@ -152,4 +159,7 @@
if (!CyclesLeft)
Stage = IS_EXECUTED;
}
+
+const unsigned WriteRef::INVALID_IID = std::numeric_limits<unsigned>::max();
+
} // namespace mca