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.