| 2117 | } |
| 2118 | |
| 2119 | pub fn run(&self, errors: &mut VerifierErrors) -> VerifierStepResult { |
| 2120 | self.verify_global_values(errors)?; |
| 2121 | self.verify_alias_regions(errors)?; |
| 2122 | self.typecheck_entry_block_params(errors)?; |
| 2123 | self.check_entry_not_cold(errors)?; |
| 2124 | self.typecheck_function_signature(errors)?; |
| 2125 | self.verify_signatures(errors)?; |
| 2126 | |
| 2127 | for block in self.func.layout.blocks() { |
| 2128 | if self.func.layout.first_inst(block).is_none() { |
| 2129 | return errors.fatal((block, format!("{block} cannot be empty"))); |
| 2130 | } |
| 2131 | for inst in self.func.layout.block_insts(block) { |
| 2132 | crate::trace!("verifying {inst:?}: {}", self.func.dfg.display_inst(inst)); |
| 2133 | self.block_integrity(block, inst, errors)?; |
| 2134 | self.instruction_integrity(inst, errors)?; |
| 2135 | self.typecheck(inst, errors)?; |
| 2136 | self.immediate_constraints(inst, errors)?; |
| 2137 | self.iconst_bounds(inst, errors)?; |
| 2138 | self.debug_tags(inst, errors)?; |
| 2139 | } |
| 2140 | |
| 2141 | self.encodable_as_bb(block, errors)?; |
| 2142 | } |
| 2143 | |
| 2144 | if !errors.is_empty() { |
| 2145 | log::warn!( |
| 2146 | "Found verifier errors in function:\n{}", |
| 2147 | pretty_verifier_error(self.func, None, errors.clone()) |
| 2148 | ); |
| 2149 | } |
| 2150 | |
| 2151 | Ok(()) |
| 2152 | } |
| 2153 | } |
| 2154 | |
| 2155 | #[cfg(test)] |