Lines Matching refs:MBB
97 void lowerInitExec(MachineBasicBlock *MBB, MachineInstr &MI);
104 bool removeMBBifRedundant(MachineBasicBlock &MBB);
112 skipIgnoreExecInstsTrivialSucc(MachineBasicBlock &MBB,
117 skipToUncondBrOrEnd(MachineBasicBlock &MBB, in skipToUncondBrOrEnd() argument
122 MachineBasicBlock::iterator End = MBB.end(); in skipToUncondBrOrEnd()
173 MachineBasicBlock *MBB = Worklist.pop_back_val(); in hasKill() local
175 if (MBB == End || !Visited.insert(MBB).second) in hasKill()
177 if (KillBlocks.contains(MBB)) in hasKill()
180 Worklist.append(MBB->succ_begin(), MBB->succ_end()); in hasKill()
199 MachineBasicBlock &MBB = *MI.getParent(); in emitIf() local
226 BuildMI(MBB, I, DL, TII->get(AMDGPU::COPY), CopyReg) in emitIf()
234 BuildMI(MBB, I, DL, TII->get(AndOpc), Tmp) in emitIf()
243 BuildMI(MBB, I, DL, TII->get(XorOpc), SaveExecReg) in emitIf()
252 BuildMI(MBB, I, DL, TII->get(MovTermOpc), Exec) in emitIf()
257 I = skipToUncondBrOrEnd(MBB, I); in emitIf()
261 MachineInstr *NewBr = BuildMI(MBB, I, DL, TII->get(AMDGPU::S_CBRANCH_EXECZ)) in emitIf()
294 MachineBasicBlock &MBB = *MI.getParent(); in emitElse() local
299 MachineBasicBlock::iterator Start = MBB.begin(); in emitElse()
305 BuildMI(MBB, Start, DL, TII->get(OrSaveExecOpc), SaveReg) in emitElse()
314 MachineInstr *And = BuildMI(MBB, ElsePt, DL, TII->get(AndOpc), DstReg) in emitElse()
322 BuildMI(MBB, ElsePt, DL, TII->get(XorTermrOpc), Exec) in emitElse()
328 ElsePt = skipToUncondBrOrEnd(MBB, ElsePt); in emitElse()
331 BuildMI(MBB, ElsePt, DL, TII->get(AMDGPU::S_CBRANCH_EXECZ)) in emitElse()
356 MachineBasicBlock &MBB = *MI.getParent(); in emitIfBreak() local
377 And = BuildMI(MBB, &MI, DL, TII->get(AndOpc), AndReg) in emitIfBreak()
380 Or = BuildMI(MBB, &MI, DL, TII->get(OrOpc), Dst) in emitIfBreak()
386 Or = BuildMI(MBB, &MI, DL, TII->get(OrOpc), Dst) in emitIfBreak()
400 MachineBasicBlock &MBB = *MI.getParent(); in emitLoop() local
404 BuildMI(MBB, &MI, DL, TII->get(Andn2TermOpc), Exec) in emitLoop()
408 auto BranchPt = skipToUncondBrOrEnd(MBB, MI.getIterator()); in emitLoop()
410 BuildMI(MBB, BranchPt, DL, TII->get(AMDGPU::S_CBRANCH_EXECNZ)) in emitLoop()
423 MachineBasicBlock &MBB, MachineBasicBlock::iterator It) const { in skipIgnoreExecInstsTrivialSucc() argument
426 MachineBasicBlock *B = &MBB; in skipIgnoreExecInstsTrivialSucc()
429 return MBB.end(); in skipIgnoreExecInstsTrivialSucc()
441 return MBB.end(); in skipIgnoreExecInstsTrivialSucc()
452 MachineBasicBlock &MBB = *MI.getParent(); in emitEndCf() local
455 MachineBasicBlock::iterator InsPt = MBB.begin(); in emitEndCf()
471 MachineBasicBlock *SplitBB = &MBB; in emitEndCf()
473 SplitBB = MBB.splitAt(MI, /*UpdateLiveIns*/true, LIS); in emitEndCf()
479 BuildMI(MBB, InsPt, DL, TII->get(Opcode), Exec) in emitEndCf()
557 MachineBasicBlock &MBB = *MI->getParent(); in optimizeEndCf() local
559 skipIgnoreExecInstsTrivialSucc(MBB, std::next(MI->getIterator())); in optimizeEndCf()
560 if (Next == MBB.end() || !LoweredEndCf.count(&*Next)) in optimizeEndCf()
574 removeMBBifRedundant(MBB); in optimizeEndCf()
580 MachineBasicBlock &MBB = *MI.getParent(); in process() local
582 MachineInstr *Prev = (I != MBB.begin()) ? &*(std::prev(I)) : nullptr; in process()
584 MachineBasicBlock *SplitBB = &MBB; in process()
617 for (I = Prev ? Prev->getIterator() : MBB.begin(); I != MBB.end(); I = Next) { in process()
629 I = MBB.end(); in process()
637 void SILowerControlFlow::lowerInitExec(MachineBasicBlock *MBB, in lowerInitExec() argument
639 MachineFunction &MF = *MBB->getParent(); in lowerInitExec()
645 BuildMI(*MBB, MBB->begin(), MI.getDebugLoc(), in lowerInitExec()
662 MachineInstr *FirstMI = &*MBB->begin(); in lowerInitExec()
666 if (DefInstr->getParent() == MBB) { in lowerInitExec()
671 MBB->insert(FirstMI, DefInstr); in lowerInitExec()
686 auto BfeMI = BuildMI(*MBB, FirstMI, DL, TII->get(AMDGPU::S_BFE_U32), CountReg) in lowerInitExec()
690 BuildMI(*MBB, FirstMI, DL, in lowerInitExec()
694 auto CmpMI = BuildMI(*MBB, FirstMI, DL, TII->get(AMDGPU::S_CMP_EQ_U32)) in lowerInitExec()
698 BuildMI(*MBB, FirstMI, DL, in lowerInitExec()
721 bool SILowerControlFlow::removeMBBifRedundant(MachineBasicBlock &MBB) { in removeMBBifRedundant() argument
739 for (auto &I : MBB.instrs()) { in removeMBBifRedundant()
744 assert(MBB.succ_size() == 1 && "MBB has more than one successor"); in removeMBBifRedundant()
746 MachineBasicBlock *Succ = *MBB.succ_begin(); in removeMBBifRedundant()
749 while (!MBB.predecessors().empty()) { in removeMBBifRedundant()
750 MachineBasicBlock *P = *MBB.pred_begin(); in removeMBBifRedundant()
751 if (GetFallThroughSucc(P) == &MBB) in removeMBBifRedundant()
753 P->ReplaceUsesOfBlockWith(&MBB, Succ); in removeMBBifRedundant()
755 MBB.removeSuccessor(Succ); in removeMBBifRedundant()
757 for (auto &I : MBB.instrs()) in removeMBBifRedundant()
760 MBB.clear(); in removeMBBifRedundant()
761 MBB.eraseFromParent(); in removeMBBifRedundant()
811 for (auto &MBB : MF) { in runOnMachineFunction() local
813 for (auto &Term : MBB.terminators()) { in runOnMachineFunction()
815 KillBlocks.insert(&MBB); in runOnMachineFunction()
821 for (auto &MI : MBB) { in runOnMachineFunction()
823 KillBlocks.insert(&MBB); in runOnMachineFunction()
834 MachineBasicBlock *MBB = &*BI; in runOnMachineFunction() local
837 E = MBB->end(); in runOnMachineFunction()
838 for (I = MBB->begin(); I != E; I = Next) { in runOnMachineFunction()
841 MachineBasicBlock *SplitMBB = MBB; in runOnMachineFunction()
856 lowerInitExec(MBB, MI); in runOnMachineFunction()
865 if (SplitMBB != MBB) { in runOnMachineFunction()
866 MBB = Next->getParent(); in runOnMachineFunction()
867 E = MBB->end(); in runOnMachineFunction()