Add a verifier
The current implementation only performs a few basic checks.
This commit is contained in:
@@ -55,7 +55,7 @@ impl Layout {
|
||||
/// can only be removed from the layout when it is empty.
|
||||
///
|
||||
/// Since every EBB must end with a terminator instruction which cannot fall through, the layout of
|
||||
/// EBBs does not affect the semantics of the program.
|
||||
/// EBBs do not affect the semantics of the program.
|
||||
///
|
||||
impl Layout {
|
||||
/// Is `ebb` currently part of the layout?
|
||||
@@ -188,6 +188,11 @@ impl Layout {
|
||||
ebb_node.last_inst = inst;
|
||||
}
|
||||
|
||||
/// Fetch an ebb's last instruction.
|
||||
pub fn last_inst(&self, ebb: Ebb) -> Inst {
|
||||
self.ebbs[ebb].last_inst
|
||||
}
|
||||
|
||||
/// Insert `inst` before the instruction `before` in the same EBB.
|
||||
pub fn insert_inst(&mut self, inst: Inst, before: Inst) {
|
||||
assert_eq!(self.inst_ebb(inst), None);
|
||||
|
||||
Reference in New Issue
Block a user