summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2017-01-20 03:58:42 +0000
committerMatthias Braun <matze@braunis.de>2017-01-20 03:58:42 +0000
commitd9217c0b86aeca0b0088687776d0fea966297c3d (patch)
tree4fa553983d68f4c45ad9e71bb04ac07a29ab21ce /llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp
parent4d0d252288592ba41ef8ae5f1427d9b32c9c1e7f (diff)
downloadbcm5719-llvm-d9217c0b86aeca0b0088687776d0fea966297c3d.tar.gz
bcm5719-llvm-d9217c0b86aeca0b0088687776d0fea966297c3d.zip
Revert "LiveRegUnits: Add accumulateBackward() function"
This seems to be breaking some bots. This reverts commit r292543. llvm-svn: 292574
Diffstat (limited to 'llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp')
-rw-r--r--llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp50
1 files changed, 32 insertions, 18 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp b/llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp
index a589719e9b7..0aa597bcdc5 100644
--- a/llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp
+++ b/llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp
@@ -493,29 +493,43 @@ bool AArch64A57FPLoadBalancing::colorChainSet(std::vector<Chain*> GV,
int AArch64A57FPLoadBalancing::scavengeRegister(Chain *G, Color C,
MachineBasicBlock &MBB) {
+ RegScavenger RS;
+ RS.enterBasicBlock(MBB);
+ RS.forward(MachineBasicBlock::iterator(G->getStart()));
+
// Can we find an appropriate register that is available throughout the life
- // of the chain? Simulate liveness backwards until the end of the chain.
- LiveRegUnits Units(*TRI);
- Units.addLiveOuts(MBB);
- MachineBasicBlock::iterator I = MBB.end(), ChainEnd = G->end();
- do {
- --I;
- Units.stepBackward(*I);
- } while (I != ChainEnd);
-
- // Check which register units are alive throughout the chain.
- MachineBasicBlock::iterator ChainBegin = G->begin();
- assert(ChainBegin != ChainEnd && "Chain should contain instructions");
- do {
- --I;
- Units.accumulateBackward(*I);
- } while (I != ChainBegin);
+ // of the chain?
+ unsigned RegClassID = G->getStart()->getDesc().OpInfo[0].RegClass;
+ BitVector AvailableRegs = RS.getRegsAvailable(TRI->getRegClass(RegClassID));
+ for (MachineBasicBlock::iterator I = G->begin(), E = G->end(); I != E; ++I) {
+ RS.forward(I);
+ AvailableRegs &= RS.getRegsAvailable(TRI->getRegClass(RegClassID));
+
+ // Remove any registers clobbered by a regmask or any def register that is
+ // immediately dead.
+ for (auto J : I->operands()) {
+ if (J.isRegMask())
+ AvailableRegs.clearBitsNotInMask(J.getRegMask());
+
+ if (J.isReg() && J.isDef()) {
+ MCRegAliasIterator AI(J.getReg(), TRI, /*IncludeSelf=*/true);
+ if (J.isDead())
+ for (; AI.isValid(); ++AI)
+ AvailableRegs.reset(*AI);
+#ifndef NDEBUG
+ else
+ for (; AI.isValid(); ++AI)
+ assert(!AvailableRegs[*AI] &&
+ "Non-dead def should have been removed by now!");
+#endif
+ }
+ }
+ }
// Make sure we allocate in-order, to get the cheapest registers first.
- unsigned RegClassID = ChainBegin->getDesc().OpInfo[0].RegClass;
auto Ord = RCI.getOrder(TRI->getRegClass(RegClassID));
for (auto Reg : Ord) {
- if (!Units.available(Reg))
+ if (!AvailableRegs[Reg])
continue;
if (C == getColor(Reg))
return Reg;
OpenPOWER on IntegriCloud