-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Make LLVM emit assembly comments with -Z asm-comments #53290
Conversation
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
@bors r+ Thanks! |
📌 Commit 66fd1eb has been approved by |
🌲 The tree is currently closed for pull requests below priority 10, this pull request will be tested once the tree is reopened |
Make LLVM emit assembly comments with -Z asm-comments Fixes rust-lang#35741, and makes `-Z asm-comments` actually do something useful. Before: ``` .section .text.main,"ax",@progbits .globl main .p2align 4, 0x90 .type main,@function main: .cfi_startproc pushq %rax .cfi_def_cfa_offset 16 movslq %edi, %rax leaq _ZN1t4main17he95a7d4f1843730eE(%rip), %rdi movq %rsi, (%rsp) movq %rax, %rsi movq (%rsp), %rdx callq _ZN3std2rt10lang_start17h3121da83b2bc3697E movl %eax, %ecx movl %ecx, %eax popq %rcx .cfi_def_cfa_offset 8 retq .Lfunc_end8: .size main, .Lfunc_end8-main .cfi_endproc ``` After: ``` .section .text.main,"ax",@progbits .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc pushq %rax .cfi_def_cfa_offset 16 movslq %edi, %rax leaq _ZN1t4main17he95a7d4f1843730eE(%rip), %rdi movq %rsi, (%rsp) # 8-byte Spill movq %rax, %rsi movq (%rsp), %rdx # 8-byte Reload callq _ZN3std2rt10lang_start17h3121da83b2bc3697E movl %eax, %ecx movl %ecx, %eax popq %rcx .cfi_def_cfa_offset 8 retq .Lfunc_end8: .size main, .Lfunc_end8-main .cfi_endproc # -- End function ```
@bors rollup |
Make LLVM emit assembly comments with -Z asm-comments Fixes rust-lang#35741, and makes `-Z asm-comments` actually do something useful. Before: ``` .section .text.main,"ax",@progbits .globl main .p2align 4, 0x90 .type main,@function main: .cfi_startproc pushq %rax .cfi_def_cfa_offset 16 movslq %edi, %rax leaq _ZN1t4main17he95a7d4f1843730eE(%rip), %rdi movq %rsi, (%rsp) movq %rax, %rsi movq (%rsp), %rdx callq _ZN3std2rt10lang_start17h3121da83b2bc3697E movl %eax, %ecx movl %ecx, %eax popq %rcx .cfi_def_cfa_offset 8 retq .Lfunc_end8: .size main, .Lfunc_end8-main .cfi_endproc ``` After: ``` .section .text.main,"ax",@progbits .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: pushq %rax .cfi_def_cfa_offset 16 movslq %edi, %rax leaq _ZN1t4main17he95a7d4f1843730eE(%rip), %rdi movq %rsi, (%rsp) # 8-byte Spill movq %rax, %rsi movq (%rsp), %rdx # 8-byte Reload callq _ZN3std2rt10lang_start17h3121da83b2bc3697E movl %eax, %ecx movl %ecx, %eax popq %rcx .cfi_def_cfa_offset 8 retq .Lfunc_end8: .size main, .Lfunc_end8-main .cfi_endproc # -- End function ```
Make LLVM emit assembly comments with -Z asm-comments Fixes rust-lang#35741, and makes `-Z asm-comments` actually do something useful. Before: ``` .section .text.main,"ax",@progbits .globl main .p2align 4, 0x90 .type main,@function main: .cfi_startproc pushq %rax .cfi_def_cfa_offset 16 movslq %edi, %rax leaq _ZN1t4main17he95a7d4f1843730eE(%rip), %rdi movq %rsi, (%rsp) movq %rax, %rsi movq (%rsp), %rdx callq _ZN3std2rt10lang_start17h3121da83b2bc3697E movl %eax, %ecx movl %ecx, %eax popq %rcx .cfi_def_cfa_offset 8 retq .Lfunc_end8: .size main, .Lfunc_end8-main .cfi_endproc ``` After: ``` .section .text.main,"ax",@progbits .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: pushq %rax .cfi_def_cfa_offset 16 movslq %edi, %rax leaq _ZN1t4main17he95a7d4f1843730eE(%rip), %rdi movq %rsi, (%rsp) # 8-byte Spill movq %rax, %rsi movq (%rsp), %rdx # 8-byte Reload callq _ZN3std2rt10lang_start17h3121da83b2bc3697E movl %eax, %ecx movl %ecx, %eax popq %rcx .cfi_def_cfa_offset 8 retq .Lfunc_end8: .size main, .Lfunc_end8-main .cfi_endproc # -- End function ```
Rollup of 11 pull requests Successful merges: - #53112 (pretty print BTreeSet) - #53208 (Don't panic on std::env::vars() when env is null.) - #53226 (driver: set the syntax edition in phase 1) - #53229 (Make sure rlimit is only ever increased) - #53233 (targets: aarch64: Add bare-metal aarch64 target) - #53239 (rustc_codegen_llvm: Restore the closure env alloca hack for LLVM 5.) - #53246 (A few cleanups) - #53257 (Idiomatic improvements to IP method) - #53274 (Remove statics field from CodegenCx) - #53290 (Make LLVM emit assembly comments with -Z asm-comments) - #53317 (Mark prior failure to avoid ICE)
Is it possible to use this in stable rust? |
No, since it's a |
Is there an issue tracking the stabilization of this flag ? |
Nope, I just added the flag. |
This looks really useful. Any idea on when it will get into stable rust? |
Fixes #35741, and makes
-Z asm-comments
actually do something useful.Before:
After: