()
| 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() { |
no test coverage detected