aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/CodeGen/RegAllocFast.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backend/lib/CodeGen/RegAllocFast.cpp')
-rw-r--r--backend/lib/CodeGen/RegAllocFast.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/backend/lib/CodeGen/RegAllocFast.cpp b/backend/lib/CodeGen/RegAllocFast.cpp
index 9b087cc..897f217 100644
--- a/backend/lib/CodeGen/RegAllocFast.cpp
+++ b/backend/lib/CodeGen/RegAllocFast.cpp
@@ -266,7 +266,7 @@ private:
return std::unexpected(Evicted.error());
}
- auto Candidates = regalloc_detail::allocationOrder(Function, Target, Reg);
+ auto Candidates = regalloc_detail::allocationOrder(Function, Target, TargetInfo, Reg);
if (!Candidates)
return std::unexpected(Candidates.error());
for (const PhysicalRegister Candidate : *Candidates) {
@@ -319,7 +319,7 @@ private:
const Register Reg = *LiveIn.InitialVirtualRegister;
if (!Function.registerInfo().isKnownVirtualRegister(Reg))
continue;
- auto Candidates = regalloc_detail::allocationOrder(Function, Target, Reg);
+ auto Candidates = regalloc_detail::allocationOrder(Function, Target, TargetInfo, Reg);
if (!Candidates)
return std::unexpected(Candidates.error());
if (std::ranges::find(*Candidates, LiveIn.PhysReg) == Candidates->end()) {
@@ -577,6 +577,12 @@ Expected<MachinePassResult> FastAllocatorPass::run(MachineFunction &Function,
auto Trial = regalloc_detail::cloneForAllocation(Function, Target);
if (!Trial)
return std::unexpected(Trial.error());
+ const std::vector<PhysicalRegister> FunctionReserved =
+ regalloc_detail::functionReservedRegisters(Function, Target, *Info);
+ auto TrialReserved =
+ regalloc_detail::reserveFunctionRegisters(*Trial->ClonedFunction, FunctionReserved);
+ if (!TrialReserved)
+ return std::unexpected(TrialReserved.error());
MachineAnalysisManager TrialAnalyses;
auto Registered = registerStage11MachineAnalyses(TrialAnalyses);
if (!Registered)
@@ -602,6 +608,10 @@ Expected<MachinePassResult> FastAllocatorPass::run(MachineFunction &Function,
return std::unexpected(regalloc_detail::withPrefix(
Allocated.error(), "FastAllocator diverged after a successful transaction preflight: "));
}
+ auto Reserved = regalloc_detail::reserveFunctionRegisters(Function, FunctionReserved);
+ if (!Reserved)
+ return std::unexpected(Reserved.error());
+ Allocated->Changed |= *Reserved;
return regalloc_detail::passResult(*Allocated);
}