clang 24.0.0git
CIRDataLayoutSpec.h
Go to the documentation of this file.
1//===-- CIRDataLayoutSpec.h - DLTI data layout for CIR modules --*- 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 declares a helper that attaches the DLTI data-layout spec to a CIR
10// module.
11//
12//===----------------------------------------------------------------------===//
13#ifndef CLANG_CIR_CIRDATALAYOUTSPEC_H
14#define CLANG_CIR_CIRDATALAYOUTSPEC_H
15
16namespace llvm {
17class DataLayout;
18} // namespace llvm
19
20namespace mlir {
21class ModuleOp;
22} // namespace mlir
23
24namespace cir {
25
26/// Translate \p dl into a DLTI data-layout spec and attach it to \p mod.
27/// On top of the plain mlir::translateDataLayout entries this adds:
28///
29/// - a #cir.ptr_spec entry keyed on !cir.ptr, which CIR pointer types read
30/// for their size and alignment. Without it pointer widths default to 64
31/// bits.
32/// - a #cir.bitint_spec entry keyed on !cir.int<u, 1, bitint>.
33/// \p bitIntMaxAlign is TargetInfo::getBitIntMaxAlign(), in bits. _BitInt
34/// language alignment clamps to that cap.
35/// - a #cir.vector_spec entry keyed on !cir.vector<1 x !cir.int<u, 8>>,
36/// present when \p maxVectorAlign is non-zero. That value is
37/// TargetInfo::getMaxVectorAlign(), in bits. Vector language alignment
38/// clamps to that cap. Zero means the target imposes no cap, and the entry
39/// is omitted.
40void setMLIRDataLayout(mlir::ModuleOp mod, const llvm::DataLayout &dl,
41 unsigned bitIntMaxAlign, unsigned maxVectorAlign);
42
43} // namespace cir
44
45#endif // CLANG_CIR_CIRDATALAYOUTSPEC_H
void setMLIRDataLayout(mlir::ModuleOp mod, const llvm::DataLayout &dl, unsigned bitIntMaxAlign, unsigned maxVectorAlign)
Translate dl into a DLTI data-layout spec and attach it to mod.
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30