MLIR 24.0.0git
LLVMOps.h
Go to the documentation of this file.
1//===- LLVMOps.h - LLVM operation 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#ifndef MLIR_LIB_DIALECT_LLVMIR_IR_LLVMOPS_H
10#define MLIR_LIB_DIALECT_LLVMIR_IR_LLVMOPS_H
11
13
14#include <optional>
15
16namespace mlir::LLVM {
17
18mlir::Type getI1SameShape(mlir::Type type);
19mlir::LLVM::LLVMStructType getValAndBoolStructType(mlir::Type valType);
20
21mlir::ParseResult parseCmpPredicate(mlir::OpAsmParser &parser,
22 mlir::LLVM::ICmpPredicateAttr &predicate);
23mlir::ParseResult parseCmpPredicate(mlir::OpAsmParser &parser,
24 mlir::LLVM::FCmpPredicateAttr &predicate);
26 mlir::LLVM::ICmpPredicateAttr predicate);
28 mlir::LLVM::FCmpPredicateAttr predicate);
29
31 mlir::LLVM::LinkageAttr val);
33 mlir::LLVM::LinkageAttr &val);
34
36 mlir::OperandRangeRange opBundleOperands,
37 mlir::TypeRangeRange opBundleOperandTypes,
38 std::optional<mlir::ArrayAttr> opBundleTags);
39std::optional<mlir::ParseResult> parseOpBundles(
42 &opBundleOperands,
44 mlir::ArrayAttr &opBundleTags);
45
46mlir::ParseResult parseSwitchOpCases(
47 mlir::OpAsmParser &parser, mlir::Type flagType,
53void printSwitchOpCases(mlir::OpAsmPrinter &p, mlir::LLVM::SwitchOp op,
54 mlir::Type flagType,
56 mlir::SuccessorRange caseDestinations,
57 mlir::OperandRangeRange caseOperands,
58 const mlir::TypeRangeRange &caseOperandTypes);
59
60mlir::ParseResult parseGEPIndices(
61 mlir::OpAsmParser &parser,
63 mlir::DenseI32ArrayAttr &rawConstantIndices);
64void printGEPIndices(mlir::OpAsmPrinter &printer, mlir::LLVM::GEPOp gepOp,
66 mlir::DenseI32ArrayAttr rawConstantIndices);
67
69 mlir::AsmParser &parser, mlir::Type &valueType, mlir::Type containerType,
73 mlir::Type valueType,
74 mlir::Type containerType,
76
77mlir::ParseResult parseShuffleType(mlir::AsmParser &parser, mlir::Type v1Type,
78 mlir::Type &resType,
81 mlir::Type v1Type, mlir::Type resType,
83
84mlir::ParseResult parseIndirectBrOpSucessors(
85 mlir::OpAsmParser &parser, mlir::Type &flagType,
86 mlir::SmallVectorImpl<mlir::Block *> &succOperandBlocks,
91 mlir::LLVM::IndirectBrOp op,
92 mlir::Type flagType, mlir::SuccessorRange succs,
93 mlir::OperandRangeRange succOperands,
94 const mlir::TypeRangeRange &succOperandsTypes);
95
96} // namespace mlir::LLVM
97
98#include "mlir/Dialect/LLVMIR/LLVMAllOps.h.inc"
99
100#endif // MLIR_LIB_DIALECT_LLVMIR_IR_LLVMOPS_H
This base class exposes generic asm parser hooks, usable across the various derived parsers.
This base class exposes generic asm printer hooks, usable across the various derived printers.
An attribute that represents a reference to a dense integer vector or tensor object.
The OpAsmParser has methods for interacting with the asm parser: parsing things from it,...
This is a pure-virtual base class that exposes the asmprinter hooks necessary to implement a custom p...
This class represents a contiguous range of operand ranges, e.g.
Definition ValueRange.h:85
This class implements the operand iterators for the Operation class.
Definition ValueRange.h:44
Operation is the basic unit of execution within MLIR.
Definition Operation.h:87
This class implements the successor iterators for Block.
This class provides an abstraction for a range of TypeRange.
Definition TypeRange.h:107
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Definition Types.h:74
mlir::ParseResult parseCmpPredicate(mlir::OpAsmParser &parser, mlir::LLVM::ICmpPredicateAttr &predicate)
void printCmpPredicate(mlir::OpAsmPrinter &printer, mlir::Operation *, mlir::LLVM::ICmpPredicateAttr predicate)
mlir::ParseResult parseInsertExtractValueElementType(mlir::AsmParser &parser, mlir::Type &valueType, mlir::Type containerType, mlir::DenseI64ArrayAttr position)
Infer the value type from the container type and position.
void printLLVMLinkage(mlir::OpAsmPrinter &p, mlir::Operation *, mlir::LLVM::LinkageAttr val)
void printOpBundles(mlir::OpAsmPrinter &p, mlir::Operation *op, mlir::OperandRangeRange opBundleOperands, mlir::TypeRangeRange opBundleOperandTypes, std::optional< mlir::ArrayAttr > opBundleTags)
mlir::ParseResult parseShuffleType(mlir::AsmParser &parser, mlir::Type v1Type, mlir::Type &resType, mlir::DenseI32ArrayAttr mask)
Build the result type of a shuffle vector operation.
void printShuffleType(mlir::AsmPrinter &printer, mlir::Operation *op, mlir::Type v1Type, mlir::Type resType, mlir::DenseI32ArrayAttr mask)
Nothing to do when the result type is inferred.
mlir::Type getI1SameShape(mlir::Type type)
Returns a boolean type that has the same shape as type.
void printSwitchOpCases(mlir::OpAsmPrinter &p, mlir::LLVM::SwitchOp op, mlir::Type flagType, mlir::DenseIntElementsAttr caseValues, mlir::SuccessorRange caseDestinations, mlir::OperandRangeRange caseOperands, const mlir::TypeRangeRange &caseOperandTypes)
void printIndirectBrOpSucessors(mlir::OpAsmPrinter &p, mlir::LLVM::IndirectBrOp op, mlir::Type flagType, mlir::SuccessorRange succs, mlir::OperandRangeRange succOperands, const mlir::TypeRangeRange &succOperandsTypes)
mlir::ParseResult parseIndirectBrOpSucessors(mlir::OpAsmParser &parser, mlir::Type &flagType, mlir::SmallVectorImpl< mlir::Block * > &succOperandBlocks, mlir::SmallVectorImpl< mlir::SmallVector< mlir::OpAsmParser::UnresolvedOperand > > &succOperands, mlir::SmallVectorImpl< mlir::SmallVector< mlir::Type > > &succOperandsTypes)
mlir::ParseResult parseLLVMLinkage(mlir::OpAsmParser &p, mlir::LLVM::LinkageAttr &val)
mlir::LLVM::LLVMStructType getValAndBoolStructType(mlir::Type valType)
Returns an LLVM struct type that contains a value type and a boolean type.
std::optional< mlir::ParseResult > parseOpBundles(mlir::OpAsmParser &p, mlir::SmallVector< mlir::SmallVector< mlir::OpAsmParser::UnresolvedOperand > > &opBundleOperands, mlir::SmallVector< mlir::SmallVector< mlir::Type > > &opBundleOperandTypes, mlir::ArrayAttr &opBundleTags)
mlir::ParseResult parseGEPIndices(mlir::OpAsmParser &parser, mlir::SmallVectorImpl< mlir::OpAsmParser::UnresolvedOperand > &indices, mlir::DenseI32ArrayAttr &rawConstantIndices)
void printGEPIndices(mlir::OpAsmPrinter &printer, mlir::LLVM::GEPOp gepOp, mlir::OperandRange indices, mlir::DenseI32ArrayAttr rawConstantIndices)
void printInsertExtractValueElementType(mlir::AsmPrinter &printer, mlir::Operation *op, mlir::Type valueType, mlir::Type containerType, mlir::DenseI64ArrayAttr position)
Nothing to print for an inferred type.
mlir::ParseResult parseSwitchOpCases(mlir::OpAsmParser &parser, mlir::Type flagType, mlir::DenseIntElementsAttr &caseValues, mlir::SmallVectorImpl< mlir::Block * > &caseDestinations, mlir::SmallVectorImpl< mlir::SmallVector< mlir::OpAsmParser::UnresolvedOperand > > &caseOperands, mlir::SmallVectorImpl< mlir::SmallVector< mlir::Type > > &caseOperandTypes)
<cases> ::= [ (case (, case )* )?
detail::DenseArrayAttrImpl< int64_t > DenseI64ArrayAttr
detail::DenseArrayAttrImpl< int32_t > DenseI32ArrayAttr