inline-asm: Inline some Assembly in ur Haskell!

[ bsd3, ffi, library ] [ Propose Tags ]

Modules

[Last Documentation]

  • Language
    • Asm
      • Language.Asm.Inline
        • Language.Asm.Inline.AsmCode
        • Language.Asm.Inline.QQ
        • Language.Asm.Inline.Util

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.1.0, 0.2.0.0, 0.2.1.0, 0.3.1.0, 0.4.0.0, 0.4.0.1, 0.4.0.2, 0.5.0.0, 0.5.0.1, 0.5.0.2
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), bytestring, containers, either, ghc-prim, inline-asm, megaparsec, mtl, template-haskell (>=2.15.0.0), uniplate [details]
License BSD-3-Clause
Copyright 2020 Georg Rudoy
Author Georg Rudoy
Maintainer 0xd34df00d@gmail.com
Category FFI
Home page https://github.com/0xd34df00d/inline-asm#readme
Bug tracker https://github.com/0xd34df00d/inline-asm/issues
Source repo head: git clone https://github.com/0xd34df00d/inline-asm
Uploaded by 0xd34df00d at 2020-02-25T20:50:51Z
Distributions
Executables inline-asm-exe
Downloads 2186 total (26 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 2020-02-26 [all 3 reports]

Readme for inline-asm-0.3.1.0

[back to package description]

inline-asm

Build Status

When inline C is too safe.

Did you try inline-c, but it's not enough? You need more? Nothing seems to satisfy? inline-asm to the rescue!

For now the usage is pretty straightforward: use defineAsmFun to define the corresponding function, like

defineAsmFun "timesTwo" [t| Word -> Word |] "add %rbx, %rbx"

and then use the function timesTwo as any other function of type Word -> Word:

main = print $ timesTwo 21

There is also an alternative notation allowing named arguments to avoid remembering which arguments are passed in which registers:

defineAsmFun "swap2p1"
  [asmTy| (a : Int) (b : Int) | (_ : Int) (_ : Int)]
  [asm|
  xchg ${a}, ${b}
  add $1, ${b}
  |]