PavlosMak / LLVM-IR-Fencer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fence Insertion for LLVM IR

A modification of the LLVM compiler infrastructure for automatically inserting fences in weak memory model concurrent programs. The project aims to reproduce and adapt the integer linear programming for fence insertion presented by Alglave et.al.

Running instructions

After cloning the repository please follow the steps listed below to setup the project.

Setting up SVF

Our tool relies on SVF to perform points-to analysis on the LLVM IR. As such, when first setting up the project you have to compile it. Extensive instructions can be found on SVF's github page but in sort:

Navigate to the SVF-SVF-2.2 directory and run:

$ source ./build.sh

If you encounter any problems please consult the SVF setup page.

Running and building the fencer

The main python script can be used to compile the test programs and run the tool against them. First compile by running:

$ python main.py --compile-tests

And then run the tool by doing:

$ python main.py --run

This command will place fences in all of the .ll files within the test_programs/ directory, and all of the test_programs/own directory. By editing main.py you could redirect this to a custom folder.

If you wish to verify your installation, you can run our Python test suite by running:

$ python main.py --python-tests

Code structure

Within the fence_insertion directory, there are different files that each have their own functionality:

  • aeg.py: Represent the abstract event graph, and can perform Tarjan's algorithm
  • analysis.py: Handles the iterators that convert the parsed code into parts of the abstract event graph
  • insertion.py: Exports a new file where it has inserted the required fences
  • instructions.py: parses instructions to find determine what kind of instruction a line entails
  • pointer_analysis: Finds shared memory locations within the program that are indirectly accessed through pointers

Requirements

Tests and Benchmarks

To test the tool we utilize the classic and fast benchmarks provided here.

About


Languages

Language:C++ 57.4%Language:C 39.2%Language:LLVM 1.3%Language:Python 1.3%Language:HTML 0.3%Language:CSS 0.2%Language:CMake 0.2%Language:Shell 0.1%Language:Dockerfile 0.0%