Add a Function::clear() method.

This makes it possible to clear out a Function data structure so it can
be reused for compiling multiple functions.

Also add clear() methods to various sub-structures.
This commit is contained in:
Jakob Stoklund Olesen
2017-09-08 14:53:55 -07:00
parent 439a40e5e4
commit 0c16f13c6b
4 changed files with 41 additions and 0 deletions

View File

@@ -51,6 +51,14 @@ impl Layout {
last_ebb: None,
}
}
/// Clear the layout.
pub fn clear(&mut self) {
self.ebbs.clear();
self.insts.clear();
self.first_ebb = None;
self.last_ebb = None;
}
}
// Sequence numbers.