Skip to content

Commit

Permalink
[SystemZ] NFC refactoring in SystemZHazardRecognizer.
Browse files Browse the repository at this point in the history
Handle the not-taken branch in emitInstruction() where the TakenBranch
argument is available. This is cleaner than relying on EmitInstruction().

Review: Ulrich Weigand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326879 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
JonPsson committed Mar 7, 2018
1 parent dbd628b commit 1ab3677
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/Target/SystemZ/SystemZHazardRecognizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,17 +283,14 @@ EmitInstruction(SUnit *SU) {
<< LastFPdOpCycleIdx << "\n";);
}

bool GroupEndingBranch =
(CurrGroupSize >= 1 && isBranchRetTrap(SU->getInstr()));

// Insert SU into current group by increasing number of slots used
// in current group.
CurrGroupSize += getNumDecoderSlots(SU);
assert (CurrGroupSize <= 3);

// Check if current group is now full/ended. If so, move on to next
// group to be ready to evaluate more candidates.
if (CurrGroupSize == 3 || SC->EndGroup || GroupEndingBranch)
if (CurrGroupSize == 3 || SC->EndGroup)
nextGroup();
}

Expand Down Expand Up @@ -386,8 +383,15 @@ void SystemZHazardRecognizer::emitInstruction(MachineInstr *MI,
}
}

unsigned GroupSizeBeforeEmit = CurrGroupSize;
EmitInstruction(&SU);

if (!TakenBranch && isBranchRetTrap(MI)) {
// NT Branch on second slot ends group.
if (GroupSizeBeforeEmit == 1)
nextGroup();
}

if (TakenBranch && CurrGroupSize > 0)
nextGroup();

Expand Down

0 comments on commit 1ab3677

Please sign in to comment.