Compute the controlling type variable accurately.

Some polymorphic instructions don't return the controlling type
variable, so it has to be computed from the designated operand instead.

- Add a requires_typevar_operand() method to the operand constraints
  which indicates that.
- Add a ctrl_typevar(dfg) method to InstructionData which computes the
  controlling type variable correctly, and returns VOID for monomorphic
  instructions.
- Use ctrl_typevar(dfg) to drive the level-1 encoding table lookups.
This commit is contained in:
Jakob Stoklund Olesen
2017-02-21 16:18:45 -08:00
parent b6fa40d6a3
commit 608d452f0c
6 changed files with 60 additions and 12 deletions

View File

@@ -53,8 +53,8 @@ impl TargetIsa for Isa {
registers::INFO.clone()
}
fn encode(&self, _: &DataFlowGraph, inst: &InstructionData) -> Result<Encoding, Legalize> {
lookup_enclist(inst.first_type(),
fn encode(&self, dfg: &DataFlowGraph, inst: &InstructionData) -> Result<Encoding, Legalize> {
lookup_enclist(inst.ctrl_typevar(dfg),
inst.opcode(),
self.cpumode,
&enc_tables::LEVEL2[..])