Type checking and Dominator Tree integrity checks in Verifier (#66)
* Verify that a recomputed dominator tree is identical to the existing one.
* The verifier now typechecks instruction results and arguments.
* The verifier now typechecks instruction results and arguments.
* The verifier now typechecks instruction results and arguments.
* Added `inst_{fixed,variable}_args` accessor functions.
* Improved error messages in verifier.
* Type check return statements against the function signature.
This commit is contained in:
committed by
Jakob Stoklund Olesen
parent
1d6049b8f8
commit
b5fda64b49
@@ -344,16 +344,40 @@ impl DataFlowGraph {
|
||||
DisplayInst(self, inst)
|
||||
}
|
||||
|
||||
/// Get the value arguments on `inst` as a slice.
|
||||
/// Get all 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.
|
||||
/// Get all 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)
|
||||
}
|
||||
|
||||
/// Get the fixed value arguments on `inst` as a slice.
|
||||
pub fn inst_fixed_args(&self, inst: Inst) -> &[Value] {
|
||||
let fixed_args = self[inst].opcode().constraints().fixed_value_arguments();
|
||||
&self.inst_args(inst)[..fixed_args]
|
||||
}
|
||||
|
||||
/// Get the fixed value arguments on `inst` as a mutable slice.
|
||||
pub fn inst_fixed_args_mut(&mut self, inst: Inst) -> &mut [Value] {
|
||||
let fixed_args = self[inst].opcode().constraints().fixed_value_arguments();
|
||||
&mut self.inst_args_mut(inst)[..fixed_args]
|
||||
}
|
||||
|
||||
/// Get the variable value arguments on `inst` as a slice.
|
||||
pub fn inst_variable_args(&self, inst: Inst) -> &[Value] {
|
||||
let fixed_args = self[inst].opcode().constraints().fixed_value_arguments();
|
||||
&self.inst_args(inst)[fixed_args..]
|
||||
}
|
||||
|
||||
/// Get the variable value arguments on `inst` as a mutable slice.
|
||||
pub fn inst_variable_args_mut(&mut self, inst: Inst) -> &mut [Value] {
|
||||
let fixed_args = self[inst].opcode().constraints().fixed_value_arguments();
|
||||
&mut self.inst_args_mut(inst)[fixed_args..]
|
||||
}
|
||||
|
||||
/// 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
|
||||
|
||||
@@ -398,7 +398,6 @@ pub struct OpcodeConstraints {
|
||||
/// Offset into `OPERAND_CONSTRAINT` table of the descriptors for this opcode. The first
|
||||
/// `fixed_results()` entries describe the result constraints, then follows constraints for the
|
||||
/// fixed `Value` input operands. (`fixed_value_arguments()` of them).
|
||||
/// format.
|
||||
constraint_offset: u16,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user