aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/llvm/mod.rs
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2021-09-18 00:18:28 +0200
committerJohannes Stoelp <johannes.stoelp@gmail.com>2021-09-18 00:18:28 +0200
commitcd62c3f8ccce0d834c333edafe2a825126c2bef6 (patch)
treeb84918a15fcc3ee801914afe15f8e2626bc50ffb /src/llvm/mod.rs
parentb0cad668398c0102b726336871bac28ddfac347c (diff)
downloadllvm-kaleidoscope-rs-cd62c3f8ccce0d834c333edafe2a825126c2bef6.tar.gz
llvm-kaleidoscope-rs-cd62c3f8ccce0d834c333edafe2a825126c2bef6.zip
llvm: split into sub-modules
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 ()>);