Add a trapif instruction.

This is a conditional trap controlled by integer CPU flags.
Compare to brif.
This commit is contained in:
Jakob Stoklund Olesen
2018-02-08 14:39:06 -08:00
parent 3eeef1c752
commit 11c721934c
8 changed files with 49 additions and 0 deletions

View File

@@ -264,6 +264,12 @@ pub enum InstructionData {
arg: Value,
code: ir::TrapCode,
},
IntCondTrap {
opcode: Opcode,
cond: IntCC,
arg: Value,
code: ir::TrapCode,
},
}
/// A variable list of `Value` operands used for function call arguments and passing arguments to

View File

@@ -365,6 +365,7 @@ impl<'a> Verifier<'a> {
CopySpecial { .. } |
Trap { .. } |
CondTrap { .. } |
IntCondTrap { .. } |
NullAry { .. } => {}
}

View File

@@ -428,6 +428,7 @@ pub fn write_operands(
}
Trap { code, .. } => write!(w, " {}", code),
CondTrap { arg, code, .. } => write!(w, " {}, {}", arg, code),
IntCondTrap { cond, arg, code, .. } => write!(w, " {} {}, {}", cond, arg, code),
}
}