Thread overview
Generating assembly from dmd
Dec 22, 2013
Kelet
Dec 22, 2013
Kelet
Dec 22, 2013
Kelet
Dec 22, 2013
nazriel
December 22, 2013
Hi all,

Can someone walk me through in a friendly way how to check the assembly produced by dmd?  The application in this case is checking some new patches to Phobos. It's something I'm not familiar with doing in general and particularly not with dmd (which doesn't seem to have an assembly-output switch), so I'm hoping someone can advise :-)

Thanks & best wishes,

    -- Joe
December 22, 2013
On Sunday, 22 December 2013 at 14:17:50 UTC, Joseph Rushton
Wakeling wrote:
> Hi all,
>
> Can someone walk me through in a friendly way how to check the assembly produced by dmd?  The application in this case is checking some new patches to Phobos. It's something I'm not familiar with doing in general and particularly not with dmd (which doesn't seem to have an assembly-output switch), so I'm hoping someone can advise :-)
>
> Thanks & best wishes,
>
>     -- Joe

DMD never discretely generates assembly, which is why there is no
switch. There is obj2asm by Walter, but it is part of the paid
Digital Mars package (AFAIK). objconv[1] should work though, and
it is free.

Alternatively, if you don't mind GDC-generated assembly, you can
do it online quite easily[2].

[1]: http://www.agner.org/optimize/
[2]: http://d.godbolt.org/
December 22, 2013
On Sunday, 22 December 2013 at 14:31:44 UTC, Kelet wrote:
> DMD never discretely generates assembly

To clarify, DMD goes straight from its intermediate
representation (IR) of the code to the binary opcodes, which is
part of the reason why it compiles faster relative to GDC or LDC.

Regards,
Kelet
December 22, 2013
On Sunday, 22 December 2013 at 14:31:44 UTC, Kelet wrote:
> There is obj2asm by Walter, but it is part of the paid
> Digital Mars package (AFAIK).

Correction: obj2asm actually seems to come with DMD for Linux and
Mac, but not Windows, where it seemingly needs to be purchased in
the C and C++ Development System or Extended Utility Package[1]

[1]: http://www.digitalmars.com/shop.html

Regards,
Kelet
December 22, 2013
On 22/12/13 15:42, Kelet wrote:
> Correction: obj2asm actually seems to come with DMD for Linux and
> Mac, but not Windows, where it seemingly needs to be purchased in
> the C and C++ Development System or Extended Utility Package[1]

Hmm, is there a separate download?  I'm running latest git-HEAD self-compiled DMD, so I never download any of the packages.

December 22, 2013
On Sunday, 22 December 2013 at 14:17:50 UTC, Joseph Rushton Wakeling wrote:
> Hi all,
>
> Can someone walk me through in a friendly way how to check the assembly produced by dmd?  The application in this case is checking some new patches to Phobos. It's something I'm not familiar with doing in general and particularly not with dmd (which doesn't seem to have an assembly-output switch), so I'm hoping someone can advise :-)
>
> Thanks & best wishes,
>
>     -- Joe

dmd -c ./file.d && objdump ./file.o -D -M intel

or drop -M intel if you prefer at&t