-
Notifications
You must be signed in to change notification settings - Fork 182
[CIR][ABI][AArch64][Lowering] Support structures with padding #1118
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
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
00d5f11
initial commit
bruteforceboy ce67cb9
cleanup
bruteforceboy 0eed6bf
fix review comments
bruteforceboy 835ee1c
merge test properly
bruteforceboy 0da820a
Merge branch 'llvm:main' into aarch64-padding
bruteforceboy 38b716b
use camel case
bruteforceboy 5e21c5b
Merge branch 'aarch64-padding' of https://github.com/bruteforceboy/cl…
bruteforceboy 34b0fdb
more camel case
bruteforceboy 5ba1474
moree camel case
bruteforceboy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -167,4 +167,33 @@ void pass_gt_128(GT_128 s) {} | |
| // LLVM: %[[#V2:]] = alloca [2 x i64], i64 1, align 8 | ||
| // LLVM: store [2 x i64] %[[#ARG]], ptr %[[#V2]], align 8 | ||
| // LLVM: call void @llvm.memcpy.p0.p0.i64(ptr %[[#V1]], ptr %[[#V2]], i64 12, i1 false) | ||
| void passS(S s) {} | ||
| void passS(S s) {} | ||
|
|
||
| typedef struct { | ||
| uint8_t a; | ||
| uint16_t b; | ||
| uint8_t c; | ||
| } S_PAD; | ||
|
|
||
| // CHECK: cir.func {{.*@ret_s_pad}}() -> !u48i | ||
| // CHECK: %[[#V0:]] = cir.alloca !ty_S_PAD, !cir.ptr<!ty_S_PAD>, ["__retval"] {alignment = 2 : i64} | ||
| // CHECK: %[[#V1:]] = cir.load %[[#V0]] : !cir.ptr<!ty_S_PAD>, !ty_S_PAD | ||
| // CHECK: %[[#V2:]] = cir.alloca !u48i, !cir.ptr<!u48i>, [""] {alignment = 2 : i64} | ||
| // CHECK: %[[#V3:]] = cir.cast(bitcast, %[[#V0]] : !cir.ptr<!ty_S_PAD>) | ||
| // CHECK: %[[#V4:]] = cir.cast(bitcast, %[[#V2:]] : !cir.ptr<!u48i>), !cir.ptr<!void> | ||
| // CHECK: %[[#V5:]] = cir.const #cir.int<6> : !u64i | ||
| // CHECK: cir.libc.memcpy %[[#V5]] bytes from %[[#V3]] to %[[#V4]] : !u64i, !cir.ptr<!void> | ||
| // CHECK: %[[#V6:]] = cir.load %[[#V2]] : !cir.ptr<!u48i> | ||
| // CHECK: cir.return %[[#V6]] | ||
|
|
||
| // LLVM: i48 @ret_s_pad() | ||
| // LLVM: %[[#V1:]] = alloca %struct.S_PAD, i64 1, align 2 | ||
| // LLVM: %[[#V2:]] = load %struct.S_PAD, ptr %[[#V1]], align 2 | ||
| // LLVM: %[[#V3:]] = alloca i48, i64 1, align 2 | ||
| // LLVM: call void @llvm.memcpy.p0.p0.i64(ptr %[[#V3]], ptr %[[#V1]], i64 6, i1 false) | ||
| // LLVM: %[[#V4:]] = load i48, ptr %[[#V3]] | ||
| // LLVM: ret i48 %[[#V4]] | ||
| S_PAD ret_s_pad() { | ||
| S_PAD s; | ||
| return s; | ||
| } | ||
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.