[NFCI] Add StackOffset class and base classes for ElementCount, TypeSize.
authorSander de Smalen <sander.desmalen@arm.com>
Mon, 2 Nov 2020 21:32:57 +0000 (21:32 +0000)
committerSander de Smalen <sander.desmalen@arm.com>
Tue, 3 Nov 2020 09:41:39 +0000 (09:41 +0000)
commit1667d23e585c13835c66b8d61c2d5ef93f196dd5
treef4edfb7d2b96a82cd0324c506846195b15337467
parent4b9fa3b705c8280e71908f4cc8c115320ef48316
[NFCI] Add StackOffset class and base classes for ElementCount, TypeSize.

This patch adds a linear polynomial base class, called LinearPolyBase, which
serves as a base class for StackOffset. It tries to represent a linear
polynomial like:

  c0 * scale0 + c1 * scale1 + ... + cK * scaleK

where the scale is implicit, meaning that only the coefficients are
encoded.

This patch also adds a univariate linear polynomial, which serves as
a base class for ElementCount and TypeSize. This tries to represent a
linear polynomial where only one dimension can be set at any one time,
i.e. a TypeSize is either fixed-sized, or scalable-sized, but cannot be
a combination of the two.

  class LinearPolyBase
     ^
     |
     +---- class StackOffset  (dimensions = 2 (fixed/scalable), type = int64_t)

  class UnivariateLinearPolyBase
     |
     |
     +---- class LinearPolySize (dimensions = 2 (fixed/scalable))
                  ^
                  |
                  +-------- class ElementCount  (type = unsigned)
                  |
                  |
                  +-------- class TypeSize      (type = uint64_t)

Reviewed By: ctetreau, david-arm

Differential Revision: https://reviews.llvm.org/D88982
llvm/include/llvm/Support/TypeSize.h
llvm/unittests/Support/CMakeLists.txt
llvm/unittests/Support/LinearPolyBaseTest.cpp [new file with mode: 0644]