MLIR 22.0.0git
mlir::emitc Namespace Reference

Namespaces

namespace  impl

Classes

struct  Placeholder

Typedefs

using ReplacementItem = std::variant<StringRef, Placeholder>

Enumerations

enum class  LanguageTarget { c99 , cpp11 }
 Enum to specify the language target for EmitC code generation. More...

Functions

void buildTerminatedBody (OpBuilder &builder, Location loc)
 Default callback for builders of ops carrying a region.
bool isSupportedEmitCType (mlir::Type type)
 Determines whether type is valid in EmitC.
bool isSupportedIntegerType (mlir::Type type)
 Determines whether type is a valid integer type in EmitC.
bool isIntegerIndexOrOpaqueType (Type type)
 Determines whether type is integer like, i.e.
bool isSupportedFloatType (mlir::Type type)
 Determines whether type is a valid floating-point type in EmitC.
bool isPointerWideType (mlir::Type type)
 Determines whether type is a emitc.size_t/ssize_t type.
bool isFundamentalType (mlir::Type type)
 Determines whether type is a valid fundamental C++ type in EmitC.
std::unique_ptr<::mlir::PasscreateFormExpressionsPass ()
std::unique_ptr<::mlir::PasscreateWrapFuncInClassPass ()
void registerFormExpressionsPass ()
void registerFormExpressionsPassPass ()
void registerWrapFuncInClassPass ()
void registerWrapFuncInClassPassPass ()
void registerEmitCPasses ()
ExpressionOp createExpression (Operation *op, OpBuilder &builder)
void populateExpressionPatterns (RewritePatternSet &patterns)
 Populates patterns with expression-related patterns.
void populateFuncPatterns (RewritePatternSet &patterns)
 Populates 'patterns' with func-related patterns.
std::optional< TypegetUnsignedTypeFor (Type ty)
 Get an unsigned integer or size data type corresponding to ty.
std::optional< TypegetSignedTypeFor (Type ty)
 Get a signed integer or size data type corresponding to ty that supports arithmetic on negative values.
LogicalResult translateToCpp (Operation *op, raw_ostream &os, bool declareVariablesAtTop=false, StringRef fileId={})
 Translates the given operation to C++ code.

Typedef Documentation

◆ ReplacementItem

using mlir::emitc::ReplacementItem = std::variant<StringRef, Placeholder>

Definition at line 54 of file EmitC.h.

Enumeration Type Documentation

◆ LanguageTarget

enum class mlir::emitc::LanguageTarget
strong

Enum to specify the language target for EmitC code generation.

Enumerator
c99 
cpp11 

Definition at line 16 of file MathToEmitC.h.

Function Documentation

◆ buildTerminatedBody()

void mlir::emitc::buildTerminatedBody ( OpBuilder & builder,
Location loc )

Default callback for builders of ops carrying a region.

Inserts a yield without arguments.

Definition at line 57 of file EmitC.cpp.

◆ createExpression()

◆ createFormExpressionsPass()

std::unique_ptr<::mlir::Pass > mlir::emitc::createFormExpressionsPass ( )

We declare an explicit private instantiation because Pass classes should only be visible by the current library.

Definition at line 80 of file FormExpressions.cpp.

◆ createWrapFuncInClassPass()

std::unique_ptr<::mlir::Pass > mlir::emitc::createWrapFuncInClassPass ( )

We declare an explicit private instantiation because Pass classes should only be visible by the current library.

Definition at line 155 of file WrapFuncInClass.cpp.

◆ getSignedTypeFor()

std::optional< Type > mlir::emitc::getSignedTypeFor ( Type ty)

Get a signed integer or size data type corresponding to ty that supports arithmetic on negative values.

Definition at line 52 of file TypeConversions.cpp.

References mlir::Type::getContext(), mlir::Type::getIntOrFloatBitWidth(), and mlir::Type::isInteger().

◆ getUnsignedTypeFor()

std::optional< Type > mlir::emitc::getUnsignedTypeFor ( Type ty)

Get an unsigned integer or size data type corresponding to ty.

Definition at line 39 of file TypeConversions.cpp.

References mlir::Type::getContext(), mlir::Type::getIntOrFloatBitWidth(), and mlir::Type::isInteger().

◆ isFundamentalType()

bool mlir::emitc::isFundamentalType ( mlir::Type type)

Determines whether type is a valid fundamental C++ type in EmitC.

Definition at line 136 of file EmitC.cpp.

References isPointerWideType(), isSupportedFloatType(), and isSupportedIntegerType().

◆ isIntegerIndexOrOpaqueType()

bool mlir::emitc::isIntegerIndexOrOpaqueType ( Type type)

Determines whether type is integer like, i.e.

it's a supported integer, an index or opaque type.

Definition at line 111 of file EmitC.cpp.

References isPointerWideType(), and isSupportedIntegerType().

◆ isPointerWideType()

bool mlir::emitc::isPointerWideType ( mlir::Type type)

Determines whether type is a emitc.size_t/ssize_t type.

Definition at line 131 of file EmitC.cpp.

Referenced by isFundamentalType(), isIntegerIndexOrOpaqueType(), isSupportedEmitCType(), and verifyInitializationAttribute().

◆ isSupportedEmitCType()

bool mlir::emitc::isSupportedEmitCType ( mlir::Type type)

Determines whether type is valid in EmitC.

Definition at line 61 of file EmitC.cpp.

References mlir::Type::isIndex(), isPointerWideType(), isSupportedEmitCType(), isSupportedFloatType(), and isSupportedIntegerType().

Referenced by isSupportedEmitCType().

◆ isSupportedFloatType()

bool mlir::emitc::isSupportedFloatType ( mlir::Type type)

Determines whether type is a valid floating-point type in EmitC.

Definition at line 116 of file EmitC.cpp.

Referenced by isFundamentalType(), and isSupportedEmitCType().

◆ isSupportedIntegerType()

bool mlir::emitc::isSupportedIntegerType ( mlir::Type type)

Determines whether type is a valid integer type in EmitC.

Definition at line 95 of file EmitC.cpp.

Referenced by isFundamentalType(), isIntegerIndexOrOpaqueType(), and isSupportedEmitCType().

◆ populateExpressionPatterns()

void mlir::emitc::populateExpressionPatterns ( RewritePatternSet & patterns)

Populates patterns with expression-related patterns.

Definition at line 154 of file Transforms.cpp.

References mlir::patterns.

◆ populateFuncPatterns()

void mlir::emitc::populateFuncPatterns ( RewritePatternSet & patterns)

Populates 'patterns' with func-related patterns.

Definition at line 107 of file WrapFuncInClass.cpp.

◆ registerEmitCPasses()

void mlir::emitc::registerEmitCPasses ( )
inline

Definition at line 213 of file Passes.h.

Referenced by mlir::registerAllPasses().

◆ registerFormExpressionsPass()

void mlir::emitc::registerFormExpressionsPass ( )
inline

Definition at line 171 of file Passes.h.

◆ registerFormExpressionsPassPass()

void mlir::emitc::registerFormExpressionsPassPass ( )
inline

Definition at line 178 of file Passes.h.

◆ registerWrapFuncInClassPass()

void mlir::emitc::registerWrapFuncInClassPass ( )
inline

Definition at line 192 of file Passes.h.

◆ registerWrapFuncInClassPassPass()

void mlir::emitc::registerWrapFuncInClassPassPass ( )
inline

Definition at line 199 of file Passes.h.

◆ translateToCpp()

LogicalResult mlir::emitc::translateToCpp ( Operation * op,
raw_ostream & os,
bool declareVariablesAtTop = false,
StringRef fileId = {} )

Translates the given operation to C++ code.

The operation or operations in the region of 'op' need almost all be in EmitC dialect. The parameter 'declareVariablesAtTop' enforces that all variables for op results and block arguments are declared at the beginning of the function. If parameter 'fileId' is non-empty, then body of emitc.file ops with matching id are emitted.

Definition at line 1953 of file TranslateToCpp.cpp.

Referenced by mlir::registerToCppTranslation().