reg_alloc: const correctness for ValueLocation()

This commit is contained in:
Lioncash 2016-08-18 22:13:38 -04:00 committed by MerryMage
parent 2d6a86e43c
commit 36a0ad5bc2
2 changed files with 3 additions and 3 deletions

View file

@ -341,9 +341,9 @@ HostLoc RegAlloc::SelectARegister(HostLocList desired_locations) const {
return candidates.front(); return candidates.front();
} }
boost::optional<HostLoc> RegAlloc::ValueLocation(IR::Inst* value) const { boost::optional<HostLoc> RegAlloc::ValueLocation(const IR::Inst* value) const {
for (size_t i = 0; i < HostLocCount; i++) for (size_t i = 0; i < HostLocCount; i++)
for (IR::Inst* v : hostloc_info[i].values) for (const IR::Inst* v : hostloc_info[i].values)
if (v == value) if (v == value)
return boost::make_optional<HostLoc>(static_cast<HostLoc>(i)); return boost::make_optional<HostLoc>(static_cast<HostLoc>(i));

View file

@ -136,7 +136,7 @@ public:
private: private:
HostLoc SelectARegister(HostLocList desired_locations) const; HostLoc SelectARegister(HostLocList desired_locations) const;
boost::optional<HostLoc> ValueLocation(IR::Inst* value) const; boost::optional<HostLoc> ValueLocation(const IR::Inst* value) const;
bool IsRegisterOccupied(HostLoc loc) const; bool IsRegisterOccupied(HostLoc loc) const;
bool IsRegisterAllocated(HostLoc loc) const; bool IsRegisterAllocated(HostLoc loc) const;
bool IsLastUse(IR::Inst* inst) const; bool IsLastUse(IR::Inst* inst) const;