summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-mca/Instruction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-mca/Instruction.cpp')
-rw-r--r--llvm/tools/llvm-mca/Instruction.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/tools/llvm-mca/Instruction.cpp b/llvm/tools/llvm-mca/Instruction.cpp
index e3b26bd9609..edf321aaae5 100644
--- a/llvm/tools/llvm-mca/Instruction.cpp
+++ b/llvm/tools/llvm-mca/Instruction.cpp
@@ -92,10 +92,12 @@ void WriteState::dump() const {
}
#endif
-void Instruction::dispatch() {
+void Instruction::dispatch(unsigned RCUToken) {
assert(Stage == IS_INVALID);
Stage = IS_AVAILABLE;
+ RCUTokenID = RCUToken;
+ // Check if input operands are already available.
if (std::all_of(Uses.begin(), Uses.end(),
[](const UniqueUse &Use) { return Use->isReady(); }))
Stage = IS_READY;
@@ -104,8 +106,14 @@ void Instruction::dispatch() {
void Instruction::execute() {
assert(Stage == IS_READY);
Stage = IS_EXECUTING;
+
+ // Set the cycles left before the write-back stage.
+ setCyclesLeft(Desc.MaxLatency);
+
for (UniqueDef &Def : Defs)
Def->onInstructionIssued();
+
+ // Transition to the "executed" stage if this is a zero-latency instruction.
if (!CyclesLeft)
Stage = IS_EXECUTED;
}
OpenPOWER on IntegriCloud