aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/llvm/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/llvm/mod.rs')
-rw-r--r--src/llvm/mod.rs29
1 files changed, 29 insertions, 0 deletions
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 ()>);