Lines Matching full:region
317 // The exit block is part of the region, and is the last
318 // merge block before exiting the region.
330 void storeLiveOutRegRegion(RegionMRT *Region, Register Reg,
343 void storeLiveOuts(RegionMRT *Region, const MachineRegisterInfo *MRI,
353 void setRegionMRT(RegionMRT *Region) { RMRT = Region; } in setRegionMRT() argument
415 void initLiveOut(RegionMRT *Region, const MachineRegisterInfo *MRI,
446 void setParent(RegionMRT *Region) { Parent = Region; } in setParent() argument
492 MachineRegion *Region; member in __anon3d3c1dbc0211::RegionMRT
498 RegionMRT(MachineRegion *MachineRegion) : Region(MachineRegion) { in RegionMRT()
522 MachineRegion *getMachineRegion() { return Region; } in getMachineRegion()
534 dbgs() << "Region: " << (void *)Region; in dump()
625 // for the top level region. in buildMRT()
643 MachineRegion *Region = RegionInfo->getRegionFor(MBB); in buildMRT() local
645 // Ensure we have the MRT region in buildMRT()
646 if (RegionMap.count(Region) == 0) { in buildMRT()
647 RegionMRT *NewMRTRegion = new RegionMRT(Region); in buildMRT()
648 RegionMap[Region] = NewMRTRegion; in buildMRT()
651 MachineRegion *Parent = Region->getParent(); in buildMRT()
664 // Add MBB to Region MRT in buildMRT()
665 RegionMap[Region]->addChild(NewMBB); in buildMRT()
666 NewMBB->setParent(RegionMap[Region]); in buildMRT()
667 RegionMap[Region]->setSucc(Region->getExit()); in buildMRT()
712 void LinearizedRegion::storeLiveOutRegRegion(RegionMRT *Region, Register Reg, in storeLiveOutRegRegion() argument
721 if (!Region->contains(UI.getParent()->getParent())) { in storeLiveOutRegRegion()
722 LLVM_DEBUG(dbgs() << "Add LiveOut (Region " << (void *)Region in storeLiveOutRegRegion()
790 void LinearizedRegion::storeLiveOuts(RegionMRT *Region, in storeLiveOuts() argument
795 MachineBasicBlock *Exit = Region->getSucc(); in storeLiveOuts()
798 CurrentTopRegion == nullptr ? Region : CurrentTopRegion; in storeLiveOuts()
804 auto Children = Region->getChildren(); in storeLiveOuts()
812 // linearized region in storeLiveOuts()
820 auto Succ = Region->getSucc(); in storeLiveOuts()
826 if (Region->contains(getPHIPred(PHI, i))) { in storeLiveOuts()
828 LLVM_DEBUG(dbgs() << "Add Region LiveOut (" << (void *)Region in storeLiveOuts()
840 OS << "Linearized Region {"; in print()
895 dbgs() << "Preparing to replace register (region): " in replaceRegister()
904 LLVM_DEBUG(dbgs() << "Region before register replace\n"); in replaceRegister()
907 LLVM_DEBUG(dbgs() << "Region after register replace\n"); in replaceRegister()
937 LLVM_DEBUG(dbgs() << "Replacing register (region): " in replaceRegister()
1040 void LinearizedRegion::initLiveOut(RegionMRT *Region, in initLiveOut() argument
1044 storeLiveOuts(Region, MRI, TRI, PHIInfo); in initLiveOut()
1076 void getPHIRegionIndices(RegionMRT *Region, MachineInstr &PHI,
1078 void getPHIRegionIndices(LinearizedRegion *Region, MachineInstr &PHI,
1080 void getPHINonRegionIndices(LinearizedRegion *Region, MachineInstr &PHI,
1109 void rewriteRegionExitPHI(RegionMRT *Region, MachineBasicBlock *LastMerge,
1112 void rewriteRegionExitPHIs(RegionMRT *Region, MachineBasicBlock *LastMerge,
1114 void rewriteRegionEntryPHI(LinearizedRegion *Region, MachineBasicBlock *IfMBB,
1116 void rewriteRegionEntryPHIs(LinearizedRegion *Region,
1119 bool regionIsSimpleIf(RegionMRT *Region);
1121 void transformSimpleIfRegion(RegionMRT *Region);
1127 MachineBasicBlock *createLinearizedExitBlock(RegionMRT *Region);
1185 LinearizedRegion *initLinearizedRegion(RegionMRT *Region);
1187 bool structurizeComplexRegion(RegionMRT *Region);
1189 bool structurizeRegion(RegionMRT *Region);
1191 bool structurizeRegions(RegionMRT *Region, bool isTopRegion);
1207 void createLinearizedRegion(RegionMRT *Region, unsigned SelectOut);
1224 bool AMDGPUMachineCFGStructurizer::regionIsSimpleIf(RegionMRT *Region) { in regionIsSimpleIf() argument
1225 MachineBasicBlock *Entry = Region->getEntry(); in regionIsSimpleIf()
1226 MachineBasicBlock *Succ = Region->getSucc(); in regionIsSimpleIf()
1246 void AMDGPUMachineCFGStructurizer::transformSimpleIfRegion(RegionMRT *Region) { in transformSimpleIfRegion() argument
1247 MachineBasicBlock *Entry = Region->getEntry(); in transformSimpleIfRegion()
1248 MachineBasicBlock *Exit = Region->getExit(); in transformSimpleIfRegion()
1265 static void fixRegionTerminator(RegionMRT *Region) { in fixRegionTerminator() argument
1268 LinearizedRegion *LRegion = Region->getLinearizedRegion(); in fixRegionTerminator()
1296 // If a region is just a sequence of regions (and the exit
1297 // block in the case of the top level region), we can simply skip
1299 bool regionIsSequence(RegionMRT *Region) { in regionIsSequence() argument
1300 auto Children = Region->getChildren(); in regionIsSequence()
1311 void fixupRegionExits(RegionMRT *Region) { in fixupRegionExits() argument
1312 auto Children = Region->getChildren(); in fixupRegionExits()
1323 RegionMRT *Region, MachineInstr &PHI, in getPHIRegionIndices() argument
1328 if (Region->contains(Pred)) { in getPHIRegionIndices()
1335 LinearizedRegion *Region, MachineInstr &PHI, in getPHIRegionIndices() argument
1340 if (Region->contains(Pred)) { in getPHIRegionIndices()
1347 LinearizedRegion *Region, MachineInstr &PHI, in getPHINonRegionIndices() argument
1352 if (!Region->contains(Pred)) { in getPHINonRegionIndices()
1596 void AMDGPUMachineCFGStructurizer::rewriteRegionExitPHI(RegionMRT *Region, in rewriteRegionExitPHI() argument
1601 getPHIRegionIndices(Region, PHI, PHIRegionIndices); in rewriteRegionExitPHI()
1609 void AMDGPUMachineCFGStructurizer::rewriteRegionEntryPHI(LinearizedRegion *Region, in rewriteRegionEntryPHI() argument
1613 getPHINonRegionIndices(Region, PHI, PHINonRegionIndices); in rewriteRegionEntryPHI()
1628 void AMDGPUMachineCFGStructurizer::rewriteRegionExitPHIs(RegionMRT *Region, in rewriteRegionExitPHIs() argument
1632 auto Exit = Region->getSucc(); in rewriteRegionExitPHIs()
1639 rewriteRegionExitPHI(Region, LastMerge, *PHII, LRegion); in rewriteRegionExitPHIs()
1643 void AMDGPUMachineCFGStructurizer::rewriteRegionEntryPHIs(LinearizedRegion *Region, in rewriteRegionEntryPHIs() argument
1646 auto Entry = Region->getEntry(); in rewriteRegionEntryPHIs()
1651 rewriteRegionEntryPHI(Region, IfMBB, *PHII); in rewriteRegionEntryPHIs()
1690 AMDGPUMachineCFGStructurizer::createLinearizedExitBlock(RegionMRT *Region) { in createLinearizedExitBlock() argument
1691 auto Exit = Region->getSucc(); in createLinearizedExitBlock()
1694 MachineFunction *MF = Region->getEntry()->getParent(); in createLinearizedExitBlock()
1696 return &(*(--(Region->getEntry()->getParent()->end()))); in createLinearizedExitBlock()
1758 // structurized region with a loop will have the entry block split, in removeExternalCFGEdges()
1926 // inside the region. in insertChainedPHI()
1936 // We collect all PHI Information, and if we are at the region entry, in insertChainedPHI()
1944 // If this is not a phi-def, or it is a phi-def but from a linearized region in insertChainedPHI()
1947 // need to replace any uses outside the region. in insertChainedPHI()
2006 // chain, we need to create a PHI node to handle the if region, in rewriteLiveOutRegs()
2007 // and replace all uses outside of the region with the new dest in rewriteLiveOutRegs()
2065 // is always executed when the region is executed. in prunePHIInfo()
2245 // Handle non-loop region entry block. in createIfRegion()
2270 // linearized region entry. in createIfRegion()
2356 LLVM_DEBUG(dbgs() << "Insert BB Select PHI (region)\n"); in createIfRegion()
2516 AMDGPUMachineCFGStructurizer::initLinearizedRegion(RegionMRT *Region) { in initLinearizedRegion() argument
2517 LinearizedRegion *LRegion = Region->getLinearizedRegion(); in initLinearizedRegion()
2518 LRegion->initLiveOut(Region, MRI, TRI, PHIInfo); in initLinearizedRegion()
2519 LRegion->setEntry(Region->getEntry()); in initLinearizedRegion()
2523 static void removeOldExitPreds(RegionMRT *Region) { in removeOldExitPreds() argument
2524 MachineBasicBlock *Exit = Region->getSucc(); in removeOldExitPreds()
2531 if (Region->contains(*PI)) { in removeOldExitPreds()
2558 RegionMRT *Region = Tree->getRegionMRT(); in containsNewBackedge() local
2559 for (MRT *C : llvm::reverse(*Region->getChildren())) in containsNewBackedge()
2566 static bool containsNewBackedge(RegionMRT *Region) { in containsNewBackedge() argument
2568 return containsNewBackedge(Region, MBBs); in containsNewBackedge()
2571 bool AMDGPUMachineCFGStructurizer::structurizeComplexRegion(RegionMRT *Region) { in structurizeComplexRegion() argument
2572 auto *LRegion = initLinearizedRegion(Region); in structurizeComplexRegion()
2573 LRegion->setHasLoop(containsNewBackedge(Region)); in structurizeComplexRegion()
2574 MachineBasicBlock *LastMerge = createLinearizedExitBlock(Region); in structurizeComplexRegion()
2579 rewriteRegionExitPHIs(Region, LastMerge, LRegion); in structurizeComplexRegion()
2580 removeOldExitPreds(Region); in structurizeComplexRegion()
2584 SetVector<MRT *> *Children = Region->getChildren(); in structurizeComplexRegion()
2585 LLVM_DEBUG(dbgs() << "===========If Region Start===============\n"); in structurizeComplexRegion()
2602 // We found the block is the exit of an inner region, we need in structurizeComplexRegion()
2603 // to put it in the current linearized region. in structurizeComplexRegion()
2605 LLVM_DEBUG(dbgs() << "Linearizing region: "); in structurizeComplexRegion()
2611 // Entry has already been linearized, no need to do this region. in structurizeComplexRegion()
2655 // This is a basic block that is not part of an inner region, we in structurizeComplexRegion()
2656 // need to put it in the current linearized region. in structurizeComplexRegion()
2681 NewInReg, Region->getEntry()->getNumber()); in structurizeComplexRegion()
2682 // Need to be careful about updating the registers inside the region. in structurizeComplexRegion()
2692 if (Region->isRoot()) { in structurizeComplexRegion()
2696 LLVM_DEBUG(Region->getEntry()->getParent()->dump()); in structurizeComplexRegion()
2700 LLVM_DEBUG(dbgs() << "===========If Region End===============\n"); in structurizeComplexRegion()
2702 Region->setLinearizedRegion(LRegion); in structurizeComplexRegion()
2706 bool AMDGPUMachineCFGStructurizer::structurizeRegion(RegionMRT *Region) { in structurizeRegion() argument
2707 if (false && regionIsSimpleIf(Region)) { in structurizeRegion()
2708 transformSimpleIfRegion(Region); in structurizeRegion()
2711 if (regionIsSequence(Region)) in structurizeRegion()
2712 fixupRegionExits(Region); in structurizeRegion()
2714 structurizeComplexRegion(Region); in structurizeRegion()
2720 bool AMDGPUMachineCFGStructurizer::structurizeRegions(RegionMRT *Region, in structurizeRegions() argument
2724 auto Children = Region->getChildren(); in structurizeRegions()
2732 Changed |= structurizeRegion(Region); in structurizeRegions()
2750 void AMDGPUMachineCFGStructurizer::createLinearizedRegion(RegionMRT *Region, in createLinearizedRegion() argument
2758 LRegion->setRegionMRT(Region); in createLinearizedRegion()
2759 Region->setLinearizedRegion(LRegion); in createLinearizedRegion()
2760 LRegion->setParent(Region->getParent() in createLinearizedRegion()
2761 ? Region->getParent()->getLinearizedRegion() in createLinearizedRegion()
2770 RegionMRT *Region = MRT->getRegionMRT(); in initializeSelectRegisters() local
2771 Region->setBBSelectRegOut(SelectOut); in initializeSelectRegisters()
2775 createLinearizedRegion(Region, SelectOut); in initializeSelectRegisters()
2777 for (auto *CI : *Region->getChildren()) in initializeSelectRegisters()