GRIN is a compiler back-end for lazy and strict functional languages with whole program optimization support.
Go to file
2018-11-25 00:36:20 +01:00
bugs add test file for a new bug 2018-11-25 00:33:29 +01:00
docs Update MemoryManagement.md 2018-11-24 23:16:10 +01:00
grin Disable tests. 2018-11-25 00:36:20 +01:00
images revert 2018-09-25 00:08:54 +02:00
my-notes move docs and notes into separate folder 2018-09-24 19:19:04 +02:00
nix add support for nix 2018-06-08 17:58:15 +02:00
papers add paper on packed data layout 2018-11-05 14:02:59 +01:00
playground Remove duplicated code: ExtendReg 2018-11-15 02:04:08 +01:00
.gitattributes more accurate statistics 2018-03-22 18:46:42 +01:00
.gitignore WIP: Agda backend prototype 2018-06-09 15:43:32 +02:00
.travis.yml fix travis script 2018-11-08 22:29:31 +01:00
bench.sh add llvm jit to benchmarks 2017-09-18 18:31:16 +01:00
created-by.todo Fixed a bug in created-by analysis, added corresponding test case 2018-08-30 14:39:40 +02:00
dead-code-elimination.todo Refactored Pipeline.hs 2018-11-18 14:59:21 +01:00
examples.note First steps of implementing created-by analysis 2018-08-15 01:21:17 +02:00
live-variable.todo Added more tests for LVA. Also refactored LVA a little bit 2018-09-05 21:15:38 +02:00
README.md Update README.md 2018-11-09 06:47:54 +01:00
shell.nix add support for nix 2018-06-08 17:58:15 +02:00
stack.yaml Finalized merge 2018-11-24 00:03:13 +01:00

GRIN

Build Status Coverage Status Gitter chat

The name GRIN is short for Graph Reduction Intermediate Notation, and it is an intermediate language for graph reduction. For an overview read The GRIN Project article. To grasp the details take your time and read Urban Boquist's PhD thesis on Code Optimisation Techniques for Lazy Functional Languages .

We presented the core ideas of GRIN at Haskell Exchange 2018. slides video

Also check the GRIN transformation example from Boquist PhD and an example from our imlementation.

Setup

Installing LLVM

Homebrew

Example using Homebrew on macOS:

$ brew install llvm-hs/llvm/llvm-7.0

Debian/Ubuntu

For Debian/Ubuntu based Linux distributions, the LLVM.org website provides binary distribution packages. Check apt.llvm.org for instructions for adding the correct package database for your OS version, and then:

$ apt-get install llvm-7-dev

Nix

To get a nix shell with all the required dependencies do the following in the top level folder.

nix-shell

To run the example do the following from the top level folder.

(cd grin; cabal run grin -- grin/opt-stages-high-level/stage-00.grin)

To run a local Hoogle server with Haskell documentation do the following.

hoogle server --port 8087 1>/dev/null 2>/dev/null&

Build GRIN

stack setup
stack build

Usage

stack exec -- grin grin/grin/opt-stages-high-level/stage-00.grin

How to Contribute

See: Issues / Tasks for new contributors

Example Front-End

Read about how to generate GRIN code from a frontend language.

Also check the corresponding source code.

i.e.

Simplifying Transformations

Transformation Schema
vectorisation

source code:
Vectorisation2.hs
case simplification

source code:
CaseSimplification.hs
split fetch operation

source code:
SplitFetch.hs
right hoist fetch operation

source code:
RightHoistFetch2.hs
register introduction

source code:
RegisterIntroduction.hs

Optimising Transformations

Transformation Schema
evaluated case elimination

source code:
EvaluatedCaseElimination.hs

test:
EvaluatedCaseEliminationSpec.hs
trivial case elimination

source code:
TrivialCaseElimination.hs

test:
TrivialCaseEliminationSpec.hs
sparse case optimisation

source code:
SparseCaseOptimisation.hs

test:
SparseCaseOptimisationSpec.hs
update elimination

source code:
UpdateElimination.hs

test:
UpdateEliminationSpec.hs
copy propagation

source code:
CopyPropagation.hs

test:
CopyPropagationSpec.hs
late inlining

source code:
Inlining.hs

test:
InliningSpec.hs
generalised unboxing

source code:
GeneralizedUnboxing.hs

test:
GeneralizedUnboxingSpec.hs
arity raising

source code:
ArityRaising.hs

test:
ArityRaisingSpec.hs
case copy propagation

source code:
CaseCopyPropagation.hs

test:
CaseCopyPropagationSpec.hs
case hoisting

source code:
CaseHoisting.hs

test:
CaseHoistingSpec.hs
whnf update elimination

source code:
TODO

test:
TODO
common sub-expression elimination

source code:
CSE.hs

test:
CSESpec.hs
constant propagation

source code:
ConstantPropagation.hs

test:
ConstantPropagationSpec.hs
dead procedure elimination

source code:
DeadProcedureElimination.hs

test:
DeadProcedureEliminationSpec.hs
dead variable elimination

source code:
DeadVariableElimination.hs

test:
DeadVariableEliminationSpec.hs
dead parameter elimination

source code:
DeadParameterElimination.hs

test:
DeadParameterEliminationSpec.hs