Replace binary_function by plain function.

- Deprecated in C++11
- Removed in C++17
This commit is contained in:
Joel Linn 2020-02-13 00:25:18 +01:00 committed by Rick Gibbed
parent 722018d095
commit 64539621b4
2 changed files with 8 additions and 10 deletions

View File

@ -2,7 +2,7 @@
****************************************************************************** ******************************************************************************
* Xenia : Xbox 360 Emulator Research Project * * Xenia : Xbox 360 Emulator Research Project *
****************************************************************************** ******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. * * Copyright 2020 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. * * Released under the BSD license - see LICENSE in the root for more details. *
****************************************************************************** ******************************************************************************
*/ */
@ -347,9 +347,9 @@ bool RegisterAllocationPass::SpillOneRegister(HIRBuilder* builder, Block* block,
DumpUsage("SpillOneRegister (pre)"); DumpUsage("SpillOneRegister (pre)");
// Pick the one with the furthest next use. // Pick the one with the furthest next use.
assert_true(!usage_set->upcoming_uses.empty()); assert_true(!usage_set->upcoming_uses.empty());
auto furthest_usage = std::max_element(usage_set->upcoming_uses.begin(), auto furthest_usage =
usage_set->upcoming_uses.end(), std::max_element(usage_set->upcoming_uses.begin(),
RegisterUsage::Comparer()); usage_set->upcoming_uses.end(), &RegisterUsage::Compare);
assert_true(furthest_usage->value->def->block == block); assert_true(furthest_usage->value->def->block == block);
assert_true(furthest_usage->use->instr->block == block); assert_true(furthest_usage->use->instr->block == block);
auto spill_value = furthest_usage->value; auto spill_value = furthest_usage->value;

View File

@ -2,7 +2,7 @@
****************************************************************************** ******************************************************************************
* Xenia : Xbox 360 Emulator Research Project * * Xenia : Xbox 360 Emulator Research Project *
****************************************************************************** ******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. * * Copyright 2020 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. * * Released under the BSD license - see LICENSE in the root for more details. *
****************************************************************************** ******************************************************************************
*/ */
@ -39,12 +39,10 @@ class RegisterAllocationPass : public CompilerPass {
RegisterUsage() : value(nullptr), use(nullptr) {} RegisterUsage() : value(nullptr), use(nullptr) {}
RegisterUsage(hir::Value* value_, hir::Value::Use* use_) RegisterUsage(hir::Value* value_, hir::Value::Use* use_)
: value(value_), use(use_) {} : value(value_), use(use_) {}
struct Comparer : std::binary_function<RegisterUsage, RegisterUsage, bool> { static bool Compare(const RegisterUsage& a, const RegisterUsage& b) {
bool operator()(const RegisterUsage& a, const RegisterUsage& b) const {
return a.use->instr->ordinal < b.use->instr->ordinal; return a.use->instr->ordinal < b.use->instr->ordinal;
} }
}; };
};
struct RegisterSetUsage { struct RegisterSetUsage {
const backend::MachineInfo::RegisterSet* set = nullptr; const backend::MachineInfo::RegisterSet* set = nullptr;
uint32_t count = 0; uint32_t count = 0;