LLVMInitializeMyTargetAsmPrinter is not called


I'm trying to implement a LLVM backend but have actually a problem and don't know how to handle. Actually I'm at the very beginning.
I tried to (carefully) copy from existing backends (Sparc and Hexogon), but I messed up with something. My "LLVMInitializeMyTargetAsmPrinter" function is not called. All the other "LLVMInitializeMyTargetSomeThing" functions to register something are called, but not the one to register the AsmPrinter.

The function is in the MyTargetAsmPrinter.cpp in the main directory of my target. It is just plain:

extern "C" void LLVMInitializeMyTargetAsmPrinter() {
  RegisterAsmPrinter<MyTargetAsmPrinter> X(TheMyTargetTarget);

I'm afraid I did a very subtle (or maybe stupid) change after copying, because I can't find it.

Is there a switch in the build system for LLVMInitializeMyTargetAsmPrinter functions?
Anything else in the backend code that triggers the call of these functions (especially LLVMInitializeMyTargetAsmPrinter) ?

Thanks for any help or hint!


Hi Nico, you want LLVM_ASM_PRINTER(MyTarget) to end up in
include/llvm/Config/AsmPrinters.def. This is an auto-generated file, which
seems to get filled based on information in LLVMBuild files, for example take
a look at lib/Target/X86/LLVMBuild.txt and notice "has_asmprinter = 1".

Ciao, Duncan.