reg_alloc: Improve performance of HostLocInfo (#112)
This commit changes the type of HostLocInfo::values from std::vector<Inst*> to std::forward_list<Inst*>.
This commit is contained in:
parent
148c01e08f
commit
ed4964e892
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include <xbyak.h>
|
||||
|
||||
@ -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;
|
||||
|
@ -7,7 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <forward_list>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <xbyak.h>
|
||||
@ -40,7 +40,7 @@ public:
|
||||
void EndOfAllocScope();
|
||||
|
||||
private:
|
||||
std::vector<IR::Inst*> values;
|
||||
std::forward_list<IR::Inst*> values;
|
||||
bool is_being_used = false;
|
||||
bool is_scratch = false;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user