Skip to content

Commit

Permalink
document llvmcall
Browse files Browse the repository at this point in the history
  • Loading branch information
ihnorton committed Oct 20, 2015
1 parent b82ab6a commit a957dae
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions base/docs/basedocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,22 @@ keywords[:ccall] = doc"""
in a call to `convert(ArgumentType, ArgumentValue)`.
"""

keywords[:llvmcall] = doc"""
llvmcall(IR::String, ReturnType, (ArgumentType1, ...), ArgumentValue1, ...)
Call LLVM IR string in the first argument. Similar to an LLVM function `define`
block, arguments are available as consecutive unnamed SSA variables (%0, %1, etc.).
Note that the argument type tuple must be a literal tuple, and not a tuple-valued variable or expression.
Each `ArgumentValue` to `llvmcall` will be converted to the corresponding `ArgumentType`,
by automatic insertion of calls to `unsafe_convert(ArgumentType, cconvert(ArgumentType, ArgumentValue))`.
(see also the documentation for each of these functions for further details).
In most cases, this simply results in a call to `convert(ArgumentType, ArgumentValue)`.
See `test/llvmcall.jl` for usage examples.
"""

keywords[:begin] = doc"""
`begin...end` denotes a block of code.
Expand Down
16 changes: 16 additions & 0 deletions doc/stdlib/c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,19 @@
.. data:: Cdouble

Equivalent to the native ``double`` c-type (Float64)

****************
LLVM Interface
****************


.. Docstring generated from Julia source
Call LLVM IR string in the first argument. Similar to an LLVM function ``define`` block, arguments are available as consecutive unnamed SSA variables (%0, %1, etc.).

Note that the argument type tuple must be a literal tuple, and not a tuple-valued variable or expression.

Each ``ArgumentValue`` to ``llvmcall`` will be converted to the corresponding ``ArgumentType``\ , by automatic insertion of calls to ``unsafe_convert(ArgumentType, cconvert(ArgumentType, ArgumentValue))``\ . (see also the documentation for each of these functions for further details). In most cases, this simply results in a call to ``convert(ArgumentType, ArgumentValue)``\ .

See ``test/llvmcall.jl`` for usage examples.

0 comments on commit a957dae

Please sign in to comment.