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
83 lines
2.8 KiB
TeX
83 lines
2.8 KiB
TeX
\subsection{Class LoopTreeNode}
|
|
\definedin{CFG.h}
|
|
The LoopTreeNode class provides a tree interface to a collection of instances of class
|
|
Loop contained in a function. The structure of the tree
|
|
follows the nesting relationship of the loops in a function.
|
|
Each LoopTreeNode contains a pointer to a loop (represented by Loop), and a set
|
|
of sub-loops (represented by other LoopTreeNode objects). The \code{loop} field
|
|
at the root node is always \code{NULL} since a function may contain multiple outer
|
|
loops. The \code{loop} field is never \code{NULL} at any other node since it
|
|
always corresponds to a real loop.
|
|
Therefore, the outer most loops in the function are contained in the vector of \code{children} of the root.
|
|
|
|
Each instance of LoopTreeNode is given a name that indicates its position in the hierarchy of loops.
|
|
The name of each outermost loop takes the form of \code{loop\_x},
|
|
where \code{x} is an integer from 1 to n,
|
|
where n is the number of outer loops in the function.
|
|
Each sub-loop has the name of its parent,
|
|
followed by a \code{.y}, where \code{y} is 1 to m, where m is the number of sub-loops under the outer loop.
|
|
For example, consider the following C function:
|
|
|
|
\lstset{language=[GNU]C++,basicstyle=\fontfamily{fvm}\selectfont\small}
|
|
\lstset{showstringspaces=false, numbers=none}
|
|
|
|
\begin{lstlisting}
|
|
|
|
void foo() {
|
|
int x, y, z, i;
|
|
for (x=0; x<10; x++) {
|
|
for (y = 0; y<10; y++)
|
|
...
|
|
for (z = 0; z<10; z++)
|
|
...
|
|
}
|
|
for (i = 0; i<10; i++) {
|
|
...
|
|
}
|
|
}
|
|
\end{lstlisting}
|
|
|
|
The \code{foo} function will have a root LoopTreeNode, containing a NULL loop entry and
|
|
two LoopTreeNode children representing the functions outermost loops. These children
|
|
would have names \code{loop\_1} and \code{loop\_2}, respectively representing the \code{x} and \code{i} loops. \code{loop\_2} has
|
|
no children. \code{loop\_1} has two child LoopTreeNode objects, named
|
|
\code{loop\_1.1} and
|
|
\code{loop\_1.2}, respectively representing the \code{y} and \code{z} loops.
|
|
|
|
\begin{apient}
|
|
Loop *loop;
|
|
\end{apient}
|
|
\apidesc{The Loop instance it points to.}
|
|
|
|
\begin{apient}
|
|
std::vector<LoopTreeNode *> children;
|
|
\end{apient}
|
|
\apidesc{The LoopTreeNode instances nested within this loop.}
|
|
|
|
\begin{apient}
|
|
const char * name();
|
|
\end{apient}
|
|
\apidesc{Returns the hierarchical name of this loop.}
|
|
|
|
\begin{apient}
|
|
const char * getCalleeName(unsigned int i)
|
|
\end{apient}
|
|
\apidesc{Returns the function name of the ith callee.}
|
|
|
|
\begin{apient}
|
|
unsigned int numCallees()
|
|
\end{apient}
|
|
\apidesc{Returns the number of callees contained in this loop's body.}
|
|
|
|
\begin{apient}
|
|
bool getCallees(vector<Function *> &v);
|
|
\end{apient}
|
|
\apidesc{Fills \code{v} with a vector of the functions called inside this loop.}
|
|
|
|
|
|
\begin{apient}
|
|
Loop * findLoop(const char *name);
|
|
\end{apient}
|
|
\apidesc{Looks up a loop by the hierarchical name}
|
|
|