[llvm] [MachineFrameInfo] Refactoring with computeMaxcallFrameSize() (NFC) (PR #78001)

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 18 07:49:17 PST 2024


================
@@ -184,26 +184,24 @@ uint64_t MachineFrameInfo::estimateStackSize(const MachineFunction &MF) const {
   return alignTo(Offset, StackAlign);
 }
 
-void MachineFrameInfo::computeMaxCallFrameSize(const MachineFunction &MF) {
+void MachineFrameInfo::computeMaxCallFrameSize(
+    MachineFunction &MF, std::vector<MachineBasicBlock::iterator> *FrameSDOps) {
   const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
   unsigned FrameSetupOpcode = TII.getCallFrameSetupOpcode();
   unsigned FrameDestroyOpcode = TII.getCallFrameDestroyOpcode();
   assert(FrameSetupOpcode != ~0u && FrameDestroyOpcode != ~0u &&
          "Can only compute MaxCallFrameSize if Setup/Destroy opcode are known");
 
   MaxCallFrameSize = 0;
-  for (const MachineBasicBlock &MBB : MF) {
-    for (const MachineInstr &MI : MBB) {
+  for (MachineBasicBlock &MBB : MF) {
+    for (MachineInstr &MI : MBB) {
       unsigned Opcode = MI.getOpcode();
       if (Opcode == FrameSetupOpcode || Opcode == FrameDestroyOpcode) {
         unsigned Size = TII.getFrameSize(MI);
         MaxCallFrameSize = std::max(MaxCallFrameSize, Size);
         AdjustsStack = true;
----------------
JonPsson1 wrote:

This has been a confusion for me also - I actually tried setting the AdjustsStack for any call, but that gave test failures on some target.

Yes, as callseq pseudos seem to be used for other things and not just calls, any refactoring needs to preserve this mapping from them to the AdjustsStack flag, I think.


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


More information about the llvm-commits mailing list