Files
TheRock/rocm-systems/projects/rocprofiler-systems/external/dyninst/dataflowAPI/doc/AST.tex
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

82 lines
2.4 KiB
TeX

\subsection{Class AST}
\label{sec:ast}
\definedin{DynAST.h}
We provide a generic AST framework to represent tree structures.
One example use case is to represent instruction semantics with symbolic expressions.
The AST framework includes the base class definitions for tree nodes and visitors.
Users can inherit tree node classes to create their own AST structure and
AST visitors to write their own analyses for the AST.
All AST node classes should be derived from the AST class. Currently we have the
following types of AST nodes.
\begin{center}
\begin{tabular}{ll}
\toprule
AST::ID & Meaning \\
\midrule
V\_AST & Base class type \\
V\_BottomAST & Bottom AST node \\
V\_ConstantAST & Constant AST node \\
V\_VariableAST & Variable AST node \\
V\_RoseAST & ROSEOperation AST node \\
V\_StackAST & Stack AST node \\
\bottomrule
\end{tabular}
\end{center}
\begin{apient}
typedef boost::shared_ptr<AST> Ptr;
\end{apient}
\apidesc{Shared pointer for class AST.}
\begin{apient}
typedef std::vector<AST::Ptr> Children;
\end{apient}
\apidesc{The container type for the children of this AST.}
\begin{apient}
bool operator==(const AST &rhs) const;
bool equals(AST::Ptr rhs);
\end{apient}
\apidesc{Check whether two AST nodes are equal. Return \code{true} when two
nodes are in the same type and are equal according to the \code{==} operator of that type.}
\begin{apient}
virtual unsigned numChildren() const;
\end{apient}
\apidesc{Return the number of children of this node.}
\begin{apient}
virtual AST::Ptr child(unsigned i) const;
\end{apient}
\apidesc{Return the \code{i}th child.}
\begin{apient}
virtual const std::string format() const = 0;
\end{apient}
\apidesc{Return the string representation of the node.}
\begin{apient}
static AST::Ptr substitute(AST::Ptr in, AST::Ptr a, AST::Ptr b);
\end{apient}
\apidesc{Substitute every occurrence of \code{a} with \code{b} in AST \code{in}.
Return a new AST after the substitution.}
\begin{apient}
virtual AST::ID AST::getID() const;
\end{apient}
\apidesc{Return the class type ID of this node.}
\begin{apient}
virtual Ptr accept(ASTVisitor *v);
\end{apient}
\apidesc{Apply visitor \code{v} to this node. Note that this method will not
automatically apply the visitor to its children.}
\begin{apient}
virtual void AST::setChild(int i, AST::Ptr c);
\end{apient}
\apidesc{Set the \code{i}th child of this node to \code{c}.}