Switch to a FuncCursor in the top-level legalizer loop.

Stop passing Cursor references to legalizer functions. Give them the
whole &mut Function instead. Given the whole Function reference, these
functions can create their own cursors.

This lets legalizer actions access other Function data structures like
the global variables.
This commit is contained in:
Jakob Stoklund Olesen
2017-08-17 15:45:21 -07:00
parent 5566c99dba
commit 4b94ea21ed
4 changed files with 43 additions and 54 deletions

View File

@@ -138,9 +138,9 @@ impl settings::Configurable for Builder {
/// legalize it?
///
/// The `Encodings` iterator returns a legalization function to call.
pub type Legalize = fn(&mut ir::DataFlowGraph,
&mut flowgraph::ControlFlowGraph,
&mut ir::Cursor)
pub type Legalize = fn(ir::Inst,
&mut ir::Function,
&mut flowgraph::ControlFlowGraph)
-> bool;
/// Methods that are specialized to a target ISA.