1 #ifndef FLOWGRAPH_H 2 #define FLOWGRAPH_H 3 4 /// 5 // Utilities for flowgraphs 6 // ------------------------ 7 8 #include <stdbool.h> 9 10 struct entrypoint; 11 struct basic_block; 12 13 /// 14 // Set the BB's reverse postorder links 15 // Each BB will also have its 'order number' set. 16 int cfg_postorder(struct entrypoint *ep); 17 18 /// 19 // Build the dominance tree. 20 // Each BB will then have: 21 // - a link to its immediate dominator (::idom) 22 // - the list of BB it immediately dominates (::doms) 23 // - its level in the dominance tree (::dom_level) 24 void domtree_build(struct entrypoint *ep); 25 26 /// 27 // Test the dominance between two basic blocks. 28 // @a: the basic block expected to dominate 29 // @b: the basic block expected to be dominated 30 // @return: ``true`` if @a dominates @b, ``false`` otherwise. 31 bool domtree_dominates(struct basic_block *a, struct basic_block *b); 32 33 #endif 34