()
| 284 | #[test] |
| 285 | fn regalloc_heap_alloc_and_uart_output() { |
| 286 | // malloc results cross a call boundary into allocated registers; printing |
| 287 | // exercises stdlib calls with allocated arguments. |
| 288 | assert_equivalent( |
| 289 | r#" |
| 290 | console := import("console") |
| 291 | external free: (p: i64*) -> void |
| 292 | |
| 293 | main: () -> i32 { |
| 294 | p: i64* = new(i64, 8) |
| 295 | i: i64 = 0 |
| 296 | while i < 8 { |
| 297 | p[i] = i * i |
| 298 | i = i + 1 |
| 299 | } |
| 300 | total: i64 = 0 |
| 301 | i = 0 |
| 302 | while i < 8 { |
| 303 | total = total + p[i] |
| 304 | i = i + 1 |
| 305 | } |
| 306 | console.putchar(65 + (total % 26) as i32) |
| 307 | console.putchar(10) |
| 308 | free(p) |
| 309 | return (total % 256) as i32 |
| 310 | } |
| 311 | "#, |
| 312 | ); |
| 313 | } |
| 314 | |
| 315 | #[test] |
| 316 | fn regalloc_composes_with_peephole_and_ir_opt() { |
| 317 | // All three optimization flags together must still be behavior-preserving. |
nothing calls this directly
no test coverage detected