Skip to content

Commit 40d94a6

Browse files
committed
[PATCH-AVR] avr-rust/rust-legacy-fork#111 (D53485): nested stack adjust
1 parent a1bfed5 commit 40d94a6

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2939,6 +2939,29 @@ void RegReductionPQBase::PrescheduleNodesWithMultipleUses() {
29392939
(cast<RegisterSDNode>(N->getOperand(1))->getReg()))
29402940
continue;
29412941

2942+
SDNode *PredFrameSetup = nullptr;
2943+
for (const SDep &Pred : SU.Preds)
2944+
if (Pred.isCtrl() && Pred.getSUnit()) {
2945+
// Find the predecessor which is not data dependence.
2946+
SDNode *PredND = Pred.getSUnit()->getNode();
2947+
2948+
// If PredND is FrameSetup, we should not pre-scheduled the node,
2949+
// or else, when bottom up scheduling, ADJCALLSTACKDOWN and
2950+
// ADJCALLSTACKUP may hold CallResource too long and make other
2951+
// calls can't be scheduled. If there's no other available node
2952+
// to schedule, the schedular will try to rename the register by
2953+
// creating copy to avoid the conflict which will fail because
2954+
// CallResource is not a real physical register.
2955+
if (PredND && PredND->isMachineOpcode() &&
2956+
(PredND->getMachineOpcode() == TII->getCallFrameSetupOpcode())) {
2957+
PredFrameSetup = PredND;
2958+
break;
2959+
}
2960+
}
2961+
// Skip the node has FrameSetup parent.
2962+
if (PredFrameSetup != nullptr)
2963+
continue;
2964+
29422965
// Locate the single data predecessor.
29432966
SUnit *PredSU = nullptr;
29442967
for (const SDep &Pred : SU.Preds)

0 commit comments

Comments
 (0)