aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/CodeGen/RegisterAllocators/StackAllocator.cs
blob: a6233d6eef60fb18db0f9e15a48b8e69ca97941a (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
using ARMeilleure.Common;
using ARMeilleure.IntermediateRepresentation;
using System;

namespace ARMeilleure.CodeGen.RegisterAllocators
{
    class StackAllocator
    {
        private int _offset;

        public int TotalSize => _offset;

        public int Allocate(OperandType type)
        {
            return Allocate(type.GetSizeInBytes());
        }

        public int Allocate(int sizeInBytes)
        {
            int offset = _offset;

            _offset += sizeInBytes;

            return offset;
        }
    }
}