31 , gid_(gid_counter_++) {}
33 uint64_t
gid()
const {
return gid_; }
37 const CFNodes& preds()
const {
return preds_; }
38 const CFNodes& succs()
const {
return succs_; }
39 void link(
const CFNode* other)
const;
41 mutable size_t f_index_ = -1;
42 mutable size_t b_index_ = -1;
46 static uint64_t gid_counter_;
51 template<
bool>
friend class CFG;
77 auto i = nodes_.find(mut);
78 return i == nodes_.end() ? nullptr : i->second;
85 auto cn = nodes_.find(mut)->second;
89 const CFNodes& succs(Def* mut)
const {
90 auto cn = nodes_.find(mut)->second;
94 const CFNode* entry()
const {
return entry_; }
95 const CFNode* exit()
const {
return exit_; }
96 const CFNode* node(Def*);
100 const CFNode* entry_;
102 mutable std::unique_ptr<const F_CFG> f_cfg_;
103 mutable std::unique_ptr<const B_CFG> b_cfg_;
105 template<
bool>
friend class CFG;
116template<
bool forward>
class CFG {
140 auto post_order()
const {
return std::views::reverse(rpo_.array()); }
150 static size_t index(
const CFNode* n) {
return forward ? n->f_index_ : n->b_index_; }
153 size_t post_order_visit(
const CFNode* n,
size_t i);
157 mutable std::unique_ptr<const DomTreeBase<forward>> domtree_;
158 mutable std::unique_ptr<const LoopTree<forward>> looptree_;
159 mutable std::unique_ptr<const DomFrontierBase<forward>> domfrontier_;
const B_CFG & b_cfg() const
const Scope & scope() const
const MutMap< const CFNode * > & nodes() const
const CFNode * operator[](Def *mut) const
CFA & operator=(CFA)=delete
const F_CFG & f_cfg() const
const CFNode * post_order(size_t i) const
Maps from post-order index to CFNode.
CFG & operator=(CFG)=delete
auto reverse_post_order() const
const CFNodes & preds(Def *mut) const
const LoopTree< forward > & looptree() const
const CFNodes & succs(Def *mut) const
const DomFrontierBase< forward > & domfrontier() const
size_t num_succs(const CFNode *n) const
const DomTreeBase< forward > & domtree() const
size_t num_succs(Def *mut) const
IndexMap< CFG< forward >, const CFNode *, Value > Map
size_t num_preds(const CFNode *n) const
const CFNode * reverse_post_order(size_t i) const
Maps from reverse post-order index to CFNode.
const CFNodes & preds(const CFNode *n) const
static size_t index(const CFNode *n)
const CFNode * exit() const
const CFNode * operator[](Def *mut) const
Maps from mut to CFNode.
size_t num_preds(Def *mut) const
const CFNodes & succs(const CFNode *n) const
const CFNode * entry() const
A Dominance Frontier Graph.
Calculates a loop nesting forest rooted at LoopTree::root_.
A Scope represents a region of Defs that are live from the view of an entry's Var.
The World represents the whole program and manages creation of MimIR nodes (Defs).
absl::flat_hash_set< K, GIDHash< K >, GIDEq< K > > GIDSet
GIDSet< const CFNode * > CFNodes
std::ostream & operator<<(std::ostream &, const CFNode *)
GIDMap< Def *, To > MutMap