[llvm] [RISCV] Pattern-match frameindex (NFCI) (PR #120917)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 22 12:24:36 PST 2024
================
@@ -1400,8 +1397,19 @@ def PseudoAddTPRel : Pseudo<(outs GPR:$rd),
/// FrameIndex calculations
-def : Pat<(FrameAddrRegImm (iPTR GPR:$rs1), simm12:$imm12),
- (ADDI GPR:$rs1, simm12:$imm12)>;
+// Converts frameindex -> tframeindex.
+def to_tframeindex : SDNodeXForm<frameindex, [{
+ return CurDAG->getTargetFrameIndex(N->getIndex(), N->getValueType(0));
+}]>;
+
+def : GICustomOperandRenderer<"renderFrameIndex">,
+ GISDNodeXFormEquiv<to_tframeindex>;
+
+def : Pat<(frameindex:$fi), (ADDI (iPTR (to_tframeindex $fi)), 0)>;
+
+def : Pat<(add_like frameindex:$fi, simm12:$offset),
----------------
topperc wrote:
I think add_like might be less capable than `SelectionDAG::isBaseWithConstantOffset`, but if it shows up its probably fixable.
https://github.com/llvm/llvm-project/pull/120917
More information about the llvm-commits
mailing list