FreeTensor
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
freetensor::VarDefNode Class Reference

#include <stmt.h>

Inheritance diagram for freetensor::VarDefNode:
Inheritance graph
[legend]
Collaboration diagram for freetensor::VarDefNode:
Collaboration graph
[legend]

Public Member Functions

std::vector< Stmtchildren () const override
 If pinned, SinkVar and ShrinkVar will not alter this node.
 
void compHash () override
 
 DEFINE_NODE_TRAIT (VarDef)
 
- Public Member Functions inherited from freetensor::StmtNode
void setId (const ID &id=ID::make())
 
ID id () const
 
const Metadatametadata () const
 
Metadatametadata ()
 
bool isStmt () const override
 
virtual bool isCtrlFlow () const
 
virtual std::vector< Ref< StmtNode > > children () const
 
Ref< StmtNodeprevLeafStmtInDFSOrder () const
 
Ref< StmtNodenextLeafStmtInDFSOrder () const
 
Ref< StmtNodeprevStmtInDFSPostOrder () const
 
Ref< StmtNodenextStmtInDFSPreOrder () const
 
Ref< StmtNodeancestorById (const ID &lookup) const
 
bool isAncestorOf (const Stmt &other) const
 
bool isBefore (const Stmt &other) const
 
 DEFINE_NODE_ACCESS (Stmt)
 
Ref< StmtNodeparentStmt () const
 
Ref< StmtNodeparentStmtByFilter (const std::function< bool(const Stmt &)> &filter) const
 
Ref< StmtNodeprevStmt () const
 
Ref< StmtNodenextStmt () const
 
Ref< StmtNodeparentCtrlFlow () const
 
Ref< StmtNodeprevInCtrlFlow () const
 
Ref< StmtNodenextInCtrlFlow () const
 
- Public Member Functions inherited from freetensor::ASTNode
virtual ~ASTNode ()
 
virtual ASTNodeType nodeType () const =0
 
bool isAST () const override
 
virtual bool isFunc () const
 
virtual bool isStmt () const
 
virtual bool isExpr () const
 
Ref< ASTNodeparentAST () const
 
std::source_location debugBlame () const
 
void setDebugBlame (std::source_location loc)
 
 DEFINE_NODE_ACCESS (AST)
 
- Public Member Functions inherited from freetensor::ASTPart
virtual ~ASTPart ()
 
 ASTPart (ASTPart &&other)
 
 ASTPart (const ASTPart &other)
 
ASTPartoperator= (ASTPart &&)
 
ASTPartoperator= (const ASTPart &)
 
bool trySetParent (const Ref< ASTPart > &parent)
 
void resetParent ()
 
Ref< ASTPartparent () const
 
bool isSubTree () const
 
int depth () const
 
virtual void modifiedHook ()
 
size_t hash ()
 
virtual bool isAST () const
 
- Public Member Functions inherited from freetensor::EnableSelf< ASTPart >
Ref< ASTPartself () const
 

Public Attributes

std::string name_
 
SubTree< Bufferbuffer_ = ChildOf{this}
 
std::optional< std::string > viewOf_
 
SubTree< StmtNodebody_ = ChildOf{this}
 
bool pinned_
 

Additional Inherited Members

- Public Types inherited from freetensor::EnableSelf< ASTPart >
typedef ASTPart Self
 
- Protected Member Functions inherited from freetensor::ASTPart
void lock ()
 
void unlock ()
 
virtual void compHash ()=0
 
void resetHash ()
 
- Protected Attributes inherited from freetensor::ASTPart
size_t hash_ = ~0ull
 
std::atomic_flag lock_ = ATOMIC_FLAG_INIT
 

Detailed Description

Define a (tensor) variable

The scope of the variable is body_, which means scopes in FreeTensor follows FILO (stack) rule

It is NOT allowed to modify the shape of a VarDef inside its body. This rule is enforced in the frontend (see the checkings on borrowed_vardefs in VarRef in expr.py) and each pass should keep this rule

Member Function Documentation

◆ children()

std::vector< Stmt > freetensor::VarDefNode::children ( ) const
inlineoverridevirtual

If pinned, SinkVar and ShrinkVar will not alter this node.

Reimplemented from freetensor::StmtNode.

◆ compHash()

void freetensor::VarDefNode::compHash ( )
overridevirtual

Implements freetensor::ASTPart.

◆ DEFINE_NODE_TRAIT()

freetensor::VarDefNode::DEFINE_NODE_TRAIT ( VarDef  )

Member Data Documentation

◆ body_

SubTree<StmtNode> freetensor::VarDefNode::body_ = ChildOf{this}

◆ buffer_

SubTree<Buffer> freetensor::VarDefNode::buffer_ = ChildOf{this}

◆ name_

std::string freetensor::VarDefNode::name_

◆ pinned_

bool freetensor::VarDefNode::pinned_

◆ viewOf_

std::optional<std::string> freetensor::VarDefNode::viewOf_

This VarDef node can be a view of another VarDef node, represented by the name of its source VarDef

Simultaneously access of a VarDef and the VarDef it views is ALWAYS treated as dependences

This is useful when we want to alter the shape of an VarDef with non-cache access type, whose shape must be kept during I/O or in an internal allocation


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