Bug 7867 – -S compiler switch to output asm

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-04-08T17:41:29Z
Last change time
2023-08-13T21:15:07Z
Assigned to
No Owner
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2012-04-08T17:41:29Z
Looking at the asm produced by a system language is often useful, to know if a function was inlined, to see if the compiler has done certain expected optimizations, to verify certain compiler bugs, to compare the quality of a D compiler to a C or C++ compiler on similar code, to learn to write assembly, and so on. There are some ways to read the asm produced by the D compiler (like using obj2asm) but I suggest to add to DMD a compiler switch similar to "-S" of GCC to output the asm from the compiler itself. There was a request for it in D.learn too: http://forum.dlang.org/thread/[email protected]
Comment #1 by yebblies — 2012-10-28T09:29:10Z
Unlike gcc, the dmd backend generates machine code directly instead of generating assembly. You would need to pass the code through a disassembler in order to display the assembly. This is never going to happen, especially given how easy it is to just use objconv/objdump.
Comment #2 by bugzilla — 2023-08-13T21:15:07Z
We did eventually add that, it's the -vasm switch.