x64/reg_alloc: Use type alias for array returned by GetArgumentInfo()

This way if the number ever changes, we don't need to change the type in
other places.
This commit is contained in:
Lioncash 2018-08-13 11:10:34 -04:00 committed by MerryMage
parent 2188765e28
commit c41b5a3492
3 changed files with 6 additions and 4 deletions

View file

@ -19,7 +19,7 @@ namespace AES = Common::Crypto::AES;
using AESFn = void(AES::State&, const AES::State&); using AESFn = void(AES::State&, const AES::State&);
static void EmitAESFunction(std::array<Argument, 3> args, EmitContext& ctx, BlockOfCode& code, static void EmitAESFunction(RegAlloc::ArgumentInfo args, EmitContext& ctx, BlockOfCode& code,
IR::Inst* inst, AESFn fn) { IR::Inst* inst, AESFn fn) {
constexpr u32 stack_space = static_cast<u32>(sizeof(AES::State)) * 2; constexpr u32 stack_space = static_cast<u32>(sizeof(AES::State)) * 2;
const Xbyak::Xmm input = ctx.reg_alloc.UseXmm(args[0]); const Xbyak::Xmm input = ctx.reg_alloc.UseXmm(args[0]);

View file

@ -208,8 +208,8 @@ bool Argument::IsInMemory() const {
return HostLocIsSpill(*reg_alloc.ValueLocation(value.GetInst())); return HostLocIsSpill(*reg_alloc.ValueLocation(value.GetInst()));
} }
std::array<Argument, 3> RegAlloc::GetArgumentInfo(IR::Inst* inst) { RegAlloc::ArgumentInfo RegAlloc::GetArgumentInfo(IR::Inst* inst) {
std::array<Argument, 3> ret = { Argument{*this}, Argument{*this}, Argument{*this} }; ArgumentInfo ret = { Argument{*this}, Argument{*this}, Argument{*this} };
for (size_t i = 0; i < inst->NumArgs(); i++) { for (size_t i = 0; i < inst->NumArgs(); i++) {
const IR::Value& arg = inst->GetArg(i); const IR::Value& arg = inst->GetArg(i);
ret[i].value = arg; ret[i].value = arg;

View file

@ -91,10 +91,12 @@ private:
class RegAlloc final { class RegAlloc final {
public: public:
using ArgumentInfo = std::array<Argument, 3>;
explicit RegAlloc(BlockOfCode& code, size_t num_spills, std::function<Xbyak::Address(HostLoc)> spill_to_addr) explicit RegAlloc(BlockOfCode& code, size_t num_spills, std::function<Xbyak::Address(HostLoc)> spill_to_addr)
: hostloc_info(NonSpillHostLocCount + num_spills), code(code), spill_to_addr(std::move(spill_to_addr)) {} : hostloc_info(NonSpillHostLocCount + num_spills), code(code), spill_to_addr(std::move(spill_to_addr)) {}
std::array<Argument, 3> GetArgumentInfo(IR::Inst* inst); ArgumentInfo GetArgumentInfo(IR::Inst* inst);
Xbyak::Reg64 UseGpr(Argument& arg); Xbyak::Reg64 UseGpr(Argument& arg);
Xbyak::Xmm UseXmm(Argument& arg); Xbyak::Xmm UseXmm(Argument& arg);