diff --git a/src/backend_x64/reg_alloc.cpp b/src/backend_x64/reg_alloc.cpp index a56de6ca..889d92ac 100644 --- a/src/backend_x64/reg_alloc.cpp +++ b/src/backend_x64/reg_alloc.cpp @@ -130,7 +130,7 @@ std::tuple RegAlloc::UseDefOpArgHostLocReg(IR::Value use_value, DEBUG_ASSERT_MSG(use_value.IsImmediate() || ValueLocation(use_value.GetInst()), "use_inst has not been defined"); if (!use_value.IsImmediate()) { - IR::Inst* use_inst = use_value.GetInst(); + const IR::Inst* use_inst = use_value.GetInst(); if (IsLastUse(use_inst)) { HostLoc current_location = *ValueLocation(use_inst); @@ -347,7 +347,7 @@ bool RegAlloc::IsRegisterAllocated(HostLoc loc) const { return LocInfo(loc).is_being_used; } -bool RegAlloc::IsLastUse(IR::Inst* inst) const { +bool RegAlloc::IsLastUse(const IR::Inst* inst) const { if (inst->use_count > 1) return false; return LocInfo(*ValueLocation(inst)).values.size() == 1; diff --git a/src/backend_x64/reg_alloc.h b/src/backend_x64/reg_alloc.h index faae4cf5..648ccd58 100644 --- a/src/backend_x64/reg_alloc.h +++ b/src/backend_x64/reg_alloc.h @@ -156,7 +156,7 @@ private: boost::optional ValueLocation(const IR::Inst* value) const; bool IsRegisterOccupied(HostLoc loc) const; bool IsRegisterAllocated(HostLoc loc) const; - bool IsLastUse(IR::Inst* inst) const; + bool IsLastUse(const IR::Inst* inst) const; HostLoc DefHostLocReg(IR::Inst* def_inst, HostLocList desired_locations); HostLoc UseDefHostLocReg(IR::Value use_value, IR::Inst* def_inst, HostLocList desired_locations);