https://github.com/epiqc/ScaffCC
Raw File
Tip revision: 4d7bfa034cfaea4e8346396c6198cdd3e271d272 authored by Andrew Litteken on 23 April 2020, 16:55:47 UTC
Version 5 Upgrade! (#40)
Tip revision: 4d7bfa0
chapter-expand.tex
\chapter{Expanding ScaffCC}\label{ch:expand}

ScaffCC is completely open-source and may be expanded to accomodate future needs of quantum circuit analysis and optimization.


At the core of ScaffCC are the LLVM compiler passes, which operate on LLVM IR (.ll) code. All LLVM passes are stored in:
\begin{lstlisting}
llvm/lib/Transforms/
\end{lstlisting}

Passes specific to ScaffCC are stored in:
\begin{lstlisting}
llvm/lib/Transforms/Scaffold
\end{lstlisting}

In general, to run a pass in LLVM, you invoke the opt program as follows:
\begin{lstlisting}
build/Release+Asserts/bin/opt -S -load build/Release+Asserts/lib/Scaffold.so {pass_name} {input_ll_file} > {output_ll_file} 2> {log_file}
\end{lstlisting}

Note that ${pass\_name}$ referes to the unique name of the pass by which it is registered in the LLVM system, by invoking the following in the implementation of the pass:
\begin{lstlisting}
static RegisterPass<{pass_name}> X({pass_name}, {description_of_functionality});
\end{lstlisting}

To write a new pass, start by looking at the previously implemented examples in this directory, and consulting the LLVM Documentation:
\url{http://llvm.org/docs/WritingAnLLVMPass.html}
back to top