{"id":15101443,"url":"https://github.com/zshipko/llama","last_synced_at":"2025-09-26T22:31:35.212Z","repository":{"id":42014078,"uuid":"246695553","full_name":"zshipko/llama","owner":"zshipko","description":"Rust LLVM bindings","archived":true,"fork":false,"pushed_at":"2023-01-31T13:03:03.000Z","size":4650,"stargazers_count":31,"open_issues_count":2,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-17T07:54:46.242Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zshipko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-11T22:50:20.000Z","updated_at":"2024-11-19T01:44:35.000Z","dependencies_parsed_at":"2023-02-16T19:31:16.327Z","dependency_job_id":null,"html_url":"https://github.com/zshipko/llama","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zshipko%2Fllama","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zshipko%2Fllama/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zshipko%2Fllama/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zshipko%2Fllama/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zshipko","download_url":"https://codeload.github.com/zshipko/llama/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234338042,"owners_count":18816448,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-25T18:23:08.225Z","updated_at":"2025-09-26T22:31:34.898Z","avatar_url":"https://github.com/zshipko.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# llama\n\nA friendly LLVM library for Rust.\n\nGoals:\n- Support the latest `llvm-sys` release (as of LLVM 14 and llama 0.14.0 the version numbers match)\n- Provide an improved interface, while still remaining as close as possible to the LLVM C API.\n\nDue to the size of the LLVM API there is bound to be missing, broken or incomplete functionality in `llama`, please create an issue if something you need isn't implemented.\n\n**NOTE**: `llama` will let you generate invalid IR, take a look at [inkwell](https://github.com/TheDan64/inkwell) for LLVM bindings with a focus on type-safety\n\n## Documentation\n\n- [llama](https://zshipko.github.io/llama/llama) \u003ca href=\"https://crates.io/crates/llama\"\u003e\u003cimg src=\"https://img.shields.io/crates/v/llama.svg\"\u003e\u003c/a\u003e\n- [llama-build](https://zshipko.github.io/llama/llama_build) \u003ca href=\"https://crates.io/crates/llama-build\"\u003e\u003cimg src=\"https://img.shields.io/crates/v/llama-build.svg\"\u003e\u003c/a\u003e\n\n## Examples\n\nInkwell's example using `llama`:\n\n```rust\nuse llama::*;\n\n// Convenience type alias for the `sum` function.\n//\n// Calling this is innately `unsafe` because there's no guarantee it doesn't\n// do `unsafe` operations internally.\ntype SumFunc = unsafe extern \"C\" fn(u64, u64, u64) -\u003e u64;\n\nfn compile_sum(jit: \u0026mut Jit) -\u003e Result\u003cSumFunc, Error\u003e {\n    let i64 = Type::i64(jit.context())?;\n    let sum_t = FuncType::new(i64, [i64, i64, i64])?;\n    jit.declare_function(\"sum\", sum_t, |build, f| {\n        let params = f.params();\n        let x = params[0];\n        let y = params[1];\n        let z = params[2];\n\n        let sum = build.add(x, y, \"sum\")?;\n        let sum = build.add(sum, z, \"sum\")?;\n        build.ret(sum)\n    })?;\n\n    unsafe { jit.engine().function(\"sum\") }\n}\n\nfn main() -\u003e Result\u003c(), Error\u003e {\n    let mut jit = Jit::new(\"sum\", None)?;\n\n    let sum = compile_sum(\u0026mut jit)?;\n\n    let x = 1u64;\n    let y = 2u64;\n    let z = 3u64;\n\n    unsafe {\n        println!(\"{} + {} + {} = {}\", x, y, z, sum(x, y, z));\n        assert_eq!(sum(x, y, z), x + y + z);\n    }\n\n    Ok(())\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzshipko%2Fllama","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzshipko%2Fllama","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzshipko%2Fllama/lists"}