My Project
LayoutUtils.h
Go to the documentation of this file.
1 //===-- LayoutUtils.h - Decorate composite type with layout information ---===//
2 //
3 // Part of the MLIR Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines utilities used to get alignment and layout information for
10 // types in SPIR-V dialect.
11 //
12 //===----------------------------------------------------------------------===//
13 #ifndef MLIR_DIALECT_SPIRV_LAYOUTUTILS_H_
14 #define MLIR_DIALECT_SPIRV_LAYOUTUTILS_H_
15 
16 #include <cstdint>
17 
18 namespace mlir {
19 class Type;
20 class VectorType;
21 namespace spirv {
22 class StructType;
23 class ArrayType;
24 } // namespace spirv
25 
47 public:
48  using Size = uint64_t;
49 
52  static spirv::StructType decorateType(spirv::StructType structType,
53  Size &size, Size &alignment);
58  static bool isLegalType(Type type);
59 
60 private:
61  static Type decorateType(Type type, Size &size, Size &alignment);
62  static Type decorateType(VectorType vectorType, Size &size, Size &alignment);
63  static Type decorateType(spirv::ArrayType arrayType, Size &size,
64  Size &alignment);
66  static Size getScalarTypeAlignment(Type scalarType);
67 };
68 
69 } // namespace mlir
70 
71 #endif // MLIR_DIALECT_SPIRV_LAYOUTUTILS_H_
Definition: InferTypeOpInterface.cpp:20
Definition: Attributes.h:139
Definition: LayoutUtils.h:46
uint64_t Size
Definition: LayoutUtils.h:48
Definition: Types.h:84
Definition: StandardTypes.h:256
Definition: SPIRVTypes.h:162
Definition: SPIRVTypes.h:73