Skip to content

exaloop/example-codon-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codon plugin example

This repo implements an example plugin for Codon called MyValidate, which works on the following code:

def foo(x):
    return x*3 + x

def validate(x, y):
    print('validate called!')
    assert y == x*4

a = foo(10)
b = foo(1.5)
c = foo('a')

The plugin includes a Codon IR pass that inserts calls to validate() after calls to foo().

To build the plugin:

export LLVM_DIR=/path/to/lib/cmake/llvm
mkdir build
cd build
cmake ..
make

To use:

codon run -release -plugin /path/to/example-codon-plugin test.py

About

Example plugin for Codon

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published