7#ifndef LOOMC_LINK_INDEX_H_
8#define LOOMC_LINK_INDEX_H_
65typedef enum loomc_link_provider_role_e {
74typedef enum loomc_link_provider_kind_e {
89typedef enum loomc_link_symbol_identity_e {
98typedef enum loomc_link_symbol_kind_e {
125typedef enum loomc_link_symbol_flag_bits_e {
#define LOOMC_API_EXPORT
Exports a public Loom C API symbol from a shared library build.
Definition base.h:34
size_t loomc_host_size_t
Host allocation and container size type.
Definition base.h:45
loomc_structure_type_t
Structure type values used by extensible public descriptors.
Definition base.h:181
struct iree_status_handle_t * loomc_status_t
Opaque status handle.
Definition base.h:55
Per-invocation configuration bindings.
Reusable Loom API context.
struct loomc_context_t loomc_context_t
Immutable Loom API context.
Definition context.h:47
loomc_link_symbol_kind_t
Linker-facing symbol kind.
Definition link_index.h:98
@ LOOMC_LINK_SYMBOL_KIND_GLOBAL
Global value or configuration symbol.
Definition link_index.h:115
@ LOOMC_LINK_SYMBOL_KIND_FUNCTION_TEMPLATE
Function template.
Definition link_index.h:109
@ LOOMC_LINK_SYMBOL_KIND_FUNCTION_UKERNEL
Microkernel implementation.
Definition link_index.h:112
@ LOOMC_LINK_SYMBOL_KIND_FUNCTION_DEFINITION
Function definition with a body.
Definition link_index.h:103
@ LOOMC_LINK_SYMBOL_KIND_UNKNOWN
Symbol kind is unknown.
Definition link_index.h:100
@ LOOMC_LINK_SYMBOL_KIND_EXECUTABLE
Executable/package symbol.
Definition link_index.h:118
@ LOOMC_LINK_SYMBOL_KIND_FUNCTION_DECLARATION
Function declaration or import.
Definition link_index.h:106
@ LOOMC_LINK_SYMBOL_KIND_RECORD
Record symbol.
Definition link_index.h:121
bool loomc_link_index_symbol_at(const loomc_link_index_t *link_index, loomc_host_size_t ordinal, loomc_link_index_symbol_t *out_symbol)
Returns symbol metadata by ordinal.
loomc_link_provider_role_t
Search role assigned to a source provider in a link index.
Definition link_index.h:65
@ LOOMC_LINK_PROVIDER_ROLE_INPUT
Primary input providers are selected before libraries.
Definition link_index.h:67
@ LOOMC_LINK_PROVIDER_ROLE_LIBRARY
Library providers are searched after primary inputs.
Definition link_index.h:70
void loomc_link_index_release(loomc_link_index_t *link_index)
Releases a frozen link index from one owner.
void loomc_link_index_builder_release(loomc_link_index_builder_t *builder)
Releases a link-index builder.
loomc_host_size_t loomc_link_index_provider_count(const loomc_link_index_t *link_index)
Returns the number of providers in a frozen index.
loomc_status_t loomc_link_index_builder_finish(loomc_link_index_builder_t *builder, loomc_link_index_t **out_link_index, loomc_result_t **out_result)
Finishes a builder into a frozen immutable link index.
bool loomc_link_index_provider_at(const loomc_link_index_t *link_index, loomc_host_size_t ordinal, loomc_link_index_provider_t *out_provider)
Returns provider metadata by ordinal.
bool loomc_link_index_next_global_duplicate(const loomc_link_index_t *link_index, const loomc_link_index_symbol_t *symbol, loomc_link_index_symbol_t *out_symbol)
Returns the next duplicate global symbol for symbol.
void loomc_link_index_retain(loomc_link_index_t *link_index)
Retains a frozen link index for another owner.
struct loomc_link_index_t loomc_link_index_t
Frozen immutable link index.
Definition link_index.h:62
struct loomc_link_index_builder_t loomc_link_index_builder_t
Mutable builder used to construct a frozen link index.
Definition link_index.h:55
bool loomc_link_index_module_at(const loomc_link_index_t *link_index, loomc_host_size_t ordinal, loomc_link_index_module_t *out_module)
Returns module metadata by ordinal.
loomc_link_provider_kind_t
Source representation kind recorded for an indexed provider.
Definition link_index.h:74
@ LOOMC_LINK_PROVIDER_KIND_UNKNOWN
Provider kind is unknown.
Definition link_index.h:76
@ LOOMC_LINK_PROVIDER_KIND_BYTECODE
Provider was indexed from bytecode .loombc source.
Definition link_index.h:82
@ LOOMC_LINK_PROVIDER_KIND_MATERIALIZED
Provider was indexed from an already materialized module.
Definition link_index.h:85
@ LOOMC_LINK_PROVIDER_KIND_TEXT
Provider was indexed from text .loom source.
Definition link_index.h:79
bool loomc_link_index_lookup_private(const loomc_link_index_t *link_index, const loomc_link_index_module_t *module, loomc_string_view_t name, loomc_link_index_symbol_t *out_symbol)
Looks up a private symbol within an indexed module.
loomc_host_size_t loomc_link_index_module_count(const loomc_link_index_t *link_index)
Returns the number of modules in a frozen index.
bool loomc_link_index_lookup_global(const loomc_link_index_t *link_index, loomc_string_view_t name, loomc_link_index_symbol_t *out_symbol)
Looks up the selected global symbol by name.
loomc_link_symbol_flag_bits_t
Link-index symbol flag bit values.
Definition link_index.h:125
@ LOOMC_LINK_SYMBOL_FLAG_DECLARATION
Symbol is declaration-like and may be superseded by a concrete definition.
Definition link_index.h:136
@ LOOMC_LINK_SYMBOL_FLAG_HAS_BODY
Symbol has materializable IR owned by its provider.
Definition link_index.h:139
@ LOOMC_LINK_SYMBOL_FLAG_TEST_ONLY
Symbol exists only for test or benchmark tooling.
Definition link_index.h:145
@ LOOMC_LINK_SYMBOL_FLAG_EXPORT
Symbol is exported from its provider/module.
Definition link_index.h:133
@ LOOMC_LINK_SYMBOL_FLAG_CONFIG
Symbol implements the config symbol interface.
Definition link_index.h:142
@ LOOMC_LINK_SYMBOL_FLAG_IMPORT
Symbol is an import declaration supplied by another provider/module.
Definition link_index.h:130
@ LOOMC_LINK_SYMBOL_FLAG_PUBLIC
Symbol is publicly visible in its source module.
Definition link_index.h:127
loomc_host_size_t loomc_link_index_symbol_count(const loomc_link_index_t *link_index)
Returns the number of symbols in a frozen index.
loomc_status_t loomc_link_index_builder_reserve_source_slot(loomc_link_index_builder_t *builder, const loomc_link_index_source_options_t *options, loomc_link_index_source_slot_t *out_slot)
Reserves a deterministic source slot.
loomc_status_t loomc_link_index_builder_create(loomc_context_t *context, const loomc_link_index_builder_options_t *options, loomc_allocator_t allocator, loomc_link_index_builder_t **out_builder)
Creates an empty link-index builder.
loomc_status_t loomc_link_index_builder_fill_source_slot(loomc_link_index_builder_t *builder, loomc_link_index_source_slot_t slot, loomc_source_t *source)
Fills an already reserved source slot.
loomc_status_t loomc_link_index_builder_add_source(loomc_link_index_builder_t *builder, loomc_source_t *source, const loomc_link_index_source_options_t *options, loomc_link_index_source_slot_t *out_slot)
Reserves and fills the next source slot.
uint32_t loomc_link_symbol_flags_t
Bitmask of loomc_link_symbol_flag_bits_t values.
Definition link_index.h:149
loomc_link_symbol_identity_t
Linker-facing symbol identity class.
Definition link_index.h:89
@ LOOMC_LINK_SYMBOL_IDENTITY_GLOBAL
Symbol identity is resolved by name across providers.
Definition link_index.h:94
@ LOOMC_LINK_SYMBOL_IDENTITY_PRIVATE
Symbol identity is scoped to one provider-local module.
Definition link_index.h:91
Shared operation result container.
struct loomc_result_t loomc_result_t
Immutable operation result.
Definition result.h:63
struct loomc_source_t loomc_source_t
Immutable source handle.
Definition source.h:80
Host allocator used for persistent Loom object storage.
Definition base.h:375
Link-index builder creation options.
Definition link_index.h:156
const void * next
Extension chain for future builder options.
Definition link_index.h:165
loomc_host_size_t block_size
Total bytes acquired from the host allocator per persistent frozen-index block.
Definition link_index.h:169
loomc_structure_type_t type
Structure type.
Definition link_index.h:159
loomc_host_size_t structure_size
Size of this structure in bytes.
Definition link_index.h:162
Indexed module metadata.
Definition link_index.h:224
loomc_host_size_t symbol_start_ordinal
First symbol ordinal owned by this module.
Definition link_index.h:238
loomc_string_view_t name
Module name.
Definition link_index.h:235
loomc_host_size_t symbol_count
Number of symbols owned by this module.
Definition link_index.h:241
loomc_host_size_t provider_module_ordinal
Provider-local module ordinal.
Definition link_index.h:232
loomc_host_size_t provider_ordinal
Provider that owns this module.
Definition link_index.h:229
loomc_host_size_t ordinal
Index-wide module ordinal.
Definition link_index.h:226
Indexed provider metadata.
Definition link_index.h:199
loomc_host_size_t module_count
Number of modules owned by this provider.
Definition link_index.h:216
loomc_host_size_t ordinal
Index-wide provider ordinal.
Definition link_index.h:201
loomc_host_size_t module_start_ordinal
First module ordinal owned by this provider.
Definition link_index.h:213
loomc_string_view_t name
Provider label used for diagnostics.
Definition link_index.h:210
loomc_link_provider_role_t role
Provider search precedence role.
Definition link_index.h:207
loomc_link_provider_kind_t kind
Source representation kind.
Definition link_index.h:204
Source provider options used when adding sources to a link index.
Definition link_index.h:186
loomc_link_provider_role_t role
Provider search precedence role.
Definition link_index.h:191
loomc_string_view_t provider_name
Stable provider label for diagnostics and private-name determinism.
Definition link_index.h:188
Deterministic source slot reserved by a link-index builder.
Definition link_index.h:176
loomc_host_size_t ordinal
Deterministic provider slot ordinal reserved by the builder.
Definition link_index.h:178
Indexed symbol metadata.
Definition link_index.h:249
loomc_string_view_t name
Module-local symbol name without an @ sigil.
Definition link_index.h:266
loomc_host_size_t ordinal
Index-wide symbol ordinal.
Definition link_index.h:251
loomc_host_size_t provider_module_ordinal
Provider-local module ordinal.
Definition link_index.h:260
loomc_link_symbol_flags_t flags
Link-index symbol flags.
Definition link_index.h:275
loomc_link_symbol_identity_t identity
Link identity class.
Definition link_index.h:272
loomc_link_symbol_kind_t kind
Linker-facing symbol kind.
Definition link_index.h:269
loomc_host_size_t module_ordinal
Module that owns this symbol.
Definition link_index.h:257
loomc_host_size_t module_symbol_ordinal
Module-local symbol ordinal.
Definition link_index.h:263
loomc_host_size_t provider_ordinal
Provider that supplied this symbol.
Definition link_index.h:254
Non-owning string view over bytes that need not be NUL-terminated.
Definition base.h:63