Move the ctrl_typevar function into dfg.
Soon, InstructionData won't have sufficient information to compute this. Give TargetIsa::encode() an explicit ctrl_typevar argument. This function does not require the instruction to be inserted in the DFG tables.
This commit is contained in:
@@ -14,7 +14,6 @@ use ir::{Value, Type, Ebb, JumpTable, SigRef, FuncRef, StackSlot, MemFlags};
|
||||
use ir::immediates::{Imm64, Uimm8, Ieee32, Ieee64, Offset32, Uoffset32};
|
||||
use ir::condcodes::*;
|
||||
use ir::types;
|
||||
use ir::DataFlowGraph;
|
||||
|
||||
use entity_list;
|
||||
use ref_slice::{ref_slice, ref_slice_mut};
|
||||
@@ -397,27 +396,6 @@ impl InstructionData {
|
||||
_ => CallInfo::NotACall,
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the controlling type variable, or `VOID` if this instruction isn't polymorphic.
|
||||
///
|
||||
/// In most cases, the controlling type variable is the same as the first result type, but some
|
||||
/// opcodes require us to read the type of the designated type variable operand from `dfg`.
|
||||
pub fn ctrl_typevar(&self, dfg: &DataFlowGraph) -> Type {
|
||||
let constraints = self.opcode().constraints();
|
||||
|
||||
if !constraints.is_polymorphic() {
|
||||
types::VOID
|
||||
} else if constraints.requires_typevar_operand() {
|
||||
// Not all instruction formats have a designated operand, but in that case
|
||||
// `requires_typevar_operand()` should never be true.
|
||||
dfg.value_type(self.typevar_operand(&dfg.value_lists)
|
||||
.expect("Instruction format doesn't have a designated operand, bad opcode."))
|
||||
} else {
|
||||
// For locality of reference, we prefer to get the controlling type variable from
|
||||
// `idata` itself, when possible.
|
||||
self.first_type()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Information about branch and jump instructions.
|
||||
|
||||
Reference in New Issue
Block a user