MLIR 22.0.0git
mlir::tblgen Namespace Reference

Namespaces

namespace  detail

Classes

struct  AppliedConstraint
class  AttrConstraint
class  AttrDef
 This class represents a wrapper around a tablegen AttrDef record. More...
class  Attribute
class  AttributeSelfTypeParameter
struct  AttrInterface
class  AttrOrTypeBuilder
 Wrapper class that represents a Tablegen AttrOrTypeBuilder. More...
class  AttrOrTypeDef
 Wrapper class that contains a TableGen AttrOrTypeDef's record and provides helper methods for accessing them. More...
class  AttrOrTypeParameter
 A wrapper class for tblgen AttrOrTypeParameter, arrays of which belong to AttrOrTypeDefs to parameterize them. More...
class  Builder
 Wrapper class with helper methods for accessing Builders defined in TableGen. More...
class  ClassDeclaration
 A class declaration is a class element that appears as part of its declaration. More...
class  ClassDeclarationBase
 Base class for class declarations. More...
class  CombinedPred
class  ConcatPred
class  ConstantAttr
class  ConstantProp
class  Constraint
class  Constructor
class  CPred
class  DagLeaf
class  DagNode
class  Dialect
class  DialectNamespaceEmitter
class  EnumCase
class  EnumInfo
class  FmtContext
 Format context containing substitutions for special placeholders. More...
class  FmtObject
class  FmtObjectBase
struct  FmtReplacement
 Struct representing a replacement segment for the formatted string. More...
class  FmtStrVecObject
class  InferredResultType
 This class represents an inferred result type. More...
class  Interface
class  InterfaceMethod
class  InterfaceTrait
class  InternalTrait
class  Method
 Class for holding an op's method for C++ code emission. More...
class  MethodBody
 This class contains the body of a C++ method. More...
class  MethodParameter
 This class contains a single method parameter for a C++ function. More...
class  MethodParameters
 This class contains a list of method parameters for constructor, class methods, and method signatures. More...
class  MethodSignature
 This class contains the signature of a C++ method, including the return type. More...
struct  NamedAttribute
struct  NamedProperty
struct  NamedRegion
struct  NamedSuccessor
struct  NamedTypeConstraint
class  NativeTrait
class  Operator
 Wrapper class that contains a MLIR op's information (e.g., operands, attributes) defined in TableGen and provides helper methods for accessing them. More...
struct  OpInterface
class  ParentClass
 This class describes a C++ parent class declaration. More...
class  Pass
 Wrapper class providing helper methods for Passes defined in TableGen. More...
class  PassOption
class  PassStatistic
class  Pattern
class  Pred
class  PredTrait
class  PropConstraint
class  Property
class  Region
class  SideEffect
class  SideEffectTrait
class  StaticVerifierFunctionEmitter
 This class deduplicates shared operation verification code by emitting static functions alongside the op definitions. More...
class  SubstLeavesPred
class  Successor
class  SymbolInfoMap
class  Trait
class  Type
class  TypeConstraint
class  TypeDef
 This class represents a wrapper around a tablegen TypeDef record. More...
struct  TypeInterface
class  UsingDeclaration
 This class describes a using-declaration for a class. More...

Typedefs

using Argument
using RecordOperatorMap

Enumerations

enum class  Visibility { Public , Protected , Private }
 This enum describes C++ inheritance visibility. More...
enum class  ErrorStreamType { InString , InsideOpError }
 This class represents how an error stream string being constructed will be consumed. More...

Functions

llvm::raw_ostream & operator<< (llvm::raw_ostream &os, mlir::tblgen::Visibility visibility)
 Write "public", "protected", or "private".
template<typename... Parameters>
std::string strfmt (const char *fmt, Parameters &&...parameters)
std::string escapeString (StringRef value)
 Escape a string using C++ encoding. E.g. foo"bar -> foo\x22bar.
template<typename T>
std::string stringify (T &&t)
 Generically convert a value to a std::string.
std::string buildErrorStreamingString (StringRef message, const FmtContext &ctx, ErrorStreamType errorStreamType=ErrorStreamType::InString)
 Helper to generate a C++ streaming error message from a given message.
template<typename... Ts>
auto tgfmt (StringRef fmt, const FmtContext *ctx, Ts &&...vals) -> FmtObject< decltype(std::make_tuple(llvm::support::detail::build_format_adapter(std::forward< Ts >(vals))...))>
 Formats text by substituting placeholders in format string with replacement parameters.
FmtStrVecObject tgfmt (StringRef fmt, const FmtContext *ctx, ArrayRef< std::string > params)
raw_ostreamoperator<< (raw_ostream &os, Visibility visibility)

Variables

const char * inferTypeOpInterface = "InferTypeOpInterface"

Typedef Documentation

◆ Argument

◆ RecordOperatorMap

Initial value:
llvm::DenseMap< KeyT, ValueT, KeyInfoT, BucketT > DenseMap
Definition LLVM.h:126

Definition at line 44 of file Pattern.h.

Enumeration Type Documentation

◆ ErrorStreamType

enum class mlir::tblgen::ErrorStreamType
strong

This class represents how an error stream string being constructed will be consumed.

Enumerator
InString 
InsideOpError 

Definition at line 57 of file CodeGenHelpers.h.

◆ Visibility

enum class mlir::tblgen::Visibility
strong

This enum describes C++ inheritance visibility.

Enumerator
Public 
Protected 
Private 

Definition at line 426 of file Class.h.

Function Documentation

◆ buildErrorStreamingString()

std::string mlir::tblgen::buildErrorStreamingString ( StringRef message,
const FmtContext & ctx,
ErrorStreamType errorStreamType = ErrorStreamType::InString )

Helper to generate a C++ streaming error message from a given message.

Helper to generate a C++ string expression from a given message.

Message can contain '{{...}}' placeholders that are substituted with C-expressions via tgfmt. It would effectively convert: "failed to verify {{foo}}" into: "failed to verify " << bar where bar is the result of evaluating 'tgfmt("foo", &ctx)' at compile time.

Message can contain '{{...}}' placeholders that are substituted with C-expressions via tgfmt.

Definition at line 132 of file CodeGenHelpers.cpp.

References escapeString(), InsideOpError, result, and tgfmt().

◆ escapeString()

std::string mlir::tblgen::escapeString ( StringRef value)

Escape a string using C++ encoding. E.g. foo"bar -> foo\x22bar.

Definition at line 473 of file CodeGenHelpers.cpp.

Referenced by buildErrorStreamingString().

◆ operator<<() [1/2]

llvm::raw_ostream & mlir::tblgen::operator<< ( llvm::raw_ostream & os,
mlir::tblgen::Visibility visibility )

Write "public", "protected", or "private".

◆ operator<<() [2/2]

raw_ostream & mlir::tblgen::operator<< ( raw_ostream & os,
Visibility visibility )

Definition at line 248 of file Class.cpp.

References Private, Protected, and Public.

◆ strfmt()

template<typename... Parameters>
std::string mlir::tblgen::strfmt ( const char * fmt,
Parameters &&... parameters )

Definition at line 38 of file CodeGenHelpers.h.

◆ stringify()

◆ tgfmt() [1/2]

FmtStrVecObject mlir::tblgen::tgfmt ( StringRef fmt,
const FmtContext * ctx,
ArrayRef< std::string > params )
inline

Definition at line 274 of file Format.h.

◆ tgfmt() [2/2]

template<typename... Ts>
auto mlir::tblgen::tgfmt ( StringRef fmt,
const FmtContext * ctx,
Ts &&... vals ) -> FmtObject< decltype(std::make_tuple(llvm::support::detail::build_format_adapter( std::forward<Ts>(vals))...))>
inline

Formats text by substituting placeholders in format string with replacement parameters.

There are two categories of placeholders accepted, both led by a '$' sign:

1.a Positional placeholder: $[0-9]+ 1.b Positional range placeholder: $[0-9]+...

  1. Special placeholder: $[a-zA-Z_][a-zA-Z0-9_]*

Replacement parameters for positional placeholders are supplied as the vals parameter pack with 1:1 mapping. That is, $0 will be replaced by the first parameter in vals, $1 by the second one, and so on. Note that you can use the positional placeholders in any order and repeat any times, for example, "$2 $1 $1 $0" is accepted.

Replace parameters for positional range placeholders are supplied as if positional placeholders were specified with commas separating them.

Replacement parameters for special placeholders are supplied using the ctx format context.

The fmt is recorded as a StringRef inside the returned FmtObject. The caller needs to make sure the underlying data is available when the FmtObject is used.

ctx accepts a nullptr if there is no special placeholder is used.

If no substitution is provided for a placeholder or any error happens during format string parsing or replacement, the placeholder will be outputted as-is with an additional marker '<no-subst-found>', to aid debugging.

To print a '$' literally, escape it with '$$'.

This utility function is inspired by LLVM formatv(), with modifications specially tailored for TableGen C++ generation usage:

  1. This utility use '$' instead of '{' and '}' for denoting the placeholder because '{' and '}' are frequently used in C++ code.
  2. This utility does not support format layout because it is rarely needed in C++ code generation.

Definition at line 262 of file Format.h.

Referenced by buildErrorStreamingString(), canUniqueAttrConstraint(), and canUniquePropConstraint().

Variable Documentation

◆ inferTypeOpInterface

const char * mlir::tblgen::inferTypeOpInterface = "InferTypeOpInterface"
extern

Definition at line 148 of file Attribute.cpp.