2022-11-04 17:33:22 +00:00
|
|
|
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Luau/RegisterA64.h"
|
|
|
|
|
|
|
|
namespace Luau
|
|
|
|
{
|
|
|
|
namespace CodeGen
|
|
|
|
{
|
|
|
|
|
|
|
|
enum class AddressKindA64 : uint8_t
|
|
|
|
{
|
|
|
|
imm, // reg + imm
|
|
|
|
reg, // reg + reg
|
|
|
|
|
|
|
|
// TODO:
|
|
|
|
// reg + reg << shift
|
|
|
|
// reg + sext(reg) << shift
|
|
|
|
// reg + uext(reg) << shift
|
|
|
|
};
|
|
|
|
|
|
|
|
struct AddressA64
|
|
|
|
{
|
|
|
|
AddressA64(RegisterA64 base, int off = 0)
|
|
|
|
: kind(AddressKindA64::imm)
|
|
|
|
, base(base)
|
|
|
|
, offset(xzr)
|
|
|
|
, data(off)
|
|
|
|
{
|
2022-11-10 22:53:13 +00:00
|
|
|
LUAU_ASSERT(base.kind == KindA64::x || base == sp);
|
|
|
|
LUAU_ASSERT(off >= -256 && off < 4096);
|
2022-11-04 17:33:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AddressA64(RegisterA64 base, RegisterA64 offset)
|
|
|
|
: kind(AddressKindA64::reg)
|
|
|
|
, base(base)
|
|
|
|
, offset(offset)
|
|
|
|
, data(0)
|
|
|
|
{
|
|
|
|
LUAU_ASSERT(base.kind == KindA64::x);
|
|
|
|
LUAU_ASSERT(offset.kind == KindA64::x);
|
|
|
|
}
|
|
|
|
|
|
|
|
AddressKindA64 kind;
|
|
|
|
RegisterA64 base;
|
|
|
|
RegisterA64 offset;
|
|
|
|
int data;
|
|
|
|
};
|
|
|
|
|
2022-11-10 22:53:13 +00:00
|
|
|
using mem = AddressA64;
|
|
|
|
|
2022-11-04 17:33:22 +00:00
|
|
|
} // namespace CodeGen
|
|
|
|
} // namespace Luau
|