Skip to content

[CIR][ABI][AArch64][Lowering] support for passing struct types > 128 bits #1068

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 6, 2024

Conversation

gitoleg
Copy link
Collaborator

@gitoleg gitoleg commented Nov 6, 2024

This PR adds a partial support for so-called indirect function arguments for struct types with size > 128 bits for aarch64.

Couple words about the implementation

The hard part is that it's not one-to-one copy from the original codegen, but the code is inspired by it of course.
In the original codegen there is no much job is done for the indirect arguments inside the loop in the EmitFunctionProlog, and additional alloca is added in the end, in the call for EmitParamDecl function.

In our case, for the indirect argument (which is a pointer) we replace the original alloca with a new one, and store the pointer in there. And replace all the uses of the old alloca with the load from the new one, i.e. in both cases users works with the pointer to a structure.

Also, I added several missed features in the constructAttributeList for indirect arguments, but didn't preserve the original code structure, so let me know if I need to do it.

Copy link

github-actions bot commented Nov 6, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@bcardosolopes
Copy link
Member

bcardosolopes commented Nov 6, 2024

@bzcheeseman: @gitoleg has also been working on aarch64 in case you want to follow / also provide insights.

@bcardosolopes
Copy link
Member

Also, I added several missed features in the constructAttributeList for indirect arguments, but didn't preserve the original code structure, so let me know if I need to do it.

If you can do that it would be great, will make everyone's life easier when trying to reach completeness

@bcardosolopes
Copy link
Member

Actually constructAttributeList is fine as of this PR, you only added missing features. It'd still be nice to follow the skeleton in another PR, but not worth blocking you this time around.

@bcardosolopes bcardosolopes merged commit 681e660 into llvm:main Nov 6, 2024
6 checks passed
bcardosolopes pushed a commit that referenced this pull request Nov 14, 2024
…ts (#1074)

As the title says, this PR adds support for calls with struct types >
128 bits, building upon this
[PR](#1068).

The idea is gotten from the original Codegen, and I have added a couple
of tests.
lanza pushed a commit that referenced this pull request Mar 18, 2025
…bits (#1068)

This PR adds a partial support for so-called indirect function arguments
for struct types with size > 128 bits for aarch64.

#### Couple words about the implementation
The hard part is that it's not one-to-one copy from the original
codegen, but the code is inspired by it of course.
In the original codegen there is no much job is done for the indirect
arguments inside the loop in the `EmitFunctionProlog`, and additional
alloca is added in the end, in the call for `EmitParamDecl` function.

In our case, for the indirect argument (which is a pointer) we replace
the original alloca with a new one, and store the pointer in there. And
replace all the uses of the old alloca with the load from the new one,
i.e. in both cases users works with the pointer to a structure.

Also, I added several missed features in the `constructAttributeList`
for indirect arguments, but didn't preserve the original code structure,
so let me know if I need to do it.
lanza pushed a commit that referenced this pull request Mar 18, 2025
…ts (#1074)

As the title says, this PR adds support for calls with struct types >
128 bits, building upon this
[PR](#1068).

The idea is gotten from the original Codegen, and I have added a couple
of tests.
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.

2 participants