opinions on turning on encoding info by default in -S

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@GOTPCREL(%rip), %rax ## encoding: [0x48,0x8b,0x05,A,A,A,A]
                                        ## fixup A - offset: 3, value: _last_tf_arg_u@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

It's too noisy for my taste, and the situations where that info would be helpful to me are pretty rare.
I'd rather have it disabled by default.

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@GOTPCREL(%rip), %rax ## encoding: [0x48,0x8b,0x05,A,A,A,A]
                                       ## fixup A - offset: 3, value: _last_tf_arg_u@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".

This cries out for different levels of verbosity. How about printing the encoding information for -verbose-asm=2 (or higher)?

Evan

On Thursday, 16 December 2010,

This cries out for different levels of verbosity. How about printing the encoding information for -verbose-asm=2 (or higher)?

I concur, the current verbose level is enough for all my needs, now.
If/when I start fiddling with MC, I might find that useful, but a
special flag would do just fine.

Cheers,
Renato

Ok

-Chris