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

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;
        }
    }
}