From 36a0ad5bc2da0689addee6d7fc5b761a3661d6b4 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 18 Aug 2016 22:13:38 -0400 Subject: [PATCH] reg_alloc: const correctness for ValueLocation() --- src/backend_x64/reg_alloc.cpp | 4 ++-- src/backend_x64/reg_alloc.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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;