MLIR 23.0.0git
OpenACCUtilsType.h
Go to the documentation of this file.
1//===- OpenACCUtilsType.h - OpenACC Type Utilities -------------*- C++ -*-===//
2//
3// Part of the LLVM 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 type utilities for OpenACC.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef MLIR_DIALECT_OPENACC_OPENACCUTILSTYPE_H_
14#define MLIR_DIALECT_OPENACC_OPENACCUTILSTYPE_H_
15
16#include "llvm/Support/TypeSize.h"
17#include <optional>
18#include <utility>
19
20namespace mlir {
21class DataLayout;
22class ModuleOp;
23class Type;
24
25namespace acc {
26
27class OpenACCSupport;
28
29using TypeSizeAndAlignment = std::pair<llvm::TypeSize, llvm::TypeSize>;
30
31/// Returns the size and ABI alignment in bytes.
32///
33/// For aggregate structures and arrays, padding between members or elements is
34/// not taken into account. The result is a close estimate suitable for early
35/// OpenACC layout decisions, but not a complete ABI guarantee. For final size
36/// computations, use LLVM materialized types.
37///
38/// When \p support is provided, aggregate element types are sized by recursing
39/// through \p support so dialect-specific implementations can handle nested
40/// types.
41///
42/// Returns std::nullopt when the size is not statically computable or the type
43/// is not supported.
44std::optional<TypeSizeAndAlignment>
45getTypeSizeAndAlignment(Type ty, ModuleOp module, const DataLayout &dl,
46 OpenACCSupport *support = nullptr);
47
48/// Same as above, obtaining \p dl from \p module via getDataLayout.
49std::optional<TypeSizeAndAlignment>
50getTypeSizeAndAlignment(Type ty, ModuleOp module,
51 OpenACCSupport *support = nullptr);
52
53} // namespace acc
54} // namespace mlir
55
56#endif // MLIR_DIALECT_OPENACC_OPENACCUTILSTYPE_H_
The main mechanism for performing data layout queries.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Definition Types.h:74
std::optional< TypeSizeAndAlignment > getTypeSizeAndAlignment(Type ty, ModuleOp module, const DataLayout &dl, OpenACCSupport *support=nullptr)
Returns the size and ABI alignment in bytes.
std::pair< llvm::TypeSize, llvm::TypeSize > TypeSizeAndAlignment
Include the generated interface declarations.