MLIR 22.0.0git
mlir::pdll::ast::UserConstraintDecl Class Referencefinal

This decl represents a user defined constraint. More...

#include "mlir/Tools/PDLL/AST/Nodes.h"

Inheritance diagram for mlir::pdll::ast::UserConstraintDecl:

Public Member Functions

const NamegetName () const
 Return the name of the constraint.
MutableArrayRef< VariableDecl * > getInputs ()
 Return the input arguments of this constraint.
ArrayRef< VariableDecl * > getInputs () const
std::optional< StringRef > getNativeInputType (unsigned index) const
 Return the explicit native type to use for the given input.
MutableArrayRef< VariableDecl * > getResults ()
 Return the explicit results of the constraint declaration.
ArrayRef< VariableDecl * > getResults () const
std::optional< StringRef > getCodeBlock () const
 Return the optional code block of this constraint, if this is a native constraint with a provided implementation.
const CompoundStmtgetBody () const
 Return the body of this constraint if this constraint is a PDLL constraint, otherwise returns nullptr.
Type getResultType () const
 Return the result type of this constraint.
bool isExternal () const
 Returns true if this constraint is external.
Public Member Functions inherited from mlir::pdll::ast::Decl
const NamegetName () const
 Return the name of the decl, or nullptr if it doesn't have one.
void setDocComment (Context &ctx, StringRef comment)
 Set the documentation comment for this decl.
std::optional< StringRef > getDocComment () const
 Return the documentation comment attached to this decl if it has been set.
Public Member Functions inherited from mlir::pdll::ast::Node
TypeID getTypeID () const
 Return the type identifier of this node.
SMRange getLoc () const
 Return the location of this node.
void print (raw_ostream &os) const
 Print this node to the given stream.
void walk (function_ref< void(const Node *)> walkFn) const
 Walk all of the nodes including, and nested under, this node in pre-order.
template<typename WalkFnT, typename ArgT = typename llvm::function_traits< WalkFnT>::template arg_t<0>>
std::enable_if_t<!std::is_convertible< const Node *, ArgT >::value > walk (WalkFnT &&walkFn) const

Static Public Member Functions

static UserConstraintDeclcreateNative (Context &ctx, const Name &name, ArrayRef< VariableDecl * > inputs, ArrayRef< VariableDecl * > results, std::optional< StringRef > codeBlock, Type resultType, ArrayRef< StringRef > nativeInputTypes={})
 Create a native constraint with the given optional code block.
static UserConstraintDeclcreatePDLL (Context &ctx, const Name &name, ArrayRef< VariableDecl * > inputs, ArrayRef< VariableDecl * > results, const CompoundStmt *body, Type resultType)
 Create a PDLL constraint with the given body.
Static Public Member Functions inherited from mlir::pdll::ast::Node::NodeBase< UserConstraintDecl, ConstraintDecl >
static bool classof (const Node *node)
 Provide type casting support.
Static Public Member Functions inherited from mlir::pdll::ast::ConstraintDecl
static bool classof (const Node *node)
 Provide type casting support.
Static Public Member Functions inherited from mlir::pdll::ast::Decl
static bool classof (const Node *node)
 Provide type casting support.

Additional Inherited Members

Public Types inherited from mlir::pdll::ast::Node::NodeBase< UserConstraintDecl, ConstraintDecl >
using Base
Protected Member Functions inherited from mlir::pdll::ast::Node::NodeBase< UserConstraintDecl, ConstraintDecl >
 NodeBase (SMRange loc, Args &&...args)
Protected Member Functions inherited from mlir::pdll::ast::ConstraintDecl
 ConstraintDecl (TypeID typeID, SMRange loc, const Name *name=nullptr)
Protected Member Functions inherited from mlir::pdll::ast::Decl
 Decl (TypeID typeID, SMRange loc, const Name *name=nullptr)
Protected Member Functions inherited from mlir::pdll::ast::Node
 Node (TypeID typeID, SMRange loc)

Detailed Description

This decl represents a user defined constraint.

This is either:

  • an imported native constraint
    • Similar to an external function declaration. This is a native constraint defined externally, and imported into PDLL via a declaration.
  • a native constraint defined in PDLL
    • This is a native constraint, i.e. a constraint whose implementation is defined in C++(or potentially some other non-PDLL language). The implementation of this constraint is specified as a string code block in PDLL.
  • a PDLL constraint
    • This is a constraint which is defined using only PDLL constructs.

Definition at line 886 of file Nodes.h.

Member Function Documentation

◆ createNative()

UserConstraintDecl * mlir::pdll::ast::UserConstraintDecl::createNative ( Context & ctx,
const Name & name,
ArrayRef< VariableDecl * > inputs,
ArrayRef< VariableDecl * > results,
std::optional< StringRef > codeBlock,
Type resultType,
ArrayRef< StringRef > nativeInputTypes = {} )
inlinestatic

Create a native constraint with the given optional code block.

Definition at line 892 of file Nodes.h.

◆ createPDLL()

UserConstraintDecl * mlir::pdll::ast::UserConstraintDecl::createPDLL ( Context & ctx,
const Name & name,
ArrayRef< VariableDecl * > inputs,
ArrayRef< VariableDecl * > results,
const CompoundStmt * body,
Type resultType )
inlinestatic

Create a PDLL constraint with the given body.

Definition at line 901 of file Nodes.h.

◆ getBody()

const CompoundStmt * mlir::pdll::ast::UserConstraintDecl::getBody ( ) const
inline

Return the body of this constraint if this constraint is a PDLL constraint, otherwise returns nullptr.

Definition at line 940 of file Nodes.h.

◆ getCodeBlock()

std::optional< StringRef > mlir::pdll::ast::UserConstraintDecl::getCodeBlock ( ) const
inline

Return the optional code block of this constraint, if this is a native constraint with a provided implementation.

Definition at line 936 of file Nodes.h.

◆ getInputs() [1/2]

MutableArrayRef< VariableDecl * > mlir::pdll::ast::UserConstraintDecl::getInputs ( )
inline

Return the input arguments of this constraint.

Definition at line 914 of file Nodes.h.

◆ getInputs() [2/2]

ArrayRef< VariableDecl * > mlir::pdll::ast::UserConstraintDecl::getInputs ( ) const
inline

Definition at line 917 of file Nodes.h.

◆ getName()

const Name & mlir::pdll::ast::UserConstraintDecl::getName ( ) const
inline

Return the name of the constraint.

Definition at line 911 of file Nodes.h.

References mlir::pdll::ast::Decl::getName().

◆ getNativeInputType()

std::optional< StringRef > UserConstraintDecl::getNativeInputType ( unsigned index) const

Return the explicit native type to use for the given input.

Returns std::nullopt if no explicit type was set.

Definition at line 452 of file Nodes.cpp.

◆ getResults() [1/2]

MutableArrayRef< VariableDecl * > mlir::pdll::ast::UserConstraintDecl::getResults ( )
inline

Return the explicit results of the constraint declaration.

May be empty, even if the constraint has results (e.g. in the case of inferred results).

Definition at line 927 of file Nodes.h.

Referenced by getResults().

◆ getResults() [2/2]

ArrayRef< VariableDecl * > mlir::pdll::ast::UserConstraintDecl::getResults ( ) const
inline

Definition at line 930 of file Nodes.h.

References getResults().

◆ getResultType()

Type mlir::pdll::ast::UserConstraintDecl::getResultType ( ) const
inline

Return the result type of this constraint.

Definition at line 943 of file Nodes.h.

◆ isExternal()

bool mlir::pdll::ast::UserConstraintDecl::isExternal ( ) const
inline

Returns true if this constraint is external.

Definition at line 946 of file Nodes.h.


The documentation for this class was generated from the following files: