2

I'm trying to write a custom backend for LLVM. I copied a llvm/lib/Target/AVR folder to llvm/lib/Target/Abc (it's my backend). Then I replaced all AVR with Abc and avr with abc in file names and in file contents. Here is CMakeLists.txt:

set(LLVM_TARGET_DEFINITIONS Abc.td)

tablegen(LLVM AbcGenRegisterInfo.inc -gen-register-info)
tablegen(LLVM AbcGenInstrInfo.inc -gen-instr-info)
tablegen(LLVM AbcGenCallingConv.inc -gen-callingconv)
tablegen(LLVM AbcGenSubtargetInfo.inc -gen-subtarget)
add_public_tablegen_target(AbcCommonTableGen)

add_llvm_target(AbcCodeGen
  AbcInstrInfo.cpp
  AbcRegisterInfo.cpp
  AbcTargetMachine.cpp
  AbcTargetObjectFile.cpp
)

add_dependencies(LLVMAbcCodeGen intrinsincs_gen)

add_subdirectory(MCTargetDesc)
add_subdirectory(TargetInfo)

I tryed to add Abd to LLVM_ALL_TARGETS variable in llvm/CMakeLists.txt, but when I try to run cmake, the following error is displayed:

llvm-build: error: invalid target to enable: 'Abc' not in project

I also tryed to remove Abc from llvm/CMakeLists.txt and run cmake with -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=Abc, but the result is the same.

1 Answer 1

7

The problem was that I didn't add Abc to subdirectories in llvm/lib/Target/LLVMBuild.txt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.