Add a ControlFlowGraph argument to legalize_function.

Legalizing some instructions may require modifications to the control
flow graph, and some operations need to use the CFG analysis.

The CFG reference is threaded through all the legalization functions to
reach the generated expansion functions as well as the legalizer::split
module where it will be used first.
This commit is contained in:
Jakob Stoklund Olesen
2017-03-21 15:48:08 -07:00
parent a9056f699e
commit ca6e402b90
7 changed files with 52 additions and 28 deletions

View File

@@ -64,17 +64,26 @@
//! It is possible to have circular dependencies of EBB arguments that are never used by any real
//! instructions. These loops will remain in the program.
use flowgraph::ControlFlowGraph;
use ir::{DataFlowGraph, Cursor, Value, Opcode, ValueDef, InstructionData, InstBuilder};
/// Split `value` into two values using the `isplit` semantics. Do this by reusing existing values
/// if possible.
pub fn isplit(dfg: &mut DataFlowGraph, pos: &mut Cursor, value: Value) -> (Value, Value) {
pub fn isplit(dfg: &mut DataFlowGraph,
_cfg: &ControlFlowGraph,
pos: &mut Cursor,
value: Value)
-> (Value, Value) {
split_value(dfg, pos, value, Opcode::Iconcat)
}
/// Split `value` into halves using the `vsplit` semantics. Do this by reusing existing values if
/// possible.
pub fn vsplit(dfg: &mut DataFlowGraph, pos: &mut Cursor, value: Value) -> (Value, Value) {
pub fn vsplit(dfg: &mut DataFlowGraph,
_cfg: &ControlFlowGraph,
pos: &mut Cursor,
value: Value)
-> (Value, Value) {
split_value(dfg, pos, value, Opcode::Vconcat)
}