MLIR  21.0.0git
Macros | Functions
IRDL.cpp File Reference
#include "mlir/Dialect/IRDL/IR/IRDL.h"
#include "mlir/Dialect/IRDL/IRDLSymbols.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/ExtensibleDialect.h"
#include "mlir/IR/OpDefinition.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/Operation.h"
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetOperations.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/IR/Metadata.h"
#include "llvm/Support/Casting.h"
#include "mlir/Dialect/IRDL/IR/IRDL.cpp.inc"
#include "mlir/Dialect/IRDL/IR/IRDLDialect.cpp.inc"
#include "mlir/Dialect/IRDL/IR/IRDLOps.cpp.inc"
#include "mlir/Dialect/IRDL/IR/IRDLTypesGen.cpp.inc"
#include "mlir/Dialect/IRDL/IR/IRDLAttributes.cpp.inc"
#include "mlir/Dialect/IRDL/IR/IRDLInterfaces.cpp.inc"
#include "mlir/Dialect/IRDL/IR/IRDLEnums.cpp.inc"

Go to the source code of this file.

Macros

#define GET_OP_LIST
 
#define GET_TYPEDEF_LIST
 
#define GET_ATTRDEF_LIST
 
#define GET_TYPEDEF_CLASSES
 
#define GET_ATTRDEF_CLASSES
 
#define GET_OP_CLASSES
 

Functions

static ParseResult parseSingleBlockRegion (OpAsmParser &p, Region &region)
 Parse a region, and add a single block if the region is empty. More...
 
static void printSingleBlockRegion (OpAsmPrinter &p, Operation *op, Region &region)
 
static LogicalResult verifyNames (Operation *op, StringRef kindName, ArrayAttr names, size_t numOperands)
 
template<typename ValueListOp >
static LogicalResult verifyOperandsResultsCommon (ValueListOp op, StringRef kindName)
 
static LogicalResult checkSymbolIsTypeOrAttribute (SymbolTableCollection &symbolTable, Operation *source, SymbolRefAttr symbol)
 Finds whether the provided symbol is an IRDL type or attribute definition. More...
 
static ParseResult parseValueWithVariadicity (OpAsmParser &p, OpAsmParser::UnresolvedOperand &operand, VariadicityAttr &variadicityAttr)
 Parse a value with its variadicity first. More...
 
static ParseResult parseNamedValueListImpl (OpAsmParser &p, SmallVectorImpl< OpAsmParser::UnresolvedOperand > &operands, ArrayAttr &valueNamesAttr, VariadicityArrayAttr *variadicityAttr)
 
static ParseResult parseNamedValueList (OpAsmParser &p, SmallVectorImpl< OpAsmParser::UnresolvedOperand > &operands, ArrayAttr &valueNamesAttr)
 Parse a list of named values. More...
 
static ParseResult parseNamedValueListWithVariadicity (OpAsmParser &p, SmallVectorImpl< OpAsmParser::UnresolvedOperand > &operands, ArrayAttr &valueNamesAttr, VariadicityArrayAttr &variadicityAttr)
 Parse a list of named values with their variadicities first. More...
 
static void printNamedValueListImpl (OpAsmPrinter &p, Operation *op, OperandRange operands, ArrayAttr valueNamesAttr, VariadicityArrayAttr variadicityAttr)
 
static void printNamedValueList (OpAsmPrinter &p, Operation *op, OperandRange operands, ArrayAttr valueNamesAttr)
 Print a list of named values. More...
 
static void printNamedValueListWithVariadicity (OpAsmPrinter &p, Operation *op, OperandRange operands, ArrayAttr valueNamesAttr, VariadicityArrayAttr variadicityAttr)
 Print a list of named values with their variadicities first. More...
 
static ParseResult parseAttributesOp (OpAsmParser &p, SmallVectorImpl< OpAsmParser::UnresolvedOperand > &attrOperands, ArrayAttr &attrNamesAttr)
 
static void printAttributesOp (OpAsmPrinter &p, AttributesOp op, OperandRange attrArgs, ArrayAttr attrNames)
 

Macro Definition Documentation

◆ GET_ATTRDEF_CLASSES

#define GET_ATTRDEF_CLASSES

Definition at line 433 of file IRDL.cpp.

◆ GET_ATTRDEF_LIST

#define GET_ATTRDEF_LIST

◆ GET_OP_CLASSES

#define GET_OP_CLASSES

Definition at line 436 of file IRDL.cpp.

◆ GET_OP_LIST

#define GET_OP_LIST

◆ GET_TYPEDEF_CLASSES

#define GET_TYPEDEF_CLASSES

Definition at line 428 of file IRDL.cpp.

◆ GET_TYPEDEF_LIST

#define GET_TYPEDEF_LIST

Function Documentation

◆ checkSymbolIsTypeOrAttribute()

static LogicalResult checkSymbolIsTypeOrAttribute ( SymbolTableCollection symbolTable,
Operation source,
SymbolRefAttr  symbol 
)
static

Finds whether the provided symbol is an IRDL type or attribute definition.

The source operation must be within a DialectOp.

Definition at line 217 of file IRDL.cpp.

References mlir::Operation::emitOpError(), mlir::Operation::getName(), and mlir::irdl::lookupSymbolNearDialect().

◆ parseAttributesOp()

static ParseResult parseAttributesOp ( OpAsmParser p,
SmallVectorImpl< OpAsmParser::UnresolvedOperand > &  attrOperands,
ArrayAttr &  attrNamesAttr 
)
static

◆ parseNamedValueList()

static ParseResult parseNamedValueList ( OpAsmParser p,
SmallVectorImpl< OpAsmParser::UnresolvedOperand > &  operands,
ArrayAttr &  valueNamesAttr 
)
static

Parse a list of named values.

values ::= ( (named-value (, named-value)*)? ) named-value := bare-id : ssa-value

Definition at line 322 of file IRDL.cpp.

References parseNamedValueListImpl().

◆ parseNamedValueListImpl()

static ParseResult parseNamedValueListImpl ( OpAsmParser p,
SmallVectorImpl< OpAsmParser::UnresolvedOperand > &  operands,
ArrayAttr &  valueNamesAttr,
VariadicityArrayAttr *  variadicityAttr 
)
static

◆ parseNamedValueListWithVariadicity()

static ParseResult parseNamedValueListWithVariadicity ( OpAsmParser p,
SmallVectorImpl< OpAsmParser::UnresolvedOperand > &  operands,
ArrayAttr &  valueNamesAttr,
VariadicityArrayAttr &  variadicityAttr 
)
static

Parse a list of named values with their variadicities first.

By default, the variadicity is single.

values-with-variadicity ::= ( (value-with-variadicity (, value-with-variadicity)*)? ) value-with-variadicity ::= bare-id : ("single" | "optional" | "variadic")? ssa-value

Definition at line 335 of file IRDL.cpp.

References parseNamedValueListImpl().

◆ parseSingleBlockRegion()

static ParseResult parseSingleBlockRegion ( OpAsmParser p,
Region region 
)
static

Parse a region, and add a single block if the region is empty.

If no region is parsed, create a new region with a single empty block.

Definition at line 60 of file IRDL.cpp.

References mlir::Region::empty(), mlir::OpAsmParser::parseOptionalRegion(), and mlir::Region::push_back().

◆ parseValueWithVariadicity()

static ParseResult parseValueWithVariadicity ( OpAsmParser p,
OpAsmParser::UnresolvedOperand operand,
VariadicityAttr &  variadicityAttr 
)
static

Parse a value with its variadicity first.

By default, the variadicity is single.

value-with-variadicity ::= ("single" | "optional" | "variadic")? ssa-value

Definition at line 256 of file IRDL.cpp.

References mlir::get(), mlir::AsmParser::getBuilder(), mlir::Builder::getContext(), mlir::OpAsmParser::parseOperand(), and mlir::AsmParser::parseOptionalKeyword().

Referenced by parseNamedValueListImpl().

◆ printAttributesOp()

static void printAttributesOp ( OpAsmPrinter p,
AttributesOp  op,
OperandRange  attrArgs,
ArrayAttr  attrNames 
)
static

Definition at line 403 of file IRDL.cpp.

◆ printNamedValueList()

static void printNamedValueList ( OpAsmPrinter p,
Operation op,
OperandRange  operands,
ArrayAttr  valueNamesAttr 
)
static

Print a list of named values.

values ::= ( (named-value (, named-value)*)? ) named-value := bare-id : ssa-value

Definition at line 364 of file IRDL.cpp.

References printNamedValueListImpl().

◆ printNamedValueListImpl()

static void printNamedValueListImpl ( OpAsmPrinter p,
Operation op,
OperandRange  operands,
ArrayAttr  valueNamesAttr,
VariadicityArrayAttr  variadicityAttr 
)
static

Definition at line 341 of file IRDL.cpp.

Referenced by printNamedValueList(), and printNamedValueListWithVariadicity().

◆ printNamedValueListWithVariadicity()

static void printNamedValueListWithVariadicity ( OpAsmPrinter p,
Operation op,
OperandRange  operands,
ArrayAttr  valueNamesAttr,
VariadicityArrayAttr  variadicityAttr 
)
static

Print a list of named values with their variadicities first.

By default, the variadicity is single.

values-with-variadicity ::= ( (value-with-variadicity (, value-with-variadicity)*)? ) value-with-variadicity ::= bare-id : ("single" | "optional" | "variadic")? ssa-value

Definition at line 377 of file IRDL.cpp.

References printNamedValueListImpl().

◆ printSingleBlockRegion()

static void printSingleBlockRegion ( OpAsmPrinter p,
Operation op,
Region region 
)
static

Definition at line 72 of file IRDL.cpp.

References mlir::Region::getBlocks(), and mlir::OpAsmPrinter::printRegion().

◆ verifyNames()

static LogicalResult verifyNames ( Operation op,
StringRef  kindName,
ArrayAttr  names,
size_t  numOperands 
)
static

Definition at line 124 of file IRDL.cpp.

References mlir::Operation::emitOpError(), and mlir::detail::enumerate().

Referenced by verifyOperandsResultsCommon().

◆ verifyOperandsResultsCommon()

template<typename ValueListOp >
static LogicalResult verifyOperandsResultsCommon ( ValueListOp  op,
StringRef  kindName 
)
static

Definition at line 163 of file IRDL.cpp.

References verifyNames().