pub struct Context { /* private fields */ }Expand description
A context of IR, dialects, and passes.
Contexts own various objects, such as types, locations, and dialect instances.
Implementations§
Source§impl Context
impl Context
Sourcepub fn new_with_threading(threading_enabled: bool) -> Self
pub fn new_with_threading(threading_enabled: bool) -> Self
Creates a context with multithreading set explicitly.
Sourcepub fn new_with_registry(
registry: &DialectRegistry,
threading_enabled: bool,
) -> Self
pub fn new_with_registry( registry: &DialectRegistry, threading_enabled: bool, ) -> Self
Creates a context with a pre-loaded dialect registry and explicit threading setting.
Sourcepub fn registered_dialect_count(&self) -> usize
pub fn registered_dialect_count(&self) -> usize
Returns a number of registered dialects.
Sourcepub fn loaded_dialect_count(&self) -> usize
pub fn loaded_dialect_count(&self) -> usize
Returns a number of loaded dialects.
Sourcepub fn get_or_load_dialect<'c>(&'c self, name: &str) -> Dialect<'c>
pub fn get_or_load_dialect<'c>(&'c self, name: &str) -> Dialect<'c>
Returns or loads a dialect.
Sourcepub fn append_dialect_registry(&self, registry: &DialectRegistry)
pub fn append_dialect_registry(&self, registry: &DialectRegistry)
Appends a dialect registry.
Sourcepub fn load_all_available_dialects(&self)
pub fn load_all_available_dialects(&self)
Loads all available dialects.
Sourcepub fn enable_multi_threading(&self, enabled: bool)
pub fn enable_multi_threading(&self, enabled: bool)
Enables multi-threading.
Sourcepub fn allow_unregistered_dialects(&self) -> bool
pub fn allow_unregistered_dialects(&self) -> bool
Returns true if unregistered dialects are allowed.
Sourcepub fn set_allow_unregistered_dialects(&self, allowed: bool)
pub fn set_allow_unregistered_dialects(&self, allowed: bool)
Sets if unregistered dialects are allowed.
Sourcepub fn is_registered_operation(&self, name: &str) -> bool
pub fn is_registered_operation(&self, name: &str) -> bool
Returns true if a given operation is registered in a context.
Sourcepub const fn to_raw(&self) -> MlirContext
pub const fn to_raw(&self) -> MlirContext
Converts a context into a raw object.
Sourcepub fn attach_diagnostic_handler<F: FnMut(Diagnostic<'_>) -> bool>(
&self,
handler: F,
) -> DiagnosticHandlerId
pub fn attach_diagnostic_handler<F: FnMut(Diagnostic<'_>) -> bool>( &self, handler: F, ) -> DiagnosticHandlerId
Attaches a diagnostic handler.
Sourcepub fn detach_diagnostic_handler(&self, id: DiagnosticHandlerId)
pub fn detach_diagnostic_handler(&self, id: DiagnosticHandlerId)
Detaches a diagnostic handler.
Sourcepub unsafe fn set_thread_pool(&self, pool: &ThreadPool)
pub unsafe fn set_thread_pool(&self, pool: &ThreadPool)
Sourcepub fn thread_count(&self) -> usize
pub fn thread_count(&self) -> usize
Returns the number of threads used by the context.
Trait Implementations§
Source§impl PartialEq<Context> for ContextRef<'_>
impl PartialEq<Context> for ContextRef<'_>
Source§impl<'a> PartialEq<ContextRef<'a>> for Context
impl<'a> PartialEq<ContextRef<'a>> for Context
impl Eq for Context
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
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