Loom C API
Public Loom compiler C API
Loading...
Searching...
No Matches
artifact.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_ARTIFACT_H_
8#define LOOMC_ARTIFACT_H_
9
10#include <stdio.h>
11
12#include "loomc/source.h"
13
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
44#define LOOMC_ARTIFACT_FORMAT_LOOM_TEXT "loom-text"
45
47#define LOOMC_ARTIFACT_FORMAT_LOOM_BYTECODE "loombc"
48
50#define LOOMC_ARTIFACT_FORMAT_JSON "json"
51
69
89
98 void* user_data, loomc_byte_span_t contents);
99
114 const loomc_artifact_t* artifact, loomc_source_format_t format,
115 loomc_allocator_t allocator, loomc_source_t** out_source);
116
127
136 const loomc_artifact_t* artifact, loomc_string_view_t path,
137 loomc_allocator_t allocator);
138
139#ifdef __cplusplus
140} // extern "C"
141#endif
142
143#endif // LOOMC_ARTIFACT_H_
loomc_status_t loomc_artifact_write_to_file(const loomc_artifact_t *artifact, FILE *file)
Writes artifact bytes to an open C FILE*.
loomc_status_t loomc_artifact_create_source(const loomc_artifact_t *artifact, loomc_source_format_t format, loomc_allocator_t allocator, loomc_source_t **out_source)
Creates an immutable source handle from an artifact.
loomc_artifact_kind_t
Artifact category.
Definition artifact.h:53
@ LOOMC_ARTIFACT_KIND_REPORT
Machine-readable report artifact.
Definition artifact.h:61
@ LOOMC_ARTIFACT_KIND_LAUNCH_CONFIG
Compiled kernel launch-configuration program.
Definition artifact.h:67
@ LOOMC_ARTIFACT_KIND_EXECUTABLE
Executable or loadable binary artifact.
Definition artifact.h:55
@ LOOMC_ARTIFACT_KIND_TEXT
Human-readable textual artifact.
Definition artifact.h:58
@ LOOMC_ARTIFACT_KIND_MODULE
Loom module artifact. The format indicates text or bytecode.
Definition artifact.h:64
void(* loomc_artifact_release_fn_t)(void *user_data, loomc_byte_span_t contents)
Callback used to release artifact contents transferred to a consumer.
Definition artifact.h:97
loomc_status_t loomc_artifact_write_to_path(const loomc_artifact_t *artifact, loomc_string_view_t path, loomc_allocator_t allocator)
Writes artifact bytes to a filesystem path.
#define LOOMC_API_EXPORT
Exports a public Loom C API symbol from a shared library build.
Definition base.h:34
#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
Immutable source handles used by parsing, indexing, linking, and compiling.
struct loomc_source_t loomc_source_t
Immutable source handle.
Definition source.h:80
loomc_source_format_t
Source byte format.
Definition source.h:83
Host allocator used for persistent Loom object storage.
Definition base.h:375
Borrowed artifact view owned by a result object.
Definition artifact.h:75
loomc_string_view_t format
Stable format string, such as vmfb, spirv, LOOMC_ARTIFACT_FORMAT_LOOM_TEXT, or LOOMC_ARTIFACT_FORMAT_...
Definition artifact.h:81
loomc_artifact_kind_t kind
Artifact kind.
Definition artifact.h:77
loomc_byte_span_t contents
Artifact bytes.
Definition artifact.h:87
loomc_string_view_t identifier
Human-readable artifact identifier.
Definition artifact.h:84
Non-owning view over immutable bytes.
Definition base.h:128
Non-owning string view over bytes that need not be NUL-terminated.
Definition base.h:63