MLIR 22.0.0git
EmitC.h
Go to the documentation of this file.
1//===- EmitC.h - EmitC Dialect ----------------------------------*- 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 EmitC in MLIR.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef MLIR_DIALECT_EMITC_IR_EMITC_H
14#define MLIR_DIALECT_EMITC_IR_EMITC_H
15
18#include "mlir/IR/Builders.h"
19#include "mlir/IR/BuiltinOps.h"
21#include "mlir/IR/Dialect.h"
26
27#include "mlir/Dialect/EmitC/IR/EmitCDialect.h.inc"
28#include "mlir/Dialect/EmitC/IR/EmitCEnums.h.inc"
29
30#include <variant>
31
32namespace mlir {
33namespace emitc {
34void buildTerminatedBody(OpBuilder &builder, Location loc);
35
36/// Determines whether \p type is valid in EmitC.
37bool isSupportedEmitCType(mlir::Type type);
38
39/// Determines whether \p type is a valid integer type in EmitC.
40bool isSupportedIntegerType(mlir::Type type);
41
42/// Determines whether \p type is integer like, i.e. it's a supported integer,
43/// an index or opaque type.
44bool isIntegerIndexOrOpaqueType(Type type);
45
46/// Determines whether \p type is a valid floating-point type in EmitC.
47bool isSupportedFloatType(mlir::Type type);
48
49/// Determines whether \p type is a emitc.size_t/ssize_t type.
50bool isPointerWideType(mlir::Type type);
51
52// Either a literal string, or an placeholder for the fmtArgs.
53struct Placeholder {};
54using ReplacementItem = std::variant<StringRef, Placeholder>;
55
56/// Determines whether \p type is a valid fundamental C++ type in EmitC.
58
59} // namespace emitc
60} // namespace mlir
61
62#define GET_ATTRDEF_CLASSES
63#include "mlir/Dialect/EmitC/IR/EmitCAttributes.h.inc"
64
65#define GET_TYPEDEF_CLASSES
66#include "mlir/Dialect/EmitC/IR/EmitCTypes.h.inc"
67
68#define GET_OP_CLASSES
69#include "mlir/Dialect/EmitC/IR/EmitC.h.inc"
70
71#endif // MLIR_DIALECT_EMITC_IR_EMITC_H
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Definition Types.h:74
void buildTerminatedBody(OpBuilder &builder, Location loc)
Default callback for builders of ops carrying a region.
Definition EmitC.cpp:57
std::variant< StringRef, Placeholder > ReplacementItem
Definition EmitC.h:54
bool isFundamentalType(mlir::Type type)
Determines whether type is a valid fundamental C++ type in EmitC.
Definition EmitC.cpp:136
bool isSupportedFloatType(mlir::Type type)
Determines whether type is a valid floating-point type in EmitC.
Definition EmitC.cpp:116
bool isSupportedEmitCType(mlir::Type type)
Determines whether type is valid in EmitC.
Definition EmitC.cpp:61
bool isPointerWideType(mlir::Type type)
Determines whether type is a emitc.size_t/ssize_t type.
Definition EmitC.cpp:131
bool isIntegerIndexOrOpaqueType(Type type)
Determines whether type is integer like, i.e.
Definition EmitC.cpp:111
bool isSupportedIntegerType(mlir::Type type)
Determines whether type is a valid integer type in EmitC.
Definition EmitC.cpp:95
Include the generated interface declarations.