[llvm] r291317 - [MachineBasicBlock] Add a non-assert live-in accessor for debug mode.

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 16:46:31 PST 2017


Author: qcolombet
Date: Fri Jan  6 18:46:30 2017
New Revision: 291317

URL: http://llvm.org/viewvc/llvm-project?rev=291317&view=rev
Log:
[MachineBasicBlock] Add a non-assert live-in accessor for debug mode.

With r291169, it is now not possible to access the live-in information
when the liveness is not properly tracked. Although this is want we want
in general, for debugging purpose we may want to still be able to
traverse this information even if it may not be accurate.

Modified:
    llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h

Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=291317&r1=291316&r2=291317&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Fri Jan  6 18:46:30 2017
@@ -308,6 +308,16 @@ public:
   // Iteration support for live in sets.  These sets are kept in sorted
   // order by their register number.
   typedef LiveInVector::const_iterator livein_iterator;
+#ifndef NDEBUG
+  /// Unlike livein_begin, this method does not check that the liveness
+  /// information is accurate. Still for debug purposes it may be useful
+  /// to have iterators that won't assert if the liveness information
+  /// is not current.
+  livein_iterator livein_begin_dbg() const { return LiveIns.begin(); }
+  iterator_range<livein_iterator> liveins_dbg() const {
+    return make_range(livein_begin_dbg(), livein_end());
+  }
+#endif
   livein_iterator livein_begin() const;
   livein_iterator livein_end()   const { return LiveIns.end(); }
   bool            livein_empty() const { return LiveIns.empty(); }




More information about the llvm-commits mailing list