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

Function multiple_blocks

cranelift/codegen/src/ir/layout.rs:1097–1123  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1095
1096 #[test]
1097 fn multiple_blocks() {
1098 let mut layout = Layout::new();
1099
1100 let e0 = Block::new(0);
1101 let e1 = Block::new(1);
1102
1103 assert_eq!(layout.entry_block(), None);
1104 layout.append_block(e0);
1105 assert_eq!(layout.entry_block(), Some(e0));
1106 layout.append_block(e1);
1107 assert_eq!(layout.entry_block(), Some(e0));
1108
1109 let i0 = Inst::new(0);
1110 let i1 = Inst::new(1);
1111 let i2 = Inst::new(2);
1112 let i3 = Inst::new(3);
1113
1114 layout.append_inst(i0, e0);
1115 layout.append_inst(i1, e0);
1116 layout.append_inst(i2, e1);
1117 layout.append_inst(i3, e1);
1118
1119 let v0: Vec<Inst> = layout.block_insts(e0).collect();
1120 let v1: Vec<Inst> = layout.block_insts(e1).collect();
1121 assert_eq!(v0, [i0, i1]);
1122 assert_eq!(v1, [i2, i3]);
1123 }
1124
1125 #[test]
1126 fn split_block() {

Callers

nothing calls this directly

Calls 5

append_blockMethod · 0.80
append_instMethod · 0.80
collectMethod · 0.80
block_instsMethod · 0.80
newFunction · 0.50

Tested by

no test coverage detected