7#ifndef LOOMC_PASS_TRACE_H_
8#define LOOMC_PASS_TRACE_H_
25typedef enum loomc_pass_trace_format_e {
34typedef enum loomc_pass_trace_flag_bits_e {
63typedef enum loomc_pass_trace_point_e {
Base types, descriptors, spans, and host allocation helpers.
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
loomc_pass_trace_flag_bits_t
Pass trace selection bits.
Definition pass_trace.h:34
@ LOOMC_PASS_TRACE_FLAG_BEFORE_ALL
Trace the IR immediately before every pass invocation.
Definition pass_trace.h:36
@ LOOMC_PASS_TRACE_FLAG_AFTER_ALL
Trace the IR immediately after every pass invocation.
Definition pass_trace.h:39
loomc_status_t(* loomc_pass_trace_write_fn_t)(void *user_data, loomc_string_view_t fragment)
Writes one ordered trace fragment.
Definition pass_trace.h:50
loomc_pass_trace_point_t
Pass trace boundary point.
Definition pass_trace.h:63
@ LOOMC_PASS_TRACE_POINT_AFTER
Snapshot immediately after the selected pass invocation.
Definition pass_trace.h:68
@ LOOMC_PASS_TRACE_POINT_BEFORE
Snapshot immediately before the selected pass invocation.
Definition pass_trace.h:65
loomc_pass_trace_format_t
Formatted pass trace representation.
Definition pass_trace.h:25
@ LOOMC_PASS_TRACE_FORMAT_JSONL
One JSON object per event with JSON-escaped textual Loom IR.
Definition pass_trace.h:30
@ LOOMC_PASS_TRACE_FORMAT_TEXT
Human-readable event metadata followed by textual Loom IR.
Definition pass_trace.h:27
loomc_status_t(* loomc_pass_trace_artifact_close_fn_t)(void *user_data, loomc_pass_trace_artifact_t *artifact)
Closes one destination successfully returned from open.
Definition pass_trace.h:110
loomc_status_t(* loomc_pass_trace_artifact_open_fn_t)(void *user_data, const loomc_pass_trace_event_t *event, loomc_pass_trace_artifact_t *out_artifact)
Opens one destination for a selected trace event.
Definition pass_trace.h:101
uint32_t loomc_pass_trace_flags_t
Bitmask of loomc_pass_trace_flag_bits_t.
Definition pass_trace.h:43
Optional per-event artifact destination callbacks.
Definition pass_trace.h:114
void * user_data
Opaque value passed to open and close.
Definition pass_trace.h:122
loomc_pass_trace_artifact_close_fn_t close
Function closing one successfully opened event artifact.
Definition pass_trace.h:119
loomc_pass_trace_artifact_open_fn_t open
Function opening one selected event artifact.
Definition pass_trace.h:116
Caller-owned destination for one per-event trace artifact.
Definition pass_trace.h:84
loomc_string_view_t reference
Non-empty reference written into the sequential trace event.
Definition pass_trace.h:89
loomc_pass_trace_sink_t sink
Destination receiving this event's textual IR snapshot.
Definition pass_trace.h:92
Stable metadata available when opening one per-event artifact.
Definition pass_trace.h:72
loomc_host_size_t event_ordinal
Zero-based ordinal among events emitted by this compile invocation.
Definition pass_trace.h:74
loomc_pass_trace_point_t point
Boundary represented by this event.
Definition pass_trace.h:77
loomc_string_view_t pass_key
Stable key of the pass invoked at this boundary.
Definition pass_trace.h:80
Pass trace options for one pipeline or compile invocation.
Definition pass_trace.h:137
const loomc_string_view_t * after_filters
Pass keys, pipeline symbols, or stage names traced after invocation.
Definition pass_trace.h:173
loomc_host_size_t after_filter_count
Number of entries in after_filters.
Definition pass_trace.h:176
const void * next
Next invocation option extension.
Definition pass_trace.h:145
loomc_host_size_t structure_size
Size of this structure in bytes.
Definition pass_trace.h:142
loomc_string_view_t input_identifier
Input identity included in event metadata.
Definition pass_trace.h:159
loomc_pass_trace_flags_t flags
Boundary selection flags.
Definition pass_trace.h:151
loomc_pass_trace_sink_t sink
Destination receiving the complete formatted trace in order.
Definition pass_trace.h:179
loomc_string_view_t tool_name
Tool identity included in event metadata.
Definition pass_trace.h:155
const loomc_string_view_t * before_filters
Pass keys, pipeline symbols, or stage names traced before invocation.
Definition pass_trace.h:167
loomc_host_size_t before_filter_count
Number of entries in before_filters.
Definition pass_trace.h:170
loomc_pass_trace_format_t format
Formatted representation written to sink.
Definition pass_trace.h:148
loomc_pass_trace_artifact_sink_t artifact_sink
Optional destinations for per-event textual IR snapshots.
Definition pass_trace.h:187
loomc_structure_type_t type
Structure type. Must be LOOMC_STRUCTURE_TYPE_PASS_TRACE_OPTIONS.
Definition pass_trace.h:139
Borrowed destination for one sequential pass trace.
Definition pass_trace.h:54
loomc_pass_trace_write_fn_t write
Function invoked for each ordered trace fragment.
Definition pass_trace.h:56
void * user_data
Opaque value passed to write.
Definition pass_trace.h:59
Non-owning string view over bytes that need not be NUL-terminated.
Definition base.h:63