FLANG
DataLayout.h
1//===-- Optimizer/Support/DataLayout.h --------------------------*- 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// Coding style: https://mlir.llvm.org/getting_started/DeveloperGuide/
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef FORTRAN_OPTIMIZER_SUPPORT_DATALAYOUT_H
14#define FORTRAN_OPTIMIZER_SUPPORT_DATALAYOUT_H
15
16#include "mlir/Interfaces/DataLayoutInterfaces.h"
17#include <optional>
18
19namespace mlir {
20class ModuleOp;
21namespace gpu {
22class GPUModuleOp;
23} // namespace gpu
24} // namespace mlir
25
26namespace llvm {
27class DataLayout;
28} // namespace llvm
29
30namespace fir::support {
36void setMLIRDataLayout(mlir::ModuleOp mlirModule, const llvm::DataLayout &dl);
37void setMLIRDataLayout(mlir::gpu::GPUModuleOp mlirModule,
38 const llvm::DataLayout &dl);
39
44void setMLIRDataLayoutFromAttributes(mlir::ModuleOp mlirModule,
45 bool allowDefaultLayout);
46void setMLIRDataLayoutFromAttributes(mlir::gpu::GPUModuleOp mlirModule,
47 bool allowDefaultLayout);
48
54std::optional<mlir::DataLayout>
55getOrSetMLIRDataLayout(mlir::ModuleOp mlirModule,
56 bool allowDefaultLayout = false);
57std::optional<mlir::DataLayout>
58getOrSetMLIRDataLayout(mlir::gpu::GPUModuleOp mlirModule,
59 bool allowDefaultLayout = false);
60
61} // namespace fir::support
62
63#endif // FORTRAN_OPTIMIZER_SUPPORT_DATALAYOUT_H
Definition: AbstractConverter.h:27