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/byte_sequence.h"
13#include "loomc/source.h"
14
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
45#define LOOMC_ARTIFACT_FORMAT_LOOM_TEXT "loom-text"
46
48#define LOOMC_ARTIFACT_FORMAT_LOOM_BYTECODE "loombc"
49
51#define LOOMC_ARTIFACT_FORMAT_JSON "json"
52
70
93
109 const loomc_artifact_t* artifact, loomc_source_format_t format,
110 loomc_allocator_t allocator, loomc_source_t** out_source);
111
124
133 const loomc_artifact_t* artifact, loomc_string_view_t path,
134 loomc_allocator_t allocator);
135
136#ifdef __cplusplus
137} // extern "C"
138#endif
139
140#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:54
@ LOOMC_ARTIFACT_KIND_REPORT
Machine-readable report artifact.
Definition artifact.h:62
@ LOOMC_ARTIFACT_KIND_LAUNCH_CONFIG
Compiled kernel launch-configuration program.
Definition artifact.h:68
@ LOOMC_ARTIFACT_KIND_EXECUTABLE
Executable or loadable binary artifact.
Definition artifact.h:56
@ LOOMC_ARTIFACT_KIND_TEXT
Human-readable textual artifact.
Definition artifact.h:59
@ LOOMC_ARTIFACT_KIND_MODULE
Loom module artifact. The format indicates text or bytecode.
Definition artifact.h:65
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
struct iree_status_handle_t * loomc_status_t
Opaque status handle.
Definition base.h:55
Immutable ref-counted byte sequences.
struct loomc_byte_sequence_t loomc_byte_sequence_t
Immutable logical sequence of bytes stored in one or more segments.
Definition byte_sequence.h:28
Immutable source handles used by parsing, indexing, linking, and compiling.
struct loomc_source_t loomc_source_t
Immutable source handle.
Definition source.h:81
loomc_source_format_t
Source byte format.
Definition source.h:84
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
loomc_string_view_t format
Stable format string, such as amdgpu-hsaco, spirv, LOOMC_ARTIFACT_FORMAT_LOOM_TEXT,...
Definition artifact.h:84
loomc_artifact_kind_t kind
Artifact kind.
Definition artifact.h:80
loomc_byte_sequence_t * contents
Immutable artifact bytes.
Definition artifact.h:91
loomc_string_view_t identifier
Human-readable artifact identifier.
Definition artifact.h:87
Non-owning string view over bytes that need not be NUL-terminated.
Definition base.h:63