llvm-general-quote: QuasiQuoting llvm code for llvm-general

[ bsd3, code-generation, compilers-interpreters, library ] [ Propose Tags ] [ Report a vulnerability ]
Versions [RSS] 0.1.0.0, 0.2.0.0
Dependencies array (>=0.5 && <0.6), base (>=4.7 && <4.8), bytestring, containers (>=0.5 && <0.6), haskell-src-meta, llvm-general-pure (>=3.4.3.0), mainland-pretty, mtl (>=2.2.1), split, srcloc, syb, symbol, template-haskell (>=2.7), th-lift [details]
License BSD-3-Clause
Copyright Timo von Holtz 2014
Author Timo von Holtz <tvh@tvholtz.de>
Maintainer Timo von Holtz <tvh@tvholtz.de>
Category Compilers/Interpreters, Code Generation
Home page https://github.com/tvh/llvm-general-quote
Source repo head: git clone git://github.com/tvh/llvm-general-quote.git
Uploaded by TvH at 2014-10-14T22:41:42Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1746 total (5 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for llvm-general-quote-0.2.0.0

[back to package description]

llvm-general-quote

llvm-general-quote is a quasiquoting-library for llvm-general. It aims to support all language constructs of llvm.

In addtion to this, it supports using mutable variables and control structures instead of pure SSA form. This is translated automatically into SSA through appropriate renaming.

Example:

[lldef|
  define i64 @foo(i64 %start, i64 %end) {
    entry:
      %x = i64 0

    for:
      for i64 %i in %start to %end {
          %x = add i64 %i, %x
      }

    exit:
      ret i64 %x
  }
  |]

this would be transformed into:

define i64 @foo(i64 %start, i64 %end) {
entry:
  br label %for.head

for.head:                      ; preds = %n0, %entry
  %x.12 = phi i64 [ 0, %entry ], [ %x.6, %n0 ]
  %i.4 = phi i64 [ %start, %entry ], [ %i.9, %n0 ]
  %for.cond.3 = icmp slt i64 %i.4, %end
  br i1 %for.cond.3, label %n0, label %for.end

n0:                            ; preds = %for.head
  %x.6 = add i64 %i.4, %x.12
  %i.9 = add nuw nsw i64 %i.4, 1
  br label %for.head

for.end:                       ; preds = %for.head
  ret i64 %x.12
}