-
-
Notifications
You must be signed in to change notification settings - Fork 283
Emit naked functions as LLVM IR with inline asm instead of module asm #5041
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
kinke
merged 21 commits into
ldc-developers:master
from
CyberShadow:naked-llvm-ir-refactor
Apr 15, 2026
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
9ca884a
Emit naked functions as LLVM IR with inline asm instead of module asm
76f45e7
Fix IRBuilderHelper assertion when DtoDefineNakedFunction called at m…
4b07717
Fix naked_asm_corner_cases.d test to work on macOS
36620f0
Fix naked_asm_output.d test for flexible function ordering
9dc63f8
Fix naked function symbol mangling and linkage for Windows
130ae8c
Fix naked lambda dllexport assertion on Windows
f475f9e
Fix naked_asm_corner_cases.d test for Windows and 32-bit
c7907b7
WIP: Remove DtoDefineNakedFunction()
kinke 7f16e37
WIP: Hack away special cases for *naked* DMD-style inline asm
kinke 3b59004
[restore support for jumping to non-asm labels]
kinke 62c09e4
[little cleanup]
kinke 420cc00
Merge remote-tracking branch 'origin/master' into naked-llvm-ir-refactor
kinke 006e01b
Naked DMD-style inline asm: Disallow branches to non-asm labels
kinke 19a56a5
Alternative approach: Allow jumping to D labels in naked DMD-style in…
kinke 7c97088
Remove 2 new naked DMD-style inline-asm tests again
kinke aec8193
[revise new tests/codegen/naked_asm_output.d]
kinke 325cad1
[revise new tests/codegen/naked_asm_corner_cases.d]
kinke 3a12831
[revise new tests/linking/asm_labels_lto.d]
kinke 4d91a03
Merge remote-tracking branch 'origin/master' into naked-llvm-ir-refactor
kinke c98dc83
[add changelog entry]
kinke 3206d53
[tiny nits after last review pass]
kinke 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
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
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 |
|---|---|---|
|
|
@@ -94,9 +94,6 @@ struct IRAsmBlock { | |
| std::set<std::string> clobs; | ||
| size_t outputcount; | ||
|
|
||
| // stores the labels within the asm block | ||
| std::vector<Identifier *> internalLabels; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Collecting them now in |
||
|
|
||
| CompoundAsmStatement *asmBlock; | ||
| LLType *retty; | ||
| unsigned retn; | ||
|
|
@@ -220,7 +217,6 @@ struct IRState { | |
|
|
||
| // for inline asm | ||
| IRAsmBlock *asmBlock = nullptr; | ||
| std::ostringstream nakedAsm; | ||
|
|
||
| // Globals to pin in the llvm.used array to make sure they are not | ||
| // eliminated. | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Doing this now for non-naked asm too, to avoid an integer input for the asm expression - simply use the literal in the template string directly, for readability and simplicity.