Hide implementations of BasicBlock::dominates,postdominates
authorDavid Neto <dneto@google.com>
Fri, 5 Aug 2016 19:20:59 +0000 (15:20 -0400)
committerDavid Neto <dneto@google.com>
Fri, 5 Aug 2016 20:55:21 +0000 (16:55 -0400)
source/val/BasicBlock.cpp
source/val/BasicBlock.h

index 645b555..3e95618 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "BasicBlock.h"
 
+#include <algorithm>
 #include <utility>
 #include <vector>
 
@@ -76,6 +77,18 @@ void BasicBlock::RegisterBranchInstruction(SpvOp branch_instruction) {
   return;
 }
 
+bool BasicBlock::dominates(const BasicBlock& other) const {
+  return (this == &other) ||
+         !(other.dom_end() ==
+           std::find(other.dom_begin(), other.dom_end(), this));
+}
+
+bool BasicBlock::postdominates(const BasicBlock& other) const {
+  return (this == &other) ||
+         !(other.pdom_end() ==
+           std::find(other.pdom_begin(), other.pdom_end(), this));
+}
+
 BasicBlock::DominatorIterator::DominatorIterator() : current_(nullptr) {}
 
 BasicBlock::DominatorIterator::DominatorIterator(
index dd1014c..21b0e39 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <cstdint>
 
-#include <algorithm>
 #include <bitset>
 #include <functional>
 #include <vector>
@@ -130,19 +129,11 @@ class BasicBlock {
 
   /// Returns true if this block dominates the other block.
   /// Assumes dominators have been computed.
-  bool dominates(const BasicBlock& other) const {
-    return (this == &other) ||
-           !(other.dom_end() ==
-             std::find(other.dom_begin(), other.dom_end(), this));
-  }
+  bool dominates(const BasicBlock& other) const;
 
   /// Returns true if this block postdominates the other block.
   /// Assumes dominators have been computed.
-  bool postdominates(const BasicBlock& other) const {
-    return (this == &other) ||
-           !(other.pdom_end() ==
-             std::find(other.pdom_begin(), other.pdom_end(), this));
-  }
+  bool postdominates(const BasicBlock& other) const;
 
   /// @brief A BasicBlock dominator iterator class
   ///