Skip to content

Commit

Permalink
[TableGen] Handle frameindex/tframeindex
Browse files Browse the repository at this point in the history
  • Loading branch information
redstar committed Apr 29, 2024
1 parent 8cd55d1 commit 672dc50
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions llvm/lib/Target/M88k/M88kInstrInfo.td
Expand Up @@ -466,6 +466,8 @@ def : Pat<(ptradd GPROpnd:$rs1, uimm16:$imm),
def : Pat<(ptradd GPROpnd:$rs1, GPROpnd:$rs2),
(ADDUrr GPROpnd:$rs1, GPROpnd:$rs2)>;

def : Pat<(i32 frameindex:$fi), (ADDri tframeindex:$fi, R0)>;

// ---------------------------------------------------------------------------//
// Materialize immediates & constants.
// ---------------------------------------------------------------------------//
Expand Down
9 changes: 9 additions & 0 deletions llvm/utils/TableGen/GlobalISelEmitter.cpp
Expand Up @@ -834,6 +834,11 @@ Expected<InstructionMatcher &> GlobalISelEmitter::createAndImportSelDAGMatcher(
return InsnMatcher;
}

if (SrcGIOrNull->TheDef->getName() == "G_FRAME_INDEX") {
InsnMatcher.addOperand(OpIdx++, Src.getName(), TempOpIdx);
return InsnMatcher;
}

// Special case because the operand order is changed from setcc. The
// predicate operand needs to be swapped from the last operand to the first
// source.
Expand Down Expand Up @@ -1223,6 +1228,10 @@ Expected<action_iterator> GlobalISelEmitter::importExplicitUseRenderer(
if (DstChild.getOperator()->getName() == "timm") {
DstMIBuilder.addRenderer<CopyRenderer>(DstChild.getName());
return InsertPt;
}
if (DstChild.getOperator()->getName() == "tframeindex") {
DstMIBuilder.addRenderer<CopyRenderer>(DstChild.getName());
return InsertPt;
} else if (DstChild.getOperator()->getName() == "imm") {
DstMIBuilder.addRenderer<CopyConstantAsImmRenderer>(DstChild.getName());
return InsertPt;
Expand Down

0 comments on commit 672dc50

Please sign in to comment.