Simplify the back-end of InstBuilder.

We don't want to distinguish between single-result and multiple-result
instructions any longer.

- Merge the simple_instruction() and complex_instruction() builder
  methods into a single build() that can handle all cases.
- All format constructors now take a ctrl_type argument. Previously,
  some would take a result_type argument.
- Instruction constructors no longer attempt to compute a single result
  type. Just pass a ctrl_type and let the backend decide.

Fix one format constructor call in legalizer/split.rs which now takes a
ctrl_type instead of a result type.
This commit is contained in:
Jakob Stoklund Olesen
2017-04-12 08:34:59 -07:00
parent 3c99dc0eb4
commit 69180a2f84
4 changed files with 36 additions and 112 deletions

View File

@@ -633,7 +633,12 @@ impl DataFlowGraph {
.expect("Instruction has no results")
}
/// Iterate through all the results of an instruction.
/// Test if `inst` has any result values currently.
pub fn has_results(&self, inst: Inst) -> bool {
!self.results[inst].is_empty()
}
/// Return all the results of an instruction.
pub fn inst_results(&self, inst: Inst) -> &[Value] {
self.results[inst].as_slice(&self.value_lists)
}