From 2dcf0512599280ba68a5028f24ea96dfdb37b7b7 Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Fri, 30 Jun 2023 08:14:40 +0100 Subject: [CodeGen] Store call frame size in MachineBasicBlock Record the call frame size on entry to each basic block. This is usually zero except when a basic block has been split in the middle of a call sequence. This simplifies PEI::replaceFrameIndices which previously had to visit basic blocks in a specific order and had special handling for unreachable blocks. More importantly it paves the way for an equally simple implementation of a backwards version of replaceFrameIndices, which is required to fully convert PrologEpilogInserter to backwards register scavenging, which is preferred because it does not rely on accurate kill flags. Differential Revision: https://reviews.llvm.org/D156113 --- llvm/lib/CodeGen/MachineBasicBlock.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp') diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 231544494c32..8e7b2d7e1e87 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -570,6 +570,11 @@ void MachineBasicBlock::printName(raw_ostream &os, unsigned printNameFlags, os << "bb_id " << *getBBID(); hasAttributes = true; } + if (CallFrameSize != 0) { + os << (hasAttributes ? ", " : " ("); + os << "call-frame-size " << CallFrameSize; + hasAttributes = true; + } } if (hasAttributes) @@ -1099,6 +1104,7 @@ MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge( DebugLoc DL; // FIXME: this is nowhere MachineBasicBlock *NMBB = MF->CreateMachineBasicBlock(); + NMBB->setCallFrameSize(Succ->getCallFrameSize()); // Is there an indirect jump with jump table? bool ChangedIndirectJump = false; -- cgit v1.2.3