#include "BasicBlock.h"
+#include <algorithm>
#include <utility>
#include <vector>
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(
#include <cstdint>
-#include <algorithm>
#include <bitset>
#include <functional>
#include <vector>
/// 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
///