Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/duncantl/Rllvm
R interface to LLVM C++ API to be able to create compiled code from within R
https://github.com/duncantl/Rllvm
Last synced: 3 months ago
JSON representation
R interface to LLVM C++ API to be able to create compiled code from within R
- Host: GitHub
- URL: https://github.com/duncantl/Rllvm
- Owner: duncantl
- Created: 2012-04-01T16:57:16.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2024-05-11T03:43:22.000Z (6 months ago)
- Last Synced: 2024-05-21T02:53:58.303Z (6 months ago)
- Language: R
- Homepage: http://www.omegahat.org/Rllvm
- Size: 228 MB
- Stars: 87
- Watchers: 17
- Forks: 10
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog
Awesome Lists containing this project
README
# RLLVM
**Updated for LLVM 18**
+ Not fully tested!RLLVM is an R interface to [LLVM](http://llvm.org). This interface
allows one to+ dynamically create native machine code
+ invoke native/compiled code
+ analyze native code from C/C++/FORTRAN codeWe generate native code via R commands and
intermediate representation (IR), which LLVM can then extensively and
efficiently optimize and generate native code.For examples, see
+ [explorations](explorations),
+ [experiments](experiments) and
+ [tests](tests) directories.The current repository builds against LLVM 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, ..., 3.5, 3.6, 3.7, and 3.8.
Importantly, versions of LLVM default to the MCJIT execution engine.
This unfortunately has very limited ability to invoke routines compiled via Rllvm,
i.e., using the .llvm() and run() functions. Acccordingly, we have implemented a
reasonably comprehensive mechanism to invoke these routines.
We use the [Rffi](https://github.com/omegahat/Rffi) package to do this.So this package now requires the [Rffi](https://github.com/omegahat/Rffi) package.
This comes with its own version of libffi, but will find a more up-to-date version
if it is installed (see pkg-config).These packages are not on CRAN.
Related packages are
+ [Rffi](https://github.com/omegahat/Rffi),
+ Rllvm (this one),
+ [RLLVMCompile](https://github.com/duncantl/RLLVMCompile),
+ [RCIndex](https://github.com/omegahat/RClangSimple),
+ [NativeCodeAnalysis](https://github.com/duncantl/NativeCodeAnalysis).And exploration/proof-of-concept packages using this include:
+ [RCUDA](https://github.com/duncantl/RCUDA),
+ [RllvmSQLiteUDF](https://github.com/duncantl/RllvmSQLiteUDF)
+ [RllvmXPathUDF](https://github.com/duncantl/RllvmXPathUDF)## Installation
See [INSTALL.md](INSTALL.md).
The usual package installation
```
R CMD INSTALL .
```
should work.On OSX, when working with binary versions of LLVM or versions built from source,
some of the dynamic libraries (dylib) may not correctly point to the libc++.1.dylib
leading to a failure to load the Rllvm.so library.
To fix this, we use the command
```
install_name_tool -change @rpath/libc++.1.dylib /usr/lib/libc++.1.dylib src/Rllvm.so
```
to fix the `src/Rllvm.so`.We can detect this either
+ a) from the error message when R tries to load the package and its .so, or
+ b) using `otool -L src/Rllvm.so`.After correcting this, R CMD INSTALL should install the corrected .so without needing to recompile
or relink.## URLs
+ [LLVM Web site](https://llvm.org)
+ [LLVM Documentation](http://llvm.org/docs/)
+ [Book chapter on LLVM](http://www.aosabook.org/en/llvm.html)