reg_alloc: const correctness (#8)

This commit is contained in:
Mat M 2016-09-02 12:30:01 -04:00 committed by Merry
parent ba04be5071
commit 1e781d911a
2 changed files with 3 additions and 3 deletions

View file

@ -130,7 +130,7 @@ std::tuple<OpArg, HostLoc> 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;

View file

@ -156,7 +156,7 @@ private:
boost::optional<HostLoc> 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);