Skip to content

A simple example that shows how to build an LLVM pass as a dynamic library as well as a stand-alone application

License

Notifications You must be signed in to change notification settings

FAU-Inf2/llvm-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LLVM examples

This repository contains a very simple example project that shows how to write an LLVM optimization pass and how to build a dynamic library as well as a stand-alone application from it. This example was written as part of the LLVM lecture in "Ausgewählte Kapitel aus dem Übersetzerbau" at the Friedrich-Alexander-University Erlangen-Nürnberg.

Building the dynamic library and the application

To build the dynamic library as well as the stand-alone application simply type

make

Without further changes to the Makefile it is required that LLVM is installed and can be found in the search path. This project was built and tested against LLVM version 7.0.

Running the example pass

The dynamic library can be used with the LLVM opt tool, e.g.

opt -S -load=./bin/passes.o -strength-reduction <INPUT PROGRAM>

The stand-alone application can be run as follows:

./bin/app <INPUT PROGRAM>

License

This project is licensed under the terms of the MIT license, see LICENSE.mit for further information.

About

A simple example that shows how to build an LLVM pass as a dynamic library as well as a stand-alone application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published