From fd9d04ccd615b185e65a765e3587eae3f72aa867 Mon Sep 17 00:00:00 2001 From: Bruce He <44327446+zm2he@users.noreply.github.com> Date: Fri, 23 Jun 2023 22:56:48 +0000 Subject: Liveness Analysis Proof of Concept (#5771) This introduces a limited monotone flow-sensitive liveness analysis on local indices as an initial proof of concept for the creation of a monotone flow-sensitive static analysis framework. Tests are included in test/gtest/cfg.cpp. --- src/analysis/cfg.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/analysis/cfg.h') diff --git a/src/analysis/cfg.h b/src/analysis/cfg.h index ba4d7a774..c14cf70f4 100644 --- a/src/analysis/cfg.h +++ b/src/analysis/cfg.h @@ -40,6 +40,10 @@ struct BasicBlock { iterator end() const { return insts.cend(); } size_t size() const { return insts.size(); } + using reverse_iterator = std::vector::const_reverse_iterator; + reverse_iterator rbegin() const { return insts.rbegin(); } + reverse_iterator rend() const { return insts.rend(); } + // Iterables for predecessor and successor blocks. struct Predecessors; struct Successors; @@ -48,6 +52,8 @@ struct BasicBlock { void print(std::ostream& os, Module* wasm = nullptr, size_t start = 0) const; + Index getIndex() const { return index; } + private: Index index; std::vector insts; -- cgit v1.2.3