Add dfg.inst_args(_mut) methods.

A shortcut for calling arguments() directly that goes with the existing
inst_results() method.
This commit is contained in:
Jakob Stoklund Olesen
2017-03-23 12:39:05 -07:00
parent c5c9f211df
commit f710f13949
7 changed files with 19 additions and 10 deletions

View File

@@ -344,6 +344,16 @@ impl DataFlowGraph {
DisplayInst(self, inst)
}
/// Get the value arguments on `inst` as a slice.
pub fn inst_args(&self, inst: Inst) -> &[Value] {
self.insts[inst].arguments(&self.value_lists)
}
/// Get the value arguments on `inst` as a mutable slice.
pub fn inst_args_mut(&mut self, inst: Inst) -> &mut [Value] {
self.insts[inst].arguments_mut(&mut self.value_lists)
}
/// Create result values for an instruction that produces multiple results.
///
/// Instructions that produce 0 or 1 result values only need to be created with `make_inst`. If