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][LowerToLLVM][CXXABI] Lower cir.va.arg #573

Merged
merged 3 commits into from
May 28, 2024
Merged

Conversation

ghehg
Copy link
Contributor

@ghehg ghehg commented Apr 29, 2024

lowering var_arg op for ARM64 architecture. This is CIR lowering.

This PR modified LoweringPrepare CXXABI code to make LoweringPrepareArm64CXXABI class inherit more generic LoweringPrepareItaniumCXXABI, this way lowering var_arg would be only meaningful for arm64 targets and for other arch its no op for now.

The ABI doc and detailed algorithm description can be found in this official doc.

The following pic is a easier-to-understand and close to lowered code explanation

Screenshot 2024-04-29 at 4 02 17 PM

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

Hey, thanks for the PR, this is much needed.

You should also add LLVM checks on the relevant part of the end result, we need to make sure it's correct overall (i.e. if parts are connected right).

@ghehg ghehg force-pushed the main branch 3 times, most recently from 168ca49 to 0a6e761 Compare May 6, 2024 16:31
@bcardosolopes bcardosolopes changed the title [CIR][Lowering][CXXABI]lower var_arg op [CIR][LowerToLLVM][CXXABI] Lower cir.va.arg May 7, 2024
@@ -1,4 +1,5 @@
//====- LoweringPrepareItaniumCXXABI.h - Itanium ABI specific code --------===//
//====- LoweringPrepareItaniumCXXABI.cpp - Itanium ABI specific code
//--------===//
Copy link
Member

Choose a reason for hiding this comment

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

ops, this should fit in 80 instead

Copy link
Member

Choose a reason for hiding this comment

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

Not resolved, please address this.

clang/test/CIR/CodeGen/var-arg-float.c Outdated Show resolved Hide resolved
@ghehg ghehg force-pushed the main branch 2 times, most recently from 3adfff7 to acede3e Compare May 10, 2024 01:29
@ghehg ghehg requested a review from bcardosolopes May 10, 2024 19:11
clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp Outdated Show resolved Hide resolved
@@ -1,4 +1,5 @@
//====- LoweringPrepareItaniumCXXABI.h - Itanium ABI specific code --------===//
//====- LoweringPrepareItaniumCXXABI.cpp - Itanium ABI specific code
//--------===//
Copy link
Member

Choose a reason for hiding this comment

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

Not resolved, please address this.

clang/test/CIR/CodeGen/variadics.c Outdated Show resolved Hide resolved
Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

Thanks for applying the reviews, few more nits!

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

Thanks for your patience, LGTM!

@bcardosolopes bcardosolopes merged commit b5f3862 into llvm:main May 28, 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.

None yet

2 participants