MCPcopy Create free account
hub / github.com/Amanieu/regalloc3 / check_entity

Method check_entity

src/debug_utils/validate_func.rs:119–128  ·  view source on GitHub ↗

Check that an entity refers to a valid object.

(&self, entity: Entity)

Source from the content-addressed store, hash-verified

117impl<F: Function, R: RegInfo> Context<'_, F, R> {
118 /// Check that an entity refers to a valid object.
119 fn check_entity(&self, entity: Entity) -> Result<()> {
120 let (index, len) = match entity {
121 Entity::Block(x) => (x.index(), self.func.num_blocks()),
122 Entity::Value(x) => (x.index(), self.func.num_values()),
123 Entity::ValueGroup(x) => (x.index(), self.func.num_value_groups()),
124 Entity::Inst(x) => (x.index(), self.func.num_insts()),
125 };
126 ensure!(index < len, "{entity}: Invalid entity reference");
127 Ok(())
128 }
129
130 /// Checks a range of instructions.
131 fn check_inst_range(&mut self, range: InstRange) -> Result<()> {

Callers 6

check_inst_rangeMethod · 0.45
check_instMethod · 0.45
check_blockMethod · 0.45
check_ssa_dominanceMethod · 0.45
check_valueMethod · 0.45
check_functionMethod · 0.45

Calls 5

indexMethod · 0.45
num_blocksMethod · 0.45
num_valuesMethod · 0.45
num_value_groupsMethod · 0.45
num_instsMethod · 0.45

Tested by

no test coverage detected