[PATCH] D88982: [NFCI] Add LinearPolyBase as base class for ElementCount, TypeSize and StackOffset.

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 22 14:46:35 PDT 2020


ctetreau added inline comments.


================
Comment at: llvm/include/llvm/Support/TypeSize.h:34
 
-// TODO: This class will be redesigned in a later patch that introduces full
-// polynomial behaviour, i.e. the ability to have composites made up of both
-// fixed and scalable sizes.
-template <typename T> class PolySize {
-protected:
-  T MinVal;        // The minimum value that it could be.
-  bool IsScalable; // If true, the total value is determined by multiplying
-                   // 'MinVal' by a runtime determinded quantity, 'vscale'.
+template <typename LeafTy> struct LinearPolyBaseTypeTraits {};
 
----------------
Couldn't we just require that any type used as `LeafTy` have a `ScalarTy` typedef?


================
Comment at: llvm/include/llvm/Support/TypeSize.h:158-161
+class StackOffset;
+template <> struct LinearPolyBaseTypeTraits<StackOffset> {
+  using ScalarTy = int64_t;
+};
----------------
Does this need to be inside the `NewStackOffset` namespace?  I believe that you are forward declaring `llvm::StackOffset` and then creating the type traits for it, not `llvm::NewStackOffset::StackOffset`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88982/new/

https://reviews.llvm.org/D88982



More information about the llvm-commits mailing list