Thanks for the good work! It would be really nice if in the future we could compare DMD, GDC and LDC (and SDC when it becomes more usable) at asm.dlang.org. (Btw a nice choice of name :) )

I have a couple of questions about the output when looking at a C++[1] program and the same in GDC[2] and DMD[3](I am not very familiar with assembly):


1) Syntax:
AFAIU, (_D)main pushes 3 and 4 to the stack and calls (example.)add. Then (example.)add loads them from the stack in two registers and adds them. IIRC, dmd passes parameters in reverse order (of the normal C way) and that's why pushing and loading 3 and 4 from the stack is in reverse order.

However why does DMD use hex instead of decimal notation?
[I was also a little confused about positive vs negative indexing of bp and the order of src and dst in the arguments to movl, but then I noticed that I am comparing x86 and x86_64, so I managed to answer those questions myself :D ]

2) _Dmain:
I also noticed that the output of gdc-4.4 and gdc-4.6 does not include a label for _Dmain (nor the regular C main). Is this a problem of the disassembly, or just how older version of GDC produced code?


[1]: http://goo.gl/mUQKiX (permalink at http://gcc.godbolt.org/)
[2]: http://goo.gl/CmYbrZ (permalink at http://explore.dgnu.org/)
[3]: http://goo.gl/ZHHVuZ (permalink at http://asm.dlang.org/)

On Monday, 26 January 2015 at 23:46:24 UTC, Iain Buclaw wrote:
Hi,

It is my pleasure to release a new site onto the community. An Interactive DMD compiler.

http://asm.dlang.org/

Inspired by Matt Godbolt's GCC Explorer[1], and my own hosted version that uses GDC[2]. I was asked by Andrei to fork and make a working protoype that uses DMD.

All work is hosted on Github[3], and we are planning on moving it to part of the D-Programming-Language repositories.

Please share, contribute, and destroy!

Regards
Iain.

[1]: http://gcc.godbolt.org/
[2]: http://explore.dgnu.org/
[3]: https://github.com/ibuclaw/gcc-explorer/

Reply via email to