clang 24.0.0git
CIROpDefinitions.h
Go to the documentation of this file.
1//===- CIROpDefinitions.h - CIR op implementation helpers -------*- 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 header declares the custom directive parsers and printers implemented
10// in CIRDialect.cpp and referenced by the TableGen-generated CIR operation
11// definitions, which are compiled in separate shards.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef CLANG_LIB_CIR_DIALECT_IR_CIROPDEFINITIONS_H
16#define CLANG_LIB_CIR_DIALECT_IR_CIROPDEFINITIONS_H
17
19
20#include "mlir/IR/OpImplementation.h"
21
22namespace cir {
23
24mlir::ParseResult parseOmittedTerminatorRegion(mlir::OpAsmParser &parser,
25 mlir::Region &region);
26void printOmittedTerminatorRegion(mlir::OpAsmPrinter &printer, cir::ScopeOp &op,
27 mlir::Region &region);
28
29mlir::OptionalParseResult
30parseGlobalMemorySpace(mlir::AsmParser &p,
31 mlir::ptr::MemorySpaceAttrInterface &attr);
32void printGlobalMemorySpace(mlir::AsmPrinter &printer, cir::GlobalOp op,
33 mlir::ptr::MemorySpaceAttrInterface attr);
34
35mlir::ParseResult parseAssumeBundle(
36 mlir::OpAsmParser &p, cir::AssumeBundleKindAttr &bundleKindAttr,
38 llvm::SmallVector<mlir::Type, 1> &bundleArgTypes);
39void printAssumeBundle(mlir::OpAsmPrinter &p, cir::AssumeOp op,
40 cir::AssumeBundleKindAttr kindAttr,
41 mlir::OperandRange bundleArgs,
42 mlir::TypeRange bundleArgTypes);
43
45 mlir::OpAsmParser &parser, mlir::Type &flagType,
46 llvm::SmallVectorImpl<mlir::Block *> &succOperandBlocks,
50void printIndirectBrOpSucessors(mlir::OpAsmPrinter &p, cir::IndirectBrOp op,
51 mlir::Type flagType, mlir::SuccessorRange succs,
52 mlir::OperandRangeRange succOperands,
53 const mlir::TypeRangeRange &succOperandsTypes);
54
55mlir::ParseResult parseSwitchFlatOpCases(
56 mlir::OpAsmParser &parser, mlir::Type flagType, mlir::ArrayAttr &caseValues,
61void printSwitchFlatOpCases(mlir::OpAsmPrinter &p, cir::SwitchFlatOp op,
62 mlir::Type flagType, mlir::ArrayAttr caseValues,
63 mlir::SuccessorRange caseDestinations,
64 mlir::OperandRangeRange caseOperands,
65 const mlir::TypeRangeRange &caseOperandTypes);
66
67mlir::ParseResult parseComdatName(mlir::OpAsmParser &parser,
68 mlir::StringAttr &comdatAttr);
69void printComdatName(mlir::OpAsmPrinter &p, cir::GlobalOp op,
70 mlir::StringAttr comdat);
71
73 mlir::OpAsmParser &parser, mlir::TypeAttr &typeAttr,
74 mlir::Attribute &initialValueAttr, mlir::Region &ctorRegion,
75 mlir::Region &dtorRegion);
76void printGlobalOpTypeAndInitialValue(mlir::OpAsmPrinter &p, cir::GlobalOp op,
77 mlir::TypeAttr type,
78 mlir::Attribute initAttr,
79 mlir::Region &ctorRegion,
80 mlir::Region &dtorRegion);
81
82mlir::ParseResult parseCopyTypes(mlir::OpAsmParser &parser, mlir::Type &srcType,
83 mlir::Type &dstType);
84void printCopyTypes(mlir::OpAsmPrinter &printer, mlir::Operation *,
85 mlir::Type srcType, mlir::Type dstType);
86
87mlir::ParseResult parseTryHandlerRegions(
88 mlir::OpAsmParser &parser,
89 llvm::SmallVectorImpl<std::unique_ptr<mlir::Region>> &handlerRegions,
90 mlir::ArrayAttr &handlerTypes);
91void printTryHandlerRegions(mlir::OpAsmPrinter &printer, cir::TryOp op,
92 mlir::MutableArrayRef<mlir::Region> handlerRegions,
93 mlir::ArrayAttr handlerTypes);
94
96 mlir::OpAsmParser &parser, mlir::ArrayAttr &catchTypes,
97 llvm::SmallVectorImpl<mlir::Block *> &catchDestinations,
98 mlir::Block *&defaultDestination, mlir::UnitAttr &defaultIsCatchAll);
99void printEhDispatchDestinations(mlir::OpAsmPrinter &p, cir::EhDispatchOp op,
100 mlir::ArrayAttr catchTypes,
101 mlir::SuccessorRange catchDestinations,
102 mlir::Block *defaultDestination,
103 mlir::UnitAttr defaultIsCatchAll);
104
105} // namespace cir
106
107#endif // CLANG_LIB_CIR_DIALECT_IR_CIROPDEFINITIONS_H
mlir::ParseResult parseEhDispatchDestinations(mlir::OpAsmParser &parser, mlir::ArrayAttr &catchTypes, llvm::SmallVectorImpl< mlir::Block * > &catchDestinations, mlir::Block *&defaultDestination, mlir::UnitAttr &defaultIsCatchAll)
mlir::ParseResult parseOmittedTerminatorRegion(mlir::OpAsmParser &parser, mlir::Region &region)
void printCopyTypes(mlir::OpAsmPrinter &printer, mlir::Operation *, mlir::Type srcType, mlir::Type dstType)
mlir::ParseResult parseCopyTypes(mlir::OpAsmParser &parser, mlir::Type &srcType, mlir::Type &dstType)
void printComdatName(mlir::OpAsmPrinter &p, cir::GlobalOp op, mlir::StringAttr comdat)
mlir::ParseResult parseGlobalOpTypeAndInitialValue(mlir::OpAsmParser &parser, mlir::TypeAttr &typeAttr, mlir::Attribute &initialValueAttr, mlir::Region &ctorRegion, mlir::Region &dtorRegion)
mlir::ParseResult parseSwitchFlatOpCases(mlir::OpAsmParser &parser, mlir::Type flagType, mlir::ArrayAttr &caseValues, llvm::SmallVectorImpl< mlir::Block * > &caseDestinations, llvm::SmallVectorImpl< llvm::SmallVector< mlir::OpAsmParser::UnresolvedOperand > > &caseOperands, llvm::SmallVectorImpl< llvm::SmallVector< mlir::Type > > &caseOperandTypes)
mlir::ParseResult parseAssumeBundle(mlir::OpAsmParser &p, cir::AssumeBundleKindAttr &bundleKindAttr, llvm::SmallVector< mlir::OpAsmParser::UnresolvedOperand, 4 > &bundleArgs, llvm::SmallVector< mlir::Type, 1 > &bundleArgTypes)
mlir::ParseResult parseComdatName(mlir::OpAsmParser &parser, mlir::StringAttr &comdatAttr)
mlir::OptionalParseResult parseGlobalMemorySpace(mlir::AsmParser &p, mlir::ptr::MemorySpaceAttrInterface &attr)
void printOmittedTerminatorRegion(mlir::OpAsmPrinter &printer, cir::ScopeOp &op, mlir::Region &region)
void printTryHandlerRegions(mlir::OpAsmPrinter &printer, cir::TryOp op, mlir::MutableArrayRef< mlir::Region > handlerRegions, mlir::ArrayAttr handlerTypes)
void printIndirectBrOpSucessors(mlir::OpAsmPrinter &p, cir::IndirectBrOp op, mlir::Type flagType, mlir::SuccessorRange succs, mlir::OperandRangeRange succOperands, const mlir::TypeRangeRange &succOperandsTypes)
mlir::ParseResult parseTryHandlerRegions(mlir::OpAsmParser &parser, llvm::SmallVectorImpl< std::unique_ptr< mlir::Region > > &handlerRegions, mlir::ArrayAttr &handlerTypes)
void printGlobalMemorySpace(mlir::AsmPrinter &printer, cir::GlobalOp op, mlir::ptr::MemorySpaceAttrInterface attr)
mlir::ParseResult parseIndirectBrOpSucessors(mlir::OpAsmParser &parser, mlir::Type &flagType, llvm::SmallVectorImpl< mlir::Block * > &succOperandBlocks, llvm::SmallVectorImpl< llvm::SmallVector< mlir::OpAsmParser::UnresolvedOperand > > &succOperands, llvm::SmallVectorImpl< llvm::SmallVector< mlir::Type > > &succOperandsTypes)
void printGlobalOpTypeAndInitialValue(mlir::OpAsmPrinter &p, cir::GlobalOp op, mlir::TypeAttr type, mlir::Attribute initAttr, mlir::Region &ctorRegion, mlir::Region &dtorRegion)
void printEhDispatchDestinations(mlir::OpAsmPrinter &p, cir::EhDispatchOp op, mlir::ArrayAttr catchTypes, mlir::SuccessorRange catchDestinations, mlir::Block *defaultDestination, mlir::UnitAttr defaultIsCatchAll)
void printAssumeBundle(mlir::OpAsmPrinter &p, cir::AssumeOp op, cir::AssumeBundleKindAttr kindAttr, mlir::OperandRange bundleArgs, mlir::TypeRange bundleArgTypes)
void printSwitchFlatOpCases(mlir::OpAsmPrinter &p, cir::SwitchFlatOp op, mlir::Type flagType, mlir::ArrayAttr caseValues, mlir::SuccessorRange caseDestinations, mlir::OperandRangeRange caseOperands, const mlir::TypeRangeRange &caseOperandTypes)