diff --git a/src/backend_x64/reg_alloc.cpp b/src/backend_x64/reg_alloc.cpp index 20eb147d..c5720790 100644 --- a/src/backend_x64/reg_alloc.cpp +++ b/src/backend_x64/reg_alloc.cpp @@ -5,6 +5,7 @@ */ #include +#include #include @@ -99,12 +100,11 @@ void HostLocInfo::WriteLock() { } void HostLocInfo::AddValue(IR::Inst* inst) { - values.push_back(inst); + values.push_front(inst); } void HostLocInfo::EndOfAllocScope() { - const auto to_erase = std::remove_if(values.begin(), values.end(), [](const auto& inst) { return !inst->HasUses(); }); - values.erase(to_erase, values.end()); + values.remove_if([](const auto& inst) { return !inst->HasUses(); }); is_being_used = false; is_scratch = false; diff --git a/src/backend_x64/reg_alloc.h b/src/backend_x64/reg_alloc.h index 6a54819f..bf0a37f1 100644 --- a/src/backend_x64/reg_alloc.h +++ b/src/backend_x64/reg_alloc.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include #include #include @@ -40,7 +40,7 @@ public: void EndOfAllocScope(); private: - std::vector values; + std::forward_list values; bool is_being_used = false; bool is_scratch = false; };