I am learning LLVM backend. I would like to enable IsVerboseAsm
for AsmPrinter
on my new target machine so that I can print comments.
I tried to do this by referring to Target/X86
. Because I noticed that on my target machine, IsVerboseAsm
is always false
, while for X86 it is always true
.
However, I could not find any code to configure IsVerboseAsm
. I traced it with gdb and found that the source of this data came from a macro under include/clang/Driver/Options.inc
generated when LLVM compiled:
CODEGEN_OPTION_WITH_MARSHALLING(prefix_1, &"-fno-verbose-asm"[1], fno_verbose_asm, Flag, f_Group, INVALID, nullptr, CC1Option, 0, nullptr. nullptr, nullptr, "-fno-verbose-asm", true, 0, CodeGenOpts.AsmVerbose, true, false, true, normalizeSimpleNegativeFlag, denormalizeSimpleFlag , mergeForwardValue, extractForwardValue, -1)
Further tracing is unnecessarily complicated for me. On the other hand, I also wonder why it would appear in such a place if this is target-independent code.
So, what keywords should I be looking at so I can know how to enable IsVerboseAsm
for the AsmPrinter
of the target machine I’m adding? I know I can always write some code to directly set the options in TargetOptions
to true
, but I’d like to know how other backends do it.