Computer Laboratory

SOAAP

Generating LLVM IR

To run SOAAP on a program, you must first compile all the C/C++ files to LLVM IR and if there are several files, link them together into a single LLVM IR file. To compile to LLVM IR, use the following command:

[me@mymachine ~/workspace/scratch]$ clang -cc1 -g -I ~/workspace/me/soaap/include -emit-llvm file1.c file2.c file3.c
[me@mymachine ~/workspace/scratch]$ llvm-link -o myprog.ll file1.ll file2.ll file3.ll

This produces the LLVM IR file myprog.ll by linking the individual LLVM IR files.

Running SOAAP

We can now run the SOAAP tool on myprog.ll as follows:

[me@mymachine ~/workspace/scratch]$ ~/workspace/soaap/build/bin/soaap -o myprog.soaap myprog.ll

If you specified any performance simulation annotations, then SOAAP will have inserted instrumentation appropriately into the output file myprog.soaap. To perform the simulation, you need to create an executable and run it:

[me@mymachine ~/workspace/scratch]$ llc -filetype=obj -o myprog.o myprog.soaap
[me@mymachine ~/workspace/scratch]$ clang -o myprog-soaap myprog.o
[me@mymachine ~/workspace/scratch]$ ./myprog-soaap
soaap_perf_tic [215] SANDBOXED FUNCTION PROLOGUE -- TIC!
soaap_perf_enter_datain_persistent_sbox [59] Emulating performance of using persistent sandbox.
soaap_perf_enter_datain_persistent_sbox [103] DATALEN: 16
soaap_perf_enter_datain_persistent_sbox [122] PARENT: written to the pipe 16 bytes
soaap_perf_overhead_toc [222] SANDBOXED FUNCTION OVERHEAD -- SBOX_TOC!
Result: 16
[!!!] Sandboxing Overhead 69.998658% (Threshold: 12%)
soaap_perf_total_toc_thres [303] [Total Execution Time]: 22349 ns, [Sandboxing Time]: 15644 ns, [Sandboxing Overhead]: 69.998658%