lac-dcc / Daedalus

Daedalus is an LLVM pass that compresses code by identifying and extracting recurrent program slices.
GNU General Public License v3.0
20 stars 1 forks source link

Daedalus

Daedalus drawing

Daedalus is an LLVM pass that maps instructions to program slices. Our goal is to use program slices as a unit of program compression by outlining common slices, thereby making code shorter.

Table of Contents

Documentation

To generate the project's documentation, execute the following command from the root directory of the repository:

$ doxygen

The complete documentation will be generated inside the docs/ folder. To view it, open docs/html/index.html in your web browser.

Building

Daedalus is an out-of-tree LLVM pass. Therefore, you can compile and install it as a library by doing the following:

$ mkdir build
$ cd build
$ cmake -DLLVM_DIR={path_to_llvm_project} ../
$ cmake --build .

Disclaimer: This pass depends on a custom fork of LLVM 17.

Running

After building Daedalus, you can test it using the source files inside the tests/ folder. Run the following sequence of commands in bash to generate test executables and IR files:

$ cd tests
$ ./generate_tests.sh -v

For a given test file name (without its extension), the following files are created:

Test Name: test6.c

If you prefer to run the pass directly, you can simply do the following:

$ clang -S -Xclang -disable-O0-optnone -emit-llvm {path_to_ll_file} -o {path_to_output_ll_file}
$ opt -S -passes=mem2reg,lcssa {path_to_output_ll_file} -o {path_to_output_ll_file}
$ opt -debug-only=daedalus -passes=daedalus -load-pass-plugin=path/to/lib/libdaedalus.so -S {path_to_ll_file} -o {path_to_output_ll_file} 2>&1