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

Unified Diff: src/IceCfgNode.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/IceCfgNode.h ('k') | src/IceClFlags.def » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceCfgNode.cpp
diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp
index 9c59dac709130553f8ed2a5ee0c33c64bfe26a0e..4b5268a72faaea348d28dd102fb3ee76e6418a66 100644
--- a/src/IceCfgNode.cpp
+++ b/src/IceCfgNode.cpp
@@ -37,10 +37,20 @@ CfgNode::CfgNode(Cfg *Func, SizeT Number) : Func(Func), Number(Number) {
// Adds an instruction to either the Phi list or the regular instruction list.
// Validates that all Phis are added before all regular instructions.
-void CfgNode::appendInst(Inst *Instr) {
+void CfgNode::appendInst(Inst *Instr, bool AllowPhisAnywhere) {
++InstCountEstimate;
+
+ if (BuildDefs::wasm()) {
+ if (llvm::isa<InstSwitch>(Instr) || llvm::isa<InstBr>(Instr)) {
+ for (auto *N : Instr->getTerminatorEdges()) {
+ N->addInEdge(this);
+ addOutEdge(N);
+ }
+ }
+ }
+
if (auto *Phi = llvm::dyn_cast<InstPhi>(Instr)) {
- if (!Insts.empty()) {
+ if (!AllowPhisAnywhere && !Insts.empty()) {
Func->setError("Phi instruction added to the middle of a block");
return;
}
@@ -81,6 +91,8 @@ void CfgNode::computePredecessors() {
}
void CfgNode::computeSuccessors() {
+ OutEdges.clear();
+ InEdges.clear();
OutEdges = Insts.rbegin()->getTerminatorEdges();
}
@@ -889,7 +901,7 @@ void CfgNode::contractIfEmpty() {
// Make sure there is actually a successor to repoint in-edges to.
if (OutEdges.empty())
return;
- assert(OutEdges.size() == 1);
+ assert(hasSingleOutEdge());
// Don't try to delete a self-loop.
if (OutEdges[0] == this)
return;
« no previous file with comments | « src/IceCfgNode.h ('k') | src/IceClFlags.def » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698