An open API service indexing awesome lists of open source software.

https://github.com/xhacker/bitcast-legalization-pass

An LLVM pass for legalizing bitcast from illegal types
https://github.com/xhacker/bitcast-legalization-pass

Last synced: over 1 year ago
JSON representation

An LLVM pass for legalizing bitcast from illegal types

Awesome Lists containing this project

README

          

# Bitcast Legalization Pass

## Motivation

If LLVM IR code uses bitcasts from vectors with illegal element types, the resulting assembly or machine code generated by the backend could be incorrect. This pass implements a simple workaround to this problem. For more information, see [I2Result Demo](http://parabix.costar.sfu.ca/wiki/I2Result).

## Build and Run Using `cmake`, `make`, and `opt`

```sh
mkdir build
cd build
cmake -G "Unix Makefiles" ..
make
cd ..
opt -S -load build/BitcastLegalization/libBitcastLegalization.so -bitcastlegalization < tests/i1.ll
```

## Build and Run Using Xcode and `opt`

```sh
mkdir xcode
cd xcode
cmake -G "Xcode" ..
# Open Xcode and build
cd ..
opt -S -load xcode/BitcastLegalization/Debug/libBitcastLegalization.so -bitcastlegalization < tests/i1.ll
```

## Run Tests

The following runs a test that shows that the pass avoids the problem mentioned in the page linked above.

```sh
cd tests
./run.sh pr2
```