/ src / ARMeilleure / CodeGen / RegisterAllocators / StackAllocator.cs
StackAllocator.cs
 1  using ARMeilleure.IntermediateRepresentation;
 2  
 3  namespace ARMeilleure.CodeGen.RegisterAllocators
 4  {
 5      class StackAllocator
 6      {
 7          private int _offset;
 8  
 9          public int TotalSize => _offset;
10  
11          public int Allocate(OperandType type)
12          {
13              return Allocate(type.GetSizeInBytes());
14          }
15  
16          public int Allocate(int sizeInBytes)
17          {
18              int offset = _offset;
19  
20              _offset += sizeInBytes;
21  
22              return offset;
23          }
24      }
25  }