使用dmd
编译器时,使用-vasm
编译,会显示在编译时
生成的汇编
.它被嘲讽了,因为可用objdump
或S
,但是一旦你试了它
,就会知道为什么它如此方便
,因为它只是发出汇编器
,而不是制作目标文件
期望的一大堆样板
.
如,我正在研究AArch64
代码生成器,即,生成浮点代码
.我有一个函数:
float test(float a, float b) { return a * b; }
编译它:
dmd -c test.c -arm -vasm
得到:
test:0000: A9 BE 7B FD stp x29,x30,[sp,#-32]! // https://www.scs.stanford.edu/~zyedidia/arm64/encodingindex.html#ldstpair_pre0004: 91 00 03 FD mov x29,sp // https://www.scs.stanford.edu/~zyedidia/arm64/encodingindex.html#addsub_imm0008: BD 00 0F A0 str s0,[x29,#12] // https://www.scs.stanford.edu/~zyedidia/arm64/encodingindex.html#ldst_pos000c: B9 40 1B A0 ldr w0,[x29,#0x18] // https://www.scs.stanford.edu/~zyedidia/arm64/encodingindex.html#ldst_pos0010: 1E 21 08 00 fmul s0,s0,s1 // https://www.scs.stanford.edu/~zyedidia/arm64/encodingindex.html#floatdp20014: A8 C2 7B FD ldp x29,x30,[sp],#0x20 // https://www.scs.stanford.edu/~zyedidia/arm64/encodingindex.html#ldstpair_post0018: D6 5F 03 C0 ret // https://www.scs.stanford.edu/~zyedidia/arm64/encodingindex.html#branch_reg
它发出地址
,十六进制指令,指令助记符和指令规范
的网径
.
是,我知道代码
不是很正确
,我说过正在处理
它吗:-)