Skip to content

feat: SysV multi-word args and sret record returns - #104

Merged
rieske merged 1 commit into
masterfrom
feat/sysv-aggregate-abi
Aug 7, 2026
Merged

feat: SysV multi-word args and sret record returns#104
rieske merged 1 commit into
masterfrom
feat/sysv-aggregate-abi

Conversation

@rieske

@rieske rieske commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Multi-word values (valueWords != 1) always travel on the stack; pad on word parity; callee homes advance by word count.
  • Non-variadic records larger than 16 bytes use SysV sret: hidden pointer in rdi, copy to [__sret], rax holds that pointer. Returns of 8/16 bytes use rax[+rdx].
  • Same productEmitsMemoryReturn predicate on caller and callee. Call IR carries memoryReturnDest / Retrieve memoryReturn.
  • Call/return emit lives in StackMachine_Call.cpp. loadWord is the single word-addressing helper (sret excludes the dest pointer).
  • StructsReturnTest covers Point/pair/strbuf-shaped/nested sret, register args after hidden pointer, and large pass+sret (5 6 7).

Test plan

  • Local codegenTest, symbolsTest, typesTest green
  • Local struct-return functional suite intel + att smoke
  • CI build workflow (build + serial tests + coverage / Coveralls)

Coveralls: 92.885% (+0.06%) from 92.829%.

Classify multi-word values as stack-only; emit hidden sret pointer in rdi
for records larger than 16 bytes. Extract call/return into StackMachine_Call.
@mergify

mergify Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@rieske
rieske merged commit 73b3d28 into master Aug 7, 2026
4 checks passed
@rieske
rieske deleted the feat/sysv-aggregate-abi branch August 7, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant