Skip to content
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

[CIR][ABI][AArch64] Support struct passing with coercion through memory #1111

Merged
merged 5 commits into from
Nov 13, 2024

Conversation

gitoleg
Copy link
Collaborator

@gitoleg gitoleg commented Nov 12, 2024

This PR adds a support for one more case of passing structs by value, with memcpy emitted.

First of all, don't worry - despite the PR seems big, it's basically consist of helpers + refactoring. Also, there is a minor change in the CIRBaseBuilder - I made static the getBestAllocaInsertPoint method in order to call it from lowering - we discussed once - and I here we just need it (or copy-paste the code, which doesn't seem good).

I will add several comments in order to simplify review.

Copy link

github-actions bot commented Nov 12, 2024

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

auto tmp = createTmpAlloca(CGF, Src.getLoc(), SrcTy);
CGF.getRewriter().create<StoreOp>(Src.getLoc(), Src, tmp);
auto len = createUInt64(CGF, Src.getLoc(), DstSize.getFixedValue());
createMemCpy(CGF, tmp, Dst, len);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here are the changes for the title - we emit a temp alloca (basically that's why we need the changes in the CIRBaseBuilder - we don't have any hint here where to insert it. Thus, we insert it as LLVM does - in the function start

@bcardosolopes bcardosolopes merged commit 7787e7c into llvm:main Nov 13, 2024
6 checks passed
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