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

Function types

cranelift/codegen/src/ir/builder.rs:318–336  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

316
317 #[test]
318 fn types() {
319 let mut func = Function::new();
320 let block0 = func.dfg.make_block();
321 let arg0 = func.dfg.append_block_param(block0, I32);
322 let mut pos = FuncCursor::new(&mut func);
323 pos.insert_block(block0);
324
325 // Explicit types.
326 let v0 = pos.ins().iconst(I32, 3);
327 assert_eq!(pos.func.dfg.value_type(v0), I32);
328
329 // Inferred from inputs.
330 let v1 = pos.ins().iadd(arg0, v0);
331 assert_eq!(pos.func.dfg.value_type(v1), I32);
332
333 // Formula.
334 let cmp = pos.ins().icmp(IntCC::Equal, arg0, v0);
335 assert_eq!(pos.func.dfg.value_type(cmp), I8);
336 }
337
338 #[test]
339 fn reuse_results() {

Callers 2

wrapMethod · 0.85
func_wrapMethod · 0.85

Calls 5

make_blockMethod · 0.80
newFunction · 0.50
append_block_paramMethod · 0.45
insert_blockMethod · 0.45
insMethod · 0.45

Tested by

no test coverage detected