|
MLIR 22.0.0git
|
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_ostream & | operator<< (raw_ostream &os, Visibility visibility) |
Variables | |
| const char * | inferTypeOpInterface = "InferTypeOpInterface" |
| using mlir::tblgen::Argument |
Definition at line 63 of file Argument.h.
|
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.
|
strong |
| 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().
| 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().
| llvm::raw_ostream & mlir::tblgen::operator<< | ( | llvm::raw_ostream & | os, |
| mlir::tblgen::Visibility | visibility ) |
Write "public", "protected", or "private".
| raw_ostream & mlir::tblgen::operator<< | ( | raw_ostream & | os, |
| Visibility | visibility ) |
| std::string mlir::tblgen::strfmt | ( | const char * | fmt, |
| Parameters &&... | parameters ) |
Definition at line 38 of file CodeGenHelpers.h.
| std::string mlir::tblgen::stringify | ( | T && | t | ) |
Generically convert a value to a std::string.
Definition at line 251 of file CodeGenHelpers.h.
Referenced by mlir::tblgen::Constructor::addMemberInitializer(), mlir::tblgen::MethodSignature::addTemplateParam(), mlir::tblgen::ParentClass::addTemplateParam(), mlir::tblgen::MethodParameter::MethodParameter(), mlir::tblgen::MethodSignature::MethodSignature(), and mlir::tblgen::ParentClass::ParentClass().
|
inline |
|
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]+...
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:
Definition at line 262 of file Format.h.
Referenced by buildErrorStreamingString(), canUniqueAttrConstraint(), and canUniquePropConstraint().
|
extern |
Definition at line 148 of file Attribute.cpp.