pub struct LlvmBackend { /* private fields */ }Expand description
LLVM IR code generation backend.
Compiles LCNF declarations to LLVM IR text format.
Implementations§
Source§impl LlvmBackend
impl LlvmBackend
Sourcepub fn mangle_name(name: &str) -> String
pub fn mangle_name(name: &str) -> String
Mangle a name for LLVM IR: replace ., -, spaces, and other
non-alphanumeric characters (except _) with underscores.
Sourcepub fn llvm_type_for(ty: &LcnfType) -> LlvmType
pub fn llvm_type_for(ty: &LcnfType) -> LlvmType
Map an LCNF type to an LLVM type.
Sourcepub fn compile_decl(&mut self, decl: &LcnfFunDecl) -> LlvmFunc
pub fn compile_decl(&mut self, decl: &LcnfFunDecl) -> LlvmFunc
Compile an LCNF function declaration to an LLVM function.
Sourcepub fn emit_module(&mut self, decls: &[LcnfFunDecl]) -> Result<String, String>
pub fn emit_module(&mut self, decls: &[LcnfFunDecl]) -> Result<String, String>
Compile all LCNF declarations and emit an LLVM IR module as text.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LlvmBackend
impl RefUnwindSafe for LlvmBackend
impl Send for LlvmBackend
impl Sync for LlvmBackend
impl Unpin for LlvmBackend
impl UnsafeUnpin for LlvmBackend
impl UnwindSafe for LlvmBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more