From 86f803da0466ff0f3bde7bfd980f459942c12083 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 18 Aug 2016 22:08:01 -0400 Subject: [PATCH] reg_alloc: Use Inst's HasUses() function where applicable --- src/backend_x64/reg_alloc.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend_x64/reg_alloc.cpp b/src/backend_x64/reg_alloc.cpp index 9ffbe8b6..3fba0266 100644 --- a/src/backend_x64/reg_alloc.cpp +++ b/src/backend_x64/reg_alloc.cpp @@ -229,7 +229,7 @@ Gen::X64Reg RegAlloc::UseScratchRegister(IR::Value use_value, HostLocList desire Gen::X64Reg RegAlloc::UseScratchRegister(IR::Inst* use_inst, HostLocList desired_locations) { DEBUG_ASSERT(std::all_of(desired_locations.begin(), desired_locations.end(), HostLocIsRegister)); DEBUG_ASSERT_MSG(ValueLocation(use_inst), "use_inst has not been defined"); - ASSERT_MSG(use_inst->use_count != 0, "use_inst ran out of uses. (Use-d an IR::Inst* too many times)"); + ASSERT_MSG(use_inst->HasUses(), "use_inst ran out of uses. (Use-d an IR::Inst* too many times)"); HostLoc current_location = *ValueLocation(use_inst); HostLoc new_location = SelectARegister(desired_locations); @@ -397,14 +397,14 @@ void RegAlloc::EndOfAllocScope() { } if (!iter.values.empty()) { auto to_erase = std::remove_if(iter.values.begin(), iter.values.end(), - [](const auto& inst){ return inst->use_count <= 0; }); + [](const auto& inst){ return !inst->HasUses(); }); iter.values.erase(to_erase, iter.values.end()); } } } void RegAlloc::DecrementRemainingUses(IR::Inst* value) { - ASSERT_MSG(value->use_count > 0, "value doesn't have any remaining uses"); + ASSERT_MSG(value->HasUses(), "value doesn't have any remaining uses"); value->use_count--; }