Loom C API
Public Loom compiler C API
Loading...
Searching...
No Matches
program.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_TARGET_CMD_PROGRAM_H_
8#define LOOMC_TARGET_CMD_PROGRAM_H_
9
10#include "loomc/artifact.h"
11#include "loomc/config.h"
12#include "loomc/context.h"
13#include "loomc/link_index.h"
14#include "loomc/product.h"
15#include "loomc/result.h"
16#include "loomc/workspace.h"
17
58
59#ifdef __cplusplus
60extern "C" {
61#endif
62
64#define LOOMC_ARTIFACT_FORMAT_CMD_PROGRAM "loom-command"
65
67typedef enum loomc_cmd_program_product_flag_bits_e {
72
75
120
153
176
186
220 loomc_workspace_t* workspace,
222 loomc_allocator_t allocator, loomc_product_t** out_product,
223 loomc_result_t** out_result);
224
262 loomc_context_t* context, loomc_workspace_t* workspace,
263 const loomc_request_t* request,
265 loomc_allocator_t allocator, loomc_product_t** out_product,
266 loomc_result_t** out_result);
267
276
283
291 const loomc_product_t* product, loomc_host_size_t ordinal,
292 loomc_cmd_program_t* out_program);
293
300 const loomc_product_t* product);
301
309 const loomc_product_t* product, loomc_host_size_t ordinal,
310 loomc_cmd_entry_requirement_t* out_requirement);
311
312#ifdef __cplusplus
313} // extern "C"
314#endif
315
316#endif // LOOMC_TARGET_CMD_PROGRAM_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
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:47
Immutable compiler products and their recursively published requests.
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
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
loomc_status_t loomc_cmd_program_product_build(loomc_workspace_t *workspace, const loomc_cmd_program_product_options_t *options, loomc_allocator_t allocator, loomc_product_t **out_product, loomc_result_t **out_result)
Builds portable command programs and optional kernel source requests.
bool loomc_cmd_program_product_program_at(const loomc_product_t *product, loomc_host_size_t ordinal, loomc_cmd_program_t *out_program)
Returns serialized command-root metadata by product-local ordinal.
loomc_host_size_t loomc_cmd_program_product_program_count(const loomc_product_t *product)
Returns the number of serialized command roots in product.
loomc_status_t loomc_cmd_program_product_build_request(loomc_context_t *context, loomc_workspace_t *workspace, const loomc_request_t *request, const loomc_cmd_program_request_options_t *options, loomc_allocator_t allocator, loomc_product_t **out_product, loomc_result_t **out_result)
Builds portable command programs from an ordinary bytecode request.
uint32_t loomc_cmd_program_product_flags_t
Bitmask of loomc_cmd_program_product_flag_bits_t values.
Definition program.h:74
loomc_host_size_t loomc_cmd_program_product_entry_requirement_count(const loomc_product_t *product)
Returns the number of product-wide executable-entry requirements.
loomc_cmd_program_product_flag_bits_t
Command-product operation flag bits.
Definition program.h:67
@ LOOMC_CMD_PROGRAM_PRODUCT_FLAG_INCLUDE_INPUT_EXPORTS
Select exported command definitions from INPUT providers in addition to explicitly supplied roots.
Definition program.h:70
bool loomc_cmd_program_product_entry_requirement_at(const loomc_product_t *product, loomc_host_size_t ordinal, loomc_cmd_entry_requirement_t *out_requirement)
Returns an executable-entry requirement by product-local ordinal.
const loomc_product_descriptor_t * loomc_cmd_program_product_descriptor(void)
Returns the process-local command-product descriptor.
Shared operation result container.
struct loomc_result_t loomc_result_t
Immutable operation result.
Definition result.h:64
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
One product-wide executable-entry binding requirement.
Definition program.h:182
loomc_string_view_t symbol
Logical kernel entry symbol without a leading @.
Definition program.h:184
Command-product construction options.
Definition program.h:82
loomc_config_options_t config
Per-invocation config bindings applied during selective materialization.
Definition program.h:112
loomc_link_index_t * link_index
Frozen provider index containing command and kernel sources.
Definition program.h:95
loomc_cmd_program_product_flags_t flags
Product construction flags.
Definition program.h:109
loomc_host_size_t structure_size
Size of this structure in bytes.
Definition program.h:88
const loomc_host_size_t * root_symbol_ordinals
Index-wide symbol ordinals of explicit command roots.
Definition program.h:103
loomc_host_size_t root_symbol_count
Number of entries in root_symbol_ordinals.
Definition program.h:106
loomc_request_sink_t request_sink
Optional sink enabling source-backed request publication.
Definition program.h:118
loomc_structure_type_t type
Structure type.
Definition program.h:85
const void * next
Optional invocation extensions such as loomc_target_specialization_options_t.
Definition program.h:92
Command-product options for an ordinary bytecode request.
Definition program.h:128
loomc_structure_type_t type
Structure type.
Definition program.h:131
loomc_host_size_t structure_size
Size of this structure in bytes.
Definition program.h:134
loomc_request_sink_t request_sink
Optional sink enabling source-backed kernel request publication.
Definition program.h:151
const loomc_link_index_t * library_index
Optional frozen library-only index used to resolve request declarations.
Definition program.h:142
const void * next
Optional invocation extensions such as loomc_target_specialization_options_t.
Definition program.h:138
loomc_config_options_t config
Per-invocation config bindings applied during selective materialization.
Definition program.h:145
One serialized command root and its executable-entry projection.
Definition program.h:159
const loomc_requirement_ordinal_t * entry_requirement_ordinals
Product-local entry requirement ordinals in root-local slot order.
Definition program.h:171
loomc_host_size_t entry_requirement_count
Number of entries in entry_requirement_ordinals.
Definition program.h:174
loomc_artifact_t artifact
Portable command-program artifact.
Definition program.h:168
loomc_string_view_t symbol
Root symbol without a leading @.
Definition program.h:161
Text configuration options attached to a link or command-product operation.
Definition config.h:77
Optional destination for streamed product requests.
Definition product.h:223
Non-owning string view over bytes that need not be NUL-terminated.
Definition base.h:63
Per-worker scratch workspace.
struct loomc_workspace_t loomc_workspace_t
Mutable per-worker scratch workspace.
Definition workspace.h:54