summaryrefslogtreecommitdiff
path: root/src/analysis/cfg.h
diff options
context:
space:
mode:
authorBruce He <44327446+zm2he@users.noreply.github.com>2023-06-23 22:56:48 +0000
committerGitHub <noreply@github.com>2023-06-23 18:56:48 -0400
commitfd9d04ccd615b185e65a765e3587eae3f72aa867 (patch)
tree69e7890a23a8bfc5c2cfcf61ae37abc48830d13b /src/analysis/cfg.h
parent1545deb41194b205c6aba4e940f3db56cdec795f (diff)
downloadbinaryen-fd9d04ccd615b185e65a765e3587eae3f72aa867.tar.gz
binaryen-fd9d04ccd615b185e65a765e3587eae3f72aa867.tar.bz2
binaryen-fd9d04ccd615b185e65a765e3587eae3f72aa867.zip
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.
Diffstat (limited to 'src/analysis/cfg.h')
-rw-r--r--src/analysis/cfg.h6
1 files changed, 6 insertions, 0 deletions
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<Expression*>::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<Expression*> insts;