[PATCH] D127931: [TableGen] Emit instruction name in INSTRINFO_OPERAND_TYPE
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 19 14:59:32 PDT 2022
craig.topper added inline comments.
================
Comment at: llvm/utils/TableGen/InstrInfoEmitter.cpp:390
OperandOffsets.push_back(CurrentOffset);
+ OffsetToInst.insert({CurrentOffset, Inst->TheDef->getName()});
for (const auto &Op : Inst->Operands) {
----------------
This is only storing the name of the last instruction that uses the offset. An instruction with no operands won't increment CurrentOffset.
================
Comment at: llvm/utils/TableGen/InstrInfoEmitter.cpp:413
+ OS << " Offsets[] = {";
+ for (int I = 0, E = OperandOffsets.size(); I != E; ++I) {
+ if (OffsetToInst.find(I) != OffsetToInst.end())
----------------
I think `I` here is the instruction number. Can't we just look it up via `NumberedInstructions[I]`?
================
Comment at: llvm/utils/TableGen/InstrInfoEmitter.cpp:432
// We print each Opcode's operands in its own row.
if (I == OperandOffsets[CurOffset]) {
OS << "\n ";
----------------
I think CurOffset here is the instrution number. Can we look up `NumberedInstructions[CurOffset]`?
================
Comment at: llvm/utils/TableGen/InstrInfoEmitter.cpp:438
while (OperandOffsets[++CurOffset] == I)
- OS << "/**/\n ";
+ ;
}
----------------
Should we print the names of instructions with no operands here?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127931/new/
https://reviews.llvm.org/D127931
More information about the llvm-commits
mailing list