[llvm] [RISCV] Pattern-match frameindex (NFCI) (PR #120917)

Sam Elliott via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 23 01:27:23 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),
----------------
lenary wrote:

Given you think there is a difference, please don't mark this as "NFCI" in the message. 

https://github.com/llvm/llvm-project/pull/120917


More information about the llvm-commits mailing list