From cd62c3f8ccce0d834c333edafe2a825126c2bef6 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Sat, 18 Sep 2021 00:18:28 +0200 Subject: llvm: split into sub-modules --- src/llvm/mod.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/llvm/mod.rs (limited to 'src/llvm/mod.rs') diff --git a/src/llvm/mod.rs b/src/llvm/mod.rs new file mode 100644 index 0000000..f3e54a8 --- /dev/null +++ b/src/llvm/mod.rs @@ -0,0 +1,29 @@ +//! Safe wrapper around the LLVM C API. +//! +//! References returned from the LLVM API are tied to the `'llvm` lifetime which is bound to the +//! context where the objects are created in. +//! We do not offer wrappers to remove or delete any objects in the context and therefore all the +//! references will be valid for the liftime of the context. +//! +//! For the scope of this tutorial we mainly use assertions to validate the results from the LLVM +//! API calls. + +use llvm_sys::prelude::LLVMBasicBlockRef; + +use std::marker::PhantomData; + +mod builder; +mod module; +mod pass_manager; +mod type_; +mod value; + +pub use builder::IRBuilder; +pub use module::Module; +pub use pass_manager::FunctionPassManager; +pub use type_::Type; +pub use value::{FnValue, Value}; + +/// Wrapper for a LLVM Basic Block. +#[derive(Copy, Clone)] +pub struct BasicBlock<'llvm>(LLVMBasicBlockRef, PhantomData<&'llvm ()>); -- cgit v1.2.3