From 02c1bb8f2c44a39997b426ef5dda67bd2e497658 Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Mon, 1 Aug 2016 15:03:56 -0700 Subject: [PATCH] Print CFG edges from func.layout instead of cfg.predecessors_iter. EBBs not in the layout should never be printed as part of the CFG. --- src/tools/print_cfg.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tools/print_cfg.rs b/src/tools/print_cfg.rs index 9a08c0287e..dd1aa3de18 100644 --- a/src/tools/print_cfg.rs +++ b/src/tools/print_cfg.rs @@ -41,8 +41,8 @@ impl CFGPrinter { self.header(func); self.push_indent(); self.ebb_subgraphs(func); - let cfg = ControlFlowGraph::new(&func); - self.cfg_connections(&cfg); + let cfg = ControlFlowGraph::new(func); + self.cfg_connections(func, &cfg); self.pop_indent(); self.footer(); self.write() @@ -145,9 +145,9 @@ impl CFGPrinter { } } - fn cfg_connections(&mut self, cfg: &ControlFlowGraph) { - for (ref ebb, ref predecessors) in cfg.predecessors_iter() { - for &(parent, inst) in *predecessors { + fn cfg_connections(&mut self, func: &Function, cfg: &ControlFlowGraph) { + for ebb in &func.layout { + for &(parent, inst) in cfg.get_predecessors(ebb) { self.append(&format!("{}:{} -> {}", parent, inst, ebb)); self.newline(); }