DMD now incorporates a disassembler

max haughton maxhaton at gmail.com
Sun Jan 9 19:33:47 UTC 2022


On Friday, 7 January 2022 at 23:14:54 UTC, Dukc wrote:
> On Friday, 7 January 2022 at 21:41:55 UTC, Walter Bright wrote:
>> Compile with -vasm to see it! Enjoy!
>>
>> For the file test.d:
>>
>>   int demo(int x)
>>   {
>>     return x * x;
>>   }
>>
>> Compiling with:
>>
>>   dmd test.d -c -vasm
>>
>> prints:
>>
>>   _D4test4demoFiZi:
>>   0000:   89 F8                   mov     EAX,EDI
>>   0002:   0F AF C0                imul    EAX,EAX
>>   0005:   C3                      ret
>>
>>
>> https://github.com/dlang/dmd/pull/13447
>
> Wow, very useful! This feature surely lowers the bar to check 
> the disassembly when optimising. Thanks!
>
> I'm slightly disappointed it does not output the asm inlined to 
> D code but that's just my daydreaming with no practical reasons 
> to back it up.

https://stackoverflow.com/questions/2511018/how-does-objdump-manage-to-display-source-code-with-the-s-option

Enjoy


More information about the Digitalmars-d-announce mailing list