diff --git a/libIRDB/include/cfg/domgraph.hpp b/libIRDB/include/cfg/domgraph.hpp index d5de10e5ebdc389b40eaebe1520fa0a0dfdd8c59..62752d18b42a63e22b2eed72a4cdfc61736e7f6a 100644 --- a/libIRDB/include/cfg/domgraph.hpp +++ b/libIRDB/include/cfg/domgraph.hpp @@ -17,6 +17,8 @@ class DominatorGraph_t const BasicBlockSet_t& GetDominators(const BasicBlock_t* node) const { return dom_graph.at(node); } const BasicBlockSet_t& GetPostDominators(const BasicBlock_t* node) const { return post_dom_graph.at(node); } + bool HasWarnings() const { return warn; } + // get the immeidate (post) dominators for a node const BasicBlock_t* GetImmediateDominator(const BasicBlock_t* node) const @@ -41,6 +43,8 @@ class DominatorGraph_t const ControlFlowGraph_t& cfg; // a reference to our cfg. + bool warn; + friend std::ostream& operator<<(std::ostream& os, const DominatorGraph_t& cfg); }; diff --git a/libIRDB/src/cfg/domgraph.cpp b/libIRDB/src/cfg/domgraph.cpp index 9fafa6a6193da9d2bbd437a1e4dccc92778f7528..6448b3b2d1911e187024b5a961bbc9055fd0b971 100644 --- a/libIRDB/src/cfg/domgraph.cpp +++ b/libIRDB/src/cfg/domgraph.cpp @@ -11,7 +11,7 @@ using namespace libIRDB; // constructor DominatorGraph_t::DominatorGraph_t(const ControlFlowGraph_t* p_cfg, bool needs_postdoms, bool needs_idoms) - : cfg(*p_cfg) + : cfg(*p_cfg), warn(false) { @@ -273,7 +273,8 @@ BlockToBlockMap_t DominatorGraph_t::Idom_Comp(const BasicBlockSet_t& N, const Do { //IDom(n) = <only element in>Tmp(n) IDom[n]= *(Tmp[n].begin()); - assert(Tmp[n].size()<=1); // should only be one idominator. + if(Tmp[n].size()!=1) // should only be one idominator. + warn=true; }); return IDom; } // IDom_Comp