Skip to content

[NFC][TableGen] Adopt Emitter::OptClass in InstrInfoEmitter #125971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions llvm/utils/TableGen/InstrInfoEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,9 @@ void InstrInfoEmitter::emitTIIHelperMethods(raw_ostream &OS,

// run - Emit the main instruction description records for the target...
void InstrInfoEmitter::run(raw_ostream &OS) {
TGTimer &Timer = Records.getTimer();
Timer.startTimer("Analyze DAG patterns");

emitSourceFileHeader("Target Instruction Enum Values and Descriptors", OS);
emitEnums(OS);

Expand All @@ -898,7 +901,6 @@ void InstrInfoEmitter::run(raw_ostream &OS) {
const Record *InstrInfo = Target.getInstructionSet();

// Collect all of the operand info records.
TGTimer &Timer = Records.getTimer();
Timer.startTimer("Collect operand info");
OperandInfoListTy OperandInfoList;
OperandInfoMapTy OperandInfoMap;
Expand Down Expand Up @@ -1138,6 +1140,9 @@ void InstrInfoEmitter::run(raw_ostream &OS) {

Timer.startTimer("Emit verifier methods");
emitFeatureVerifier(OS, Target);

Timer.startTimer("Emit map table");
EmitMapTable(Records, OS);
}

void InstrInfoEmitter::emitRecord(
Expand Down Expand Up @@ -1314,13 +1319,5 @@ void InstrInfoEmitter::emitEnums(raw_ostream &OS) {
OS << "#endif // GET_INSTRINFO_SCHED_ENUM\n\n";
}

static void EmitInstrInfo(const RecordKeeper &Records, raw_ostream &OS) {
TGTimer &Timer = Records.getTimer();
Timer.startTimer("Analyze DAG patterns");
InstrInfoEmitter(Records).run(OS);
Timer.startTimer("Emit map table");
EmitMapTable(Records, OS);
}

static TableGen::Emitter::Opt X("gen-instr-info", EmitInstrInfo,
"Generate instruction descriptions");
static TableGen::Emitter::OptClass<InstrInfoEmitter>
X("gen-instr-info", "Generate instruction descriptions");