reg_alloc: Reimplement ScratchHostLocReg

This commit is contained in:
MerryMage 2017-02-24 20:01:41 +00:00
parent 640faab8a7
commit 1ee4c07f14

View file

@ -201,18 +201,9 @@ HostLoc RegAlloc::UseScratchHostLocReg(IR::Inst* use_inst, HostLocList desired_l
} }
HostLoc RegAlloc::ScratchHostLocReg(HostLocList desired_locations) { HostLoc RegAlloc::ScratchHostLocReg(HostLocList desired_locations) {
DEBUG_ASSERT(std::all_of(desired_locations.begin(), desired_locations.end(), HostLocIsRegister));
HostLoc location = SelectARegister(desired_locations); HostLoc location = SelectARegister(desired_locations);
MoveOutOfTheWay(location);
if (IsRegisterOccupied(location)) {
SpillRegister(location);
}
// Update state
LocInfo(location).Lock(); LocInfo(location).Lock();
DEBUG_ASSERT(LocInfo(location).IsScratch());
return location; return location;
} }