-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Description
Bugzilla Link | 17465 |
Version | trunk |
OS | All |
CC | @gnzlbg,@jryans,@nico |
Extended Description
It would be nice to have if clang supported gcc's -masm=dialect switch so I can get readable asm without a special case for clang to use -mllvm --x86-asm-syntax=intel.
But more importantly I'd love to have a way to generate assembler output with properly embedded source code, especially on Linux.
But that would even allow to support the /FAs switch in clang-cl and enable me to seamlessly use my existing VS addin for quick asm inspection with the newly available clang toolkit.
I already tried several different approaches.
- -fverbose-asm is pretty useless.
- Then there's the -Wa trick (http://www.fclose.com/240/generate-a-mixed-source-and-assembly-listing-using-gcc) which only works with gcc.
- objdump works with both:
clang++ -c -g -O3 test.cpp
objdump -dSC -M intel test.o
But neither of these approaches reaches the readability of /FAs (in combination with AsmHighlighter):
?set@Point@@QEAAXNNN@Z PROC ; Point::set, COMDAT
; 47 : void set(const double X, const double Y, const double Z) { _xyz[0] = X; _xyz[1] = Y; _xyz[2] = Z; }
movsdx QWORD PTR [rcx], xmm1
movsdx QWORD PTR [rcx+8], xmm2
movsdx QWORD PTR [rcx+16], xmm3
ret 0
?set@Point@@QEAAXNNN@Z ENDP ; Point::set
In this case source code is properly injected as assembler comments and there are no line numbers or machine code confusing the syntax highlighter.
But the /FA switch also allows you to add these if you need.