Replace inst_order with Layout in Function.

The Layout also handles EBB layout, so new append_ebb calls are necessary.

- Rewrite callers to use the public data member 'layout'.
- Implement Debug for Function in terms of the write module to avoid deriving
  it.
This commit is contained in:
Jakob Stoklund Olesen
2016-07-18 18:23:32 -07:00
parent 2f74efd5fc
commit e926674b4e
5 changed files with 58 additions and 105 deletions

View File

@@ -114,7 +114,7 @@ pub fn write_ebb_header(w: &mut Write, func: &Function, ebb: Ebb) -> Result {
pub fn write_ebb(w: &mut Write, func: &Function, ebb: Ebb) -> Result {
try!(write_ebb_header(w, func, ebb));
for inst in func.ebb_insts(ebb) {
for inst in func.layout.ebb_insts(ebb) {
try!(write_instruction(w, func, inst));
}
Ok(())
@@ -251,6 +251,7 @@ mod tests {
"function foo() {\n ss0 = stack_slot 4\n}\n");
let ebb = f.make_ebb();
f.layout.append_ebb(ebb);
assert_eq!(function_to_string(&f),
"function foo() {\n ss0 = stack_slot 4\n\nebb0:\n}\n");