Llvm

Front-end for the LLVM IR-code

This front-end can be used as an enabler for many other languages, for example ADA and C++.

Currently this module a work in progress. The first step is to parse the llvm assembly. The next phase would be to convert that into ppci ir.

Another nice idea is to generate llvm ir code from ppci. When generating and parsing are combined, the llvm optimizers can be used.

ppci.lang.llvmir.llvm_to_ir(source)

Convert llvm assembly code into an IR-module

Example usage

An example usage is the following:

$ llvm-stress | ppci-llc.py -m riscv -o my_object.oj -

Here, the llvm-stress tool generates some random llvm source code, and this is piped into the ppci-llc.py command, which takes ll code and turns it into machine code.

Another example is how to use clang together with ppci-llc.py:

$ clang -S -emit-llvm -o - magic2.c | ppci-llc.py -o my_obj.oj -m msp430 -

This will compile the sourcefile magic2.c into my_obj.oj for the msp430 target.