MLIR 22.0.0git
EmitC.cpp File Reference
#include "mlir/Dialect/EmitC/IR/EmitC.h"
#include "mlir/Dialect/EmitC/IR/EmitCInterfaces.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/Types.h"
#include "mlir/Interfaces/FunctionImplementation.h"
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/Casting.h"
#include "mlir/Dialect/EmitC/IR/EmitCDialect.cpp.inc"
#include "mlir/Dialect/EmitC/IR/EmitC.cpp.inc"
#include "mlir/Dialect/EmitC/IR/EmitCTypes.cpp.inc"
#include "mlir/Dialect/EmitC/IR/EmitCAttributes.cpp.inc"
#include "mlir/Dialect/EmitC/IR/EmitCEnums.cpp.inc"
#include "mlir/Dialect/EmitC/IR/EmitCInterfaces.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_ATTRDEF_CLASSES
#define GET_TYPEDEF_CLASSES
#define GET_OP_CLASSES

Functions

static LogicalResult verifyInitializationAttribute (Operation *op, Attribute value)
 Check that the type of the initial value is compatible with the operations result type.
template<class ArgType>
FailureOr< SmallVector< ReplacementItem > > parseFormatString (StringRef toParse, ArgType fmtArgs, llvm::function_ref< mlir::InFlightDiagnostic()> emitError={})
 Parse a format string and return a list of its parts.
static void printEmitCGlobalOpTypeAndInitialValue (OpAsmPrinter &p, GlobalOp op, TypeAttr type, Attribute initialValue)
static Type getInitializerTypeForGlobal (Type type)
static ParseResult parseEmitCGlobalOpTypeAndInitialValue (OpAsmParser &parser, TypeAttr &typeAttr, Attribute &initialValue)
static ParseResult parseSwitchCases (OpAsmParser &parser, DenseI64ArrayAttr &cases, SmallVectorImpl< std::unique_ptr< Region > > &caseRegions)
 Parse the case regions and values.
static void printSwitchCases (OpAsmPrinter &p, Operation *op, DenseI64ArrayAttr cases, RegionRange caseRegions)
 Print the case regions and values.
static LogicalResult verifyRegion (emitc::SwitchOp op, Region &region, const Twine &name)
static void printEmitCFieldOpTypeAndInitialValue (OpAsmPrinter &p, FieldOp op, TypeAttr type, Attribute initialValue)
static Type getInitializerTypeForField (Type type)
static ParseResult parseEmitCFieldOpTypeAndInitialValue (OpAsmParser &parser, TypeAttr &typeAttr, Attribute &initialValue)

Macro Definition Documentation

◆ GET_ATTRDEF_CLASSES

#define GET_ATTRDEF_CLASSES

Definition at line 1096 of file EmitC.cpp.

◆ GET_ATTRDEF_LIST

#define GET_ATTRDEF_LIST

◆ GET_OP_CLASSES

#define GET_OP_CLASSES

Definition at line 1646 of file EmitC.cpp.

◆ GET_OP_LIST

#define GET_OP_LIST

◆ GET_TYPEDEF_CLASSES

#define GET_TYPEDEF_CLASSES

Definition at line 1103 of file EmitC.cpp.

◆ GET_TYPEDEF_LIST

#define GET_TYPEDEF_LIST

Function Documentation

◆ getInitializerTypeForField()

Type getInitializerTypeForField ( Type type)
static

Definition at line 1495 of file EmitC.cpp.

Referenced by parseEmitCFieldOpTypeAndInitialValue().

◆ getInitializerTypeForGlobal()

Type getInitializerTypeForGlobal ( Type type)
static

Definition at line 1232 of file EmitC.cpp.

Referenced by parseEmitCGlobalOpTypeAndInitialValue().

◆ parseEmitCFieldOpTypeAndInitialValue()

ParseResult parseEmitCFieldOpTypeAndInitialValue ( OpAsmParser & parser,
TypeAttr & typeAttr,
Attribute & initialValue )
static

◆ parseEmitCGlobalOpTypeAndInitialValue()

ParseResult parseEmitCGlobalOpTypeAndInitialValue ( OpAsmParser & parser,
TypeAttr & typeAttr,
Attribute & initialValue )
static

◆ parseFormatString()

template<class ArgType>
FailureOr< SmallVector< ReplacementItem > > parseFormatString ( StringRef toParse,
ArgType fmtArgs,
llvm::function_ref< mlir::InFlightDiagnostic()> emitError = {} )

Parse a format string and return a list of its parts.

A part is either a StringRef that has to be printed as-is, or a Placeholder which requires printing the next operand of the VerbatimOp. In the format string, all {} are replaced by Placeholders, except if the { is escaped by {{ - then it doesn't start a placeholder.

Definition at line 179 of file EmitC.cpp.

References mlir::emitError().

◆ parseSwitchCases()

ParseResult parseSwitchCases ( OpAsmParser & parser,
DenseI64ArrayAttr & cases,
SmallVectorImpl< std::unique_ptr< Region > > & caseRegions )
static

◆ printEmitCFieldOpTypeAndInitialValue()

void printEmitCFieldOpTypeAndInitialValue ( OpAsmPrinter & p,
FieldOp op,
TypeAttr type,
Attribute initialValue )
static

Definition at line 1485 of file EmitC.cpp.

References mlir::AsmPrinter::printAttributeWithoutType().

◆ printEmitCGlobalOpTypeAndInitialValue()

void printEmitCGlobalOpTypeAndInitialValue ( OpAsmPrinter & p,
GlobalOp op,
TypeAttr type,
Attribute initialValue )
static

Definition at line 1222 of file EmitC.cpp.

References mlir::AsmPrinter::printAttributeWithoutType().

◆ printSwitchCases()

void printSwitchCases ( OpAsmPrinter & p,
Operation * op,
DenseI64ArrayAttr cases,
RegionRange caseRegions )
static

◆ verifyInitializationAttribute()

LogicalResult verifyInitializationAttribute ( Operation * op,
Attribute value )
static

Check that the type of the initial value is compatible with the operations result type.

Definition at line 144 of file EmitC.cpp.

References mlir::Operation::emitOpError(), mlir::Operation::getNumResults(), mlir::Operation::getResult(), mlir::Value::getType(), mlir::Type::isIndex(), mlir::emitc::isPointerWideType(), and success().

◆ verifyRegion()

LogicalResult verifyRegion ( emitc::SwitchOp op,
Region & region,
const Twine & name )
static