Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Unified Diff: src/IceCfg.cpp

Issue 1837663002: Initial Subzero WASM prototype. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review feedback and merging master Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceCfg.h ('k') | src/IceCfgNode.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceCfg.cpp
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp
index 79dfd767540433f04897a62e221789517c1c55c4..e2bee72da7c930e092c1fa5509c6e7abb1344a9d 100644
--- a/src/IceCfg.cpp
+++ b/src/IceCfg.cpp
@@ -245,6 +245,22 @@ void Cfg::translate() {
}
}
+void Cfg::fixPhiNodes() {
+ for (auto *Node : Nodes) {
+ // Fix all the phi edges since WASM can't tell how to make them correctly at
+ // the beginning.
+ assert(Node);
+ const auto &InEdges = Node->getInEdges();
+ for (auto &Instr : Node->getPhis()) {
+ auto *Phi = llvm::cast<InstPhi>(&Instr);
+ assert(Phi);
+ for (SizeT i = 0; i < InEdges.size(); ++i) {
+ Phi->setLabel(i, InEdges[i]);
+ }
+ }
+ }
+}
+
void Cfg::computeInOutEdges() {
// Compute the out-edges.
for (CfgNode *Node : Nodes)
@@ -402,7 +418,7 @@ void Cfg::reorderNodes() {
// in-edge if the predecessor node was contracted). If this changes in
// the future, rethink the strategy.
assert(Node->getInEdges().size() >= 1);
- assert(Node->getOutEdges().size() == 1);
+ assert(Node->hasSingleOutEdge());
// If it's a (non-critical) edge where the successor has a single
// in-edge, then place it before the successor.
« no previous file with comments | « src/IceCfg.h ('k') | src/IceCfgNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698