Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cr0a3/rllvm
LLVM alternative in Rust
https://github.com/cr0a3/rllvm
codegen codegenlib llvm x64
Last synced: 3 months ago
JSON representation
LLVM alternative in Rust
- Host: GitHub
- URL: https://github.com/cr0a3/rllvm
- Owner: Cr0a3
- License: lgpl-3.0
- Created: 2024-05-09T14:05:54.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-05-20T09:55:18.000Z (8 months ago)
- Last Synced: 2024-09-30T03:40:43.192Z (3 months ago)
- Topics: codegen, codegenlib, llvm, x64
- Language: Rust
- Homepage:
- Size: 128 KB
- Stars: 11
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# RLLVM
![Languages](https://img.shields.io/github/languages/top/Toni-Graphics/rllvm?logo=rust)
![GitHub Repo stars](https://img.shields.io/github/stars/Toni-Graphics/rllvm?style=flat)
![GitHub License](https://img.shields.io/github/license/Toni-Graphics/rllvm)
![Dynamic TOML Badge](https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2FToni-Graphics%2Frllvm%2Fmain%2FCargo.toml&query=%24.package.version&label=version)LLVM alternativ
## Example
```rust
use std::error::Error;
use rllvm::prelude::*;fn main() -> Result<(), Box>{
let mut contxt = Context::new( Triple::host() )?;
let func = contxt.add_function("add", vec![Type::u32, Type::u32], Type::u32);
let asm = func.asm_func()?;let x = asm.arg(0).unwrap();
let y = asm.arg(1).unwrap();func.ir.push( Return::new(*(x + y) ) );
unsafe {
let mut func: JitFunction u32> = contxt.get_jit_function("add")?;
let out = func.call(5, 5);println!("main() -> {}", out);
}Ok(())
}
```## ToDo
Here is a bit of ToDo for my libary:
## v0.1.2
- [x] Starting high level ir struct
- [x] Use traits `impl Compiler for Ir::Add` so i can overload the enum variants
- [x] Make it compilable
- [ ] Implement `mov`, `add`, `sub`, `mul`, `div` | `ints`, `floats`
- [ ] mov
- [x] add
- [x] sub
- [x] mul
- [ ] div
- [x] ints
- [ ] floats
- [x] Starting high level ir builder
- [x] via traits## v0.1.3
- [x] Implement `args` to the high level ir
- [x] Add option (in `context`) to compile to object file
- [ ] Naming convention
- [x] generate
- [ ] parse