hLLVM: A library for analyzing and transforming LLVM (3.5) assembly codes

[ bsd3, compilers-interpreters, library, program ] [ Propose Tags ]

A pure Haskell library for analyzing and transforming LLVM assembly codes. It includes: 1) a parser to parse LLVM code in its text form; 2) an internal IR that is designed for Hoopl and direct composition; 3) a set of utility functions to convert LLVM AST to and from the internal IR; 4) a set of utility functions to query the IR.

[Skip to Readme]


  • Llvm
    • Data
      • Llvm.Data.Ast
      • Llvm.Data.Conversion
        • Llvm.Data.Conversion.AstIrConversion
        • Llvm.Data.Conversion.AstScanner
        • Llvm.Data.Conversion.AstSimplification
        • Llvm.Data.Conversion.IrAstConversion
        • Llvm.Data.Conversion.LabelMapM
        • Llvm.Data.Conversion.TypeConversion
      • Llvm.Data.CoreIr
      • Llvm.Data.Ir
      • Llvm.Data.IrType
      • Llvm.Data.Shared
        • Llvm.Data.Shared.AtomicEntity
        • Llvm.Data.Shared.DataLayout
        • Llvm.Data.Shared.SimpleConst
        • Llvm.Data.Shared.Util
      • Llvm.Data.Type
    • Pass
      • Llvm.Pass.Dominator
      • Llvm.Pass.Liveness
      • Llvm.Pass.Mem2Reg
      • Llvm.Pass.NormalGraph
      • Llvm.Pass.Optimizer
      • Llvm.Pass.PassManager
      • Llvm.Pass.PassTester
      • Llvm.Pass.PhiFixUp
      • Llvm.Pass.Rewriter
      • Llvm.Pass.Uda
    • Query
      • Llvm.Query.Conversion
      • Llvm.Query.IrCxt
      • Llvm.Query.Qerror
      • Llvm.Query.TypeConstValue
      • Llvm.Query.TypeDef
    • Syntax
      • Parser
        • Llvm.Syntax.Parser.Basic
        • Llvm.Syntax.Parser.Block
        • Llvm.Syntax.Parser.Const
        • Llvm.Syntax.Parser.DataLayout
        • Llvm.Syntax.Parser.Instruction
        • Llvm.Syntax.Parser.Module
        • Llvm.Syntax.Parser.Rhs
        • Llvm.Syntax.Parser.Type
      • Printer
        • Llvm.Syntax.Printer.Common
        • Llvm.Syntax.Printer.IrPrint
        • Llvm.Syntax.Printer.LlvmPrint
        • Llvm.Syntax.Printer.SharedEntityPrint
    • Util
      • Llvm.Util.Mapping
      • Llvm.Util.Monadic
  • ParserTester


Automatic Flags

Enable debug support


Enable test coverage report


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS],
Change log CHANGES
Dependencies array, base (>=3 && <5), bytestring, cmdargs (>=0.10 && <0.11), containers, data-dword (==0.3), directory, filepath, hooplext (==, mtl, parsec (>=3.1.2 && <3.2), pretty (>=, template-haskell (>=, transformers (>= [details]
License BSD-3-Clause
Author Ning Wang <email@ningwang.org>
Maintainer Ning Wang <email@ningwang.org>
Category Compilers/Interpreters
Source repo head: git clone https://github.com/mlite/hLLVM.git
Uploaded by NingWang at 2015-04-15T08:38:36Z
Reverse Dependencies 1 direct, 0 indirect [details]
Executables llvm-test
Downloads 1682 total (5 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2016-12-10 [all 8 reports]

Readme for hLLVM-

[back to package description]

hLLVM -- A Haskell Library for analyzing and transforming LLVM assembly codes


  • Provide functionalities for performaning analysis and transformation of LLVM codes in pure Haskell


From hLLVM toplevel directory

cabal configure

cabal build

The test driver 'llvm-test' is generated at dist/build/llvm-test


test LLVM assembly parser

dist/build/llvm-test/llvm-test parse -i test/test1.ll -o out.ll

test mem2reg pass

dist/build/llvm-test/llvm-test pass -s=mem2reg -f=10000 -i test/test1.ll -o out.ll

test dce pass

dist/build/llvm-test/llvm-test pass -s=dce -f=10000 -i test/test1.ll -o out.ll

test mem2reg and dce passes

dist/build/llvm-test/llvm-test pass -s=mem2reg -s=dce -f=1000 -i test/test1.ll -o out.ll

run tests in batch (llvm-test needs to be available in the executable search paths)

test/runLlvmTest.sh [parse|ast2ir|ir2ast]