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

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

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

Inheritance diagram for mlir::pdll::ast::UserRewriteDecl:

Public Member Functions

const NamegetName () const
 Return the name of the rewrite.
MutableArrayRef< VariableDecl * > getInputs ()
 Return the input arguments of this rewrite.
ArrayRef< VariableDecl * > getInputs () const
MutableArrayRef< VariableDecl * > getResults ()
 Return the explicit results of the rewrite declaration.
ArrayRef< VariableDecl * > getResults () const
std::optional< StringRef > getCodeBlock () const
 Return the optional code block of this rewrite, if this is a native rewrite with a provided implementation.
const CompoundStmtgetBody () const
 Return the body of this rewrite if this rewrite is a PDLL rewrite, otherwise returns nullptr.
Type getResultType () const
 Return the result type of this rewrite.
bool isExternal () const
 Returns true if this rewrite 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 UserRewriteDeclcreateNative (Context &ctx, const Name &name, ArrayRef< VariableDecl * > inputs, ArrayRef< VariableDecl * > results, std::optional< StringRef > codeBlock, Type resultType)
 Create a native rewrite with the given optional code block.
static UserRewriteDeclcreatePDLL (Context &ctx, const Name &name, ArrayRef< VariableDecl * > inputs, ArrayRef< VariableDecl * > results, const CompoundStmt *body, Type resultType)
 Create a PDLL rewrite with the given body.
Static Public Member Functions inherited from mlir::pdll::ast::Node::NodeBase< UserRewriteDecl, Decl >
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< UserRewriteDecl, Decl >
using Base
Protected Member Functions inherited from mlir::pdll::ast::Node::NodeBase< UserRewriteDecl, Decl >
 NodeBase (SMRange loc, Args &&...args)
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 rewrite.

This is either:

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

Definition at line 1096 of file Nodes.h.

Member Function Documentation

◆ createNative()

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

Create a native rewrite with the given optional code block.

Definition at line 1101 of file Nodes.h.

◆ createPDLL()

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

Create a PDLL rewrite with the given body.

Definition at line 1111 of file Nodes.h.

◆ getBody()

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

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

Definition at line 1146 of file Nodes.h.

◆ getCodeBlock()

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

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

Definition at line 1142 of file Nodes.h.

◆ getInputs() [1/2]

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

Return the input arguments of this rewrite.

Definition at line 1124 of file Nodes.h.

◆ getInputs() [2/2]

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

Definition at line 1127 of file Nodes.h.

◆ getName()

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

Return the name of the rewrite.

Definition at line 1121 of file Nodes.h.

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

◆ getResults() [1/2]

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

Return the explicit results of the rewrite declaration.

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

Definition at line 1133 of file Nodes.h.

Referenced by getResults().

◆ getResults() [2/2]

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

Definition at line 1136 of file Nodes.h.

References getResults().

◆ getResultType()

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

Return the result type of this rewrite.

Definition at line 1149 of file Nodes.h.

◆ isExternal()

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

Returns true if this rewrite is external.

Definition at line 1152 of file Nodes.h.


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