www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Generating assembly from dmd

reply Joseph Rushton Wakeling <joseph.wakeling webdrake.net> writes:
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
Dec 22 2013
next sibling parent reply "Kelet" <kelethunter gmail.com> writes:
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/
Dec 22 2013
next sibling parent "Kelet" <kelethunter gmail.com> writes:
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
Dec 22 2013
prev sibling parent reply "Kelet" <kelethunter gmail.com> writes:
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
Dec 22 2013
parent Joseph Rushton Wakeling <joseph.wakeling webdrake.net> writes:
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.
Dec 22 2013
prev sibling parent "nazriel" <spam dzfl.pl> writes:
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
Dec 22 2013