Lines Matching full:restore

12 // (resp. Restore).
15 // between 2) two executions of the Save (resp. Restore) point there is an
16 // execution of the Restore (resp. Save) point.
22 // Restore
24 // Indeed, the execution looks like Save -> Restore -> Save -> Restore ...
32 // Restore
34 // Indeed, the execution looks like Save -> Save -> ... -> Restore -> Restore.
103 cl::desc("enable splitting of the restore block if possible"));
128 MachineBasicBlock *Restore = nullptr; member in __anon8a4a73dd0111::ShrinkWrap
134 /// Hold the loop information. Used to determine if Save and Restore
173 /// after Save and before Restore.
192 /// Update the Save and Restore points such that \p MBB is in
193 /// the region that is dominated by Save and post-dominated by Restore
194 /// and Save and Restore still match the safe point definition.
195 /// Such point may not exist and Save and/or Restore may be null after
205 /// This function tries to split the restore point if doing so can shrink the
206 /// save point further. \return True if restore point is split.
210 /// This function analyzes if the restore point can split to create a new
211 /// restore point. This function collects
212 /// 1. Any preds of current restore that are reachable by callee save/FI
215 /// 2. Any preds of current restore that are not DirtyPreds - indicated by
217 /// Both sets should be non-empty for considering restore point split.
231 Restore = nullptr; in init()
248 /// Check whether or not Save and Restore points are still interesting for
250 bool ArePointsInteresting() const { return Save != Entry && Save && Restore; } in ArePointsInteresting()
347 // calls by forcing the restore point to post-dominate them. in INITIALIZE_PASS_DEPENDENCY()
438 /// Restore.
456 /// This function updates the branches post restore point split.
458 /// Restore point has been split.
459 /// Old restore point: MBB
460 /// New restore point: NMBB
476 /// This function splits the restore point and returns new restore point/BB.
480 /// Decision has been made to split the restore point.
481 /// old restore point: \p MBB
482 /// new restore point: \p NMBB
511 // After splitting, all predecessors of the restore point should be dirty in tryToSplitRestore()
524 /// This function undoes the restore point split done earlier.
528 /// Restore point was split and the change needs to be unrolled. Make necessary
529 /// changes to reset restore point from \p NMBB to \p MBB.
553 // A block is deemed fit for restore point split iff there exist
589 InitRestore = Restore; in postShrinkWrapping()
597 // Do not support multiple restore points. in postShrinkWrapping()
658 // Now we know that splitting a restore point can isolate the restore point in postShrinkWrapping()
663 // Make sure if the new restore point is valid as an epilogue, depending on in postShrinkWrapping()
671 Restore = NewRestore; in postShrinkWrapping()
676 assert((MDT->dominates(Save, Restore) && MPDT->dominates(Restore, Save)) && in postShrinkWrapping()
677 "Incorrect save or restore point due to dominance relations"); in postShrinkWrapping()
678 assert((!MLI->getLoopFor(Save) && !MLI->getLoopFor(Restore)) && in postShrinkWrapping()
679 "Unexpected save or restore point in a loop"); in postShrinkWrapping()
681 EntryFreq >= MBFI->getBlockFreq(Restore)) && in postShrinkWrapping()
682 "Incorrect save or restore point based on block frequency"); in postShrinkWrapping()
695 if (!Restore) in updateSaveRestorePoints()
696 Restore = &MBB; in updateSaveRestorePoints()
701 // return `Restore`. in updateSaveRestorePoints()
702 Restore = MPDT->findNearestCommonDominator(Restore, &MBB); in updateSaveRestorePoints()
704 Restore = nullptr; // Abort, we can't find a restore point in this case. in updateSaveRestorePoints()
706 // Make sure we would be able to insert the restore code before the in updateSaveRestorePoints()
708 if (Restore == &MBB) { in updateSaveRestorePoints()
712 // One of the terminator needs to happen before the restore point. in updateSaveRestorePoints()
714 Restore = nullptr; // Abort, we can't find a restore point in this case. in updateSaveRestorePoints()
717 // Look for a restore point that post-dominates all the successors. in updateSaveRestorePoints()
719 Restore = FindIDom<>(*Restore, Restore->successors(), *MPDT); in updateSaveRestorePoints()
724 if (!Restore) { in updateSaveRestorePoints()
726 dbgs() << "Restore point needs to be spanned on several blocks\n"); in updateSaveRestorePoints()
730 // Make sure Save and Restore are suitable for shrink-wrapping: in updateSaveRestorePoints()
731 // 1. all path from Save needs to lead to Restore before exiting. in updateSaveRestorePoints()
732 // 2. all path to Restore needs to go through Save from Entry. in updateSaveRestorePoints()
734 // A. Save dominates Restore. in updateSaveRestorePoints()
735 // B. Restore post-dominates Save. in updateSaveRestorePoints()
736 // C. Save and Restore are in the same loop. in updateSaveRestorePoints()
739 while (Restore && in updateSaveRestorePoints()
740 (!(SaveDominatesRestore = MDT->dominates(Save, Restore)) || in updateSaveRestorePoints()
741 !(RestorePostDominatesSave = MPDT->dominates(Restore, Save)) || in updateSaveRestorePoints()
747 // Restore in updateSaveRestorePoints()
753 // by Restore. However, the CSRs uses are still reachable after in updateSaveRestorePoints()
754 // Restore and before Save are executed. in updateSaveRestorePoints()
756 // For now, just push the restore/save points outside of loops. in updateSaveRestorePoints()
759 MLI->getLoopFor(Save) || MLI->getLoopFor(Restore))) { in updateSaveRestorePoints()
762 Save = MDT->findNearestCommonDominator(Save, Restore); in updateSaveRestorePoints()
767 Restore = MPDT->findNearestCommonDominator(Restore, Save); in updateSaveRestorePoints()
770 if (Restore && (MLI->getLoopFor(Save) || MLI->getLoopFor(Restore))) { in updateSaveRestorePoints()
771 if (MLI->getLoopDepth(Save) > MLI->getLoopDepth(Restore)) { in updateSaveRestorePoints()
781 MLI->getLoopFor(Restore)->getExitingBlocks(ExitBlocks); in updateSaveRestorePoints()
782 // Push Restore outside of this loop. in updateSaveRestorePoints()
784 MachineBasicBlock *IPdom = Restore; in updateSaveRestorePoints()
793 if (IPdom && MLI->getLoopDepth(IPdom) < MLI->getLoopDepth(Restore)) in updateSaveRestorePoints()
794 Restore = IPdom; in updateSaveRestorePoints()
796 Restore = nullptr; in updateSaveRestorePoints()
831 // are at least at the boundary of the save and restore points. The in performShrinkWrapping()
857 // Save (resp. restore) point must dominate (resp. post dominate) in performShrinkWrapping()
861 // save/restore instructions, just give up. in performShrinkWrapping()
878 assert(!Save && !Restore && "We miss a shrink-wrap opportunity?!"); in performShrinkWrapping()
892 << "\nRestore: " << printMBBReference(*Restore) << ' ' in performShrinkWrapping()
893 << printBlockFreq(*MBFI, *Restore) << '\n'); in performShrinkWrapping()
897 EntryFreq >= MBFI->getBlockFreq(Restore)) && in performShrinkWrapping()
899 TFI->canUseAsEpilogue(*Restore))) in performShrinkWrapping()
910 // Restore is expensive. in performShrinkWrapping()
911 Restore = FindIDom<>(*Restore, Restore->successors(), *MPDT); in performShrinkWrapping()
912 if (!Restore) in performShrinkWrapping()
914 NewBB = Restore; in performShrinkWrapping()
917 } while (Save && Restore); in performShrinkWrapping()
967 << "\nRestore: " << printMBBReference(*Restore) << '\n'); in runOnMachineFunction()
971 MFI.setRestorePoint(Restore); in runOnMachineFunction()