blob: 8bf340304e9f38a77941a11c27e3fa79c326b198 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
using System.Diagnostics;
namespace Ryujinx.Cpu.LightningJit.CodeGen
{
readonly struct Operand
{
public readonly OperandKind Kind { get; }
public readonly OperandType Type { get; }
public readonly ulong Value { get; }
public Operand(OperandKind kind, OperandType type, ulong value)
{
Kind = kind;
Type = type;
Value = value;
}
public Operand(int index, RegisterType regType, OperandType type) : this(OperandKind.Register, type, (ulong)((int)regType << 24 | index))
{
}
public Operand(OperandType type, ulong value) : this(OperandKind.Constant, type, value)
{
}
public readonly Register GetRegister()
{
Debug.Assert(Kind == OperandKind.Register);
return new Register((int)Value & 0xffffff, (RegisterType)(Value >> 24));
}
public readonly int AsInt32()
{
return (int)Value;
}
}
}
|