Loom C API
Public Loom compiler C API
Loading...
Searching...
No Matches
product.h
Go to the documentation of this file.
1// Copyright 2026 The IREE Authors
2//
3// Licensed under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
7#ifndef LOOMC_PRODUCT_H_
8#define LOOMC_PRODUCT_H_
9
10#include "loomc/artifact.h"
11#include "loomc/source.h"
12
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
52
67
72
77
83 const loomc_product_t* product);
84
91
102 const loomc_product_t* product, loomc_host_size_t ordinal);
103
113
124
127
129#define LOOMC_REQUIREMENT_ORDINAL_INVALID UINT32_MAX
130
133
135#define LOOMC_REQUEST_ROOT_ORDINAL_INVALID UINT32_MAX
136
148
161
168
197 const loomc_product_descriptor_t* product_descriptor,
198 loomc_source_t* source, const loomc_request_root_t* roots,
199 loomc_host_size_t root_count, const loomc_request_binding_t* bindings,
200 loomc_host_size_t binding_count, loomc_allocator_t allocator,
201 loomc_request_t** out_request);
202
220 void* user_data, loomc_request_t* request);
221
230
235
240
252
262 const loomc_request_t* request);
263
270
278 const loomc_request_t* request, loomc_request_root_ordinal_t ordinal,
279 loomc_request_root_t* out_root);
280
287
295 const loomc_request_t* request, loomc_host_size_t ordinal,
296 loomc_request_binding_t* out_binding);
297
298#ifdef __cplusplus
299} // extern "C"
300#endif
301
302#endif // LOOMC_PRODUCT_H_
In-memory output artifacts produced by compiler operations.
#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
#define LOOMC_API_PTR
Marks a public callback function pointer type.
Definition base.h:38
struct iree_status_handle_t * loomc_status_t
Opaque status handle.
Definition base.h:55
loomc_status_t loomc_request_create(const loomc_product_descriptor_t *product_descriptor, loomc_source_t *source, const loomc_request_root_t *roots, loomc_host_size_t root_count, const loomc_request_binding_t *bindings, loomc_host_size_t binding_count, loomc_allocator_t allocator, loomc_request_t **out_request)
Creates an immutable request over ordinary Loom bytecode.
loomc_host_size_t loomc_request_root_count(const loomc_request_t *request)
Returns the number of canonical roots in request.
struct loomc_product_t loomc_product_t
Immutable successful compiler product.
Definition product.h:66
uint32_t loomc_requirement_ordinal_t
Parent-product-local requirement ordinal.
Definition product.h:126
loomc_source_t * loomc_request_source(const loomc_request_t *request)
Returns the immutable bytecode source owned by request.
loomc_host_size_t loomc_product_export_count(const loomc_product_t *product)
Returns the number of roots exported by product.
bool loomc_request_binding_at(const loomc_request_t *request, loomc_host_size_t ordinal, loomc_request_binding_t *out_binding)
Returns a provisional parent binding by ordinal.
loomc_host_size_t loomc_product_artifact_count(const loomc_product_t *product)
Returns the number of artifacts owned by product.
loomc_status_t(* loomc_request_publish_fn_t)(void *user_data, loomc_request_t *request)
Accepts ownership of one published request at callback entry.
Definition product.h:219
loomc_host_size_t loomc_product_requirement_count(const loomc_product_t *product)
Returns the number of unresolved requirements in product.
void loomc_product_release(loomc_product_t *product)
Releases a product.
void loomc_product_retain(loomc_product_t *product)
Retains a product for another owner.
bool loomc_request_root_at(const loomc_request_t *request, loomc_request_root_ordinal_t ordinal, loomc_request_root_t *out_root)
Returns a request root by request-local ordinal.
const loomc_artifact_t * loomc_product_artifact_at(const loomc_product_t *product, loomc_host_size_t ordinal)
Returns an artifact by product-local ordinal.
uint32_t loomc_request_root_ordinal_t
Request-local root ordinal.
Definition product.h:132
void loomc_request_retain(loomc_request_t *request)
Retains a request for another owner.
struct loomc_request_t loomc_request_t
Immutable independently compilable product request.
Definition product.h:167
struct loomc_product_descriptor_t loomc_product_descriptor_t
Opaque process-local identity for one product representation.
Definition product.h:51
const loomc_product_descriptor_t * loomc_request_product_descriptor(const loomc_request_t *request)
Returns the required product representation for request.
loomc_host_size_t loomc_request_binding_count(const loomc_request_t *request)
Returns the number of provisional parent bindings in request.
const loomc_product_descriptor_t * loomc_product_descriptor(const loomc_product_t *product)
Returns the process-local descriptor identifying product.
void loomc_request_release(loomc_request_t *request)
Releases a request.
Immutable source handles used by parsing, indexing, linking, and compiling.
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:390
Borrowed artifact view owned by a producer-specific result or product.
Definition artifact.h:78
Provisional association between a parent requirement and a request root.
Definition product.h:154
loomc_requirement_ordinal_t requirement_ordinal
Requirement ordinal in the parent product.
Definition product.h:156
loomc_request_root_ordinal_t root_ordinal
Root ordinal in the request.
Definition product.h:159
Durable address of one root in a request's bytecode source.
Definition product.h:141
uint32_t symbol_ordinal
Bytecode SYMBOLS ordinal naming the root.
Definition product.h:146
uint32_t module_ordinal
Bytecode module ordinal containing the root.
Definition product.h:143
Optional destination for streamed product requests.
Definition product.h:223
loomc_request_publish_fn_t publish
Callback accepting ownership of each published request.
Definition product.h:225
void * user_data
Opaque value passed to publish.
Definition product.h:228