Trait hugr_llvm::custom::prelude::PreludeCodegen

source ·
pub trait PreludeCodegen {
    // Provided methods
    fn usize_type<'c, H: HugrView>(
        &self,
        session: &TypingSession<'c, H>,
    ) -> IntType<'c> { ... }
    fn qubit_type<'c, H: HugrView>(
        &self,
        session: &TypingSession<'c, H>,
    ) -> impl BasicType<'c> { ... }
}
Expand description

A helper trait for implementing CodegenExtensions for hugr::extension::prelude.

All methods have sensible defaults provided, and DefaultPreludeCodegen is trivial implementation o this trait, which delegates everything to those default implementations.

One should use either PreludeCodegenExtension::new, or CodegenExtsMap::add_prelude_extensions to work with the CodegenExtension.

TODO several types and ops are unimplemented. We expect to add methods to this trait as necessary, allowing downstream users to customise the lowering of prelude.

Provided Methods§

source

fn usize_type<'c, H: HugrView>( &self, session: &TypingSession<'c, H>, ) -> IntType<'c>

Return the llvm type of hugr::extension::prelude::USIZE_T. That type must be an IntType.

source

fn qubit_type<'c, H: HugrView>( &self, session: &TypingSession<'c, H>, ) -> impl BasicType<'c>

Return the llvm type of hugr::extension::prelude::QB_T.

Object Safety§

This trait is not object safe.

Implementors§