P4C
The P4 Compiler
|
Assists visitors in traversing the IR. More...
Public Member Functions | |
bool | busy (const IR::Node *n) const |
bool | done (const IR::Node *n) const |
void | finish (const IR::Node *n) |
void | revisit_visited () |
bool | shouldVisitOnce (const IR::Node *n) const |
VisitStatus | try_start (const IR::Node *n, bool defaultVisitOnce) |
void | visitAgain (const IR::Node *n) |
void | visitOnce (const IR::Node *n) |
Assists visitors in traversing the IR.
A Tracker object assists visitors traversing the IR by tracking each node. The start
method begins tracking, and finish
ends it. The done
method determines whether the node has been visited.
|
inlinenodiscard |
Determine whether
is currently being visited and the visitor has not finished That is, start(@n)
has been invoked, and finish(@n)
has not,
|
inlinenodiscard |
Determine whether
has been visited and the visitor has finished and we don't want to visit
again the next time we see it. That is, start(@n)
has been invoked, followed by finish(@n)
, and the visitOnce field is true.
|
inline |
Mark the process of visiting
as finished, with @final being the final state of the node, or nullptr if the node was removed from the tree. done(@n)
will return true, and result(@n)
will return the resulting node, if any.
If @final is a new node, that node is marked as finished as well, as if start(@final); finish(@final);
were invoked.
Util::CompilerBug | This method fails if `start( )` has not previously been invoked. |
|
inline |
Forget nodes that have already been visited, allowing them to be visited again.
|
inline |
Return a visitOnce flag for node
|
inlinenodiscard |
Begin tracking
during a visiting pass. Use finish(@n)
to mark
as visited once the pass completes.
VisitStatus::Busy
), or if node was already visited (VisitStatus::Done
), node was never seen before (VisitStatus::New
) or seen, but should be revisited (VisitStatus::Revisit
).