-
Notifications
You must be signed in to change notification settings - Fork 100
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
Conversation
✅ With the latest revision this PR passed the C/C++ code formatter. |
clang/lib/CIR/Dialect/Transforms/TargetLowering/LowerFunction.cpp
Outdated
Show resolved
Hide resolved
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); |
There was a problem hiding this comment.
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
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 thegetBestAllocaInsertPoint
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.