MLIR
20.0.0git
|
#include "mlir/TableGen/CodeGenHelpers.h"
#include "mlir/TableGen/Operator.h"
#include "mlir/TableGen/Pattern.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Path.h"
#include "llvm/TableGen/Record.h"
Go to the source code of this file.
Functions | |
static std::string | getUniqueOutputLabel (const RecordKeeper &records, StringRef tag) |
Generate a unique label based on the current file name to prevent name collisions if multiple generated files are included at once. More... | |
static bool | canUniqueAttrConstraint (Attribute attr) |
An attribute constraint that references anything other than itself and the current op cannot be generically extracted into a function. More... | |
Variables | |
static const char *const | typeConstraintCode |
Code templates for emitting type, attribute, successor, and region constraints. More... | |
static const char *const | attrConstraintCode |
Code for an attribute constraint. More... | |
static const char *const | successorConstraintCode |
Code for a successor constraint. More... | |
static const char *const | regionConstraintCode |
Code for a region constraint. More... | |
static const char *const | patternAttrOrTypeConstraintCode |
Code for a pattern type or attribute constraint. More... | |
|
static |
An attribute constraint that references anything other than itself and the current op cannot be generically extracted into a function.
Most prohibitive are operands and results, which require calls to getODSOperands
or getODSResults
. Attribute references are tricky too because ops use cached identifiers.
Definition at line 243 of file CodeGenHelpers.cpp.
References mlir::tblgen::FmtContext::addSubst(), mlir::tblgen::tgfmt(), and mlir::tblgen::FmtContext::withSelf().
Referenced by mlir::tblgen::StaticVerifierFunctionEmitter::collectOpConstraints().
|
static |
Generate a unique label based on the current file name to prevent name collisions if multiple generated files are included at once.
Definition at line 27 of file CodeGenHelpers.cpp.
|
static |
Code for an attribute constraint.
These may be called from ops only. Attribute constraints cannot reference anything other than $_self
and $_op
.
TODO: Unique constraints for adaptors. However, most Adaptor::verify functions are stripped anyways.
Definition at line 131 of file CodeGenHelpers.cpp.
|
static |
Code for a pattern type or attribute constraint.
{3}: "Type type" or "Attribute attr".
Definition at line 178 of file CodeGenHelpers.cpp.
|
static |
Code for a region constraint.
Callers will need to pass in the region's name for emitting an error message.
Definition at line 162 of file CodeGenHelpers.cpp.
|
static |
Code for a successor constraint.
Definition at line 148 of file CodeGenHelpers.cpp.
|
static |
Code templates for emitting type, attribute, successor, and region constraints.
Each of these templates require the following arguments:
{0}: The unique constraint name. {1}: The constraint code. {2}: The constraint description. Code for a type constraint. These may be called on the type of either operands or results.
Definition at line 113 of file CodeGenHelpers.cpp.