[LLVMdev] Problem regarding AsmPrinter registration

ankur deshwal a.s.deshwal at gmail.com
Mon Jun 20 01:08:42 PDT 2011


Hi,
I am trying to add a small new backend for LLVM. For assembly
printing, I have derived a class from AsmTarget,

  struct LLVM_LIBRARY_VISIBILITY Asd_ARMAsmPrinter : public AsmPrinter

After creating all the bits and pieces, I was trying to use this to
print the assembly for a sample program. Though I was getting weird
errors. I tried looking for the problem and found that the my target
AsmPrinter is not being registered properly. This conclusion was
derived from following observation.

I have configured LLVM with only two targets- X86 and ASD (my target)
When I checked for targets build/include/llvm/Config/Targets.def, I
see my target details.

  #ifndef LLVM_TARGET
  #  error Please define the macro LLVM_TARGET(TargetName)
  #endif
  LLVM_TARGET(DRE) LLVM_TARGET(X86)
  #undef LLVM_TARGET

But when I check for the ASMPrinter for my target in
build/include/llvm/Config/AsmPrinters.def, I see only X86

  #ifndef LLVM_ASM_PRINTER
  #  error Please define the macro LLVM_ASM_PRINTER(TargetName)
  #endif
  LLVM_ASM_PRINTER(X86)
  #undef LLVM_ASM_PRINTER


Can some point to some text about how these *.def files are created
and what may be the reason for my printer not getting registered. I
was having another problem related to ASM printer which I discussed in
post "Problem regarding llc command line option" which seem to be a
related problem.


Thanks and Regards,
Ankur
Please help




More information about the llvm-dev mailing list