summaryrefslogtreecommitdiff
path: root/src/analysis/cfg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/cfg.cpp')
-rw-r--r--src/analysis/cfg.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/analysis/cfg.cpp b/src/analysis/cfg.cpp
index ba638ec5a..5d939f7a6 100644
--- a/src/analysis/cfg.cpp
+++ b/src/analysis/cfg.cpp
@@ -62,6 +62,12 @@ CFG CFG::fromFunction(Function* func) {
}
}
+ assert(!cfg.blocks.empty());
+ cfg.blocks[0].entry = true;
+ if (builder.exit) {
+ oldToNewBlocks.at(builder.exit)->exit = true;
+ }
+
// Move-construct a new CFG to get mandatory copy elision, preserving basic
// block addresses through the return.
return CFG(std::move(cfg));
@@ -96,6 +102,14 @@ void BasicBlock::print(std::ostream& os, Module* wasm, size_t start) const {
}
os << "]\n";
+ if (isEntry()) {
+ os << ";; entry\n";
+ }
+
+ if (isExit()) {
+ os << ";; exit\n";
+ }
+
os << index << ":\n";
size_t instIndex = start;
for (auto* inst : *this) {