aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r--llvm/lib/CodeGen/PrologEpilogInserter.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
index 7b751ba..8fc0748 100644
--- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -351,8 +351,8 @@ bool PEIImpl::run(MachineFunction &MF) {
delete RS;
SaveBlocks.clear();
RestoreBlocks.clear();
- MFI.setSavePoint(nullptr);
- MFI.setRestorePoint(nullptr);
+ MFI.setSavePoints({});
+ MFI.setRestorePoints({});
return true;
}
@@ -423,16 +423,18 @@ void PEIImpl::calculateCallFrameInfo(MachineFunction &MF) {
/// callee-saved registers, and placing prolog and epilog code.
void PEIImpl::calculateSaveRestoreBlocks(MachineFunction &MF) {
const MachineFrameInfo &MFI = MF.getFrameInfo();
-
// Even when we do not change any CSR, we still want to insert the
// prologue and epilogue of the function.
// So set the save points for those.
// Use the points found by shrink-wrapping, if any.
- if (MFI.getSavePoint()) {
- SaveBlocks.push_back(MFI.getSavePoint());
- assert(MFI.getRestorePoint() && "Both restore and save must be set");
- MachineBasicBlock *RestoreBlock = MFI.getRestorePoint();
+ if (!MFI.getSavePoints().empty()) {
+ assert(MFI.getSavePoints().size() == 1 &&
+ "Multiple save points are not yet supported!");
+ SaveBlocks.push_back(MFI.getSavePoints().front());
+ assert(MFI.getRestorePoints().size() == 1 &&
+ "Multiple restore points are not yet supported!");
+ MachineBasicBlock *RestoreBlock = MFI.getRestorePoints().front();
// If RestoreBlock does not have any successor and is not a return block
// then the end point is unreachable and we do not need to insert any
// epilogue.
@@ -558,7 +560,11 @@ static void updateLiveness(MachineFunction &MF) {
SmallPtrSet<MachineBasicBlock *, 8> Visited;
SmallVector<MachineBasicBlock *, 8> WorkList;
MachineBasicBlock *Entry = &MF.front();
- MachineBasicBlock *Save = MFI.getSavePoint();
+
+ assert(MFI.getSavePoints().size() < 2 &&
+ "Multiple save points not yet supported!");
+ MachineBasicBlock *Save =
+ MFI.getSavePoints().empty() ? nullptr : MFI.getSavePoints().front();
if (!Save)
Save = Entry;
@@ -569,7 +575,10 @@ static void updateLiveness(MachineFunction &MF) {
}
Visited.insert(Save);
- MachineBasicBlock *Restore = MFI.getRestorePoint();
+ assert(MFI.getRestorePoints().size() < 2 &&
+ "Multiple restore points not yet supported!");
+ MachineBasicBlock *Restore =
+ MFI.getRestorePoints().empty() ? nullptr : MFI.getRestorePoints().front();
if (Restore)
// By construction Restore cannot be visited, otherwise it
// means there exists a path to Restore that does not go