aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineBasicBlock.cpp
diff options
context:
space:
mode:
authorJay Foad <jay.foad@amd.com>2023-06-30 08:14:40 +0100
committerJay Foad <jay.foad@amd.com>2023-07-27 10:32:00 +0100
commit2dcf0512599280ba68a5028f24ea96dfdb37b7b7 (patch)
treeac0371093ac23e485829862efd2fb61197c475b8 /llvm/lib/CodeGen/MachineBasicBlock.cpp
parent77ef88d7ee32dc18a4d6e3f92a61393e759e3b83 (diff)
downloadllvm-2dcf0512599280ba68a5028f24ea96dfdb37b7b7.zip
llvm-2dcf0512599280ba68a5028f24ea96dfdb37b7b7.tar.gz
llvm-2dcf0512599280ba68a5028f24ea96dfdb37b7b7.tar.bz2
[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
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineBasicBlock.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp
index 23154449..8e7b2d7 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;