/* automatically generated by rust-bindgen 0.73.1 */
pub const LOOMC_STATUS_FEATURE_SOURCE_LOCATION: u32 = 1;
pub const LOOMC_STATUS_FEATURE_ANNOTATIONS: u32 = 2;
pub const LOOMC_STATUS_FEATURE_STACK_TRACE: u32 = 4;
pub const LOOMC_STATUS_MODE: u32 = 3;
pub const LOOMC_STATUS_FEATURES: u32 = 7;
pub const LOOMC_ARTIFACT_FORMAT_LOOM_TEXT: &[u8; 10] = b"loom-text\0";
pub const LOOMC_ARTIFACT_FORMAT_LOOM_BYTECODE: &[u8; 7] = b"loombc\0";
pub const LOOMC_ARTIFACT_FORMAT_JSON: &[u8; 5] = b"json\0";
pub const LOOMC_ARTIFACT_FORMAT_ARTIFACT_MANIFEST_JSON: &[u8; 28] =
b"loom-artifact-manifest-json\0";
pub const LOOMC_REQUIREMENT_ORDINAL_INVALID: u32 = 4294967295;
pub const LOOMC_REQUEST_ROOT_ORDINAL_INVALID: u32 = 4294967295;
pub const LOOMC_ARTIFACT_FORMAT_COMPILE_REPORT_JSON: &[u8; 25] = b"loom-compile-report-json\0";
pub const LOOMC_EMIT_OPTION_KEY_IDENTIFIER: &[u8; 16] = b"emit.identifier\0";
pub const LOOMC_EMIT_OPTION_KEY_ARTIFACT_MANIFEST_MODE: &[u8; 28] =
b"emit.artifact_manifest.mode\0";
pub const LOOMC_EMIT_OPTION_KEY_ARTIFACT_MANIFEST_IDENTIFIER: &[u8; 34] =
b"emit.artifact_manifest.identifier\0";
pub const LOOMC_EMIT_OPTION_KEY_COMPILE_REPORT_MODE: &[u8; 25] = b"emit.compile_report.mode\0";
pub const LOOMC_EMIT_OPTION_KEY_COMPILE_REPORT_IDENTIFIER: &[u8; 31] =
b"emit.compile_report.identifier\0";
pub const LOOMC_ARTIFACT_FORMAT_LINK_DEPENDENCY_REPORT_JSON: &[u8; 33] =
b"loom-link-dependency-report-json\0";
pub const LOOMC_ARTIFACT_FORMAT_AMDGPU_HSACO: &[u8; 13] = b"amdgpu-hsaco\0";
#[doc = " Host allocation and container size type.\n\n Values have the same range as C `size_t`. Public ABI fields use this\n spelling so bindings can mirror one Loom-specific type name rather than\n repeating the C standard library type across the API."]
pub type loomc_host_size_t = usize;
#[repr(C)]
#[derive(Debug)]
pub struct iree_status_handle_t {
_unused: [u8; 0],
}
#[doc = " Opaque status handle.\n\n Small status codes are encoded directly in the pointer value. Rich status\n modes may allocate storage behind the handle and require\n `loomc_status_free` or `loomc_status_consume_code`."]
pub type loomc_status_t = *mut iree_status_handle_t;
#[doc = " Non-owning string view over bytes that need not be NUL-terminated.\n\n @lifetime\n A string view never owns `data`. The API receiving the view documents\n whether it copies the bytes or how long the caller must keep the bytes\n alive."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_string_view_t {
#[doc = " First byte of the string, or `NULL` when the view is empty."]
pub data: *const ::std::os::raw::c_char,
#[doc = " Number of bytes in `data`."]
pub size: loomc_host_size_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_string_view_t"][::std::mem::size_of::<loomc_string_view_t>() - 16usize];
["Alignment of loomc_string_view_t"][::std::mem::align_of::<loomc_string_view_t>() - 8usize];
["Offset of field: loomc_string_view_t::data"]
[::std::mem::offset_of!(loomc_string_view_t, data) - 0usize];
["Offset of field: loomc_string_view_t::size"]
[::std::mem::offset_of!(loomc_string_view_t, size) - 8usize];
};
impl Default for loomc_string_view_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Non-owning view over immutable bytes.\n\n @lifetime\n A byte span never owns `data`. The API receiving the span documents whether\n it copies the bytes or how long the caller must keep the bytes alive."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_byte_span_t {
#[doc = " First byte of the span, or `NULL` when the span is empty."]
pub data: *const u8,
#[doc = " Number of bytes in `data`."]
pub data_length: loomc_host_size_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_byte_span_t"][::std::mem::size_of::<loomc_byte_span_t>() - 16usize];
["Alignment of loomc_byte_span_t"][::std::mem::align_of::<loomc_byte_span_t>() - 8usize];
["Offset of field: loomc_byte_span_t::data"]
[::std::mem::offset_of!(loomc_byte_span_t, data) - 0usize];
["Offset of field: loomc_byte_span_t::data_length"]
[::std::mem::offset_of!(loomc_byte_span_t, data_length) - 8usize];
};
impl Default for loomc_byte_span_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " No structure type was supplied."]
pub const LOOMC_STRUCTURE_TYPE_NONE: loomc_structure_type_e = 0;
#[doc = " `loomc_source_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_SOURCE_OPTIONS: loomc_structure_type_e = 1;
#[doc = " `loomc_workspace_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_WORKSPACE_OPTIONS: loomc_structure_type_e = 2;
#[doc = " `loomc_context_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_CONTEXT_OPTIONS: loomc_structure_type_e = 3;
#[doc = " `loomc_link_index_builder_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_LINK_INDEX_BUILDER_OPTIONS: loomc_structure_type_e = 4;
#[doc = " `loomc_linker_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_LINKER_OPTIONS: loomc_structure_type_e = 5;
#[doc = " `loomc_link_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_LINK_OPTIONS: loomc_structure_type_e = 6;
#[doc = " `loomc_module_serialize_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_MODULE_SERIALIZE_OPTIONS: loomc_structure_type_e = 7;
#[doc = " `loomc_module_deserialize_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_MODULE_DESERIALIZE_OPTIONS: loomc_structure_type_e = 8;
#[doc = " `loomc_compiler_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_COMPILER_OPTIONS: loomc_structure_type_e = 9;
#[doc = " `loomc_compile_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_COMPILE_OPTIONS: loomc_structure_type_e = 10;
#[doc = " `loomc_pass_program_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_PASS_PROGRAM_OPTIONS: loomc_structure_type_e = 11;
#[doc = " `loomc_context_target_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_CONTEXT_TARGET_OPTIONS: loomc_structure_type_e = 12;
#[doc = " `loomc_target_pipeline_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_TARGET_PIPELINE_OPTIONS: loomc_structure_type_e = 13;
#[doc = " `loomc_spirv_emit_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_SPIRV_EMIT_OPTIONS: loomc_structure_type_e = 14;
#[doc = " `loomc_target_specialization_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_TARGET_SPECIALIZATION_OPTIONS: loomc_structure_type_e = 16;
#[doc = " `loomc_spirv_profile_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_SPIRV_PROFILE_OPTIONS: loomc_structure_type_e = 17;
#[doc = " `loomc_emit_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_EMIT_OPTIONS: loomc_structure_type_e = 18;
#[doc = " `loomc_option_dict_t`."]
pub const LOOMC_STRUCTURE_TYPE_OPTION_DICT: loomc_structure_type_e = 19;
#[doc = " `loomc_spirv_vulkaninfo_profile_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_SPIRV_VULKANINFO_PROFILE_OPTIONS: loomc_structure_type_e = 20;
#[doc = " `loomc_source_load_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_SOURCE_LOAD_OPTIONS: loomc_structure_type_e = 21;
#[doc = " `loomc_spirv_vulkan_function_table_t`."]
pub const LOOMC_STRUCTURE_TYPE_SPIRV_VULKAN_FUNCTION_TABLE: loomc_structure_type_e = 22;
#[doc = " `loomc_spirv_vulkan_profile_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_SPIRV_VULKAN_PROFILE_OPTIONS: loomc_structure_type_e = 23;
#[doc = " `loomc_iree_hal_profile_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_IREE_HAL_PROFILE_OPTIONS: loomc_structure_type_e = 24;
#[doc = " `loomc_spirv_iree_hal_profile_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_SPIRV_IREE_HAL_PROFILE_OPTIONS: loomc_structure_type_e = 25;
#[doc = " `loomc_module_function_query_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_MODULE_FUNCTION_QUERY_OPTIONS: loomc_structure_type_e = 26;
#[doc = " `loomc_module_global_query_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_MODULE_GLOBAL_QUERY_OPTIONS: loomc_structure_type_e = 27;
#[doc = " `loomc_amdgpu_profile_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_AMDGPU_PROFILE_OPTIONS: loomc_structure_type_e = 28;
#[doc = " `loomc_amdgpu_emit_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_AMDGPU_EMIT_OPTIONS: loomc_structure_type_e = 29;
#[doc = " `loomc_artifact_manifest_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_ARTIFACT_MANIFEST_OPTIONS: loomc_structure_type_e = 30;
#[doc = " `loomc_compile_report_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_COMPILE_REPORT_OPTIONS: loomc_structure_type_e = 31;
#[doc = " `loomc_sanitizer_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_SANITIZER_OPTIONS: loomc_structure_type_e = 32;
#[doc = " `loomc_launch_config_t`."]
pub const LOOMC_STRUCTURE_TYPE_LAUNCH_CONFIG: loomc_structure_type_e = 34;
#[doc = " `loomc_amdgpu_iree_hal_profile_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_AMDGPU_IREE_HAL_PROFILE_OPTIONS: loomc_structure_type_e = 35;
#[doc = " `loomc_link_dependency_analysis_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_LINK_DEPENDENCY_ANALYSIS_OPTIONS: loomc_structure_type_e = 36;
#[doc = " `loomc_cmd_program_product_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_CMD_PROGRAM_PRODUCT_OPTIONS: loomc_structure_type_e = 37;
#[doc = " `loomc_link_request_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_LINK_REQUEST_OPTIONS: loomc_structure_type_e = 38;
#[doc = " `loomc_cmd_program_request_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_CMD_PROGRAM_REQUEST_OPTIONS: loomc_structure_type_e = 39;
#[doc = " `loomc_task_pool_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_TASK_POOL_OPTIONS: loomc_structure_type_e = 40;
#[doc = " Structure type values used by extensible public descriptors.\n\n Extensible descriptors store one of these values in their `type` field and\n store `sizeof(descriptor_type)` in `structure_size`. Callers zero-initialize\n descriptors and set the fields they use."]
pub type loomc_structure_type_e = ::std::os::raw::c_uint;
#[doc = " Structure type values used by extensible public descriptors.\n\n Extensible descriptors store one of these values in their `type` field and\n store `sizeof(descriptor_type)` in `structure_size`. Callers zero-initialize\n descriptors and set the fields they use."]
pub use self::loomc_structure_type_e as loomc_structure_type_t;
#[doc = " Controls the behavior of a `loomc_allocator_ctl_fn_t` callback."]
pub type loomc_allocator_command_t = u32;
#[doc = " Allocates memory without requiring zero initialization."]
pub const LOOMC_ALLOCATOR_COMMAND_MALLOC: _bindgen_ty_1 = 0;
#[doc = " Allocates memory and zeros it before returning."]
pub const LOOMC_ALLOCATOR_COMMAND_CALLOC: _bindgen_ty_1 = 1;
#[doc = " Resizes an existing allocation."]
pub const LOOMC_ALLOCATOR_COMMAND_REALLOC: _bindgen_ty_1 = 2;
#[doc = " Frees an existing allocation."]
pub const LOOMC_ALLOCATOR_COMMAND_FREE: _bindgen_ty_1 = 3;
pub type _bindgen_ty_1 = ::std::os::raw::c_uint;
#[doc = " Host allocation control callback.\n\n @param self Callback-owned allocator state pointer.\n @param command Allocation command to perform.\n @param params Command-specific parameter structure.\n @param inout_ptr Pointer to allocation storage. Allocation commands write\n the allocated pointer. Free commands read the pointer to free.\n @return OK on success or a non-OK status when the allocator cannot satisfy\n the command.\n\n @ownership\n Memory returned by an allocator must be freed through the same allocator."]
pub type loomc_allocator_ctl_fn_t = ::std::option::Option<
unsafe extern "C" fn(
self_: *mut ::std::os::raw::c_void,
command: loomc_allocator_command_t,
params: *const ::std::os::raw::c_void,
inout_ptr: *mut *mut ::std::os::raw::c_void,
) -> loomc_status_t,
>;
#[doc = " Host allocator used for persistent Loom object storage.\n\n APIs that take an allocator require `ctl` to be non-NULL. Callers that want\n the process heap must pass `loomc_allocator_system()` explicitly."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_allocator_t {
#[doc = " Callback-owned state pointer."]
pub self_: *mut ::std::os::raw::c_void,
#[doc = " Callback implementing allocation commands."]
pub ctl: loomc_allocator_ctl_fn_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_allocator_t"][::std::mem::size_of::<loomc_allocator_t>() - 16usize];
["Alignment of loomc_allocator_t"][::std::mem::align_of::<loomc_allocator_t>() - 8usize];
["Offset of field: loomc_allocator_t::self_"]
[::std::mem::offset_of!(loomc_allocator_t, self_) - 0usize];
["Offset of field: loomc_allocator_t::ctl"]
[::std::mem::offset_of!(loomc_allocator_t, ctl) - 8usize];
};
impl Default for loomc_allocator_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Immutable logical sequence of bytes stored in one or more segments.\n\n A sequence has constant contents and length. Retained handles may be shared\n across threads and enumerated concurrently."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_byte_sequence_t {
_unused: [u8; 0],
}
#[doc = " Immutable source handle.\n\n @thread_safety\n Sources are immutable after creation. Retained source handles may be shared\n across threads."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_source_t {
_unused: [u8; 0],
}
#[doc = " Source format is unknown and must be inferred by the consumer."]
pub const LOOMC_SOURCE_FORMAT_UNKNOWN: loomc_source_format_e = 0;
#[doc = " Textual `.loom` source."]
pub const LOOMC_SOURCE_FORMAT_TEXT: loomc_source_format_e = 1;
#[doc = " Binary `.loombc` source."]
pub const LOOMC_SOURCE_FORMAT_BYTECODE: loomc_source_format_e = 2;
#[doc = " Source byte format."]
pub type loomc_source_format_e = ::std::os::raw::c_uint;
#[doc = " Source byte format."]
pub use self::loomc_source_format_e as loomc_source_format_t;
#[doc = " Source bytes are borrowed from the caller for the lifetime of the source."]
pub const LOOMC_SOURCE_STORAGE_BORROWED: loomc_source_storage_e = 0;
#[doc = " Source bytes are copied into storage owned by the source."]
pub const LOOMC_SOURCE_STORAGE_COPY: loomc_source_storage_e = 1;
#[doc = " Source bytes are owned externally and released by a caller callback."]
pub const LOOMC_SOURCE_STORAGE_EXTERNAL: loomc_source_storage_e = 2;
#[doc = " Storage policy for source bytes."]
pub type loomc_source_storage_e = ::std::os::raw::c_uint;
#[doc = " Storage policy for source bytes."]
pub use self::loomc_source_storage_e as loomc_source_storage_t;
#[doc = " Callback used to release externally owned source bytes.\n\n @param user_data Caller-provided value from `loomc_source_options_t`.\n @param contents Source bytes being released.\n\n @thread_safety\n The callback is invoked when the last source reference is released. Callers\n that share sources across threads must make the callback safe for whichever\n thread drops the final reference."]
pub type loomc_source_release_fn_t = ::std::option::Option<
unsafe extern "C" fn(user_data: *mut ::std::os::raw::c_void, contents: loomc_byte_span_t),
>;
#[doc = " Source creation options.\n\n Callers zero-initialize this descriptor, set `type` to\n `LOOMC_STRUCTURE_TYPE_SOURCE_OPTIONS`, set `structure_size` to\n `sizeof(loomc_source_options_t)`, and fill the requested fields."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_source_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_SOURCE_OPTIONS` when\n nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for future source options."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Input source format."]
pub format: loomc_source_format_t,
#[doc = " Stable identifier used in diagnostics and provider labels."]
pub identifier: loomc_string_view_t,
#[doc = " Input bytes."]
pub contents: loomc_byte_span_t,
#[doc = " Storage policy for `contents`."]
pub storage: loomc_source_storage_t,
#[doc = " Callback used when `storage` is `LOOMC_SOURCE_STORAGE_EXTERNAL`."]
pub release: loomc_source_release_fn_t,
#[doc = " User data passed to `release`."]
pub release_user_data: *mut ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_source_options_t"][::std::mem::size_of::<loomc_source_options_t>() - 88usize];
["Alignment of loomc_source_options_t"]
[::std::mem::align_of::<loomc_source_options_t>() - 8usize];
["Offset of field: loomc_source_options_t::type_"]
[::std::mem::offset_of!(loomc_source_options_t, type_) - 0usize];
["Offset of field: loomc_source_options_t::structure_size"]
[::std::mem::offset_of!(loomc_source_options_t, structure_size) - 8usize];
["Offset of field: loomc_source_options_t::next"]
[::std::mem::offset_of!(loomc_source_options_t, next) - 16usize];
["Offset of field: loomc_source_options_t::format"]
[::std::mem::offset_of!(loomc_source_options_t, format) - 24usize];
["Offset of field: loomc_source_options_t::identifier"]
[::std::mem::offset_of!(loomc_source_options_t, identifier) - 32usize];
["Offset of field: loomc_source_options_t::contents"]
[::std::mem::offset_of!(loomc_source_options_t, contents) - 48usize];
["Offset of field: loomc_source_options_t::storage"]
[::std::mem::offset_of!(loomc_source_options_t, storage) - 64usize];
["Offset of field: loomc_source_options_t::release"]
[::std::mem::offset_of!(loomc_source_options_t, release) - 72usize];
["Offset of field: loomc_source_options_t::release_user_data"]
[::std::mem::offset_of!(loomc_source_options_t, release_user_data) - 80usize];
};
impl Default for loomc_source_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Executable or loadable binary artifact."]
pub const LOOMC_ARTIFACT_KIND_EXECUTABLE: loomc_artifact_kind_e = 0;
#[doc = " Human-readable textual artifact."]
pub const LOOMC_ARTIFACT_KIND_TEXT: loomc_artifact_kind_e = 1;
#[doc = " Machine-readable report artifact."]
pub const LOOMC_ARTIFACT_KIND_REPORT: loomc_artifact_kind_e = 2;
#[doc = " Loom module artifact. The format indicates text or bytecode."]
pub const LOOMC_ARTIFACT_KIND_MODULE: loomc_artifact_kind_e = 3;
#[doc = " Compiled kernel launch-configuration program."]
pub const LOOMC_ARTIFACT_KIND_LAUNCH_CONFIG: loomc_artifact_kind_e = 4;
#[doc = " Artifact category."]
pub type loomc_artifact_kind_e = ::std::os::raw::c_uint;
#[doc = " Artifact category."]
pub use self::loomc_artifact_kind_e as loomc_artifact_kind_t;
#[doc = " Borrowed artifact view owned by a producer-specific result or product.\n\n @lifetime\n Artifact strings and the contents reference are owned by the\n operation-specific object that returned this view. They remain valid until\n that owner is released. Callers retaining contents independently use\n `loomc_byte_sequence_retain`."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_artifact_t {
#[doc = " Artifact kind."]
pub kind: loomc_artifact_kind_t,
#[doc = " Stable format string, such as `amdgpu-hsaco`, `spirv`,\n `LOOMC_ARTIFACT_FORMAT_LOOM_TEXT`, or `LOOMC_ARTIFACT_FORMAT_JSON`."]
pub format: loomc_string_view_t,
#[doc = " Human-readable artifact identifier."]
pub identifier: loomc_string_view_t,
#[doc = " Immutable artifact bytes. Valid artifacts always provide a non-NULL\n sequence, including for empty contents."]
pub contents: *mut loomc_byte_sequence_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_artifact_t"][::std::mem::size_of::<loomc_artifact_t>() - 48usize];
["Alignment of loomc_artifact_t"][::std::mem::align_of::<loomc_artifact_t>() - 8usize];
["Offset of field: loomc_artifact_t::kind"]
[::std::mem::offset_of!(loomc_artifact_t, kind) - 0usize];
["Offset of field: loomc_artifact_t::format"]
[::std::mem::offset_of!(loomc_artifact_t, format) - 8usize];
["Offset of field: loomc_artifact_t::identifier"]
[::std::mem::offset_of!(loomc_artifact_t, identifier) - 24usize];
["Offset of field: loomc_artifact_t::contents"]
[::std::mem::offset_of!(loomc_artifact_t, contents) - 40usize];
};
impl Default for loomc_artifact_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Does not request an artifact manifest."]
pub const LOOMC_ARTIFACT_MANIFEST_MODE_NONE: loomc_artifact_manifest_mode_e = 0;
#[doc = " Requests stable artifact, target, function, global, and summary ABI facts."]
pub const LOOMC_ARTIFACT_MANIFEST_MODE_SUMMARY: loomc_artifact_manifest_mode_e = 1;
#[doc = " Requests summary facts plus detail arrays such as function parameters."]
pub const LOOMC_ARTIFACT_MANIFEST_MODE_DETAILS: loomc_artifact_manifest_mode_e = 2;
#[doc = " Requests artifact-bound analysis facts when available."]
pub const LOOMC_ARTIFACT_MANIFEST_MODE_ANALYSIS: loomc_artifact_manifest_mode_e = 3;
#[doc = " Artifact manifest detail mode."]
pub type loomc_artifact_manifest_mode_e = ::std::os::raw::c_uint;
#[doc = " Artifact manifest detail mode."]
pub use self::loomc_artifact_manifest_mode_e as loomc_artifact_manifest_mode_t;
#[doc = " Artifact manifest emission options.\n\n Attach this descriptor through `loomc_emit_options_t::next`. The descriptor\n controls sidecar manifest production for the emitted target artifact. It\n does not compile source, run passes, or write filesystem paths."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_artifact_manifest_options_t {
#[doc = " Structure type. Must be\n `LOOMC_STRUCTURE_TYPE_ARTIFACT_MANIFEST_OPTIONS` when nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Next invocation option extension."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Selected manifest detail mode."]
pub mode: loomc_artifact_manifest_mode_t,
#[doc = " Result artifact identifier for the manifest JSON. Empty derives from the\n emitted artifact identifier by appending `.manifest.json`."]
pub identifier: loomc_string_view_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_artifact_manifest_options_t"]
[::std::mem::size_of::<loomc_artifact_manifest_options_t>() - 48usize];
["Alignment of loomc_artifact_manifest_options_t"]
[::std::mem::align_of::<loomc_artifact_manifest_options_t>() - 8usize];
["Offset of field: loomc_artifact_manifest_options_t::type_"]
[::std::mem::offset_of!(loomc_artifact_manifest_options_t, type_) - 0usize];
["Offset of field: loomc_artifact_manifest_options_t::structure_size"]
[::std::mem::offset_of!(loomc_artifact_manifest_options_t, structure_size) - 8usize];
["Offset of field: loomc_artifact_manifest_options_t::next"]
[::std::mem::offset_of!(loomc_artifact_manifest_options_t, next) - 16usize];
["Offset of field: loomc_artifact_manifest_options_t::mode"]
[::std::mem::offset_of!(loomc_artifact_manifest_options_t, mode) - 24usize];
["Offset of field: loomc_artifact_manifest_options_t::identifier"]
[::std::mem::offset_of!(loomc_artifact_manifest_options_t, identifier) - 32usize];
};
impl Default for loomc_artifact_manifest_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Single configuration key/value binding.\n\n @lifetime\n Binding strings are borrowed by the descriptor that contains them unless an\n operation explicitly documents that it copies the bindings."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_config_binding_t {
#[doc = " Config key, with a leading `@` accepted by normalization."]
pub key: loomc_string_view_t,
#[doc = " Config value spelling."]
pub value: loomc_string_view_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_config_binding_t"][::std::mem::size_of::<loomc_config_binding_t>() - 32usize];
["Alignment of loomc_config_binding_t"]
[::std::mem::align_of::<loomc_config_binding_t>() - 8usize];
["Offset of field: loomc_config_binding_t::key"]
[::std::mem::offset_of!(loomc_config_binding_t, key) - 0usize];
["Offset of field: loomc_config_binding_t::value"]
[::std::mem::offset_of!(loomc_config_binding_t, value) - 16usize];
};
impl Default for loomc_config_binding_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Require all final operation config values to be resolved."]
pub const LOOMC_CONFIG_POLICY_FLAG_REQUIRE_RESOLVED: loomc_config_policy_flag_bits_e = 1;
#[doc = " Configuration validation and resolution policy bit values."]
pub type loomc_config_policy_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " Bitmask of `loomc_config_policy_flag_bits_t` values."]
pub type loomc_config_policy_flags_t = u32;
#[doc = " Text configuration options attached to a link or command-product operation.\n\n The plain binding array and optional JSON/JSONC object string normalize into\n the same key/value binding set. When both spellings define the same key, the\n explicit `bindings` entry overrides the JSON object entry.\n\n @lifetime\n All views and arrays are borrowed for the duration of the API call unless\n the consuming operation explicitly documents a longer copy."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_config_options_t {
#[doc = " Plain key/value bindings."]
pub bindings: *const loomc_config_binding_t,
#[doc = " Number of entries in `bindings`."]
pub binding_count: loomc_host_size_t,
#[doc = " Optional JSON/JSONC object string normalized into the same binding set."]
pub json_object: loomc_string_view_t,
#[doc = " Config validation and resolution policy flags."]
pub flags: loomc_config_policy_flags_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_config_options_t"][::std::mem::size_of::<loomc_config_options_t>() - 40usize];
["Alignment of loomc_config_options_t"]
[::std::mem::align_of::<loomc_config_options_t>() - 8usize];
["Offset of field: loomc_config_options_t::bindings"]
[::std::mem::offset_of!(loomc_config_options_t, bindings) - 0usize];
["Offset of field: loomc_config_options_t::binding_count"]
[::std::mem::offset_of!(loomc_config_options_t, binding_count) - 8usize];
["Offset of field: loomc_config_options_t::json_object"]
[::std::mem::offset_of!(loomc_config_options_t, json_object) - 16usize];
["Offset of field: loomc_config_options_t::flags"]
[::std::mem::offset_of!(loomc_config_options_t, flags) - 32usize];
};
impl Default for loomc_config_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Immutable Loom API context.\n\n @thread_safety\n Contexts are immutable after creation and may be shared across threads.\n Operations that need mutable source-location tables serialize that mutation\n through their owning builder or invocation object rather than exposing it on\n the context API."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_context_t {
_unused: [u8; 0],
}
#[doc = " Context creation options.\n\n Callers zero-initialize this descriptor, set `type` to\n `LOOMC_STRUCTURE_TYPE_CONTEXT_OPTIONS`, set `structure_size` to\n `sizeof(loomc_context_options_t)`, and fill the requested fields."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_context_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_CONTEXT_OPTIONS` when\n nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for context options such as\n `loomc_context_target_options_t`."]
pub next: *const ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_context_options_t"][::std::mem::size_of::<loomc_context_options_t>() - 24usize];
["Alignment of loomc_context_options_t"]
[::std::mem::align_of::<loomc_context_options_t>() - 8usize];
["Offset of field: loomc_context_options_t::type_"]
[::std::mem::offset_of!(loomc_context_options_t, type_) - 0usize];
["Offset of field: loomc_context_options_t::structure_size"]
[::std::mem::offset_of!(loomc_context_options_t, structure_size) - 8usize];
["Offset of field: loomc_context_options_t::next"]
[::std::mem::offset_of!(loomc_context_options_t, next) - 16usize];
};
impl Default for loomc_context_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Informational note."]
pub const LOOMC_DIAGNOSTIC_SEVERITY_NOTE: loomc_diagnostic_severity_e = 0;
#[doc = " Warning that does not make the operation fail."]
pub const LOOMC_DIAGNOSTIC_SEVERITY_WARNING: loomc_diagnostic_severity_e = 1;
#[doc = " Error that makes the operation fail."]
pub const LOOMC_DIAGNOSTIC_SEVERITY_ERROR: loomc_diagnostic_severity_e = 2;
#[doc = " Diagnostic severity."]
pub type loomc_diagnostic_severity_e = ::std::os::raw::c_uint;
#[doc = " Diagnostic severity."]
pub use self::loomc_diagnostic_severity_e as loomc_diagnostic_severity_t;
#[doc = " Source range attached to a diagnostic.\n\n Byte offsets are zero-based and line/column values are one-based when\n available. A zero line or column means the location was not computed or is\n not meaningful for the source format.\n\n @lifetime\n The source pointer is retained by the owning result when present. The range\n view remains valid until that result is released."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_source_range_t {
#[doc = " Source handle that owns or identifies the bytes."]
pub source: *const loomc_source_t,
#[doc = " First byte in source contents covered by the range."]
pub start: loomc_host_size_t,
#[doc = " One-past-last byte in source contents covered by the range."]
pub end: loomc_host_size_t,
#[doc = " One-based starting line, or zero when unavailable."]
pub start_line: u32,
#[doc = " One-based starting column, or zero when unavailable."]
pub start_column: u32,
#[doc = " One-based ending line, or zero when unavailable."]
pub end_line: u32,
#[doc = " One-based ending column, or zero when unavailable."]
pub end_column: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_source_range_t"][::std::mem::size_of::<loomc_source_range_t>() - 40usize];
["Alignment of loomc_source_range_t"][::std::mem::align_of::<loomc_source_range_t>() - 8usize];
["Offset of field: loomc_source_range_t::source"]
[::std::mem::offset_of!(loomc_source_range_t, source) - 0usize];
["Offset of field: loomc_source_range_t::start"]
[::std::mem::offset_of!(loomc_source_range_t, start) - 8usize];
["Offset of field: loomc_source_range_t::end"]
[::std::mem::offset_of!(loomc_source_range_t, end) - 16usize];
["Offset of field: loomc_source_range_t::start_line"]
[::std::mem::offset_of!(loomc_source_range_t, start_line) - 24usize];
["Offset of field: loomc_source_range_t::start_column"]
[::std::mem::offset_of!(loomc_source_range_t, start_column) - 28usize];
["Offset of field: loomc_source_range_t::end_line"]
[::std::mem::offset_of!(loomc_source_range_t, end_line) - 32usize];
["Offset of field: loomc_source_range_t::end_column"]
[::std::mem::offset_of!(loomc_source_range_t, end_column) - 36usize];
};
impl Default for loomc_source_range_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Borrowed diagnostic view owned by a result object.\n\n @lifetime\n Diagnostic strings and source ranges are owned by the result that returned\n this view. They remain valid until that result is released."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_diagnostic_t {
#[doc = " Diagnostic severity."]
pub severity: loomc_diagnostic_severity_t,
#[doc = " Stable diagnostic code."]
pub code: loomc_string_view_t,
#[doc = " Human-readable rendered message."]
pub message: loomc_string_view_t,
#[doc = " Primary source range."]
pub range: loomc_source_range_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_diagnostic_t"][::std::mem::size_of::<loomc_diagnostic_t>() - 80usize];
["Alignment of loomc_diagnostic_t"][::std::mem::align_of::<loomc_diagnostic_t>() - 8usize];
["Offset of field: loomc_diagnostic_t::severity"]
[::std::mem::offset_of!(loomc_diagnostic_t, severity) - 0usize];
["Offset of field: loomc_diagnostic_t::code"]
[::std::mem::offset_of!(loomc_diagnostic_t, code) - 8usize];
["Offset of field: loomc_diagnostic_t::message"]
[::std::mem::offset_of!(loomc_diagnostic_t, message) - 24usize];
["Offset of field: loomc_diagnostic_t::range"]
[::std::mem::offset_of!(loomc_diagnostic_t, range) - 40usize];
};
impl Default for loomc_diagnostic_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Immutable operation result.\n\n @thread_safety\n Results are immutable after creation. Retained result handles may be shared\n across threads."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_result_t {
_unused: [u8; 0],
}
#[doc = " Mutable per-worker scratch workspace.\n\n @thread_safety\n A workspace is not internally synchronized. Calls that mutate the same\n workspace require external synchronization. Distinct workspaces may be used\n concurrently by different threads."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_workspace_t {
_unused: [u8; 0],
}
#[doc = " Workspace creation options.\n\n Callers zero-initialize this descriptor, set `type` to\n `LOOMC_STRUCTURE_TYPE_WORKSPACE_OPTIONS`, set `structure_size` to\n `sizeof(loomc_workspace_options_t)`, and fill the requested fields."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_workspace_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_WORKSPACE_OPTIONS` when\n nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for future workspace options."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Total bytes acquired from the host allocator per fixed-size arena block.\n Internal tracking metadata consumes part of this capacity."]
pub block_size: loomc_host_size_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_workspace_options_t"]
[::std::mem::size_of::<loomc_workspace_options_t>() - 32usize];
["Alignment of loomc_workspace_options_t"]
[::std::mem::align_of::<loomc_workspace_options_t>() - 8usize];
["Offset of field: loomc_workspace_options_t::type_"]
[::std::mem::offset_of!(loomc_workspace_options_t, type_) - 0usize];
["Offset of field: loomc_workspace_options_t::structure_size"]
[::std::mem::offset_of!(loomc_workspace_options_t, structure_size) - 8usize];
["Offset of field: loomc_workspace_options_t::next"]
[::std::mem::offset_of!(loomc_workspace_options_t, next) - 16usize];
["Offset of field: loomc_workspace_options_t::block_size"]
[::std::mem::offset_of!(loomc_workspace_options_t, block_size) - 24usize];
};
impl Default for loomc_workspace_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Opaque parsed, linked, optimized, or lowered module.\n\n Modules use arena storage from the workspace that created, linked, cloned,\n or deserialized them. Releasing a module returns its active arena blocks to\n that workspace. A module retains the workspace, so release ordering is\n memory-safe, but keeping modules live across `loomc_workspace_trim` keeps\n their storage live too.\n\n @thread_safety\n Retain/release operations are safe from multiple threads. Module contents\n are not internally synchronized. Read-only operations such as serialization\n may run concurrently with other read-only operations when the caller\n guarantees that no mutating module operation is active. Mutating operations\n such as compiling a module require exclusive access to that module handle."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_module_t {
_unused: [u8; 0],
}
#[doc = " Function symbol is visible outside the module for linking."]
pub const LOOMC_MODULE_FUNCTION_FLAG_PUBLIC: loomc_module_function_flag_bits_e = 1;
#[doc = " `loomc_module_function_try_get_export_info` can return export metadata."]
pub const LOOMC_MODULE_FUNCTION_FLAG_HAS_EXPORT_INFO: loomc_module_function_flag_bits_e = 2;
#[doc = " Module function metadata flag bits."]
pub type loomc_module_function_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " `loomc_module_function_export_info_t::export_symbol` is present."]
pub const LOOMC_MODULE_FUNCTION_EXPORT_FLAG_HAS_SYMBOL: loomc_module_function_export_flag_bits_e =
1;
#[doc = " Export metadata flag bits."]
pub type loomc_module_function_export_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " Global symbol is visible outside the module for linking."]
pub const LOOMC_MODULE_GLOBAL_FLAG_PUBLIC: loomc_module_global_flag_bits_e = 1;
#[doc = " Module global metadata flag bits."]
pub type loomc_module_global_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " Prepared immutable pass program.\n\n Pass programs are separate from compilers so JITs and autotuners can cache\n common pipelines, choose among several prepared programs per invocation, or\n sweep pipeline configurations without constructing many compiler handles.\n Pass programs remain target-independent. Target-aware predicates resolve\n each function's durable target when the program executes.\n\n @thread_safety\n Pass programs are immutable after creation and may be shared across worker\n threads. Retain/release operations are safe from multiple threads."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_pass_program_t {
_unused: [u8; 0],
}
#[doc = " Prepared immutable compiler.\n\n A compiler is intended to be created once and reused across many\n invocations. It must not require repeated filesystem access on the hot path.\n Pass pipelines are prepared as `loomc_pass_program_t` handles and selected\n per invocation.\n\n @thread_safety\n Prepared compilers are immutable after creation and may be shared across\n threads. Invocation-local scratch belongs in `loomc_workspace_t`."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_compiler_t {
_unused: [u8; 0],
}
#[doc = " Return textual Loom module IR after successful compilation."]
pub const LOOMC_COMPILE_ARTIFACT_FLAG_MODULE_TEXT: loomc_compile_artifact_flag_bits_e = 1;
#[doc = " Return binary Loom bytecode after successful compilation."]
pub const LOOMC_COMPILE_ARTIFACT_FLAG_MODULE_BYTECODE: loomc_compile_artifact_flag_bits_e = 2;
#[doc = " Return a JSON compile report artifact. Reports are emitted for completed\n invocations, including failed results that still returned diagnostics."]
pub const LOOMC_COMPILE_ARTIFACT_FLAG_REPORT_JSON: loomc_compile_artifact_flag_bits_e = 4;
#[doc = " Return the compiled host launch-config program for all kernel entries.\n\n The selected pass program must lower source kernel entries through the\n normal source-to-low boundary. The artifact contains one pure function\n per exported kernel and is loaded with\n `loomc_launch_config_program_load`."]
pub const LOOMC_COMPILE_ARTIFACT_FLAG_LAUNCH_CONFIG: loomc_compile_artifact_flag_bits_e = 8;
#[doc = " Compile artifact request bits."]
pub type loomc_compile_artifact_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " Bitmask of `loomc_compile_artifact_flag_bits_t`."]
pub type loomc_compile_artifact_flags_t = u32;
#[doc = " Compiler creation options.\n\n Callers zero-initialize this descriptor, set `type` to\n `LOOMC_STRUCTURE_TYPE_COMPILER_OPTIONS`, set `structure_size` to\n `sizeof(loomc_compiler_options_t)`, and fill the requested fields."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_compiler_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_COMPILER_OPTIONS` when\n nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for future compiler options."]
pub next: *const ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_compiler_options_t"]
[::std::mem::size_of::<loomc_compiler_options_t>() - 24usize];
["Alignment of loomc_compiler_options_t"]
[::std::mem::align_of::<loomc_compiler_options_t>() - 8usize];
["Offset of field: loomc_compiler_options_t::type_"]
[::std::mem::offset_of!(loomc_compiler_options_t, type_) - 0usize];
["Offset of field: loomc_compiler_options_t::structure_size"]
[::std::mem::offset_of!(loomc_compiler_options_t, structure_size) - 8usize];
["Offset of field: loomc_compiler_options_t::next"]
[::std::mem::offset_of!(loomc_compiler_options_t, next) - 16usize];
};
impl Default for loomc_compiler_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Compile invocation options.\n\n A compile invocation borrows a mutable module and returns a result with\n diagnostics and artifacts. Exact values from an optional config module\n materialize into the program module before the selected pass program runs.\n Configuration lives here rather than on the prepared compiler so autotuning\n and JIT sweeps can vary config without constructing many compiler handles.\n Per-function target specializations and target-declaration bindings are\n supplied through\n `loomc_target_specialization_options_t` on `next`, so one invocation can\n compile several function versions for different exact targets."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_compile_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_COMPILE_OPTIONS` when\n nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for compile invocation options such as\n `loomc_target_specialization_options_t`."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Runtime artifact module name for this invocation. Empty uses the\n compiler's default."]
pub module_name: loomc_string_view_t,
#[doc = " Requested result artifacts. Zero avoids artifact serialization and keeps\n the hot path focused on diagnostics and in-place module transformation."]
pub artifact_flags: loomc_compile_artifact_flags_t,
#[doc = " Config validation and final-resolution policy."]
pub config_flags: loomc_config_policy_flags_t,
#[doc = " Optional module containing only exact `config.def` operations.\n\n The module is borrowed, remains immutable, must use the compiler context,\n and must be distinct from the mutable program module. Definitions without\n matching program config symbols are ignored so one config module can serve\n several related programs. Load text or bytecode config modules through the\n normal format-specific module deserialization APIs."]
pub config_module: *const loomc_module_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_compile_options_t"][::std::mem::size_of::<loomc_compile_options_t>() - 56usize];
["Alignment of loomc_compile_options_t"]
[::std::mem::align_of::<loomc_compile_options_t>() - 8usize];
["Offset of field: loomc_compile_options_t::type_"]
[::std::mem::offset_of!(loomc_compile_options_t, type_) - 0usize];
["Offset of field: loomc_compile_options_t::structure_size"]
[::std::mem::offset_of!(loomc_compile_options_t, structure_size) - 8usize];
["Offset of field: loomc_compile_options_t::next"]
[::std::mem::offset_of!(loomc_compile_options_t, next) - 16usize];
["Offset of field: loomc_compile_options_t::module_name"]
[::std::mem::offset_of!(loomc_compile_options_t, module_name) - 24usize];
["Offset of field: loomc_compile_options_t::artifact_flags"]
[::std::mem::offset_of!(loomc_compile_options_t, artifact_flags) - 40usize];
["Offset of field: loomc_compile_options_t::config_flags"]
[::std::mem::offset_of!(loomc_compile_options_t, config_flags) - 44usize];
["Offset of field: loomc_compile_options_t::config_module"]
[::std::mem::offset_of!(loomc_compile_options_t, config_module) - 48usize];
};
impl Default for loomc_compile_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Prepared immutable target environment.\n\n A target environment owns target provider composition selected by the\n linked binary. It should be created once per target provider set and reused\n across contexts, compilers, pass programs, and worker threads.\n\n @thread_safety\n Target environments are immutable after creation and may be shared across\n threads. Retain/release operations are safe from multiple threads."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_target_environment_t {
_unused: [u8; 0],
}
#[doc = " Prepared immutable target profile.\n\n A target profile owns normalized target facts and any target-family payload\n needed by compiler passes or emitters. Profiles are separate from contexts\n and compilers so embedders can cache one profile per device, saved hardware\n profile, or cross-compilation bucket.\n\n @thread_safety\n Target profiles are immutable after creation and may be shared across\n threads. Retain/release operations are safe from multiple threads."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_target_profile_t {
_unused: [u8; 0],
}
#[doc = " Context option extension that registers a target environment.\n\n Put this descriptor on `loomc_context_options_t::next` so target dialects\n are registered before the context is finalized. The context retains the\n target environment on success; the caller may release its reference after\n `loomc_context_create` returns."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_context_target_options_t {
#[doc = " Structure type. Must be\n `LOOMC_STRUCTURE_TYPE_CONTEXT_TARGET_OPTIONS`."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Next context option extension."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Target environment to register with the context."]
pub target_environment: *mut loomc_target_environment_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_context_target_options_t"]
[::std::mem::size_of::<loomc_context_target_options_t>() - 32usize];
["Alignment of loomc_context_target_options_t"]
[::std::mem::align_of::<loomc_context_target_options_t>() - 8usize];
["Offset of field: loomc_context_target_options_t::type_"]
[::std::mem::offset_of!(loomc_context_target_options_t, type_) - 0usize];
["Offset of field: loomc_context_target_options_t::structure_size"]
[::std::mem::offset_of!(loomc_context_target_options_t, structure_size) - 8usize];
["Offset of field: loomc_context_target_options_t::next"]
[::std::mem::offset_of!(loomc_context_target_options_t, next) - 16usize];
["Offset of field: loomc_context_target_options_t::target_environment"]
[::std::mem::offset_of!(loomc_context_target_options_t, target_environment) - 24usize];
};
impl Default for loomc_context_target_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " One function version to specialize to one structured target profile."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_target_specialization_t {
#[doc = " Function symbol name. A leading `@` is accepted."]
pub function_symbol: loomc_string_view_t,
#[doc = " Complete target profile borrowed for the invocation."]
pub target_profile: *mut loomc_target_profile_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_target_specialization_t"]
[::std::mem::size_of::<loomc_target_specialization_t>() - 24usize];
["Alignment of loomc_target_specialization_t"]
[::std::mem::align_of::<loomc_target_specialization_t>() - 8usize];
["Offset of field: loomc_target_specialization_t::function_symbol"]
[::std::mem::offset_of!(loomc_target_specialization_t, function_symbol) - 0usize];
["Offset of field: loomc_target_specialization_t::target_profile"]
[::std::mem::offset_of!(loomc_target_specialization_t, target_profile) - 16usize];
};
impl Default for loomc_target_specialization_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " One authored target declaration to bind to one target profile.\n\n Every binding key must resolve to a `target.decl` in the module being\n compiled. The profile seeds all target-assignable functions authored with\n `target(@target_symbol)`. Semantic callgraph specialization propagates that\n target context through reachable callees."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_target_binding_t {
#[doc = " Target declaration symbol name. A leading `@` is accepted."]
pub target_symbol: loomc_string_view_t,
#[doc = " Complete target profile borrowed for the invocation."]
pub target_profile: *mut loomc_target_profile_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_target_binding_t"][::std::mem::size_of::<loomc_target_binding_t>() - 24usize];
["Alignment of loomc_target_binding_t"]
[::std::mem::align_of::<loomc_target_binding_t>() - 8usize];
["Offset of field: loomc_target_binding_t::target_symbol"]
[::std::mem::offset_of!(loomc_target_binding_t, target_symbol) - 0usize];
["Offset of field: loomc_target_binding_t::target_profile"]
[::std::mem::offset_of!(loomc_target_binding_t, target_profile) - 16usize];
};
impl Default for loomc_target_binding_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Option extension carrying target specialization inputs.\n\n Put this descriptor on `loomc_compile_options_t::next`. Direct function rows\n assign profiles to selected roots. Target binding rows assign profiles to\n authored `target.decl` contexts without enumerating every function using the\n context. The two sets must not assign the same function. Every row is\n validated before any function version is published. The invocation borrows\n the row arrays, symbol strings, and profiles for the duration of the call."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_target_specialization_options_t {
#[doc = " Structure type. Must be\n `LOOMC_STRUCTURE_TYPE_TARGET_SPECIALIZATION_OPTIONS`."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Additional option extensions in the same unordered chain."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Specialization rows borrowed for the invocation."]
pub specializations: *const loomc_target_specialization_t,
#[doc = " Number of rows in `specializations`."]
pub specialization_count: loomc_host_size_t,
#[doc = " Target declaration binding rows borrowed for the invocation."]
pub target_bindings: *const loomc_target_binding_t,
#[doc = " Number of rows in `target_bindings`."]
pub target_binding_count: loomc_host_size_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_target_specialization_options_t"]
[::std::mem::size_of::<loomc_target_specialization_options_t>() - 56usize];
["Alignment of loomc_target_specialization_options_t"]
[::std::mem::align_of::<loomc_target_specialization_options_t>() - 8usize];
["Offset of field: loomc_target_specialization_options_t::type_"]
[::std::mem::offset_of!(loomc_target_specialization_options_t, type_) - 0usize];
["Offset of field: loomc_target_specialization_options_t::structure_size"]
[::std::mem::offset_of!(loomc_target_specialization_options_t, structure_size) - 8usize];
["Offset of field: loomc_target_specialization_options_t::next"]
[::std::mem::offset_of!(loomc_target_specialization_options_t, next) - 16usize];
["Offset of field: loomc_target_specialization_options_t::specializations"]
[::std::mem::offset_of!(loomc_target_specialization_options_t, specializations) - 24usize];
["Offset of field: loomc_target_specialization_options_t::specialization_count"][::std::mem::offset_of!(
loomc_target_specialization_options_t,
specialization_count
) - 32usize];
["Offset of field: loomc_target_specialization_options_t::target_bindings"]
[::std::mem::offset_of!(loomc_target_specialization_options_t, target_bindings) - 40usize];
["Offset of field: loomc_target_specialization_options_t::target_binding_count"][::std::mem::offset_of!(
loomc_target_specialization_options_t,
target_binding_count
) - 48usize];
};
impl Default for loomc_target_specialization_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Lower source/kernel IR to target-low IR prepared for target emission."]
pub const LOOMC_TARGET_PIPELINE_KIND_PREPARED_LOW: loomc_target_pipeline_kind_e = 0;
#[doc = " Lower source/kernel IR to target-low IR before target ABI/resource\n materialization and packetization preparation."]
pub const LOOMC_TARGET_PIPELINE_KIND_SOURCE_LOW: loomc_target_pipeline_kind_e = 1;
#[doc = " Target lowering pipeline boundary."]
pub type loomc_target_pipeline_kind_e = ::std::os::raw::c_uint;
#[doc = " Target lowering pipeline boundary."]
pub use self::loomc_target_pipeline_kind_e as loomc_target_pipeline_kind_t;
#[doc = " Lower source structured control flow to explicit CFG before source-to-low."]
pub const LOOMC_TARGET_CONTROL_FLOW_LOWERING_CFG: loomc_target_control_flow_lowering_e = 0;
#[doc = " Preserve supported structured control flow into target-low IR."]
pub const LOOMC_TARGET_CONTROL_FLOW_LOWERING_STRUCTURED_LOW: loomc_target_control_flow_lowering_e =
1;
#[doc = " Control-flow shape selected for source-to-low lowering."]
pub type loomc_target_control_flow_lowering_e = ::std::os::raw::c_uint;
#[doc = " Control-flow shape selected for source-to-low lowering."]
pub use self::loomc_target_control_flow_lowering_e as loomc_target_control_flow_lowering_t;
#[doc = " Target pipeline creation options.\n\n Callers zero-initialize this descriptor, set `type` to\n `LOOMC_STRUCTURE_TYPE_TARGET_PIPELINE_OPTIONS`, set `structure_size` to\n `sizeof(loomc_target_pipeline_options_t)`, and fill the requested fields.\n A zero-initialized descriptor selects the prepared target-low pipeline with\n CFG control-flow lowering."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_target_pipeline_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_TARGET_PIPELINE_OPTIONS`\n when nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for target pipeline options such as\n `loomc_sanitizer_options_t`."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Stable identifier used for the synthetic pipeline module and diagnostics.\n Empty selects a library-defined identifier."]
pub identifier: loomc_string_view_t,
#[doc = " Target pipeline boundary to build."]
pub kind: loomc_target_pipeline_kind_t,
#[doc = " Control-flow shape selected for the source-to-low boundary."]
pub control_flow_lowering: loomc_target_control_flow_lowering_t,
#[doc = " Maximum source-to-low diagnostics. Zero uses source-to-low's default."]
pub source_to_low_max_errors: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_target_pipeline_options_t"]
[::std::mem::size_of::<loomc_target_pipeline_options_t>() - 56usize];
["Alignment of loomc_target_pipeline_options_t"]
[::std::mem::align_of::<loomc_target_pipeline_options_t>() - 8usize];
["Offset of field: loomc_target_pipeline_options_t::type_"]
[::std::mem::offset_of!(loomc_target_pipeline_options_t, type_) - 0usize];
["Offset of field: loomc_target_pipeline_options_t::structure_size"]
[::std::mem::offset_of!(loomc_target_pipeline_options_t, structure_size) - 8usize];
["Offset of field: loomc_target_pipeline_options_t::next"]
[::std::mem::offset_of!(loomc_target_pipeline_options_t, next) - 16usize];
["Offset of field: loomc_target_pipeline_options_t::identifier"]
[::std::mem::offset_of!(loomc_target_pipeline_options_t, identifier) - 24usize];
["Offset of field: loomc_target_pipeline_options_t::kind"]
[::std::mem::offset_of!(loomc_target_pipeline_options_t, kind) - 40usize];
["Offset of field: loomc_target_pipeline_options_t::control_flow_lowering"]
[::std::mem::offset_of!(loomc_target_pipeline_options_t, control_flow_lowering) - 44usize];
["Offset of field: loomc_target_pipeline_options_t::source_to_low_max_errors"][::std::mem::offset_of!(
loomc_target_pipeline_options_t,
source_to_low_max_errors
) - 48usize];
};
impl Default for loomc_target_pipeline_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Emit artifact request flags."]
pub type loomc_emit_artifact_flags_t = u32;
#[doc = " Request the primary loadable artifact. A zero flag value also requests\n the primary artifact."]
pub const LOOMC_EMIT_ARTIFACT_FLAG_PRIMARY: loomc_emit_artifact_flag_bits_e = 1;
#[doc = " Emit artifact request flag bits."]
pub type loomc_emit_artifact_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " Target emission options.\n\n Callers zero-initialize this descriptor, set `type` to\n `LOOMC_STRUCTURE_TYPE_EMIT_OPTIONS`, set `structure_size` to\n `sizeof(loomc_emit_options_t)`, and fill the requested fields. Attach\n `loomc_artifact_manifest_options_t`, `loomc_compile_report_options_t`,\n `loomc_option_dict_t`, and target-specific descriptors through `next`."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_emit_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_EMIT_OPTIONS` when nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for emission options."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Artifact format to emit. Empty selects the only linked emitter and fails\n if the target environment has zero or multiple emitters."]
pub artifact_format: loomc_string_view_t,
#[doc = " Artifact identifier for the primary output. Empty selects the emitter's\n default identifier."]
pub identifier: loomc_string_view_t,
#[doc = " Requested artifact classes. Zero requests the primary artifact."]
pub artifact_flags: loomc_emit_artifact_flags_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_emit_options_t"][::std::mem::size_of::<loomc_emit_options_t>() - 64usize];
["Alignment of loomc_emit_options_t"][::std::mem::align_of::<loomc_emit_options_t>() - 8usize];
["Offset of field: loomc_emit_options_t::type_"]
[::std::mem::offset_of!(loomc_emit_options_t, type_) - 0usize];
["Offset of field: loomc_emit_options_t::structure_size"]
[::std::mem::offset_of!(loomc_emit_options_t, structure_size) - 8usize];
["Offset of field: loomc_emit_options_t::next"]
[::std::mem::offset_of!(loomc_emit_options_t, next) - 16usize];
["Offset of field: loomc_emit_options_t::artifact_format"]
[::std::mem::offset_of!(loomc_emit_options_t, artifact_format) - 24usize];
["Offset of field: loomc_emit_options_t::identifier"]
[::std::mem::offset_of!(loomc_emit_options_t, identifier) - 40usize];
["Offset of field: loomc_emit_options_t::artifact_flags"]
[::std::mem::offset_of!(loomc_emit_options_t, artifact_flags) - 56usize];
};
impl Default for loomc_emit_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Mutable builder used to construct a frozen link index.\n\n @thread_safety\n Reserving slots and finishing a builder require exclusive access. Distinct\n already-reserved slots may be filled concurrently when each slot is filled\n by at most one thread and no thread calls finish until all fills have\n joined."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_link_index_builder_t {
_unused: [u8; 0],
}
#[doc = " Frozen immutable link index.\n\n @thread_safety\n Frozen indexes are immutable and may be shared by many linker invocations\n across many threads."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_link_index_t {
_unused: [u8; 0],
}
#[doc = " Direct sources jointly owned by the module being assembled."]
pub const LOOMC_LINK_PROVIDER_ROLE_INPUT: loomc_link_provider_role_e = 0;
#[doc = " Separate libraries contributing exported exact definitions and templates."]
pub const LOOMC_LINK_PROVIDER_ROLE_LIBRARY: loomc_link_provider_role_e = 1;
#[doc = " Linkage role assigned to a source provider in a link index."]
pub type loomc_link_provider_role_e = ::std::os::raw::c_uint;
#[doc = " Linkage role assigned to a source provider in a link index."]
pub use self::loomc_link_provider_role_e as loomc_link_provider_role_t;
#[doc = " Symbol is publicly visible in its source module."]
pub const LOOMC_LINK_SYMBOL_FLAG_PUBLIC: loomc_link_symbol_flag_bits_e = 1;
#[doc = " Symbol is an import declaration supplied by another provider/module."]
pub const LOOMC_LINK_SYMBOL_FLAG_IMPORT: loomc_link_symbol_flag_bits_e = 2;
#[doc = " Symbol is exported from its provider/module."]
pub const LOOMC_LINK_SYMBOL_FLAG_EXPORT: loomc_link_symbol_flag_bits_e = 4;
#[doc = " Symbol is declaration-like and may be superseded by a concrete definition."]
pub const LOOMC_LINK_SYMBOL_FLAG_DECLARATION: loomc_link_symbol_flag_bits_e = 8;
#[doc = " Symbol is a concrete definition owned by its provider."]
pub const LOOMC_LINK_SYMBOL_FLAG_CONCRETE_DEFINITION: loomc_link_symbol_flag_bits_e = 16;
#[doc = " Symbol implements the config symbol interface."]
pub const LOOMC_LINK_SYMBOL_FLAG_CONFIG: loomc_link_symbol_flag_bits_e = 32;
#[doc = " Symbol exists only for test or benchmark tooling."]
pub const LOOMC_LINK_SYMBOL_FLAG_TEST_ONLY: loomc_link_symbol_flag_bits_e = 64;
#[doc = " Source symbol is explicitly preserved by ordinary symbol pruning."]
pub const LOOMC_LINK_SYMBOL_FLAG_RETAIN: loomc_link_symbol_flag_bits_e = 128;
#[doc = " Link-index symbol flag bit values."]
pub type loomc_link_symbol_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " Link-index builder creation options.\n\n Callers zero-initialize this descriptor, set `type` to\n `LOOMC_STRUCTURE_TYPE_LINK_INDEX_BUILDER_OPTIONS`, set `structure_size` to\n `sizeof(loomc_link_index_builder_options_t)`, and fill the requested fields."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_link_index_builder_options_t {
#[doc = " Structure type. Must be\n `LOOMC_STRUCTURE_TYPE_LINK_INDEX_BUILDER_OPTIONS` when nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for future builder options."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Total bytes acquired from the host allocator per persistent frozen-index\n block. Internal tracking metadata consumes part of this capacity."]
pub block_size: loomc_host_size_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_link_index_builder_options_t"]
[::std::mem::size_of::<loomc_link_index_builder_options_t>() - 32usize];
["Alignment of loomc_link_index_builder_options_t"]
[::std::mem::align_of::<loomc_link_index_builder_options_t>() - 8usize];
["Offset of field: loomc_link_index_builder_options_t::type_"]
[::std::mem::offset_of!(loomc_link_index_builder_options_t, type_) - 0usize];
["Offset of field: loomc_link_index_builder_options_t::structure_size"]
[::std::mem::offset_of!(loomc_link_index_builder_options_t, structure_size) - 8usize];
["Offset of field: loomc_link_index_builder_options_t::next"]
[::std::mem::offset_of!(loomc_link_index_builder_options_t, next) - 16usize];
["Offset of field: loomc_link_index_builder_options_t::block_size"]
[::std::mem::offset_of!(loomc_link_index_builder_options_t, block_size) - 24usize];
};
impl Default for loomc_link_index_builder_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Deterministic source slot reserved by a link-index builder.\n\n Slots are stable within a builder. Parallel workers fill distinct slots so\n provider order and diagnostics do not depend on fill scheduling order."]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct loomc_link_index_source_slot_t {
#[doc = " Deterministic provider slot ordinal reserved by the builder."]
pub ordinal: loomc_host_size_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_link_index_source_slot_t"]
[::std::mem::size_of::<loomc_link_index_source_slot_t>() - 8usize];
["Alignment of loomc_link_index_source_slot_t"]
[::std::mem::align_of::<loomc_link_index_source_slot_t>() - 8usize];
["Offset of field: loomc_link_index_source_slot_t::ordinal"]
[::std::mem::offset_of!(loomc_link_index_source_slot_t, ordinal) - 0usize];
};
#[doc = " Source provider options used when adding sources to a link index.\n\n @lifetime\n String views are borrowed for the duration of the builder call that consumes\n this descriptor unless that call explicitly documents a copy."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_link_index_source_options_t {
#[doc = " Stable provider label for diagnostics and private-name determinism."]
pub provider_name: loomc_string_view_t,
#[doc = " Provider linkage role."]
pub role: loomc_link_provider_role_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_link_index_source_options_t"]
[::std::mem::size_of::<loomc_link_index_source_options_t>() - 24usize];
["Alignment of loomc_link_index_source_options_t"]
[::std::mem::align_of::<loomc_link_index_source_options_t>() - 8usize];
["Offset of field: loomc_link_index_source_options_t::provider_name"]
[::std::mem::offset_of!(loomc_link_index_source_options_t, provider_name) - 0usize];
["Offset of field: loomc_link_index_source_options_t::role"]
[::std::mem::offset_of!(loomc_link_index_source_options_t, role) - 16usize];
};
impl Default for loomc_link_index_source_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Prepared immutable linker.\n\n A linker owns validated link-time configuration. Frozen indexes carry\n reusable provider state and are supplied per invocation.\n\n @thread_safety\n Prepared linkers are immutable after creation and may be shared across\n threads. Invocation-local scratch belongs in `loomc_workspace_t`."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_linker_t {
_unused: [u8; 0],
}
#[doc = " Linker creation options.\n\n Callers zero-initialize this descriptor, set `type` to\n `LOOMC_STRUCTURE_TYPE_LINKER_OPTIONS`, set `structure_size` to\n `sizeof(loomc_linker_options_t)`, and fill the requested fields."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_linker_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_LINKER_OPTIONS` when\n nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for future linker options."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Default output module name for invocations that do not override it."]
pub module_name: loomc_string_view_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_linker_options_t"][::std::mem::size_of::<loomc_linker_options_t>() - 40usize];
["Alignment of loomc_linker_options_t"]
[::std::mem::align_of::<loomc_linker_options_t>() - 8usize];
["Offset of field: loomc_linker_options_t::type_"]
[::std::mem::offset_of!(loomc_linker_options_t, type_) - 0usize];
["Offset of field: loomc_linker_options_t::structure_size"]
[::std::mem::offset_of!(loomc_linker_options_t, structure_size) - 8usize];
["Offset of field: loomc_linker_options_t::next"]
[::std::mem::offset_of!(loomc_linker_options_t, next) - 16usize];
["Offset of field: loomc_linker_options_t::module_name"]
[::std::mem::offset_of!(loomc_linker_options_t, module_name) - 24usize];
};
impl Default for loomc_linker_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Select exported INPUT-provider symbols as roots and compute their closure."]
pub const LOOMC_LINK_FLAG_INCLUDE_INPUT_EXPORTS: loomc_link_flag_bits_e = 1;
#[doc = " Preserve reachable unresolved references for a later link or\n specialization step."]
pub const LOOMC_LINK_FLAG_ALLOW_UNRESOLVED_SYMBOLS: loomc_link_flag_bits_e = 2;
#[doc = " Strip symbols used only by test or benchmark tooling."]
pub const LOOMC_LINK_FLAG_STRIP_TEST_SYMBOLS: loomc_link_flag_bits_e = 4;
#[doc = " Link operation flags."]
pub type loomc_link_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " Bitmask of `loomc_link_flag_bits_t` values."]
pub type loomc_link_flags_t = u32;
#[doc = " Merge every primary-input symbol into one relocatable module. Library\n providers are not materialized."]
pub const LOOMC_LINK_MODE_MERGE: loomc_link_mode_e = 0;
#[doc = " Retain explicit roots or exported primary-input roots and their reachable\n closure through the complete supplied library universe. Selected root\n providers contribute all of their exported symbols as roots without\n changing provider visibility."]
pub const LOOMC_LINK_MODE_LINK: loomc_link_mode_e = 1;
#[doc = " Link product selection mode."]
pub type loomc_link_mode_e = ::std::os::raw::c_uint;
#[doc = " Link product selection mode."]
pub use self::loomc_link_mode_e as loomc_link_mode_t;
#[doc = " Link invocation options.\n\n A link invocation consumes a frozen index and returns either a retained\n module or a failed result with diagnostics. Merge mode materializes only\n primary INPUT providers and preserves unresolved contracts. Link mode\n selects a dependency closure from explicit roots or exported primary roots\n plus the exports of selected root providers across the complete supplied\n library universe. Linking preserves every target carried by the selected\n symbols. Target-specialization extensions participate in template-provider\n selection and project exact target facts into the standalone linked output.\n Config options materialize on the linked output for this invocation; frozen\n indexes and reusable input/library modules are never mutated by link-time\n specialization."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_link_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_LINK_OPTIONS` when nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Optional invocation extensions such as\n `loomc_target_specialization_options_t`."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Frozen provider index to link."]
pub link_index: *mut loomc_link_index_t,
#[doc = " Output module name for this invocation. Empty uses the linker's default."]
pub module_name: loomc_string_view_t,
#[doc = " Product selection mode. Zero defaults to `LOOMC_LINK_MODE_MERGE`."]
pub mode: loomc_link_mode_t,
#[doc = " Root symbol names for link mode. Function-like roots are retained as\n module-boundary entries in the linked output."]
pub root_symbols: *const loomc_string_view_t,
#[doc = " Number of entries in `root_symbols`."]
pub root_symbol_count: loomc_host_size_t,
#[doc = " Link operation flags."]
pub flags: loomc_link_flags_t,
#[doc = " Per-invocation config bindings materialized into the linked output module."]
pub config: loomc_config_options_t,
#[doc = " Provider ordinals whose exported symbols are roots in link mode. This\n selects public API surfaces without changing provider linkage roles or\n making private symbols visible across provider boundaries."]
pub root_provider_ordinals: *const loomc_host_size_t,
#[doc = " Number of entries in `root_provider_ordinals`."]
pub root_provider_count: loomc_host_size_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_link_options_t"][::std::mem::size_of::<loomc_link_options_t>() - 136usize];
["Alignment of loomc_link_options_t"][::std::mem::align_of::<loomc_link_options_t>() - 8usize];
["Offset of field: loomc_link_options_t::type_"]
[::std::mem::offset_of!(loomc_link_options_t, type_) - 0usize];
["Offset of field: loomc_link_options_t::structure_size"]
[::std::mem::offset_of!(loomc_link_options_t, structure_size) - 8usize];
["Offset of field: loomc_link_options_t::next"]
[::std::mem::offset_of!(loomc_link_options_t, next) - 16usize];
["Offset of field: loomc_link_options_t::link_index"]
[::std::mem::offset_of!(loomc_link_options_t, link_index) - 24usize];
["Offset of field: loomc_link_options_t::module_name"]
[::std::mem::offset_of!(loomc_link_options_t, module_name) - 32usize];
["Offset of field: loomc_link_options_t::mode"]
[::std::mem::offset_of!(loomc_link_options_t, mode) - 48usize];
["Offset of field: loomc_link_options_t::root_symbols"]
[::std::mem::offset_of!(loomc_link_options_t, root_symbols) - 56usize];
["Offset of field: loomc_link_options_t::root_symbol_count"]
[::std::mem::offset_of!(loomc_link_options_t, root_symbol_count) - 64usize];
["Offset of field: loomc_link_options_t::flags"]
[::std::mem::offset_of!(loomc_link_options_t, flags) - 72usize];
["Offset of field: loomc_link_options_t::config"]
[::std::mem::offset_of!(loomc_link_options_t, config) - 80usize];
["Offset of field: loomc_link_options_t::root_provider_ordinals"]
[::std::mem::offset_of!(loomc_link_options_t, root_provider_ordinals) - 120usize];
["Offset of field: loomc_link_options_t::root_provider_count"]
[::std::mem::offset_of!(loomc_link_options_t, root_provider_count) - 128usize];
};
impl Default for loomc_link_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Emits a schema-versioned JSON dependency report on success or failure."]
pub const LOOMC_LINK_DEPENDENCY_ARTIFACT_FLAG_REPORT_JSON:
loomc_link_dependency_artifact_flag_bits_e = 1;
#[doc = " Dependency-analysis artifact flag bit values."]
pub type loomc_link_dependency_artifact_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " No AMDGPU runtime support globals are emitted."]
pub const LOOMC_AMDGPU_RUNTIME_GLOBAL_NONE: loomc_amdgpu_runtime_global_flag_bits_e = 0;
#[doc = " Emits the common kernel-to-runtime feedback-channel configuration global."]
pub const LOOMC_AMDGPU_RUNTIME_GLOBAL_FEEDBACK_CONFIG: loomc_amdgpu_runtime_global_flag_bits_e = 1;
#[doc = " Emits the AMDGPU ASAN configuration global consumed by access checks."]
pub const LOOMC_AMDGPU_RUNTIME_GLOBAL_ASAN_CONFIG: loomc_amdgpu_runtime_global_flag_bits_e = 2;
#[doc = " AMDGPU runtime support global option bits."]
pub type loomc_amdgpu_runtime_global_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " Bitset of `loomc_amdgpu_runtime_global_flag_bits_t` values."]
pub type loomc_amdgpu_runtime_global_flags_t = u32;
#[doc = " AMDGPU HSACO emission options.\n\n AMDGPU emission uses the generic artifact format and artifact identifier on\n `loomc_emit_options_t`. Emitted functions carry their targets in prepared\n IR. The target-specific descriptor carries AMDGPU code-object data globals\n required by prepared-low IR that references HAL runtime support."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_amdgpu_emit_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_AMDGPU_EMIT_OPTIONS` when\n nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Next invocation option extension."]
pub next: *const ::std::os::raw::c_void,
#[doc = " AMDGPU runtime support globals to emit into the HSACO."]
pub runtime_globals: loomc_amdgpu_runtime_global_flags_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_amdgpu_emit_options_t"]
[::std::mem::size_of::<loomc_amdgpu_emit_options_t>() - 32usize];
["Alignment of loomc_amdgpu_emit_options_t"]
[::std::mem::align_of::<loomc_amdgpu_emit_options_t>() - 8usize];
["Offset of field: loomc_amdgpu_emit_options_t::type_"]
[::std::mem::offset_of!(loomc_amdgpu_emit_options_t, type_) - 0usize];
["Offset of field: loomc_amdgpu_emit_options_t::structure_size"]
[::std::mem::offset_of!(loomc_amdgpu_emit_options_t, structure_size) - 8usize];
["Offset of field: loomc_amdgpu_emit_options_t::next"]
[::std::mem::offset_of!(loomc_amdgpu_emit_options_t, next) - 16usize];
["Offset of field: loomc_amdgpu_emit_options_t::runtime_globals"]
[::std::mem::offset_of!(loomc_amdgpu_emit_options_t, runtime_globals) - 24usize];
};
impl Default for loomc_amdgpu_emit_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " The target identity does not constrain the feature."]
pub const LOOMC_AMDGPU_TARGET_FEATURE_ANY: loomc_amdgpu_target_feature_state_e = 0;
#[doc = " The selected target is known not to support the feature."]
pub const LOOMC_AMDGPU_TARGET_FEATURE_UNSUPPORTED: loomc_amdgpu_target_feature_state_e = 1;
#[doc = " The feature is explicitly disabled, such as `xnack-`."]
pub const LOOMC_AMDGPU_TARGET_FEATURE_OFF: loomc_amdgpu_target_feature_state_e = 2;
#[doc = " The feature is explicitly enabled, such as `sramecc+`."]
pub const LOOMC_AMDGPU_TARGET_FEATURE_ON: loomc_amdgpu_target_feature_state_e = 3;
#[doc = " Normalized state of one AMDHSA target-ID feature."]
pub type loomc_amdgpu_target_feature_state_e = ::std::os::raw::c_uint;
#[doc = " Normalized state of one AMDHSA target-ID feature."]
pub use self::loomc_amdgpu_target_feature_state_e as loomc_amdgpu_target_feature_state_t;
#[doc = " Structured AMDHSA target-ID feature states."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_amdgpu_amdhsa_feature_states_t {
#[doc = " SRAM ECC target-ID feature state."]
pub sramecc: loomc_amdgpu_target_feature_state_t,
#[doc = " XNACK target-ID feature state."]
pub xnack: loomc_amdgpu_target_feature_state_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_amdgpu_amdhsa_feature_states_t"]
[::std::mem::size_of::<loomc_amdgpu_amdhsa_feature_states_t>() - 8usize];
["Alignment of loomc_amdgpu_amdhsa_feature_states_t"]
[::std::mem::align_of::<loomc_amdgpu_amdhsa_feature_states_t>() - 4usize];
["Offset of field: loomc_amdgpu_amdhsa_feature_states_t::sramecc"]
[::std::mem::offset_of!(loomc_amdgpu_amdhsa_feature_states_t, sramecc) - 0usize];
["Offset of field: loomc_amdgpu_amdhsa_feature_states_t::xnack"]
[::std::mem::offset_of!(loomc_amdgpu_amdhsa_feature_states_t, xnack) - 4usize];
};
impl Default for loomc_amdgpu_amdhsa_feature_states_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Complete structured AMDGPU identity used to construct a target profile."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_amdgpu_target_identity_t {
#[doc = " Exact, generic, or overlay AMDGPU target selector, such as `gfx1151`,\n `gfx11-generic`, or `gfx1250-a0`."]
pub target: loomc_string_view_t,
#[doc = " Structured AMDHSA target-ID feature states."]
pub amdhsa_features: loomc_amdgpu_amdhsa_feature_states_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_amdgpu_target_identity_t"]
[::std::mem::size_of::<loomc_amdgpu_target_identity_t>() - 24usize];
["Alignment of loomc_amdgpu_target_identity_t"]
[::std::mem::align_of::<loomc_amdgpu_target_identity_t>() - 8usize];
["Offset of field: loomc_amdgpu_target_identity_t::target"]
[::std::mem::offset_of!(loomc_amdgpu_target_identity_t, target) - 0usize];
["Offset of field: loomc_amdgpu_target_identity_t::amdhsa_features"]
[::std::mem::offset_of!(loomc_amdgpu_target_identity_t, amdhsa_features) - 16usize];
};
impl Default for loomc_amdgpu_target_identity_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " AMDGPU target profile creation options."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_amdgpu_profile_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_AMDGPU_PROFILE_OPTIONS`\n when nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Reserved extension chain. Must be `NULL`."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Stable profile identifier used in diagnostics.\n\n Empty uses `identity.target`."]
pub identifier: loomc_string_view_t,
#[doc = " Structured AMDGPU target identity."]
pub identity: loomc_amdgpu_target_identity_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_amdgpu_profile_options_t"]
[::std::mem::size_of::<loomc_amdgpu_profile_options_t>() - 64usize];
["Alignment of loomc_amdgpu_profile_options_t"]
[::std::mem::align_of::<loomc_amdgpu_profile_options_t>() - 8usize];
["Offset of field: loomc_amdgpu_profile_options_t::type_"]
[::std::mem::offset_of!(loomc_amdgpu_profile_options_t, type_) - 0usize];
["Offset of field: loomc_amdgpu_profile_options_t::structure_size"]
[::std::mem::offset_of!(loomc_amdgpu_profile_options_t, structure_size) - 8usize];
["Offset of field: loomc_amdgpu_profile_options_t::next"]
[::std::mem::offset_of!(loomc_amdgpu_profile_options_t, next) - 16usize];
["Offset of field: loomc_amdgpu_profile_options_t::identifier"]
[::std::mem::offset_of!(loomc_amdgpu_profile_options_t, identifier) - 24usize];
["Offset of field: loomc_amdgpu_profile_options_t::identity"]
[::std::mem::offset_of!(loomc_amdgpu_profile_options_t, identity) - 40usize];
};
impl Default for loomc_amdgpu_profile_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
pub struct Loomc {
__library: ::libloading::Library,
pub loomc_allocator_system: unsafe extern "C" fn() -> loomc_allocator_t,
pub loomc_allocator_free:
unsafe extern "C" fn(allocator: loomc_allocator_t, ptr: *mut ::std::os::raw::c_void),
pub loomc_byte_sequence_length:
unsafe extern "C" fn(sequence: *const loomc_byte_sequence_t) -> u64,
pub loomc_byte_sequence_clone: unsafe extern "C" fn(
sequence: *const loomc_byte_sequence_t,
allocator: loomc_allocator_t,
out_span: *mut loomc_byte_span_t,
) -> loomc_status_t,
pub loomc_status_free: unsafe extern "C" fn(status: loomc_status_t),
pub loomc_status_format: unsafe extern "C" fn(
status: loomc_status_t,
buffer_capacity: loomc_host_size_t,
buffer: *mut ::std::os::raw::c_char,
out_length: *mut loomc_host_size_t,
) -> bool,
pub loomc_source_create: unsafe extern "C" fn(
options: *const loomc_source_options_t,
allocator: loomc_allocator_t,
out_source: *mut *mut loomc_source_t,
) -> loomc_status_t,
pub loomc_source_release: unsafe extern "C" fn(source: *mut loomc_source_t),
pub loomc_context_create: unsafe extern "C" fn(
options: *const loomc_context_options_t,
allocator: loomc_allocator_t,
out_context: *mut *mut loomc_context_t,
) -> loomc_status_t,
pub loomc_context_release: unsafe extern "C" fn(context: *mut loomc_context_t),
pub loomc_result_release: unsafe extern "C" fn(result: *mut loomc_result_t),
pub loomc_result_succeeded: unsafe extern "C" fn(result: *const loomc_result_t) -> bool,
pub loomc_result_diagnostic_count:
unsafe extern "C" fn(result: *const loomc_result_t) -> loomc_host_size_t,
pub loomc_result_diagnostic_at: unsafe extern "C" fn(
result: *const loomc_result_t,
index: loomc_host_size_t,
) -> *const loomc_diagnostic_t,
pub loomc_result_artifact_count:
unsafe extern "C" fn(result: *const loomc_result_t) -> loomc_host_size_t,
pub loomc_result_artifact_at: unsafe extern "C" fn(
result: *const loomc_result_t,
index: loomc_host_size_t,
) -> *const loomc_artifact_t,
pub loomc_workspace_create: unsafe extern "C" fn(
options: *const loomc_workspace_options_t,
allocator: loomc_allocator_t,
out_workspace: *mut *mut loomc_workspace_t,
) -> loomc_status_t,
pub loomc_workspace_trim: unsafe extern "C" fn(workspace: *mut loomc_workspace_t),
pub loomc_workspace_release: unsafe extern "C" fn(workspace: *mut loomc_workspace_t),
pub loomc_module_release: unsafe extern "C" fn(module: *mut loomc_module_t),
pub loomc_pass_program_release: unsafe extern "C" fn(pass_program: *mut loomc_pass_program_t),
pub loomc_compiler_create: unsafe extern "C" fn(
context: *mut loomc_context_t,
options: *const loomc_compiler_options_t,
allocator: loomc_allocator_t,
out_compiler: *mut *mut loomc_compiler_t,
) -> loomc_status_t,
pub loomc_compile_module: unsafe extern "C" fn(
compiler: *mut loomc_compiler_t,
workspace: *mut loomc_workspace_t,
pass_program: *const loomc_pass_program_t,
module: *mut loomc_module_t,
options: *const loomc_compile_options_t,
allocator: loomc_allocator_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t,
pub loomc_compiler_release: unsafe extern "C" fn(compiler: *mut loomc_compiler_t),
pub loomc_pass_program_create_from_target_pipeline: unsafe extern "C" fn(
context: *mut loomc_context_t,
options: *const loomc_target_pipeline_options_t,
allocator: loomc_allocator_t,
out_pass_program: *mut *mut loomc_pass_program_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t,
pub loomc_target_profile_release: unsafe extern "C" fn(profile: *mut loomc_target_profile_t),
pub loomc_target_environment_release:
unsafe extern "C" fn(target_environment: *mut loomc_target_environment_t),
pub loomc_emit_module: unsafe extern "C" fn(
target_environment: *mut loomc_target_environment_t,
workspace: *mut loomc_workspace_t,
module: *mut loomc_module_t,
options: *const loomc_emit_options_t,
allocator: loomc_allocator_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t,
pub loomc_link_index_builder_create: unsafe extern "C" fn(
context: *mut loomc_context_t,
options: *const loomc_link_index_builder_options_t,
allocator: loomc_allocator_t,
out_builder: *mut *mut loomc_link_index_builder_t,
) -> loomc_status_t,
pub loomc_link_index_builder_release:
unsafe extern "C" fn(builder: *mut loomc_link_index_builder_t),
pub loomc_link_index_builder_add_source: unsafe extern "C" fn(
builder: *mut loomc_link_index_builder_t,
source: *mut loomc_source_t,
options: *const loomc_link_index_source_options_t,
out_slot: *mut loomc_link_index_source_slot_t,
) -> loomc_status_t,
pub loomc_link_index_builder_finish: unsafe extern "C" fn(
builder: *mut loomc_link_index_builder_t,
out_link_index: *mut *mut loomc_link_index_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t,
pub loomc_link_index_release: unsafe extern "C" fn(link_index: *mut loomc_link_index_t),
pub loomc_linker_create: unsafe extern "C" fn(
context: *mut loomc_context_t,
options: *const loomc_linker_options_t,
allocator: loomc_allocator_t,
out_linker: *mut *mut loomc_linker_t,
) -> loomc_status_t,
pub loomc_link_module: unsafe extern "C" fn(
linker: *mut loomc_linker_t,
workspace: *mut loomc_workspace_t,
options: *const loomc_link_options_t,
out_module: *mut *mut loomc_module_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t,
pub loomc_linker_release: unsafe extern "C" fn(linker: *mut loomc_linker_t),
pub loomc_target_environment_create_amdgpu: unsafe extern "C" fn(
allocator: loomc_allocator_t,
out_target_environment: *mut *mut loomc_target_environment_t,
) -> loomc_status_t,
pub loomc_target_profile_create_amdgpu: unsafe extern "C" fn(
target_environment: *mut loomc_target_environment_t,
options: *const loomc_amdgpu_profile_options_t,
allocator: loomc_allocator_t,
out_profile: *mut *mut loomc_target_profile_t,
) -> loomc_status_t,
}
impl Loomc {
pub unsafe fn new<P>(path: P) -> Result<Self, ::libloading::Error>
where
P: AsRef<::std::ffi::OsStr>,
{
let path = path.as_ref();
let library = ::libloading::Library::new(path)?;
Self::from_library(library)
}
pub unsafe fn from_library<L>(library: L) -> Result<Self, ::libloading::Error>
where
L: Into<::libloading::Library>,
{
let __library = library.into();
let loomc_allocator_system = __library.get(b"loomc_allocator_system\0").map(|sym| *sym)?;
let loomc_allocator_free = __library.get(b"loomc_allocator_free\0").map(|sym| *sym)?;
let loomc_byte_sequence_length = __library
.get(b"loomc_byte_sequence_length\0")
.map(|sym| *sym)?;
let loomc_byte_sequence_clone = __library
.get(b"loomc_byte_sequence_clone\0")
.map(|sym| *sym)?;
let loomc_status_free = __library.get(b"loomc_status_free\0").map(|sym| *sym)?;
let loomc_status_format = __library.get(b"loomc_status_format\0").map(|sym| *sym)?;
let loomc_source_create = __library.get(b"loomc_source_create\0").map(|sym| *sym)?;
let loomc_source_release = __library.get(b"loomc_source_release\0").map(|sym| *sym)?;
let loomc_context_create = __library.get(b"loomc_context_create\0").map(|sym| *sym)?;
let loomc_context_release = __library.get(b"loomc_context_release\0").map(|sym| *sym)?;
let loomc_result_release = __library.get(b"loomc_result_release\0").map(|sym| *sym)?;
let loomc_result_succeeded = __library.get(b"loomc_result_succeeded\0").map(|sym| *sym)?;
let loomc_result_diagnostic_count = __library
.get(b"loomc_result_diagnostic_count\0")
.map(|sym| *sym)?;
let loomc_result_diagnostic_at = __library
.get(b"loomc_result_diagnostic_at\0")
.map(|sym| *sym)?;
let loomc_result_artifact_count = __library
.get(b"loomc_result_artifact_count\0")
.map(|sym| *sym)?;
let loomc_result_artifact_at = __library
.get(b"loomc_result_artifact_at\0")
.map(|sym| *sym)?;
let loomc_workspace_create = __library.get(b"loomc_workspace_create\0").map(|sym| *sym)?;
let loomc_workspace_trim = __library.get(b"loomc_workspace_trim\0").map(|sym| *sym)?;
let loomc_workspace_release = __library
.get(b"loomc_workspace_release\0")
.map(|sym| *sym)?;
let loomc_module_release = __library.get(b"loomc_module_release\0").map(|sym| *sym)?;
let loomc_pass_program_release = __library
.get(b"loomc_pass_program_release\0")
.map(|sym| *sym)?;
let loomc_compiler_create = __library.get(b"loomc_compiler_create\0").map(|sym| *sym)?;
let loomc_compile_module = __library.get(b"loomc_compile_module\0").map(|sym| *sym)?;
let loomc_compiler_release = __library.get(b"loomc_compiler_release\0").map(|sym| *sym)?;
let loomc_pass_program_create_from_target_pipeline = __library
.get(b"loomc_pass_program_create_from_target_pipeline\0")
.map(|sym| *sym)?;
let loomc_target_profile_release = __library
.get(b"loomc_target_profile_release\0")
.map(|sym| *sym)?;
let loomc_target_environment_release = __library
.get(b"loomc_target_environment_release\0")
.map(|sym| *sym)?;
let loomc_emit_module = __library.get(b"loomc_emit_module\0").map(|sym| *sym)?;
let loomc_link_index_builder_create = __library
.get(b"loomc_link_index_builder_create\0")
.map(|sym| *sym)?;
let loomc_link_index_builder_release = __library
.get(b"loomc_link_index_builder_release\0")
.map(|sym| *sym)?;
let loomc_link_index_builder_add_source = __library
.get(b"loomc_link_index_builder_add_source\0")
.map(|sym| *sym)?;
let loomc_link_index_builder_finish = __library
.get(b"loomc_link_index_builder_finish\0")
.map(|sym| *sym)?;
let loomc_link_index_release = __library
.get(b"loomc_link_index_release\0")
.map(|sym| *sym)?;
let loomc_linker_create = __library.get(b"loomc_linker_create\0").map(|sym| *sym)?;
let loomc_link_module = __library.get(b"loomc_link_module\0").map(|sym| *sym)?;
let loomc_linker_release = __library.get(b"loomc_linker_release\0").map(|sym| *sym)?;
let loomc_target_environment_create_amdgpu = __library
.get(b"loomc_target_environment_create_amdgpu\0")
.map(|sym| *sym)?;
let loomc_target_profile_create_amdgpu = __library
.get(b"loomc_target_profile_create_amdgpu\0")
.map(|sym| *sym)?;
Ok(Loomc {
__library,
loomc_allocator_system,
loomc_allocator_free,
loomc_byte_sequence_length,
loomc_byte_sequence_clone,
loomc_status_free,
loomc_status_format,
loomc_source_create,
loomc_source_release,
loomc_context_create,
loomc_context_release,
loomc_result_release,
loomc_result_succeeded,
loomc_result_diagnostic_count,
loomc_result_diagnostic_at,
loomc_result_artifact_count,
loomc_result_artifact_at,
loomc_workspace_create,
loomc_workspace_trim,
loomc_workspace_release,
loomc_module_release,
loomc_pass_program_release,
loomc_compiler_create,
loomc_compile_module,
loomc_compiler_release,
loomc_pass_program_create_from_target_pipeline,
loomc_target_profile_release,
loomc_target_environment_release,
loomc_emit_module,
loomc_link_index_builder_create,
loomc_link_index_builder_release,
loomc_link_index_builder_add_source,
loomc_link_index_builder_finish,
loomc_link_index_release,
loomc_linker_create,
loomc_link_module,
loomc_linker_release,
loomc_target_environment_create_amdgpu,
loomc_target_profile_create_amdgpu,
})
}
#[doc = " Returns a process-global system allocator.\n\n @return Allocator backed by the process heap."]
pub unsafe fn loomc_allocator_system(&self) -> loomc_allocator_t {
(self.loomc_allocator_system)()
}
#[doc = " Frees memory previously returned by `allocator`.\n\n @param allocator Allocator that returned `ptr`.\n @param ptr Allocation to free. Passing `NULL` is allowed.\n\n When `ptr` is non-NULL, `allocator.ctl` must also be non-NULL. Invalid\n allocator values are programmer errors because this function has no status\n channel."]
pub unsafe fn loomc_allocator_free(
&self,
allocator: loomc_allocator_t,
ptr: *mut ::std::os::raw::c_void,
) {
(self.loomc_allocator_free)(allocator, ptr)
}
#[doc = " Returns the logical byte length of `sequence`.\n\n @param sequence Sequence to inspect, or NULL.\n @return Sequence length, or zero for a NULL sequence."]
pub unsafe fn loomc_byte_sequence_length(&self, sequence: *const loomc_byte_sequence_t) -> u64 {
(self.loomc_byte_sequence_length)(sequence)
}
#[doc = " Clones `sequence` into one contiguous allocator-owned span.\n\n @param sequence Sequence to clone.\n @param allocator Host allocator owning the returned storage.\n @param out_span Receives the contiguous clone on success.\n @return OK when the complete sequence was cloned.\n\n The caller frees `out_span->data` with `allocator`. Empty sequences return\n an empty span without allocating. On failure `out_span` is empty."]
pub unsafe fn loomc_byte_sequence_clone(
&self,
sequence: *const loomc_byte_sequence_t,
allocator: loomc_allocator_t,
out_span: *mut loomc_byte_span_t,
) -> loomc_status_t {
(self.loomc_byte_sequence_clone)(sequence, allocator, out_span)
}
#[doc = " Frees status storage, if any.\n\n @param status Status to free. Passing OK or a code-only status is allowed."]
pub unsafe fn loomc_status_free(&self, status: loomc_status_t) {
(self.loomc_status_free)(status)
}
#[doc = " Formats `status` into `buffer` using the two-pass pattern.\n\n @param status Status to format.\n @param buffer_capacity Number of bytes available in `buffer`.\n @param buffer Output buffer, or `NULL` when querying the required length.\n @param out_length Receives the number of bytes required or written,\n excluding any trailing NUL byte.\n @return True when `buffer` was large enough and formatting completed.\n\n @lifetime\n Formatted bytes are owned by the caller-provided buffer."]
pub unsafe fn loomc_status_format(
&self,
status: loomc_status_t,
buffer_capacity: loomc_host_size_t,
buffer: *mut ::std::os::raw::c_char,
out_length: *mut loomc_host_size_t,
) -> bool {
(self.loomc_status_format)(status, buffer_capacity, buffer, out_length)
}
#[doc = " Creates an immutable source handle.\n\n @param options Source format, identity, bytes, and storage policy.\n @param allocator Host allocator used for source-owned storage.\n @param out_source Receives one retained source on success.\n @return OK when the source was created. Invalid argument is returned for\n malformed descriptors or impossible storage/release combinations.\n\n @ownership\n The caller owns the returned reference and releases it with\n `loomc_source_release`.\n\n @lifetime\n The source always copies `options->identifier`. Source contents are\n borrowed, copied, or externally released according to `options->storage`.\n Borrowed contents must outlive the source.\n\n @thread_safety\n The returned source is immutable and may be shared across threads."]
pub unsafe fn loomc_source_create(
&self,
options: *const loomc_source_options_t,
allocator: loomc_allocator_t,
out_source: *mut *mut loomc_source_t,
) -> loomc_status_t {
(self.loomc_source_create)(options, allocator, out_source)
}
#[doc = " Releases `source` from one owner.\n\n @param source Source to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations are safe to perform from multiple threads. The\n source is destroyed when the final reference is released."]
pub unsafe fn loomc_source_release(&self, source: *mut loomc_source_t) {
(self.loomc_source_release)(source)
}
#[doc = " Creates a reusable Loom API context.\n\n @param options Context options, or `NULL` for defaults.\n @param allocator Host allocator used for context-owned storage.\n @param out_context Receives one retained context on success.\n @return OK when the context was created.\n\n @ownership\n The caller owns the returned reference and releases it with\n `loomc_context_release`.\n\n @thread_safety\n The returned context is immutable and may be shared across prepared tools\n and worker threads."]
pub unsafe fn loomc_context_create(
&self,
options: *const loomc_context_options_t,
allocator: loomc_allocator_t,
out_context: *mut *mut loomc_context_t,
) -> loomc_status_t {
(self.loomc_context_create)(options, allocator, out_context)
}
#[doc = " Releases `context` from one owner.\n\n @param context Context to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations are safe to perform from multiple threads. The\n context is destroyed when the final reference is released."]
pub unsafe fn loomc_context_release(&self, context: *mut loomc_context_t) {
(self.loomc_context_release)(context)
}
#[doc = " Releases `result` from one owner.\n\n @param result Result to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations are safe to perform from multiple threads. The\n result is destroyed when the final reference is released."]
pub unsafe fn loomc_result_release(&self, result: *mut loomc_result_t) {
(self.loomc_result_release)(result)
}
#[doc = " Returns true when `result` succeeded.\n\n @param result Result to inspect.\n @return True when `loomc_result_state(result)` is\n `LOOMC_RESULT_STATE_SUCCEEDED`."]
pub unsafe fn loomc_result_succeeded(&self, result: *const loomc_result_t) -> bool {
(self.loomc_result_succeeded)(result)
}
#[doc = " Returns the number of diagnostics attached to `result`.\n\n @param result Result to inspect.\n @return Diagnostic count."]
pub unsafe fn loomc_result_diagnostic_count(
&self,
result: *const loomc_result_t,
) -> loomc_host_size_t {
(self.loomc_result_diagnostic_count)(result)
}
#[doc = " Returns a diagnostic by index.\n\n @param result Result to inspect.\n @param index Zero-based diagnostic index.\n @return Borrowed diagnostic view, or `NULL` when `index` is out of range.\n\n @lifetime\n The returned pointer remains valid until `result` is released."]
pub unsafe fn loomc_result_diagnostic_at(
&self,
result: *const loomc_result_t,
index: loomc_host_size_t,
) -> *const loomc_diagnostic_t {
(self.loomc_result_diagnostic_at)(result, index)
}
#[doc = " Returns the number of artifacts attached to `result`.\n\n @param result Result to inspect.\n @return Artifact count."]
pub unsafe fn loomc_result_artifact_count(
&self,
result: *const loomc_result_t,
) -> loomc_host_size_t {
(self.loomc_result_artifact_count)(result)
}
#[doc = " Returns an artifact by index.\n\n @param result Result to inspect.\n @param index Zero-based artifact index.\n @return Borrowed artifact view, or `NULL` when `index` is out of range.\n\n @lifetime\n The returned pointer remains valid until `result` is released."]
pub unsafe fn loomc_result_artifact_at(
&self,
result: *const loomc_result_t,
index: loomc_host_size_t,
) -> *const loomc_artifact_t {
(self.loomc_result_artifact_at)(result, index)
}
#[doc = " Creates a mutable workspace for one worker at a time.\n\n @param options Workspace allocation options, or `NULL` for defaults.\n @param allocator Host allocator used for workspace-owned storage.\n @param out_workspace Receives the created workspace on success.\n @return OK when the workspace was created.\n\n @ownership\n The caller owns the returned workspace and releases it with\n `loomc_workspace_release`.\n\n @lifetime\n Sources, retained results, frozen link indexes, prepared linkers, and\n prepared compilers do not use workspace arena storage unless an operation\n descriptor explicitly says so. Modules created, linked, cloned, or\n deserialized with a workspace retain that workspace and return their arena\n blocks when released.\n\n @thread_safety\n The returned workspace is mutable scratch and is intended for one worker at\n a time."]
pub unsafe fn loomc_workspace_create(
&self,
options: *const loomc_workspace_options_t,
allocator: loomc_allocator_t,
out_workspace: *mut *mut loomc_workspace_t,
) -> loomc_status_t {
(self.loomc_workspace_create)(options, allocator, out_workspace)
}
#[doc = " Trims idle arena blocks owned by `workspace`.\n\n @param workspace Workspace to trim.\n\n @lifetime\n Trim returns blocks that are already idle in the workspace block pool to the\n host allocator. Retained modules created from this workspace remain valid\n across trim, but their active arena blocks cannot be reused until those\n modules are released. Results, sources, frozen indexes, and prepared tools\n remain valid.\n\n @thread_safety\n External synchronization is required if another thread may be using the same\n workspace."]
pub unsafe fn loomc_workspace_trim(&self, workspace: *mut loomc_workspace_t) {
(self.loomc_workspace_trim)(workspace)
}
#[doc = " Releases `workspace` and all storage it owns.\n\n @param workspace Workspace to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations are safe from multiple threads. The workspace is\n destroyed when the final reference is released; no thread may be mutating it\n at that moment."]
pub unsafe fn loomc_workspace_release(&self, workspace: *mut loomc_workspace_t) {
(self.loomc_workspace_release)(workspace)
}
#[doc = " Releases an opaque module from one owner.\n\n @param module Module to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations are intended to be safe from multiple threads. The\n module is destroyed when the final reference is released."]
pub unsafe fn loomc_module_release(&self, module: *mut loomc_module_t) {
(self.loomc_module_release)(module)
}
#[doc = " Releases a pass program from one owner.\n\n @param pass_program Pass program to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations are safe from multiple threads. The pass program\n is destroyed when the final reference is released."]
pub unsafe fn loomc_pass_program_release(&self, pass_program: *mut loomc_pass_program_t) {
(self.loomc_pass_program_release)(pass_program)
}
#[doc = " Creates a prepared immutable compiler.\n\n @param context Context shared with modules compiled by this compiler.\n @param options Compiler configuration, or `NULL` for defaults.\n @param allocator Host allocator used for compiler-owned storage.\n @param out_compiler Receives one retained compiler on success.\n @return OK when the compiler was created.\n\n @ownership\n The caller owns the returned reference and releases it with\n `loomc_compiler_release`.\n\n @thread_safety\n The returned compiler is immutable and may be shared across worker threads."]
pub unsafe fn loomc_compiler_create(
&self,
context: *mut loomc_context_t,
options: *const loomc_compiler_options_t,
allocator: loomc_allocator_t,
out_compiler: *mut *mut loomc_compiler_t,
) -> loomc_status_t {
(self.loomc_compiler_create)(context, options, allocator, out_compiler)
}
#[doc = " Compiles a mutable module into in-memory artifacts.\n\n @param compiler Prepared compiler.\n @param workspace Invocation-local scratch workspace.\n @param pass_program Prepared pass program selected for this invocation.\n @param module Module produced by deserialization, linking, or another module\n operation. The invocation borrows the module for the duration of the call\n and may rewrite its IR in place.\n @param options Compile invocation options, or `NULL` for defaults.\n @param allocator Host allocator used for result-owned storage.\n @param out_result Receives a retained result for the operation.\n @return OK when the invocation ran to a result. Non-OK statuses represent\n API misuse or infrastructure failures before a result could be produced.\n\n @ownership\n The caller owns `out_result` on an OK return and releases it with\n `loomc_result_release`.\n\n @par Postcondition\n The caller retains ownership of `module`, and the module handle remains\n valid after the call. Its IR contents may have been transformed by the\n selected pass program. Callers needing independent later invocations of\n the original IR provide independent module storage before compilation.\n A successful target-specialized invocation also retains its concrete\n function-version facts in the module handle for a later\n `loomc_emit_module` call. A subsequent compile replaces that state.\n Serialization and cloning preserve IR only and do not persist compiler\n facts.\n\n @lifetime\n Returned results and artifacts do not borrow from `workspace` and remain\n valid after `loomc_workspace_trim`. The invocation borrows\n `options->config_module` only for the duration of the call and does not\n mutate or retain it.\n\n @par Artifact Requests\n Artifact emission is opt-in through `loomc_compile_options_t`. Requesting\n module text or bytecode serializes the transformed module into result-owned\n bytes. Requesting a report returns a JSON artifact with invocation metadata,\n result state, diagnostic count, and the count of other artifacts emitted by\n the invocation.\n\n @thread_safety\n Calls using the same compiler and pass program may run concurrently when\n each call uses a distinct workspace and distinct module, or when access to\n shared workspaces and modules is synchronized externally. The compiler and\n pass program are immutable after creation.\n\n @par Target Specialization\n `loomc_target_specialization_options_t` may be attached to\n `loomc_compile_options_t::next`. Direct specialization rows bind selected\n function versions to complete profiles. Target binding rows bind authored\n `target.decl` contexts and seed every function assigned to the declaration.\n All profiles must be compatible with the compiler context's target\n environment. Unrequested functions retain their authored targets, including\n generic targets, and targetless functions remain targetless."]
pub unsafe fn loomc_compile_module(
&self,
compiler: *mut loomc_compiler_t,
workspace: *mut loomc_workspace_t,
pass_program: *const loomc_pass_program_t,
module: *mut loomc_module_t,
options: *const loomc_compile_options_t,
allocator: loomc_allocator_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t {
(self.loomc_compile_module)(
compiler,
workspace,
pass_program,
module,
options,
allocator,
out_result,
)
}
#[doc = " Releases a prepared compiler from one owner.\n\n @param compiler Compiler to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations are intended to be safe from multiple threads. The\n compiler is destroyed when the final reference is released."]
pub unsafe fn loomc_compiler_release(&self, compiler: *mut loomc_compiler_t) {
(self.loomc_compiler_release)(compiler)
}
#[doc = " Creates a prepared target lowering pass program.\n\n The context must have been created with a target environment using\n `loomc_context_target_options_t`. The returned pass program is an ordinary\n `loomc_pass_program_t` and is passed to `loomc_compile_module` like any\n other prepared pipeline.\n\n @param context Context whose target environment selects the target package.\n @param options Target pipeline options, or `NULL` for defaults.\n @param allocator Host allocator used for pass-program and result storage.\n @param out_pass_program Receives one retained pass program when the result\n succeeds. Receives `NULL` when target pipeline preparation fails.\n @param out_result Receives a retained result containing pipeline\n preparation diagnostics and operation state.\n @return OK when the creation operation completed far enough to report a\n result. Non-OK statuses represent API misuse or infrastructure failures\n before a result could be produced.\n\n @ownership\n The caller owns `out_result` on an OK return and releases it with\n `loomc_result_release`. When a pass program is produced, the caller owns the\n returned reference and releases it with `loomc_pass_program_release`.\n\n @thread_safety\n The returned pass program is immutable and may be shared across worker\n threads.\n\n @par Sanitizer Assertions\n `loomc_sanitizer_options_t` may be attached to\n `loomc_target_pipeline_options_t::next`. Nonzero check bits insert\n sanitizer pass slots at the target pipeline's semantic assertion boundary."]
pub unsafe fn loomc_pass_program_create_from_target_pipeline(
&self,
context: *mut loomc_context_t,
options: *const loomc_target_pipeline_options_t,
allocator: loomc_allocator_t,
out_pass_program: *mut *mut loomc_pass_program_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t {
(self.loomc_pass_program_create_from_target_pipeline)(
context,
options,
allocator,
out_pass_program,
out_result,
)
}
#[doc = " Releases a target profile from one owner.\n\n @param profile Target profile to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations are safe from multiple threads. The profile is\n destroyed when the final reference is released."]
pub unsafe fn loomc_target_profile_release(&self, profile: *mut loomc_target_profile_t) {
(self.loomc_target_profile_release)(profile)
}
#[doc = " Releases a target environment from one owner.\n\n @param target_environment Target environment to release. Passing `NULL` is\n allowed.\n\n @thread_safety\n Retain/release operations are safe from multiple threads. The environment\n is destroyed when the final reference is released."]
pub unsafe fn loomc_target_environment_release(
&self,
target_environment: *mut loomc_target_environment_t,
) {
(self.loomc_target_environment_release)(target_environment)
}
#[doc = " Emits target artifacts from a prepared module.\n\n The module must already be in the target-low form expected by the selected\n emitter. This function does not run compile passes or link additional\n modules, and target specialization options are not accepted. When the\n module was prepared by `loomc_compile_module`, emission consumes the\n concrete function-version facts retained by that successful invocation.\n Other functions resolve their authored target witnesses from IR. A\n targetless or generic Low function that requires more precise target facts\n must be compiled with specialization before emission. The operation may\n mutate invocation-local scratch state inside `module`; callers that need to\n emit the same module concurrently should pass distinct module handles.\n\n @param target_environment Target environment that contains one or more\n linked emitters.\n @param workspace Invocation-local scratch workspace.\n @param module Mutable module containing prepared target IR.\n @param options Emission options, or `NULL` for defaults.\n @param allocator Host allocator used for result-owned storage.\n @param out_result Receives a retained result containing diagnostics and\n artifacts when the operation completes far enough to report them.\n @return OK when the emission operation produced a result. Non-OK statuses\n represent API misuse or infrastructure failures before a result could be\n produced.\n\n @ownership\n The caller owns `out_result` on an OK return and releases it with\n `loomc_result_release`.\n\n @lifetime\n Returned artifacts and diagnostics are owned by the result and remain valid\n until the result is released. They do not borrow from `workspace` or\n `module`.\n\n @thread_safety\n The target environment is immutable and may be shared across threads. The\n workspace and module are invocation-local mutable objects and must not be\n used concurrently by multiple emission calls."]
pub unsafe fn loomc_emit_module(
&self,
target_environment: *mut loomc_target_environment_t,
workspace: *mut loomc_workspace_t,
module: *mut loomc_module_t,
options: *const loomc_emit_options_t,
allocator: loomc_allocator_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t {
(self.loomc_emit_module)(
target_environment,
workspace,
module,
options,
allocator,
out_result,
)
}
#[doc = " Creates an empty link-index builder.\n\n @param context Reusable Loom API context retained by the builder.\n @param options Builder options, or `NULL` for defaults.\n @param allocator Host allocator used for builder and frozen-index storage.\n @param out_builder Receives the mutable builder on success.\n @return OK when the builder was created.\n\n @ownership\n The caller owns the returned builder and releases it with\n `loomc_link_index_builder_release`."]
pub unsafe fn loomc_link_index_builder_create(
&self,
context: *mut loomc_context_t,
options: *const loomc_link_index_builder_options_t,
allocator: loomc_allocator_t,
out_builder: *mut *mut loomc_link_index_builder_t,
) -> loomc_status_t {
(self.loomc_link_index_builder_create)(context, options, allocator, out_builder)
}
#[doc = " Releases a link-index builder.\n\n @param builder Builder to release. Passing `NULL` is allowed.\n\n @thread_safety\n No other thread may be reserving, filling, or finishing `builder`."]
pub unsafe fn loomc_link_index_builder_release(
&self,
builder: *mut loomc_link_index_builder_t,
) {
(self.loomc_link_index_builder_release)(builder)
}
#[doc = " Reserves and fills the next source slot.\n\n @param builder Builder to mutate.\n @param source Source retained by the builder on success.\n @param options Provider options copied by this call, or `NULL` for defaults.\n @param out_slot Receives the source slot, or `NULL` if not needed.\n @return OK when the source was queued for indexing."]
pub unsafe fn loomc_link_index_builder_add_source(
&self,
builder: *mut loomc_link_index_builder_t,
source: *mut loomc_source_t,
options: *const loomc_link_index_source_options_t,
out_slot: *mut loomc_link_index_source_slot_t,
) -> loomc_status_t {
(self.loomc_link_index_builder_add_source)(builder, source, options, out_slot)
}
#[doc = " Finishes a builder into a frozen immutable link index.\n\n @param builder Builder to finish. The builder becomes finished after this\n call returns OK, whether the operation result succeeded or failed.\n @param out_link_index Receives one retained frozen index when the result\n state is succeeded.\n @param out_result Receives one retained result describing indexing outcome.\n @return OK when a result was produced. Non-OK status means API or\n infrastructure failure prevented result production.\n\n @ownership\n Finishing does not consume `builder`; the caller still releases it with\n `loomc_link_index_builder_release` after the call returns. The caller owns\n `out_link_index` on successful result state and releases it with\n `loomc_link_index_release`. The caller owns `out_result` and releases it\n with `loomc_result_release`.\n\n @error_contract\n Invalid Loom text, malformed bytecode, empty reserved slots, and unsupported\n source formats produce OK status plus a failed result with diagnostics."]
pub unsafe fn loomc_link_index_builder_finish(
&self,
builder: *mut loomc_link_index_builder_t,
out_link_index: *mut *mut loomc_link_index_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t {
(self.loomc_link_index_builder_finish)(builder, out_link_index, out_result)
}
#[doc = " Releases a frozen link index from one owner.\n\n @param link_index Link index to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations for frozen indexes are intended to be safe from\n multiple threads. No mutation occurs after the index is frozen."]
pub unsafe fn loomc_link_index_release(&self, link_index: *mut loomc_link_index_t) {
(self.loomc_link_index_release)(link_index)
}
#[doc = " Creates a prepared immutable linker.\n\n @param context Context shared with all link indexes used by this linker.\n @param options Linker configuration, or `NULL` for defaults.\n @param allocator Host allocator used for linker-owned storage.\n @param out_linker Receives one retained linker on success.\n @return OK when the linker was created.\n\n @ownership\n The caller owns the returned reference and releases it with\n `loomc_linker_release`.\n\n @thread_safety\n The returned linker is immutable and may be shared across worker threads."]
pub unsafe fn loomc_linker_create(
&self,
context: *mut loomc_context_t,
options: *const loomc_linker_options_t,
allocator: loomc_allocator_t,
out_linker: *mut *mut loomc_linker_t,
) -> loomc_status_t {
(self.loomc_linker_create)(context, options, allocator, out_linker)
}
#[doc = " Links a frozen index into an opaque module.\n\n @param linker Prepared linker.\n @param workspace Invocation-local scratch workspace.\n @param options Link invocation options.\n @param out_module Receives a retained linked module when the result\n succeeds. Receives `NULL` when the result fails.\n @param out_result Receives a retained result for the operation.\n @return OK when the invocation ran to a result. Non-OK statuses represent\n API misuse or infrastructure failures before a result could be produced.\n\n @ownership\n The caller owns `out_module` when non-NULL and releases it with\n `loomc_module_release`. The caller always owns `out_result` on an OK return\n and releases it with `loomc_result_release`.\n\n @lifetime\n Returned results do not borrow from `workspace` and remain valid after\n `loomc_workspace_trim`. Returned modules retain `workspace` and keep their\n arena blocks live until released.\n\n @thread_safety\n Calls using the same linker may run concurrently when each call uses a\n distinct workspace. The same workspace requires external synchronization.\n"]
pub unsafe fn loomc_link_module(
&self,
linker: *mut loomc_linker_t,
workspace: *mut loomc_workspace_t,
options: *const loomc_link_options_t,
out_module: *mut *mut loomc_module_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t {
(self.loomc_link_module)(linker, workspace, options, out_module, out_result)
}
#[doc = " Releases a prepared linker from one owner.\n\n @param linker Linker to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations are intended to be safe from multiple threads. The\n linker is destroyed when the final reference is released."]
pub unsafe fn loomc_linker_release(&self, linker: *mut loomc_linker_t) {
(self.loomc_linker_release)(linker)
}
#[doc = " Creates a target environment containing the AMDGPU target package.\n\n @param allocator Host allocator used for target-environment storage.\n @param out_target_environment Receives one retained target environment on\n success.\n @return OK when the target environment was created.\n\n @ownership\n The caller owns the returned reference and releases it with\n `loomc_target_environment_release`."]
pub unsafe fn loomc_target_environment_create_amdgpu(
&self,
allocator: loomc_allocator_t,
out_target_environment: *mut *mut loomc_target_environment_t,
) -> loomc_status_t {
(self.loomc_target_environment_create_amdgpu)(allocator, out_target_environment)
}
#[doc = " Creates an AMDGPU target profile from a canonical target selector.\n\n @param target_environment AMDGPU-capable target environment.\n @param options Profile options. Required.\n @param allocator Host allocator used for profile storage.\n @param out_profile Receives one retained profile on success.\n @return OK when the target is known, HSACO-capable, and has a supported Loom\n descriptor-family bundle.\n\n @ownership\n The caller owns the returned profile and releases it with\n `loomc_target_profile_release`."]
pub unsafe fn loomc_target_profile_create_amdgpu(
&self,
target_environment: *mut loomc_target_environment_t,
options: *const loomc_amdgpu_profile_options_t,
allocator: loomc_allocator_t,
out_profile: *mut *mut loomc_target_profile_t,
) -> loomc_status_t {
(self.loomc_target_profile_create_amdgpu)(
target_environment,
options,
allocator,
out_profile,
)
}
}