diff --git a/src/backend_x64/reg_alloc.cpp b/src/backend_x64/reg_alloc.cpp index 765db4dd..9ffbe8b6 100644 --- a/src/backend_x64/reg_alloc.cpp +++ b/src/backend_x64/reg_alloc.cpp @@ -341,9 +341,9 @@ HostLoc RegAlloc::SelectARegister(HostLocList desired_locations) const { return candidates.front(); } -boost::optional RegAlloc::ValueLocation(IR::Inst* value) const { +boost::optional RegAlloc::ValueLocation(const IR::Inst* value) const { 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) return boost::make_optional(static_cast(i)); diff --git a/src/backend_x64/reg_alloc.h b/src/backend_x64/reg_alloc.h index cfd829a1..a48e71af 100644 --- a/src/backend_x64/reg_alloc.h +++ b/src/backend_x64/reg_alloc.h @@ -136,7 +136,7 @@ public: private: HostLoc SelectARegister(HostLocList desired_locations) const; - boost::optional ValueLocation(IR::Inst* value) const; + boost::optional ValueLocation(const IR::Inst* value) const; bool IsRegisterOccupied(HostLoc loc) const; bool IsRegisterAllocated(HostLoc loc) const; bool IsLastUse(IR::Inst* inst) const;