P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::IR::Node Class Referenceabstract
Inheritance diagram for P4::IR::Node:
[legend]

Public Member Functions

 Node (const Node &other)
 
 Node (JSONLoader &json)
 
 Node (Util::SourceInfo si)
 
const Nodeapply (Visitor &&v, const Visitor_Context *ctxt=nullptr) const
 
const Nodeapply (Visitor &v, const Visitor_Context *ctxt=nullptr) const
 
virtual void apply_visitor_loop_revisit (Inspector &v) const
 
virtual void apply_visitor_loop_revisit (Modifier &v) const
 
virtual void apply_visitor_loop_revisit (Transform &v) const
 
virtual void apply_visitor_postorder (Inspector &v) const
 
virtual void apply_visitor_postorder (Modifier &v)
 
virtual const Nodeapply_visitor_postorder (Transform &v)
 
virtual bool apply_visitor_preorder (Inspector &v) const
 
virtual bool apply_visitor_preorder (Modifier &v)
 
virtual const Nodeapply_visitor_preorder (Transform &v)
 
virtual void apply_visitor_revisit (Inspector &v) const
 
virtual void apply_visitor_revisit (Modifier &v, const Node *n) const
 
virtual void apply_visitor_revisit (Transform &v, const Node *n) const
 
virtual Nodeclone () const =0
 
void dbprint (std::ostream &out) const override
 
 DECLARE_TYPEINFO_WITH_TYPEID (Node, NodeKind::Node, INode)
 
virtual void dump_fields (std::ostream &) const
 
virtual bool equiv (const Node &a) const
 
const NodegetNode () const final
 
NodegetNode () final
 
Util::SourceInfo getSourceInfo () const override
 
cstring node_type_name () const override
 
virtual int num_children ()
 
bool operator!= (const Node &n) const
 
Nodeoperator= (const Node &)=default
 
Nodeoperator= (Node &&)=default
 
virtual bool operator== (const Node &a) const
 
Util::JsonObjectsourceInfoJsonObj () const
 
void sourceInfoToJSON (JSONGenerator &json) const
 
void toJSON (JSONGenerator &json) const override
 
cstring toString () const override
 
void traceCreation () const
 
virtual void visit_children (Visitor &)
 
virtual void visit_children (Visitor &) const
 
- Public Member Functions inherited from P4::IR::INode
template<typename T >
std::enable_if_t<!has_static_type_name_v< T >, const T * > checkedTo () const
 
template<typename T >
std::enable_if_t< has_static_type_name_v< T >, const T * > checkedTo () const
 
 DECLARE_TYPEINFO_WITH_TYPEID (INode, NodeKind::INode)
 
virtual void validate () const
 
- Public Member Functions inherited from P4::Util::IHasSourceInfo
- Public Member Functions inherited from P4::IHasDbPrint
void print () const
 
- Public Member Functions inherited from P4::ICastable
template<typename T >
T & as ()
 Tries to convert the class to type T. A BUG occurs if the cast fails.
 
template<typename T >
const T & as () const
 Tries to convert the class to type T. A BUG occurs if the cast fails.
 
template<typename T >
T * checkedTo ()
 Performs a checked cast. A BUG occurs if the cast fails.
 
template<typename T >
const T * checkedTo () const
 Performs a checked cast. A BUG occurs if the cast fails.
 
- Public Member Functions inherited from P4::RTTI::Base
template<typename T >
bool is () const noexcept
 
virtual bool isA (TypeId typeId) const noexcept=0
 
template<typename T >
const T * to () const noexcept
 Same as to, but returns const pointer to T.
 
template<typename T >
T * to () noexcept
 
virtual TypeId typeId () const noexcept=0
 

Static Public Member Functions

static cstring static_type_name ()
 

Public Attributes

int clone_id
 
int id
 
Util::SourceInfo srcInfo
 

Protected Member Functions

cstring prepareSourceInfoForJSON (Util::SourceInfo &si, unsigned *lineNumber, unsigned *columnNumber) const
 
void traceVisit (const char *visitor) const
 
- Protected Member Functions inherited from P4::RTTI::Base
virtual const void * toImpl (TypeId typeId) const noexcept=0
 

Static Protected Attributes

static int currentId = 0
 

Friends

class ::P4::Inspector
 
class ::P4::Modifier
 
class ::P4::Transform
 
class ::P4::Visitor
 
template<typename Sink >
void AbslStringify (Sink &sink, const IR::Node *n)
 

Member Function Documentation

◆ dbprint()

void P4::IR::Node::dbprint ( std::ostream & out) const
overridevirtual

Implements P4::IHasDbPrint.

◆ getNode() [1/2]

const Node * P4::IR::Node::getNode ( ) const
inlinefinalvirtual

Implements P4::IR::INode.

◆ getNode() [2/2]

Node * P4::IR::Node::getNode ( )
inlinefinalvirtual

Implements P4::IR::INode.

◆ getSourceInfo()

Util::SourceInfo P4::IR::Node::getSourceInfo ( ) const
inlineoverridevirtual

◆ node_type_name()

cstring P4::IR::Node::node_type_name ( ) const
inlineoverridevirtual

Implements P4::IR::INode.

◆ toJSON()

void P4::IR::Node::toJSON ( JSONGenerator & json) const
overridevirtual

Implements P4::IR::INode.

◆ toString()

cstring P4::IR::Node::toString ( ) const
inlineoverridevirtual

Friends And Related Symbol Documentation

◆ AbslStringify

template<typename Sink >
void AbslStringify ( Sink & sink,
const IR::Node * n )
friend

Helper to simplify usage of nodes in Abseil functions (e.g. StrCat / StrFormat, etc.) without explicit string_view conversion. Note that this calls Node::toString() so might not be always appropriate for user-visible messages / strings.