I am trying to compile the llvm/lib/Target/RISCV/RISCVInstrInfo.td file using llvm-tblgen to view the generated records. I run the following command:
llvm-tblgen -I /media/user/Volume/llvm-project/llvm/include/ RISCVInstrInfo.td -o dump
But I get this error:
RISCVInstrInfo.td:18:24: error: Couldn't find class 'SDCallSeqStart'
def SDT_CallSeqStart : SDCallSeqStart<[SDTCisVT<0, i32>,
I get errors with every .td file in the LLVM source tree I try to compile with llvm-tblgen.
Each .td file is compiled much like a C++ file is in that it needs certain includes, or may be itself included in files.
In this case you have the file
RISCVInstrInfo.td which is never actually compiled on its own, but included in
llvm/include/llvm/Target/Target.td is included, which itself includes
Sound confusing? It is.
There is no option to force an include if the file doesn’t have it, so if you want just this one file’s output without compiling
RISCV.td, I would just edit in
include include "llvm/Target/TargetSelectionDAG.td" and compile it like that (the
-I you have already should be enough to make that work).
In summary: You managed to pick a file that is never directly compiled, only ever included. It’s a bit of an anti pattern that doesn’t play well with IDEs and language servers either so I want to address it in future.