MCPcopy Create free account
hub / github.com/AliveToolkit/alive2 / LoopAnalysis

Class LoopAnalysis

ir/function.h:289–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287
288
289class LoopAnalysis final {
290 Function &f;
291 CFG cfg;
292
293 std::unordered_map<const BasicBlock*, unsigned> number;
294 std::vector<BasicBlock*> node;
295 std::vector<unsigned> last;
296 void getDepthFirstSpanningTree();
297
298 std::vector<unsigned> header;
299 enum NodeType { nonheader, self, reducible, irreducible };
300 std::vector<NodeType> type;
301 std::unordered_map<BasicBlock*, std::vector<BasicBlock*>> forest;
302 std::unordered_map<BasicBlock*, BasicBlock*> parent;
303 std::vector<BasicBlock*> roots;
304 void run();
305
306public:
307 LoopAnalysis(Function &f) : f(f), cfg(f) { run(); }
308
309 auto& getRoots() const { return roots; }
310 auto& getLoopForest() const { return forest; }
311 BasicBlock* getParent(BasicBlock *bb) const;
312
313 void printDot(std::ostream &os) const;
314};
315
316}

Callers 1

writeDotMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected