Add a verifier

The current implementation only performs a few basic checks.
This commit is contained in:
Morgan Phillips
2016-09-06 14:05:44 -07:00
parent 116b898da3
commit de04d6d083
10 changed files with 287 additions and 3 deletions

View File

@@ -349,6 +349,16 @@ impl InstructionData {
_ => BranchInfo::NotABranch,
}
}
/// Return true if an instruction is terminating, or false otherwise.
pub fn is_terminating<'a>(&'a self) -> bool {
match self {
&InstructionData::Jump { .. } => true,
&InstructionData::Return { .. } => true,
&InstructionData::Nullary { .. } => true,
_ => false,
}
}
}
/// Information about branch and jump instructions.