Skip to content

[TableGen] Accurately calculate where the source variable ops start in PseudoLoweringEmitter::emitLoweringEmitter. #135465

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
Apr 12, 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
9 changes: 5 additions & 4 deletions llvm/utils/TableGen/PseudoLoweringEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ void PseudoLoweringEmitter::emitLoweringEmitter(raw_ostream &o) {
// FIXME: Instruction operands with defaults values (predicates and cc_out
// in ARM, for example shouldn't need explicit values in the
// expansion DAG.
unsigned MIOpNo = 0;
for (const auto &DestOperand : Dest.Operands) {
o << " // Operand: " << DestOperand.Name << "\n";
unsigned MIOpNo = DestOperand.MIOperandNo;
for (unsigned i = 0, e = DestOperand.MINumOperands; i != e; ++i) {
switch (Expansion.OperandMap[MIOpNo + i].Kind) {
case OpData::Operand:
Expand Down Expand Up @@ -277,12 +277,13 @@ void PseudoLoweringEmitter::emitLoweringEmitter(raw_ostream &o) {
}
}
}
MIOpNo += DestOperand.MINumOperands;
}
if (Dest.Operands.isVariadic) {
MIOpNo = Source.Operands.size() + 1;
unsigned LastOpNo = 0;
for (const auto &Op : Source.Operands)
LastOpNo += Op.MINumOperands;
o << " // variable_ops\n";
o << " for (unsigned i = " << MIOpNo
o << " for (unsigned i = " << LastOpNo
<< ", e = MI->getNumOperands(); i != e; ++i)\n"
<< " if (lowerOperand(MI->getOperand(i), MCOp))\n"
<< " Inst.addOperand(MCOp);\n";
Expand Down