MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / remove_block_param

Method remove_block_param

cranelift/codegen/src/ir/dfg.rs:1308–1338  ·  view source on GitHub ↗

Removes `val` from `block`'s parameters by a standard linear time list removal which preserves ordering. Also updates the values' data.

(&mut self, val: Value)

Source from the content-addressed store, hash-verified

1306 /// Removes `val` from `block`'s parameters by a standard linear time list removal which
1307 /// preserves ordering. Also updates the values' data.
1308 pub fn remove_block_param(&mut self, val: Value) {
1309 let (block, num) =
1310 if let ValueData::Param { num, block, .. } = ValueData::from(self.values[val]) {
1311 (block, num)
1312 } else {
1313 panic!("{val} must be a block parameter");
1314 };
1315 self.blocks[block]
1316 .params
1317 .remove(num as usize, &mut self.value_lists);
1318 for index in num..(self.num_block_params(block) as u16) {
1319 let packed = &mut self.values[self.blocks[block]
1320 .params
1321 .get(index as usize, &self.value_lists)
1322 .unwrap()];
1323 let mut data = ValueData::from(*packed);
1324 match &mut data {
1325 ValueData::Param { num, .. } => {
1326 *num -= 1;
1327 *packed = data.into();
1328 }
1329 _ => panic!(
1330 "{} must be a block parameter",
1331 self.blocks[block]
1332 .params
1333 .get(index as usize, &self.value_lists)
1334 .unwrap()
1335 ),
1336 }
1337 }
1338 }
1339
1340 /// Append an existing value to `block`'s parameters.
1341 ///

Callers 3

mutateMethod · 0.80
do_remove_constant_phisFunction · 0.80

Calls 5

fromFunction · 0.85
num_block_paramsMethod · 0.80
removeMethod · 0.45
unwrapMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected