MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / regalloc_nine_variable_args_pass_on_stack

Function regalloc_nine_variable_args_pass_on_stack

tests/integration/regalloc.rs:174–197  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

172 // Live variables, not constants, so the stack-passed slot loads run around
173 // the sp adjustment. They once read stale offsets after sp had moved.
174 let src = r#"
175sum_nine: (a: i64, b: i64, c: i64, d: i64, e: i64, f: i64, g: i64, h: i64, ninth: i64) -> i64 {
176 return a + b + c + d + e + f + g + h + ninth
177}
178
179main: () -> i32 {
180 x: i64 = 10
181 y: i64 = 20
182 z: i64 = 12
183 r: i64 = sum_nine(x, y, z, x, y, z, x, y, z)
184 return (r % 256) as i32
185}
186"#;
187 let (outcome, _, _, _) = run_with_regalloc(src, false);
188 assert!(
189 matches!(outcome, RunOutcome::Halted(126)),
190 "expected Halted(126) = 3*(10+20+12), got {outcome:?}"
191 );
192 assert_equivalent(src);
193}
194
195#[test]
196fn regalloc_pointers_structs_and_arrays() {
197 assert_equivalent(
198 r#"
199external free: (p: i64*) -> void
200

Callers

nothing calls this directly

Calls 2

run_with_regallocFunction · 0.85
assert_equivalentFunction · 0.85

Tested by

no test coverage detected