[llvm] [clang-tools-extra] [flang] [compiler-rt] [clang] [PowerPC][CodeGen] Exploit STMW and LMW in 32-bit big-endian mode. (PR #74415)

Qiu Chaofan via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 4 22:42:56 PST 2023


================
@@ -2513,7 +2548,23 @@ bool PPCFrameLowering::spillCalleeSavedRegisters(
             !MF->getFunction().hasFnAttribute(Attribute::NoUnwind))
           TII.storeRegToStackSlotNoUpd(MBB, MI, Reg, !IsLiveIn,
                                        I.getFrameIdx(), RC, TRI);
-        else
+        else if (MergeFrom < PPC::R31 && Reg == MergeFrom) {
+          // Build an STMW instruction.
+          int FrameIdx = I.getFrameIdx();
+          MachineInstrBuilder MIB =
+              BuildMI(MBB, MBB.begin(), DL, TII.get(PPC::STMW));
+          MIB.addReg(Reg, getKillRegState(!IsLiveIn));
+          // Add frame reference.
+          MIB.addImm(0).addFrameIndex(FrameIdx);
+          const MachineFrameInfo &MFI = MF->getFrameInfo();
+          MachineMemOperand *MMO = MF->getMachineMemOperand(
+              MachinePointerInfo::getFixedStack(*MF, FrameIdx),
+              MachineMemOperand::MOStore, MFI.getObjectSize(FrameIdx),
+              MFI.getObjectAlign(FrameIdx));
+          MIB.addMemOperand(MMO);
+        } else if (Reg > MergeFrom && Reg <= PPC::R31)
+          continue;
+	else
----------------
ecnelises wrote:

Wrong indent or dangling else?

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


More information about the cfe-commits mailing list