-// Ensure this file gets linked when MachineLoopInfo.h is used.
-DEFINING_FILE_FOR(MachineLoopInfo)
\ No newline at end of file
+MachineBasicBlock *MachineLoop::getBottomBlock() {
+ MachineBasicBlock *BotMBB = getHeader();
+ MachineFunction::iterator End = BotMBB->getParent()->end();
+ if (BotMBB != std::prev(End)) {
+ MachineBasicBlock *NextMBB = std::next(MachineFunction::iterator(BotMBB));
+ while (contains(NextMBB)) {
+ BotMBB = NextMBB;
+ if (BotMBB == std::next(MachineFunction::iterator(BotMBB))) break;
+ NextMBB = std::next(MachineFunction::iterator(BotMBB));
+ }
+ }
+ return BotMBB;
+}
+
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+void MachineLoop::dump() const {
+ print(dbgs());
+}
+#endif