www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - How to output asm list file with dmd?

reply "SteveGuo" <steveguo outlook.com> writes:
I want to make a compare among vc, icc, gcc, dmd, but how can I 
output list file with dmd?
Aug 06 2013
next sibling parent "SteveGuo" <steveguo outlook.com> writes:
Here is a complete dmd switches output, but I can't find a switch 
which can output list file.

DMD64 D Compiler v2.063.2
Copyright (c) 1999-2013 by Digital Mars written by Walter Bright
Documentation: http://dlang.org/
Usage:
   dmd files.d ... { -switch }

   files.d        D source files
    cmdfile       read arguments from cmdfile
   -c             do not link
   -cov           do code coverage analysis
   -cov=nnn       require at least %nnn code coverage
   -D             generate documentation
   -Dddocdir      write documentation file to docdir directory
   -Dffilename    write documentation file to filename
   -d             silently allow deprecated features
   -dw            show use of deprecated features as warnings 
(default)
   -de            show use of deprecated features as errors (halt 
compilation)
   -debug         compile in debug code
   -debug=level   compile in debug code <= level
   -debug=ident   compile in debug code identified by ident
   -debuglib=name    set symbolic debug library to name
   -defaultlib=name  set default library to name
   -deps=filename write module dependencies to filename
   -g             add symbolic debug info
   -gc            add symbolic debug info, pretend to be C
   -gs            always emit stack frame
   -gx            add stack stomp code
   -H             generate 'header' file
   -Hddirectory   write 'header' file to directory
   -Hffilename    write 'header' file to filename
   --help         print help
   -Ipath         where to look for imports
   -ignore        ignore unsupported pragmas
   -inline        do function inlining
   -Jpath         where to look for string imports
   -Llinkerflag   pass linkerflag to link
   -lib           generate library rather than object files
   -m32           generate 32 bit code
   -m64           generate 64 bit code
   -main          add default main() (e.g. for unittesting)
   -man           open web browser on manual page
   -map           generate linker .map file
   -noboundscheck turns off array bounds checking for all functions
   -O             optimize
   -o-            do not write object file
   -odobjdir      write object & library files to directory objdir
   -offilename    name output file to filename
   -op            preserve source path for output files
   -profile       profile runtime performance of generated code
   -property      enforce property syntax
   -quiet         suppress unnecessary messages
   -release       compile release version
   -run srcfile args...   run resulting program, passing args
   -shared        generate shared library (DLL)
   -transition=id show additional info about language change 
identified by 'id'
   -transition=?  list all language changes
   -unittest      compile in unit tests
   -v             verbose
   -version=level compile in version code >= level
   -version=ident compile in version code identified by ident
   -vtls          list all variables going into thread local 
storage
   -w             warnings as errors (compilation will halt)
   -wi            warnings as messages (compilation will continue)
   -X             generate JSON file
   -Xffilename    write JSON file to filename
Aug 06 2013
prev sibling next sibling parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Tuesday, 6 August 2013 at 09:32:39 UTC, SteveGuo wrote:
 I want to make a compare among vc, icc, gcc, dmd, but how can I 
 output list file with dmd?

After compiling it, disassemble the object file with obj2asm (comes with dmd for linux, separate download for dmd on windows... actually part of the $15 extended utility package from digital mars, blargh), or some other disassembler like objdump on linux. dmd itself never generates assembly, it outputs machine code directly so you'll need a separate disassembler of some sort.
Aug 06 2013
next sibling parent Walter Bright <newshound2 digitalmars.com> writes:
On 8/6/2013 9:52 AM, bearophile wrote:
 Is obj2asm for Windows working with 64 bit objects, with SSE3, AVX2
instructions?

It supports all the instructions dmd can generate, including dmd's inline assembler.
Aug 06 2013
prev sibling parent Walter Bright <newshound2 digitalmars.com> writes:
On 8/6/2013 10:23 AM, Adam D. Ruppe wrote:
 On Tuesday, 6 August 2013 at 16:52:35 UTC, bearophile wrote:
 Is obj2asm for Windows working with 64 bit objects, with SSE3, AVX2
instructions?

I don't know, but my guess is probably not, but for 64 bit I'm sure Microsoft or someone makes an object file disassembler that would work.

Obj2asm disassembles 64 bit Windows object files just fine.
Aug 06 2013
prev sibling next sibling parent "SteveGuo" <steveguo outlook.com> writes:
 After compiling it, disassemble the object file with obj2asm 
 (comes with dmd for linux, separate download for dmd on 
 windows... actually part of the $15 extended utility package 
 from digital mars, blargh), or some other disassembler like 
 objdump on linux.

 dmd itself never generates assembly, it outputs machine code 
 directly so you'll need a separate disassembler of some sort.

Thanks, I will have a try:)
Aug 06 2013
prev sibling next sibling parent "bearophile" <bearophileHUGS lycos.com> writes:
Adam D. Ruppe:

 After compiling it, disassemble the object file with obj2asm 
 (comes with dmd for linux, separate download for dmd on 
 windows... actually part of the $15 extended utility package 
 from digital mars, blargh),

Is obj2asm for Windows working with 64 bit objects, with SSE3, AVX2 instructions? Bye, bearophile
Aug 06 2013
prev sibling next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Tuesday, 6 August 2013 at 16:52:35 UTC, bearophile wrote:
 Is obj2asm for Windows working with 64 bit objects, with SSE3, 
 AVX2 instructions?

I don't know, but my guess is probably not, but for 64 bit I'm sure Microsoft or someone makes an object file disassembler that would work.
Aug 06 2013
prev sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Tue, Aug 06, 2013 at 06:52:33PM +0200, bearophile wrote:
 Adam D. Ruppe:
 
After compiling it, disassemble the object file with obj2asm
(comes with dmd for linux, separate download for dmd on windows...
actually part of the $15 extended utility package from digital
mars, blargh),

Is obj2asm for Windows working with 64 bit objects, with SSE3, AVX2 instructions?

On Linux, you can also use objdump -D (which is what I use all the time), which should be present in a typical default desktop installation. Though keep in mind that objdump uses GNU-style instruction operand order (src, result), which is different from MS assembler operand order (result, src). T -- Those who've learned LaTeX swear by it. Those who are learning LaTeX swear at it. -- Pete Bleackley
Aug 06 2013