6 #ifndef JLM_LLVM_IR_CFG_STRUCTURE_HPP
7 #define JLM_LLVM_IR_CFG_STRUCTURE_HPP
14 #include <unordered_set>
20 class ControlFlowGraph;
21 class ControlFlowGraphEdge;
22 class ControlFlowGraphNode;
29 PtrIterator<ControlFlowGraphNode, std::unordered_set<ControlFlowGraphNode *>::const_iterator>;
55 std::unordered_set<ControlFlowGraphNode *>
nodes_{};
141 static std::unique_ptr<StronglyConnectedComponentStructure>
161 is_valid(
const ControlFlowGraph & cfg);
172 std::vector<StronglyConnectedComponent>
179 std::vector<StronglyConnectedComponent>
180 find_sccs(ControlFlowGraphNode * entry, ControlFlowGraphNode * exit);
186 return sccs.size() == 0;
215 purge(ControlFlowGraph & cfg);
222 prune(ControlFlowGraph & cfg);
Strongly Connected Component Structure.
bool IsTailControlledLoop() const noexcept
EdgeIteratorRange ExitEdges() const
size_t NumExitEdges() const noexcept
NodeIteratorRange ExitNodes() const
util::IteratorRange< CfgEdgeConstIterator > EdgeIteratorRange
NodeIteratorRange EntryNodes() const
size_t NumEntryNodes() const noexcept
util::HashSet< ControlFlowGraphEdge * > EntryEdges_
size_t NumExitNodes() const noexcept
util::HashSet< ControlFlowGraphEdge * > ExitEdges_
util::HashSet< ControlFlowGraphNode * > EntryNodes_
EdgeIteratorRange RepetitionEdges() const
size_t NumEntryEdges() const noexcept
static std::unique_ptr< StronglyConnectedComponentStructure > Create(const StronglyConnectedComponent &scc)
util::IteratorRange< CfgNodeConstIterator > NodeIteratorRange
util::HashSet< ControlFlowGraphEdge * > RepetitionEdges_
EdgeIteratorRange EntryEdges() const
size_t NumRepetitionEdges() const noexcept
util::HashSet< ControlFlowGraphNode * > ExitNodes_
Strongly Connected Component.
constiterator end() const
constiterator begin() const
std::unordered_set< ControlFlowGraphNode * > nodes_
StronglyConnectedComponent(const std::unordered_set< ControlFlowGraphNode * > &nodes)
size_t nnodes() const noexcept
bool contains(ControlFlowGraphNode *node) const
util::PtrIterator< ControlFlowGraphNode, std::unordered_set< ControlFlowGraphNode * >::const_iterator > constiterator
Global memory state passed between functions.
std::vector< StronglyConnectedComponent > find_sccs(const ControlFlowGraph &cfg)
bool is_structured(const ControlFlowGraph &cfg)
static bool is_linear(const ControlFlowGraphNode *node) noexcept
bool is_reducible(const ControlFlowGraph &cfg)
bool is_valid(const ControlFlowGraph &cfg)
void straighten(ControlFlowGraph &cfg)
bool is_proper_structured(const ControlFlowGraph &cfg)
void purge(ControlFlowGraph &cfg)
Remove all basic blocks without instructions.
bool is_closed(const ControlFlowGraph &cfg)
static bool is_acyclic(const ControlFlowGraph &cfg)
void prune(ControlFlowGraph &cfg)