Skip to content

Commit 337604e

Browse files
authored
[NFC][TableGen] Adopt Emitter::OptClass in InstrInfoEmitter (llvm#125971)
- Use `Emitter::OptClass` to invoke `InstrInfoEmitter::run` and eliminate the `EmitInstrInfo` function.
1 parent ff94b03 commit 337604e

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

llvm/utils/TableGen/InstrInfoEmitter.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,9 @@ void InstrInfoEmitter::emitTIIHelperMethods(raw_ostream &OS,
890890

891891
// run - Emit the main instruction description records for the target...
892892
void InstrInfoEmitter::run(raw_ostream &OS) {
893+
TGTimer &Timer = Records.getTimer();
894+
Timer.startTimer("Analyze DAG patterns");
895+
893896
emitSourceFileHeader("Target Instruction Enum Values and Descriptors", OS);
894897
emitEnums(OS);
895898

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

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

11391141
Timer.startTimer("Emit verifier methods");
11401142
emitFeatureVerifier(OS, Target);
1143+
1144+
Timer.startTimer("Emit map table");
1145+
EmitMapTable(Records, OS);
11411146
}
11421147

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

1317-
static void EmitInstrInfo(const RecordKeeper &Records, raw_ostream &OS) {
1318-
TGTimer &Timer = Records.getTimer();
1319-
Timer.startTimer("Analyze DAG patterns");
1320-
InstrInfoEmitter(Records).run(OS);
1321-
Timer.startTimer("Emit map table");
1322-
EmitMapTable(Records, OS);
1323-
}
1324-
1325-
static TableGen::Emitter::Opt X("gen-instr-info", EmitInstrInfo,
1326-
"Generate instruction descriptions");
1322+
static TableGen::Emitter::OptClass<InstrInfoEmitter>
1323+
X("gen-instr-info", "Generate instruction descriptions");

0 commit comments

Comments
 (0)