diff --git a/src/backend_x64/reg_alloc.cpp b/src/backend_x64/reg_alloc.cpp index 9352fe15..765db4dd 100644 --- a/src/backend_x64/reg_alloc.cpp +++ b/src/backend_x64/reg_alloc.cpp @@ -351,17 +351,19 @@ boost::optional RegAlloc::ValueLocation(IR::Inst* value) const { } bool RegAlloc::IsRegisterOccupied(HostLoc loc) const { - return !GetLocInfo(loc).values.empty() || GetLocInfo(loc).def; + const auto& info = LocInfo(loc); + + return !info.values.empty() || info.def; } bool RegAlloc::IsRegisterAllocated(HostLoc loc) const { - return GetLocInfo(loc).is_being_used; + return LocInfo(loc).is_being_used; } bool RegAlloc::IsLastUse(IR::Inst* inst) const { if (inst->use_count > 1) return false; - return GetLocInfo(*ValueLocation(inst)).values.size() == 1; + return LocInfo(*ValueLocation(inst)).values.size() == 1; } void RegAlloc::SpillRegister(HostLoc loc) { diff --git a/src/backend_x64/reg_alloc.h b/src/backend_x64/reg_alloc.h index e3cb837c..1555b467 100644 --- a/src/backend_x64/reg_alloc.h +++ b/src/backend_x64/reg_alloc.h @@ -172,7 +172,7 @@ private: HostLocInfo& LocInfo(HostLoc loc) { return hostloc_info[static_cast(loc)]; } - HostLocInfo GetLocInfo(HostLoc loc) const { + const HostLocInfo& LocInfo(HostLoc loc) const { return hostloc_info[static_cast(loc)]; } };