Skip to content

Commit

Permalink
wasm support part 1: nesting loop and if-else control flow structures (
Browse files Browse the repository at this point in the history
…#54)

* display dominate info in control flow graph doc

* fix loop entries may not in content when handling irreduceable cfg

* A buggy implementation of branch nesting

* fold if else

* fix rust toolchain version
  • Loading branch information
longfangsong authored Jul 12, 2023
1 parent 3c57a92 commit f069b0e
Show file tree
Hide file tree
Showing 13 changed files with 1,060 additions and 15 deletions.
2 changes: 1 addition & 1 deletion crates/control-flow-graph-wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl DominatorRelation {
self.dominates_calculate(it, visited);
}
}
pub fn dorminates(&self, node: u32) -> Vec<u32> {
pub fn dominates(&self, node: u32) -> Vec<u32> {
let mut visited = Vec::new();
self.dominates_calculate(node, &mut visited);
visited
Expand Down
12 changes: 6 additions & 6 deletions doc/content/tools/graph_editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ function onNodeMouseEnter(node, event) {
let hoveringNodeId = parseInt(hoveringNode.getAttribute("id").slice("node-".length));
let dorminatorInfo = model.dominator_relation();
if (dorminatorInfo) {
let dorminates = dorminatorInfo.dorminates(hoveringNodeId);
let dominates = dorminatorInfo.dominates(hoveringNodeId);
let dominance_frontiers = dorminatorInfo.dominance_frontiers(model, hoveringNodeId);
for (let dorminate of dorminates) {
for (let dorminate of dominates) {
let idText = `node-${dorminate}`;
let node = document.getElementById(idText);
node.childNodes[0].setAttribute("stroke", "none");
Expand All @@ -180,9 +180,9 @@ function onNodeMouseEnter(node, event) {
let hoveringNodeId = parseInt(hoveringNode.getAttribute("id").slice("node-".length));
let dorminatorInfo = model.dominator_relation();
if (dorminatorInfo) {
let dorminates = dorminatorInfo.dorminates(hoveringNodeId);
let dominates = dorminatorInfo.dominates(hoveringNodeId);
let dominance_frontiers = dorminatorInfo.dominance_frontiers(model, hoveringNodeId);
for (let dorminate of dorminates) {
for (let dorminate of dominates) {
let idText = `node-${dorminate}`;
let node = document.getElementById(idText);
node.childNodes[0].setAttribute("stroke", "#00FF33");
Expand All @@ -199,9 +199,9 @@ function onNodeMouseLeave(node, event) {
let hoveringNodeId = parseInt(hoveringNode.getAttribute("id").slice("node-".length));
let dorminatorInfo = model.dominator_relation();
if (dorminatorInfo) {
let dorminates = dorminatorInfo.dorminates(hoveringNodeId);
let dominates = dorminatorInfo.dominates(hoveringNodeId);
let dominance_frontiers = dorminatorInfo.dominance_frontiers(model, hoveringNodeId);
for (let dorminate of dorminates) {
for (let dorminate of dominates) {
let idText = `node-${dorminate}`;
let node = document.getElementById(idText);
node.childNodes[0].setAttribute("stroke", "none");
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "nightly"
channel = "nightly-2023-06-15"
2 changes: 2 additions & 0 deletions src/backend/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/// RISC-V backend.
pub mod riscv;

pub mod wasm;
Loading

0 comments on commit f069b0e

Please sign in to comment.