-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.yaml
More file actions
102 lines (81 loc) · 2.71 KB
/
Copy pathpackage.yaml
File metadata and controls
102 lines (81 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: ir-builder
version: 0.1.0.0
license: MIT
author: "Heikki Johannes Hildén"
maintainer: "hildenjohannes@gmail.com"
copyright: "2026-present Heikki Johannes Hildén"
synopsis: Monadic DSL for constructing LLVM IR
category: Compilers/Interpreters
homepage: https://codeberg.org/laserpants/ir-builder
bug-reports: https://codeberg.org/laserpants/ir-builder/issues
git: https://codeberg.org/laserpants/ir-builder.git
extra-source-files:
- README.md
- CHANGELOG.md
- prologue.haddock
description: |
A monadic DSL for constructing LLVM IR.
Write Haskell, get LLVM assembly — no external tools or C bindings required.
Import the complete public API with a single line:
@import LLVM.IR@
Then define functions and emit instructions:
> example :: Text
> example = compileModule "example" $
> define void "hello" [] LExternal [] $ do
> beginBlock "entry"
> retVoid
Produces:
> define void @hello() {
> entry:
> ret void
> }
== Module guide
["LLVM.IR"] Complete re-export of the public API. Start here.
["LLVM.IRBuilder"] Builder monad and compilation entry points:
@compileModule@, @buildModule@, @define@, @beginBlock@, @block@,
@declare@, @emitGlobal@, and the @(\<\#\#\>)@ inline-comment operator.
["LLVM.IRInstruction.Constructors"] Instruction smart constructors:
@add@, @sub@, @mul@, @sdiv@, @load@, @store@, @gep@, @icmp@, @phi@,
@call@, @callVoid@, @select@, @alloca@, @sext@, @zext@, and more.
["LLVM.IRType.Constructors"] Type smart constructors: @i1@, @i8@, @i16@,
@i32@, @i64@, @i128@, @ptr@, @void@, @float@, @double@, @struct@,
@array@, @vector@.
["LLVM.IRTerminator.Constructors"] Block terminators: @ret@, @retVoid@,
@br@, @condbr@, @switch@, @unreachable@.
["LLVM.IRBuilder.Error"] @IRBuilderError@ type and @displayError@ for
programs using explicit error handling via @compileModuleWith@ or
@buildModuleWith@.
["LLVM.IRRenderer"] Render an @IRModule@ to LLVM assembly text.
["LLVM.IR.Examples"] Complete, runnable examples: \"Hello, World!\",
annotated addition, and iterative factorial with @mdo@.
dependencies:
- base >= 4.7 && < 5
- text >= 1.2 && < 3
- bytestring >= 0.10 && < 0.13
- containers >= 0.6 && < 0.8
- mtl >= 2.2 && < 2.4
ghc-options:
- -Wall
- -Wcompat
- -Widentities
- -Wincomplete-record-updates
- -Wincomplete-uni-patterns
- -Wmissing-export-lists
- -Wmissing-home-modules
- -Wpartial-fields
- -Wredundant-constraints
library:
source-dirs: src
tests:
ir-builder-test:
main: Spec.hs
source-dirs: test
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
build-tools:
- hspec-discover:hspec-discover
dependencies:
- ir-builder
- hspec >= 2.10.0