aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/IntermediateRepresentation/MemoryOperand.cs
blob: 56d07288a019e7531324f8cdd0af3f2b466242df (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
namespace ARMeilleure.IntermediateRepresentation
{
    class MemoryOperand : Operand
    {
        public Operand BaseAddress { get; set; }
        public Operand Index       { get; set; }

        public Multiplier Scale { get; private set; }

        public int Displacement { get; private set; }

        public MemoryOperand() { }

        public MemoryOperand With(
            OperandType type,
            Operand     baseAddress,
            Operand     index        = null,
            Multiplier  scale        = Multiplier.x1,
            int         displacement = 0)
        {
            With(OperandKind.Memory, type);
            BaseAddress  = baseAddress;
            Index        = index;
            Scale        = scale;
            Displacement = displacement;
            return this;
        }
    }
}