MLIR
21.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... | |
static bool | canUniquePropConstraint (Property prop) |
A property constraint that references anything other than itself and the current op cannot be generically extracted into a function, just as with canUnequePropConstraint(). 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 | propConstraintCode |
Code for a property 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 289 of file CodeGenHelpers.cpp.
References mlir::tblgen::FmtContext::addSubst(), mlir::tblgen::tgfmt(), and mlir::tblgen::FmtContext::withSelf().
Referenced by mlir::tblgen::StaticVerifierFunctionEmitter::collectOpConstraints().
|
static |
A property constraint that references anything other than itself and the current op cannot be generically extracted into a function, just as with canUnequePropConstraint().
Additionally, property constraints without an interface type specified can't be uniqued, and ones that are a literal "true" shouldn't be constrained.
Definition at line 302 of file CodeGenHelpers.cpp.
References mlir::tblgen::FmtContext::addSubst(), mlir::tblgen::Constraint::getConditionTemplate(), mlir::tblgen::Property::getInterfaceType(), 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 143 of file CodeGenHelpers.cpp.
|
static |
Code for a pattern type or attribute constraint.
{3}: "Type type" or "Attribute attr".
Definition at line 209 of file CodeGenHelpers.cpp.
|
static |
Code for a property constraint.
These may be called from ops only. Property constraints cannot reference anything other than $_self
and $_op
. {3} is the interface type of the property.
Definition at line 162 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 193 of file CodeGenHelpers.cpp.
|
static |
Code for a successor constraint.
Definition at line 179 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 125 of file CodeGenHelpers.cpp.