Browse Source

Use EBB layout order almost everywhere.

The ebbs_numerically() function was a workaround for the unimplemented EBB layout
order.
pull/3/head
Jakob Stoklund Olesen 8 years ago
parent
commit
8c58fe4631
  1. 6
      src/libcretonne/cfg.rs
  2. 2
      src/libcretonne/write.rs
  3. 2
      src/libreader/parser.rs
  4. 2
      src/tools/print_cfg.rs

6
src/libcretonne/cfg.rs

@ -48,11 +48,11 @@ impl ControlFlowGraph {
// Even ebbs without predecessors should show up in the CFG, albeit
// with no entires.
for ebb in func.ebbs_numerically() {
for ebb in &func.layout {
cfg.init_ebb(ebb);
}
for ebb in func.ebbs_numerically() {
for ebb in &func.layout {
// Flips to true when a terminating instruction is seen. So that if additional
// instructions occur an error may be returned.
for inst in func.layout.ebb_insts(ebb) {
@ -120,7 +120,7 @@ mod tests {
let nodes = cfg.iter().collect::<Vec<_>>();
assert_eq!(nodes.len(), 3);
let mut fun_ebbs = func.ebbs_numerically();
let mut fun_ebbs = func.layout.ebbs();
for (ebb, predecessors) in nodes {
assert_eq!(*ebb, fun_ebbs.next().unwrap());
assert_eq!(predecessors.len(), 0);

2
src/libcretonne/write.rs

@ -16,7 +16,7 @@ pub fn write_function(w: &mut Write, func: &Function) -> Result {
try!(write_spec(w, func));
try!(writeln!(w, " {{"));
let mut any = try!(write_preamble(w, func));
for ebb in func.ebbs_numerically() {
for ebb in &func.layout {
if any {
try!(writeln!(w, ""));
}

2
src/libreader/parser.rs

@ -1116,7 +1116,7 @@ mod tests {
.unwrap();
assert_eq!(func.name, "ebbs");
let mut ebbs = func.ebbs_numerically();
let mut ebbs = func.layout.ebbs();
let ebb0 = ebbs.next().unwrap();
assert_eq!(func.ebb_args(ebb0).next(), None);

2
src/tools/print_cfg.rs

@ -106,7 +106,7 @@ impl<T: Write> CFGPrinter<T> {
}
fn ebb_subgraphs(&mut self, func: &Function) {
for ebb in func.ebbs_numerically() {
for ebb in &func.layout {
let inst_data = func.layout
.ebb_insts(ebb)
.filter(|inst| {

Loading…
Cancel
Save