I’m developing a custom backend and I got to some error while including files generated by tablegen, for example:
- TargetGenRegisterInfo.inc, included in TargetRegisterInfo.cpp/h
- TargetGenDAGISel.inc, included in TargetDAGToDAGISel.cpp/h
I checked all the possible macros before the include, but seems fine (I made a comparison with other backend like RISCV).
This is the type of error I got including TargetGenRegisterInfo.inc:
/Users/lorenzostigliano/Desktop/LLVM_13_MBLAZE/llvm/build/lib/Target/MBLAZE/MBLAZEGenRegisterInfo.inc:1026:10: error: static_cast from 'const llvm::TargetFrameLowering *' to 'const llvm::MBLAZEFrameLowering *', which are not related by inheritance, is not allowed
return static_cast<const MBLAZEFrameLowering *>(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/lorenzostigliano/Desktop/LLVM_13_MBLAZE/llvm/build/lib/Target/MBLAZE/MBLAZEGenRegisterInfo.inc:729:7: note: 'MBLAZEFrameLowering' is incomplete
class MBLAZEFrameLowering;
^
1 error generated.
make[2]: *** [lib/Target/MBLAZE/CMakeFiles/LLVMMBLAZECodeGen.dir/MBLAZERegisterInfo.cpp.o] Error 1
make[1]: *** [lib/Target/MBLAZE/CMakeFiles/LLVMMBLAZECodeGen.dir/all] Error 2
make: *** [all] Error 2
and this is the one that I got including TargetGenDAGISel.inc:
[ 79%] Building CXX object lib/Target/MBLAZE/CMakeFiles/LLVMMBLAZECodeGen.dir/MBLAZEInstrInfo.cpp.o
cd /Users/lorenzostigliano/Desktop/LLVM_13_MBLAZE/llvm/build/lib/Target/MBLAZE && /Library/Developer/CommandLineTools/usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/Users/lorenzostigliano/Desktop/LLVM_13_MBLAZE/llvm/build/lib/Target/MBLAZE -I/Users/lorenzostigliano/Desktop/LLVM_13_MBLAZE/llvm/lib/Target/MBLAZE -I/Users/lorenzostigliano/Desktop/LLVM_13_MBLAZE/llvm/build/include -I/Users/lorenzostigliano/Desktop/LLVM_13_MBLAZE/llvm/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -g -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk -fno-exceptions -fno-rtti -std=c++14 -MD -MT lib/Target/MBLAZE/CMakeFiles/LLVMMBLAZECodeGen.dir/MBLAZEInstrInfo.cpp.o -MF CMakeFiles/LLVMMBLAZECodeGen.dir/MBLAZEInstrInfo.cpp.o.d -o CMakeFiles/LLVMMBLAZECodeGen.dir/MBLAZEInstrInfo.cpp.o -c /Users/lorenzostigliano/Desktop/LLVM_13_MBLAZE/llvm/lib/Target/MBLAZE/MBLAZEInstrInfo.cpp
/Users/lorenzostigliano/Desktop/LLVM_13_MBLAZE/llvm/lib/Target/MBLAZE/MBLAZEInstrInfo.cpp:29:15: error: no member named 'GPRRegClass' in namespace 'llvm::MBLAZE'
if (MBLAZE::GPRRegClass.contains(DstReg, SrcReg)) {
~~~~~~~~^
1 error generated.
make[2]: *** [lib/Target/MBLAZE/CMakeFiles/LLVMMBLAZECodeGen.dir/MBLAZEInstrInfo.cpp.o] Error 1
make[1]: *** [lib/Target/MBLAZE/CMakeFiles/LLVMMBLAZECodeGen.dir/all] Error 2
make: *** [all] Error 2
Anyone have some suggestion on how to handle the implementation of files made by tablegen?
If someone want to take a closer look at my project here it is: LLVM_13_MBLAZE/llvm/lib/Target/MBLAZE at main · MaxBubblegum47/LLVM_13_MBLAZE · GitHub