File tree 1 file changed +71
-0
lines changed
src/doc/unstable-book/src/compiler-flags
1 file changed +71
-0
lines changed Original file line number Diff line number Diff line change
1
+ # ` verbose-asm `
2
+
3
+ The tracking issue for this feature is: [ #126802 ] ( https://github.com/rust-lang/rust/issues/126802 ) .
4
+
5
+ ------------------------
6
+
7
+ This feature enables passing ` -Zverbose-asm ` to get contextual comments added
8
+ by LLVM.
9
+
10
+ Sample code:
11
+
12
+ ``` rust
13
+ #[no_mangle]
14
+ pub fn foo (a : i32 , b : i32 ) -> i32 {
15
+ a + b
16
+ }
17
+ ```
18
+
19
+ Default output:
20
+
21
+ ``` asm
22
+ foo:
23
+ push rax
24
+ add edi, esi
25
+ mov dword ptr [rsp + 4], edi
26
+ seto al
27
+ jo .LBB0_2
28
+ mov eax, dword ptr [rsp + 4]
29
+ pop rcx
30
+ ret
31
+ .LBB0_2:
32
+ lea rdi, [rip + .L__unnamed_1]
33
+ mov rax, qword ptr [rip + core::panicking::panic_const::panic_const_add_overflow::h9c85248fe0d735b2@GOTPCREL]
34
+ call rax
35
+
36
+ .L__unnamed_2:
37
+ .ascii "/app/example.rs"
38
+
39
+ .L__unnamed_1:
40
+ .quad .L__unnamed_2
41
+ .asciz "\017\000\000\000\000\000\000\000\004\000\000\000\005\000\000"
42
+ ```
43
+
44
+ With ` -Zverbose-asm ` :
45
+
46
+ ``` asm
47
+ foo: # @foo
48
+ # %bb.0:
49
+ push rax
50
+ add edi, esi
51
+ mov dword ptr [rsp + 4], edi # 4-byte Spill
52
+ seto al
53
+ jo .LBB0_2
54
+ # %bb.1:
55
+ mov eax, dword ptr [rsp + 4] # 4-byte Reload
56
+ pop rcx
57
+ ret
58
+ .LBB0_2:
59
+ lea rdi, [rip + .L__unnamed_1]
60
+ mov rax, qword ptr [rip + core::panicking::panic_const::panic_const_add_overflow::h9c85248fe0d735b2@GOTPCREL]
61
+ call rax
62
+ # -- End function
63
+ .L__unnamed_2:
64
+ .ascii "/app/example.rs"
65
+
66
+ .L__unnamed_1:
67
+ .quad .L__unnamed_2
68
+ .asciz "\017\000\000\000\000\000\000\000\004\000\000\000\005\000\000"
69
+
70
+ # DW_AT_external
71
+ ```
You can’t perform that action at this time.
0 commit comments