Loom C API
Public Loom compiler C API
Loading...
Searching...
No Matches
cxx.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_IMPORT_CXX_H_
8#define LOOMC_IMPORT_CXX_H_
9
10#include "loomc/module.h"
11
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
36
41typedef enum loomc_cxx_fp_model_e {
47
49typedef enum loomc_cxx_import_flag_bits_e {
53
54typedef uint32_t loomc_cxx_import_flags_t;
55
78 void* user_data, loomc_string_view_t path, loomc_source_t** out_source);
79
87
107 void* user_data, loomc_string_view_t path,
108 loomc_string_view_t* out_identifier);
109
117
125
133
181
214 loomc_context_t* context, const loomc_source_t* source,
215 const loomc_cxx_import_options_t* options, loomc_allocator_t allocator,
216 loomc_cxx_preamble_t** out_preamble, loomc_result_t** out_result);
217
224
231 loomc_cxx_preamble_t* preamble);
232
259 loomc_context_t* context, loomc_workspace_t* workspace,
260 const loomc_source_t* source, const loomc_cxx_import_options_t* options,
261 loomc_allocator_t allocator, loomc_module_t** out_module,
262 loomc_result_t** out_result);
263
264#ifdef __cplusplus
265} // extern "C"
266#endif
267
268#endif // LOOMC_IMPORT_CXX_H_
#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
#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
struct loomc_context_t loomc_context_t
Immutable Loom API context.
Definition context.h:63
void loomc_cxx_preamble_retain(loomc_cxx_preamble_t *preamble)
Retains preamble for another owner.
void loomc_cxx_preamble_release(loomc_cxx_preamble_t *preamble)
Releases preamble from one owner.
loomc_status_t loomc_cxx_preamble_create(loomc_context_t *context, const loomc_source_t *source, const loomc_cxx_import_options_t *options, loomc_allocator_t allocator, loomc_cxx_preamble_t **out_preamble, loomc_result_t **out_result)
Creates an immutable semantic preamble from leading include directives.
loomc_status_t(* loomc_cxx_source_provider_fn_t)(void *user_data, loomc_string_view_t path, loomc_source_t **out_source)
Resolves a candidate include path to immutable source bytes.
Definition cxx.h:77
loomc_status_t loomc_module_import_cxx(loomc_context_t *context, loomc_workspace_t *workspace, const loomc_source_t *source, const loomc_cxx_import_options_t *options, loomc_allocator_t allocator, loomc_module_t **out_module, loomc_result_t **out_result)
Imports C/C++ source into a verified High IR module, without cleanup passes.
struct loomc_cxx_preamble_t loomc_cxx_preamble_t
Immutable process-local C/C++ semantic preamble.
Definition cxx.h:132
loomc_cxx_import_flag_bits_t
Include delivery policy.
Definition cxx.h:49
@ LOOMC_CXX_IMPORT_FLAG_NO_BUILTIN_INCLUDES
Omit the embedded system include root; use caller paths/providers only.
Definition cxx.h:51
uint32_t loomc_cxx_import_flags_t
Bitmask of loomc_cxx_import_flag_bits_t values.
Definition cxx.h:54
loomc_cxx_data_model_t
Source integer and pointer layout, independent of the importing process.
Definition cxx.h:28
@ LOOMC_CXX_DATA_MODEL_LP64
32-bit int; 64-bit long and pointers.
Definition cxx.h:30
@ LOOMC_CXX_DATA_MODEL_ILP32
32-bit int, long, and pointers.
Definition cxx.h:34
@ LOOMC_CXX_DATA_MODEL_LLP64
32-bit int and long; 64-bit pointers.
Definition cxx.h:32
loomc_cxx_fp_model_t
Translation-unit floating-point transformation policy.
Definition cxx.h:41
@ LOOMC_CXX_FP_MODEL_FAST
Permit the complete Loom fast-math contract.
Definition cxx.h:45
@ LOOMC_CXX_FP_MODEL_PRECISE
Preserve floating-point value and evaluation-order semantics.
Definition cxx.h:43
loomc_status_t(* loomc_cxx_source_path_mapper_fn_t)(void *user_data, loomc_string_view_t path, loomc_string_view_t *out_identifier)
Maps a physical frontend path to the logical source identifier retained in diagnostics and imported m...
Definition cxx.h:106
Opaque in-memory Loom modules.
struct loomc_module_t loomc_module_t
Opaque parsed, linked, optimized, or lowered module.
Definition module.h:90
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
Preprocessor definition applied after the frontend's predefined macros.
Definition cxx.h:119
loomc_string_view_t value
Replacement token text; empty defines an empty macro.
Definition cxx.h:123
loomc_string_view_t name
Macro name, including parameters for a function-like macro.
Definition cxx.h:121
Configuration for one source translation unit.
Definition cxx.h:139
loomc_cxx_import_flags_t flags
Include delivery flags.
Definition cxx.h:155
loomc_host_size_t structure_size
Size of this structure in bytes, or zero.
Definition cxx.h:143
loomc_cxx_fp_model_t fp_model
Default floating-point transformation policy.
Definition cxx.h:153
loomc_host_size_t include_path_count
Number of user include directories.
Definition cxx.h:163
loomc_cxx_source_provider_t source_provider
Optional include provider; embedded headers are resolved separately.
Definition cxx.h:157
loomc_host_size_t root_count
Number of explicitly selected roots.
Definition cxx.h:176
const loomc_string_view_t * include_paths
User include directories, searched after quoted local includes.
Definition cxx.h:161
const loomc_cxx_define_t * defines
Ordered macro definitions.
Definition cxx.h:169
const loomc_string_view_t * system_include_paths
System include directories, searched before the embedded system root.
Definition cxx.h:165
loomc_cxx_source_path_mapper_t source_path_mapper
Optional mapping from physical paths to retained logical identities.
Definition cxx.h:159
loomc_string_view_t triple
Source ABI triple, independent of output target selection.
Definition cxx.h:149
loomc_host_size_t define_count
Number of macro definitions.
Definition cxx.h:171
loomc_string_view_t standard
Frontend standard spelling, such as c23 or c++26. Empty selects c++26.
Definition cxx.h:147
const loomc_cxx_preamble_t * preamble
Optional immutable preamble borrowed until import returns.
Definition cxx.h:179
loomc_host_size_t system_include_path_count
Number of system include directories.
Definition cxx.h:167
const loomc_string_view_t * roots
Qualified source function names to export.
Definition cxx.h:174
const void * next
Reserved extension chain. Must be NULL.
Definition cxx.h:145
loomc_structure_type_t type
Structure type; LOOMC_STRUCTURE_TYPE_CXX_IMPORT_OPTIONS when nonzero.
Definition cxx.h:141
loomc_cxx_data_model_t data_model
Source integer and pointer layout.
Definition cxx.h:151
Optional logical-identity mapper for retained frontend source paths.
Definition cxx.h:111
loomc_cxx_source_path_mapper_fn_t fn
Callback, or NULL to retain physical frontend paths unchanged.
Definition cxx.h:113
void * user_data
Caller-owned state borrowed until import returns.
Definition cxx.h:115
Optional source provider replacing filesystem include reads.
Definition cxx.h:81
void * user_data
Caller-owned state borrowed until import returns.
Definition cxx.h:85
loomc_cxx_source_provider_fn_t fn
Callback, or NULL to read ordinary filesystem paths.
Definition cxx.h:83
Non-owning string view over bytes that need not be NUL-terminated.
Definition base.h:63
struct loomc_workspace_t loomc_workspace_t
Mutable per-worker scratch workspace.
Definition workspace.h:54