diff --git a/src/backend_x64/reg_alloc.cpp b/src/backend_x64/reg_alloc.cpp index c5d4c199..987c9593 100644 --- a/src/backend_x64/reg_alloc.cpp +++ b/src/backend_x64/reg_alloc.cpp @@ -338,42 +338,6 @@ void RegAlloc::Reset() { hostloc_info.fill({}); } -std::tuple RegAlloc::UseHostLoc(IR::Inst* use_inst, HostLocList desired_locations) { - DEBUG_ASSERT(std::all_of(desired_locations.begin(), desired_locations.end(), HostLocIsRegister)); - DEBUG_ASSERT_MSG(ValueLocation(use_inst), "use_inst has not been defined"); - - HostLoc current_location = *ValueLocation(use_inst); - auto iter = std::find(desired_locations.begin(), desired_locations.end(), current_location); - if (iter != desired_locations.end()) { - bool was_being_used = LocInfo(current_location).IsLocked(); - ASSERT(LocInfo(current_location).IsUse() || LocInfo(current_location).IsIdle()); - LocInfo(current_location).Lock(); - use_inst->DecrementRemainingUses(); - DEBUG_ASSERT(LocInfo(current_location).IsUse()); - return std::make_tuple(current_location, was_being_used); - } - - if (HostLocIsSpill(current_location)) { - bool was_being_used = LocInfo(current_location).IsLocked(); - LocInfo(current_location).Lock(); - use_inst->DecrementRemainingUses(); - DEBUG_ASSERT(LocInfo(current_location).IsUse()); - return std::make_tuple(current_location, was_being_used); - } else if (HostLocIsRegister(current_location)) { - HostLoc new_location = SelectARegister(desired_locations); - ASSERT(LocInfo(current_location).IsIdle()); - EmitExchange(code, new_location, current_location); - std::swap(LocInfo(new_location), LocInfo(current_location)); - LocInfo(new_location).Lock(); - use_inst->DecrementRemainingUses(); - DEBUG_ASSERT(LocInfo(new_location).IsUse()); - return std::make_tuple(new_location, false); - } - - ASSERT_MSG(false, "Invalid current_location"); - return std::make_tuple(static_cast(-1), false); -} - HostLoc RegAlloc::LoadImmediateIntoHostLocReg(IR::Value imm, HostLoc host_loc) { ASSERT_MSG(imm.IsImmediate(), "imm is not an immediate"); diff --git a/src/backend_x64/reg_alloc.h b/src/backend_x64/reg_alloc.h index ab6ff8ec..88cb2bdf 100644 --- a/src/backend_x64/reg_alloc.h +++ b/src/backend_x64/reg_alloc.h @@ -148,7 +148,6 @@ private: std::tuple UseDefOpArgHostLocReg(IR::Value use_value, IR::Inst* def_inst, HostLocList desired_locations); HostLoc UseHostLocReg(IR::Value use_value, HostLocList desired_locations); HostLoc UseHostLocReg(IR::Inst* use_inst, HostLocList desired_locations); - std::tuple UseHostLoc(IR::Inst* use_inst, HostLocList desired_locations); HostLoc UseScratchHostLocReg(IR::Value use_value, HostLocList desired_locations); HostLoc UseScratchHostLocReg(IR::Inst* use_inst, HostLocList desired_locations); HostLoc ScratchHostLocReg(HostLocList desired_locations);