Eliminate layout::Cursor from cton_frontend.

Replace all uses with a FuncCursor.

Avoid the anti-pattern of passing parts of a function around as
independent references.
This commit is contained in:
Jakob Stoklund Olesen
2017-09-21 12:16:32 -07:00
parent 03dee5e442
commit 1cd91b6f30
4 changed files with 172 additions and 485 deletions

View File

@@ -271,12 +271,7 @@ where
/// created. Forgetting to call this method on every block will cause inconsistences in the
/// produced functions.
pub fn seal_block(&mut self, ebb: Ebb) {
let side_effects = self.builder.ssa.seal_ebb_header_block(
ebb,
&mut self.func.dfg,
&mut self.func.layout,
&mut self.func.jump_tables,
);
let side_effects = self.builder.ssa.seal_ebb_header_block(ebb, self.func);
self.handle_ssa_side_effects(side_effects);
}
@@ -292,9 +287,7 @@ where
"this variable is used but its type has not been declared",
);
let (val, side_effects) = self.builder.ssa.use_var(
&mut self.func.dfg,
&mut self.func.layout,
&mut self.func.jump_tables,
self.func,
var,
ty,
self.position.basic_block,