I am trying to write TargetRegisterInfo.td file for a new Target and this file is being referred to by GISel’s TargetRegisterBanks.td file.
But I keep getting this error when my TargetRegisterInfo.td file is compiled.
error: No ‘Target’ subclasses defined!
What does this error mean? I tried to run llvm-tblgen on Target.td file with -gen-register-info --register-info-debug options, but I didn’t get any further information other than the same error.
Any more insights on this error and how to go about debugging it?
You are right, I figured this out myself this morning by trial and error. Thanks for your reply.
Wondering if there is a way to debug / step into tablgen code and common Target infrastructure code when we face issues like this while developing a new Target. It would be much easier to debug than to figure out from error messages that don’t explain much.
I guess we have to create a debug build of llvm. Other than that, wondering how to enable debug flags of tblgen code and common Target infrastructure code.
For example, yesterday, I wanted print Targets in this function defined in llvm/utils/TableGen/CodeGenTarget.cpp, but I didn’t know how to do it. I only see PrintFatalError function being used.
// getTarget - Return the current instance of the Target class.
///
CodeGenTarget::CodeGenTarget(RecordKeeper &records)
: Records(records), CGH(records) {
std::vector<Record*> Targets = Records.getAllDerivedDefinitions(“Target”);
if (Targets.size() == 0)
PrintFatalError(“No ‘Target’ subclasses defined!”);
if (Targets.size() != 1)
PrintFatalError(“Multiple subclasses of Target defined!”);
TargetRec = Targets[0];
}