[LLVMdev] opinions on turning on encoding info by default in -S

Chris Lattner clattner at apple.com
Tue Dec 14 21:37:29 PST 2010


On targets that fully support MC for encoding (today that means X86, hopefully ARM will be done soon), llc has a "-show-mc-encoding" option that can be used to dump out the encodings for every instruction.  If you're using clang, this can be accessed with the (intentionally) hidden -mllvm option like so:

$ clang t.c -S -o - -mllvm -show-mc-encoding -mkernel -O3 -fomit-frame-pointer
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_tf_bH
	.align	4, 0x90
_tf_bH:                                 ## @tf_bH
## BB#0:                                ## %entry
                                        ## kill: RSI<def> ESI<kill>
	movq	_last_tf_arg_u at GOTPCREL(%rip), %rax ## encoding: [0x48,0x8b,0x05,A,A,A,A]
                                        ##   fixup A - offset: 3, value: _last_tf_arg_u at GOTPCREL-4, kind: reloc_riprel_4byte_movq_load
	movq	%rsi, (%rax)            ## encoding: [0x48,0x89,0x30]
	imull	$43691, %esi, %eax      ## encoding: [0x69,0xc6,0xab,0xaa,0x00,0x00]
                                        ## imm = 0xAAAB
	shrl	$17, %eax               ## encoding: [0xc1,0xe8,0x11]
	ret                             ## encoding: [0xc3]

	.comm	_last_tf_arg_u,8,3      ## @last_tf_arg_u
                                        ## @last_tf_arg_u

.subsections_via_symbols



Relatively recently, we turned on verbose-asm output by default in clang for -S output on targets that support the integrated assembler (which is almost all of them on x86 now).  Does anyone have a reason to disable the encoding information?  On the one hand it is fairly noisy, on the other hand, it is very useful and is helpful when tuning code for code size.  In any case, this doesn't affect normal compile times that use "-c".

Thoughts?

-Chris



More information about the llvm-dev mailing list