Compiler Explorer Assembly Output for C, C++ and D (dlang)

Gavin Ray gavinray at site.com
Thu May 27 15:51:03 UTC 2021


On Thursday, 27 May 2021 at 10:48:43 UTC, Basile B. wrote:
> https://forum.dlang.org/post/myrjutqyzpzlyltrdkwc@forum.dlang.org

Thank you for sharing this!

The difference between setting `pragma(LDC_no_moduleinfo);` at 
the top, and `-Os -gline-tables-only` in compiler flags is 
drastic.

- Standard
   - https://d.godbolt.org/z/env355M71
- No module info + flags
   - https://d.godbolt.org/z/4KxxvonY5


You wind up with
```c
int example.square(int):
         mov     eax, edi
         imul    eax, edi
         ret
```

```
define i32 @_D7example6squareFiZi(i32 %num_arg) 
local_unnamed_addr #0 !dbg !5 {
   %1 = mul i32 %num_arg, %num_arg, !dbg !7
   ret i32 %1, !dbg !7
}

attributes #0 = { norecurse nounwind readnone uwtable 
"frame-pointer"="none" "target-cpu"="x86-64" 
"target-features"="+cx16" }
```


More information about the Digitalmars-d-learn mailing list