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

Function replace_block_params

cranelift/codegen/src/ir/dfg.rs:1698–1725  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1696
1697 #[test]
1698 fn replace_block_params() {
1699 let mut dfg = DataFlowGraph::new();
1700
1701 let block = dfg.make_block();
1702 let arg1 = dfg.append_block_param(block, types::F32);
1703
1704 let new1 = dfg.replace_block_param(arg1, types::I64);
1705 assert_eq!(dfg.value_type(arg1), types::F32);
1706 assert_eq!(dfg.value_type(new1), types::I64);
1707 assert_eq!(dfg.block_params(block), &[new1]);
1708
1709 dfg.attach_block_param(block, arg1);
1710 assert_eq!(dfg.block_params(block), &[new1, arg1]);
1711
1712 let new2 = dfg.replace_block_param(arg1, types::I8);
1713 assert_eq!(dfg.value_type(arg1), types::F32);
1714 assert_eq!(dfg.value_type(new2), types::I8);
1715 assert_eq!(dfg.block_params(block), &[new1, new2]);
1716
1717 dfg.attach_block_param(block, arg1);
1718 assert_eq!(dfg.block_params(block), &[new1, new2, arg1]);
1719
1720 let new3 = dfg.replace_block_param(new2, types::I16);
1721 assert_eq!(dfg.value_type(new1), types::I64);
1722 assert_eq!(dfg.value_type(new2), types::I8);
1723 assert_eq!(dfg.value_type(new3), types::I16);
1724 assert_eq!(dfg.block_params(block), &[new1, new3, arg1]);
1725 }
1726
1727 #[test]
1728 fn swap_remove_block_params() {

Callers

nothing calls this directly

Calls 5

make_blockMethod · 0.80
replace_block_paramMethod · 0.80
attach_block_paramMethod · 0.80
newFunction · 0.50
append_block_paramMethod · 0.45

Tested by

no test coverage detected