7#ifndef LOOMC_LINK_INDEX_H_
8#define LOOMC_LINK_INDEX_H_
75typedef enum loomc_link_provider_role_e {
84typedef enum loomc_link_provider_kind_e {
99typedef enum loomc_link_symbol_identity_e {
108typedef enum loomc_link_symbol_kind_e {
135typedef 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
Text and JSON configuration bindings.
Reusable Loom API context.
struct loomc_context_t loomc_context_t
Immutable Loom API context.
Definition context.h:63
loomc_link_symbol_kind_t
Linker-facing symbol kind.
Definition link_index.h:108
@ LOOMC_LINK_SYMBOL_KIND_GLOBAL
Global value or configuration symbol.
Definition link_index.h:125
@ LOOMC_LINK_SYMBOL_KIND_FUNCTION_TEMPLATE
Function template.
Definition link_index.h:119
@ LOOMC_LINK_SYMBOL_KIND_FUNCTION_UKERNEL
Microkernel implementation.
Definition link_index.h:122
@ LOOMC_LINK_SYMBOL_KIND_FUNCTION_DEFINITION
Function definition with a body.
Definition link_index.h:113
@ LOOMC_LINK_SYMBOL_KIND_UNKNOWN
Symbol kind is unknown.
Definition link_index.h:110
@ LOOMC_LINK_SYMBOL_KIND_EXECUTABLE
Executable/package symbol.
Definition link_index.h:128
@ LOOMC_LINK_SYMBOL_KIND_FUNCTION_DECLARATION
Function declaration or import.
Definition link_index.h:116
@ LOOMC_LINK_SYMBOL_KIND_RECORD
Record symbol.
Definition link_index.h:131
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
Linkage role assigned to a source provider in a link index.
Definition link_index.h:75
@ LOOMC_LINK_PROVIDER_ROLE_INPUT
Direct sources jointly owned by the module being assembled.
Definition link_index.h:77
@ LOOMC_LINK_PROVIDER_ROLE_LIBRARY
Separate libraries contributing exported exact definitions and templates.
Definition link_index.h:80
void loomc_link_index_builder_free(loomc_link_index_builder_t *builder)
Frees a link-index builder.
void loomc_link_index_release(loomc_link_index_t *link_index)
Releases a frozen link index from one owner.
loomc_status_t loomc_link_index_builder_add_module(loomc_link_index_builder_t *builder, const loomc_module_t *module, const loomc_link_index_source_options_t *options, loomc_link_index_source_slot_t *out_slot)
Reserves and fills the next slot with an independent module snapshot.
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 in canonical order.
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:72
struct loomc_link_index_builder_t loomc_link_index_builder_t
Mutable builder used to construct a frozen link index.
Definition link_index.h:65
loomc_status_t loomc_link_index_builder_fill_module_slot(loomc_link_index_builder_t *builder, loomc_link_index_source_slot_t slot, const loomc_module_t *module)
Fills a reserved slot with an independent snapshot of a module.
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:84
@ LOOMC_LINK_PROVIDER_KIND_UNKNOWN
Provider kind is unknown.
Definition link_index.h:86
@ LOOMC_LINK_PROVIDER_KIND_BYTECODE
Provider was indexed from bytecode .loombc source.
Definition link_index.h:92
@ LOOMC_LINK_PROVIDER_KIND_MATERIALIZED
Provider was indexed from an already materialized module.
Definition link_index.h:95
@ LOOMC_LINK_PROVIDER_KIND_TEXT
Provider was indexed from text .loom source.
Definition link_index.h:89
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_status_t loomc_link_index_builder_allocate(loomc_context_t *context, const loomc_link_index_builder_options_t *options, loomc_allocator_t allocator, loomc_link_index_builder_t **out_builder)
Allocates an exclusively owned empty link-index builder.
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 first global symbol by name in canonical enumeration order.
loomc_link_symbol_flag_bits_t
Link-index symbol flag bit values.
Definition link_index.h:135
@ LOOMC_LINK_SYMBOL_FLAG_DECLARATION
Symbol is declaration-like and may be superseded by a concrete definition.
Definition link_index.h:146
@ LOOMC_LINK_SYMBOL_FLAG_TEST_ONLY
Symbol exists only for test or benchmark tooling.
Definition link_index.h:155
@ LOOMC_LINK_SYMBOL_FLAG_EXPORT
Symbol is exported from its provider/module.
Definition link_index.h:143
@ LOOMC_LINK_SYMBOL_FLAG_CONFIG
Symbol implements the config symbol interface.
Definition link_index.h:152
@ LOOMC_LINK_SYMBOL_FLAG_IMPORT
Symbol is an import declaration supplied by another provider/module.
Definition link_index.h:140
@ LOOMC_LINK_SYMBOL_FLAG_PUBLIC
Symbol is publicly visible in its source module.
Definition link_index.h:137
@ LOOMC_LINK_SYMBOL_FLAG_RETAIN
Source symbol is explicitly preserved by ordinary symbol pruning.
Definition link_index.h:158
@ LOOMC_LINK_SYMBOL_FLAG_CONCRETE_DEFINITION
Symbol is a concrete definition owned by its provider.
Definition link_index.h:149
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_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:162
loomc_link_symbol_identity_t
Linker-facing symbol identity class.
Definition link_index.h:99
@ LOOMC_LINK_SYMBOL_IDENTITY_GLOBAL
Symbol identity is resolved by name across providers.
Definition link_index.h:104
@ LOOMC_LINK_SYMBOL_IDENTITY_PRIVATE
Symbol identity is scoped to one provider-local module.
Definition link_index.h:101
Opaque in-memory Loom modules.
struct loomc_module_t loomc_module_t
Opaque parsed, linked, optimized, or lowered module.
Definition module.h:90
Shared operation result container.
struct loomc_result_t loomc_result_t
Immutable operation result.
Definition result.h:71
struct loomc_source_t loomc_source_t
Immutable source handle.
Definition source.h:81
Host allocator used for persistent Loom object storage.
Definition base.h:414
Link-index builder creation options.
Definition link_index.h:169
const void * next
Extension chain for future builder options.
Definition link_index.h:178
loomc_host_size_t block_size
Total bytes acquired from the host allocator per persistent frozen-index block.
Definition link_index.h:182
loomc_structure_type_t type
Structure type.
Definition link_index.h:172
loomc_host_size_t structure_size
Size of this structure in bytes.
Definition link_index.h:175
Indexed module metadata.
Definition link_index.h:238
loomc_host_size_t symbol_start_ordinal
First symbol ordinal owned by this module.
Definition link_index.h:252
loomc_string_view_t name
Module name.
Definition link_index.h:249
loomc_host_size_t symbol_count
Number of symbols owned by this module.
Definition link_index.h:255
loomc_host_size_t provider_module_ordinal
Provider-local module ordinal.
Definition link_index.h:246
loomc_host_size_t provider_ordinal
Provider that owns this module.
Definition link_index.h:243
loomc_host_size_t ordinal
Index-wide module ordinal.
Definition link_index.h:240
Indexed provider metadata.
Definition link_index.h:213
loomc_host_size_t module_count
Number of modules owned by this provider.
Definition link_index.h:230
loomc_host_size_t ordinal
Index-wide provider ordinal.
Definition link_index.h:215
loomc_host_size_t module_start_ordinal
First module ordinal owned by this provider.
Definition link_index.h:227
loomc_string_view_t name
Provider label used for diagnostics.
Definition link_index.h:224
loomc_link_provider_role_t role
Provider linkage role.
Definition link_index.h:221
loomc_link_provider_kind_t kind
Source representation kind.
Definition link_index.h:218
Provider options used when adding sources or modules to a link index.
Definition link_index.h:199
loomc_link_provider_role_t role
Provider linkage role.
Definition link_index.h:204
loomc_string_view_t provider_name
Stable provider label for diagnostics and private-name determinism.
Definition link_index.h:201
Deterministic source slot reserved by a link-index builder.
Definition link_index.h:189
loomc_host_size_t ordinal
Deterministic provider slot ordinal reserved by the builder.
Definition link_index.h:191
Indexed symbol metadata.
Definition link_index.h:263
loomc_string_view_t name
Module-local symbol name without an @ sigil.
Definition link_index.h:280
loomc_host_size_t ordinal
Index-wide symbol ordinal.
Definition link_index.h:265
loomc_host_size_t provider_module_ordinal
Provider-local module ordinal.
Definition link_index.h:274
loomc_link_symbol_flags_t flags
Link-index symbol flags.
Definition link_index.h:289
loomc_link_symbol_identity_t identity
Link identity class.
Definition link_index.h:286
loomc_link_symbol_kind_t kind
Linker-facing symbol kind.
Definition link_index.h:283
loomc_host_size_t module_ordinal
Module that owns this symbol.
Definition link_index.h:271
loomc_host_size_t module_symbol_ordinal
Module-local symbol ordinal.
Definition link_index.h:277
loomc_host_size_t provider_ordinal
Provider that supplied this symbol.
Definition link_index.h:268
Non-owning string view over bytes that need not be NUL-terminated.
Definition base.h:63