Files
ziran/bootstrap/compiler_services/compiler_services.c
T
waozi 42da58fef1 Remove the unused Ziran ZIR codec and its service helpers
cmd/compiler_serial.zi was built, imported and tested by nothing. The
saved-IR helpers only it used leave cmd/compiler_services.zi and
cmd/zir/zir_services.c, and the stale copy of the services module in
cmd/law-isolate goes too.
2026-11-14 13:00:53 -03:00

303 lines
12 KiB
C

/* Generated by zi2c from compiler_services.zi. */
#include <stdbool.h>
#include "zir_string_types.h"
#include "compiler_services.h"
#ifndef ZIR_FOREIGN_zir_f_91ae99e11753ff79_ZiranDiagnose_d22cf724
#define ZIR_FOREIGN_zir_f_91ae99e11753ff79_ZiranDiagnose_d22cf724
#ifdef __APPLE__
void zir_foreign_zir_f_91ae99e11753ff79_ZiranDiagnose(ZirSourceSpan span, String code, String message) __asm__("_ZiranDiagnose");
#else
void zir_foreign_zir_f_91ae99e11753ff79_ZiranDiagnose(ZirSourceSpan span, String code, String message) __asm__("ZiranDiagnose");
#endif
static void
zir_f_91ae99e11753ff79_ZiranDiagnose(ZirSourceSpan span, String code, String message)
{
zir_foreign_zir_f_91ae99e11753ff79_ZiranDiagnose(span, code, message);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_91ae99e11753ff79_ZiranKeepText_39f1f642
#define ZIR_FOREIGN_zir_f_91ae99e11753ff79_ZiranKeepText_39f1f642
#ifdef __APPLE__
uint8_t* zir_foreign_zir_f_91ae99e11753ff79_ZiranKeepText(String text) __asm__("_ZiranKeepText");
#else
uint8_t* zir_foreign_zir_f_91ae99e11753ff79_ZiranKeepText(String text) __asm__("ZiranKeepText");
#endif
static uint8_t*
zir_f_91ae99e11753ff79_ZiranKeepText(String text)
{
return zir_foreign_zir_f_91ae99e11753ff79_ZiranKeepText(text);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_91ae99e11753ff79_ZiranKeepName_498718b6
#define ZIR_FOREIGN_zir_f_91ae99e11753ff79_ZiranKeepName_498718b6
#ifdef __APPLE__
uint8_t* zir_foreign_zir_f_91ae99e11753ff79_ZiranKeepName(String text) __asm__("_ZiranKeepName");
#else
uint8_t* zir_foreign_zir_f_91ae99e11753ff79_ZiranKeepName(String text) __asm__("ZiranKeepName");
#endif
static uint8_t*
zir_f_91ae99e11753ff79_ZiranKeepName(String text)
{
return zir_foreign_zir_f_91ae99e11753ff79_ZiranKeepName(text);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_91ae99e11753ff79_ZiranKeepParameters_650a7a53
#define ZIR_FOREIGN_zir_f_91ae99e11753ff79_ZiranKeepParameters_650a7a53
#ifdef __APPLE__
uint8_t* zir_foreign_zir_f_91ae99e11753ff79_ZiranKeepParameters(String text) __asm__("_ZiranKeepParameters");
#else
uint8_t* zir_foreign_zir_f_91ae99e11753ff79_ZiranKeepParameters(String text) __asm__("ZiranKeepParameters");
#endif
static uint8_t*
zir_f_91ae99e11753ff79_ZiranKeepParameters(String text)
{
return zir_foreign_zir_f_91ae99e11753ff79_ZiranKeepParameters(text);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_91ae99e11753ff79_CSpanPath_57316ae8
#define ZIR_FOREIGN_zir_f_91ae99e11753ff79_CSpanPath_57316ae8
#ifdef __APPLE__
uint8_t* zir_foreign_zir_f_91ae99e11753ff79_CSpanPath(ZirSourceSpan span) __asm__("_SpanPath");
#else
uint8_t* zir_foreign_zir_f_91ae99e11753ff79_CSpanPath(ZirSourceSpan span) __asm__("SpanPath");
#endif
static uint8_t*
zir_f_91ae99e11753ff79_CSpanPath(ZirSourceSpan span)
{
return zir_foreign_zir_f_91ae99e11753ff79_CSpanPath(span);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_91ae99e11753ff79_SymbolLookupsChanged_245f8ffc
#define ZIR_FOREIGN_zir_f_91ae99e11753ff79_SymbolLookupsChanged_245f8ffc
#ifdef __APPLE__
void zir_foreign_zir_f_91ae99e11753ff79_SymbolLookupsChanged(void) __asm__("_SymbolLookupsChanged");
#else
void zir_foreign_zir_f_91ae99e11753ff79_SymbolLookupsChanged(void) __asm__("SymbolLookupsChanged");
#endif
static void
zir_f_91ae99e11753ff79_SymbolLookupsChanged(void)
{
zir_foreign_zir_f_91ae99e11753ff79_SymbolLookupsChanged();
}
#endif
#ifndef ZIR_FOREIGN_zir_f_91ae99e11753ff79_ResolveFunctionAt_94470485
#define ZIR_FOREIGN_zir_f_91ae99e11753ff79_ResolveFunctionAt_94470485
#ifdef __APPLE__
int32_t zir_foreign_zir_f_91ae99e11753ff79_ResolveFunctionAt(ZirModule* module, uint8_t* name, uint8_t* path, ZirModule** owner, ZirFunction** function) __asm__("_ResolveFunctionAt");
#else
int32_t zir_foreign_zir_f_91ae99e11753ff79_ResolveFunctionAt(ZirModule* module, uint8_t* name, uint8_t* path, ZirModule** owner, ZirFunction** function) __asm__("ResolveFunctionAt");
#endif
static int32_t
zir_f_91ae99e11753ff79_ResolveFunctionAt(ZirModule* module, uint8_t* name, uint8_t* path, ZirModule** owner, ZirFunction** function)
{
return zir_foreign_zir_f_91ae99e11753ff79_ResolveFunctionAt(module, name, path, owner,
function);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_91ae99e11753ff79_CMapPrimitiveName_22c75838
#define ZIR_FOREIGN_zir_f_91ae99e11753ff79_CMapPrimitiveName_22c75838
#ifdef __APPLE__
int32_t zir_foreign_zir_f_91ae99e11753ff79_CMapPrimitiveName(uint8_t* name) __asm__("_MapPrimitiveName");
#else
int32_t zir_foreign_zir_f_91ae99e11753ff79_CMapPrimitiveName(uint8_t* name) __asm__("MapPrimitiveName");
#endif
static int32_t
zir_f_91ae99e11753ff79_CMapPrimitiveName(uint8_t* name)
{
return zir_foreign_zir_f_91ae99e11753ff79_CMapPrimitiveName(name);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_91ae99e11753ff79_ZiranAddImport_bdeca351
#define ZIR_FOREIGN_zir_f_91ae99e11753ff79_ZiranAddImport_bdeca351
#ifdef __APPLE__
ZirImport* zir_foreign_zir_f_91ae99e11753ff79_ZiranAddImport(ZirModule* module, ZirImportKind kind, String name, String target, String signature, ZirSourceSpan span) __asm__("_ZiranAddImport");
#else
ZirImport* zir_foreign_zir_f_91ae99e11753ff79_ZiranAddImport(ZirModule* module, ZirImportKind kind, String name, String target, String signature, ZirSourceSpan span) __asm__("ZiranAddImport");
#endif
static ZirImport*
zir_f_91ae99e11753ff79_ZiranAddImport(ZirModule* module, ZirImportKind kind, String name, String target, String signature, ZirSourceSpan span)
{
return zir_foreign_zir_f_91ae99e11753ff79_ZiranAddImport(module, kind, name, target,
signature, span);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_91ae99e11753ff79_FunctionAddExpr_77906f85
#define ZIR_FOREIGN_zir_f_91ae99e11753ff79_FunctionAddExpr_77906f85
#ifdef __APPLE__
ZirExpr* zir_foreign_zir_f_91ae99e11753ff79_FunctionAddExpr(ZirFunction* fn, ZirExprKind kind, uint8_t* text, ZirSourceSpan span) __asm__("_FunctionAddExpr");
#else
ZirExpr* zir_foreign_zir_f_91ae99e11753ff79_FunctionAddExpr(ZirFunction* fn, ZirExprKind kind, uint8_t* text, ZirSourceSpan span) __asm__("FunctionAddExpr");
#endif
static ZirExpr*
zir_f_91ae99e11753ff79_FunctionAddExpr(ZirFunction* fn, ZirExprKind kind, uint8_t* text, ZirSourceSpan span)
{
return zir_foreign_zir_f_91ae99e11753ff79_FunctionAddExpr(fn, kind, text,
span);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_91ae99e11753ff79_CFindType_2a8e44a3
#define ZIR_FOREIGN_zir_f_91ae99e11753ff79_CFindType_2a8e44a3
#ifdef __APPLE__
ZirType* zir_foreign_zir_f_91ae99e11753ff79_CFindType(ZirModule* module, uint8_t* name, ZirModule** owner) __asm__("_FindType");
#else
ZirType* zir_foreign_zir_f_91ae99e11753ff79_CFindType(ZirModule* module, uint8_t* name, ZirModule** owner) __asm__("FindType");
#endif
static ZirType*
zir_f_91ae99e11753ff79_CFindType(ZirModule* module, uint8_t* name, ZirModule** owner)
{
return zir_foreign_zir_f_91ae99e11753ff79_CFindType(module, name, owner);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_91ae99e11753ff79_TypeNextField_37a0826c
#define ZIR_FOREIGN_zir_f_91ae99e11753ff79_TypeNextField_37a0826c
#ifdef __APPLE__
int32_t zir_foreign_zir_f_91ae99e11753ff79_TypeNextField(ZirType* record, size_t* offset, ZirTypeField* field) __asm__("_TypeNextField");
#else
int32_t zir_foreign_zir_f_91ae99e11753ff79_TypeNextField(ZirType* record, size_t* offset, ZirTypeField* field) __asm__("TypeNextField");
#endif
static int32_t
zir_f_91ae99e11753ff79_TypeNextField(ZirType* record, size_t* offset, ZirTypeField* field)
{
return zir_foreign_zir_f_91ae99e11753ff79_TypeNextField(record, offset, field);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_91ae99e11753ff79_exit_1120afe9
#define ZIR_FOREIGN_zir_f_91ae99e11753ff79_exit_1120afe9
#ifdef __APPLE__
void zir_foreign_zir_f_91ae99e11753ff79_exit(int32_t status) __asm__("_exit");
#else
void zir_foreign_zir_f_91ae99e11753ff79_exit(int32_t status) __asm__("exit");
#endif
static void
zir_f_91ae99e11753ff79_exit(int32_t status)
{
zir_foreign_zir_f_91ae99e11753ff79_exit(status);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_91ae99e11753ff79_ExpandDefaultArguments_fb474e95
#define ZIR_FOREIGN_zir_f_91ae99e11753ff79_ExpandDefaultArguments_fb474e95
#ifdef __APPLE__
bool zir_foreign_zir_f_91ae99e11753ff79_ExpandDefaultArguments(ZirFunction* fn, ZirModule* module, ZirSourceSpan span, int32_t stmt_index, int32_t callee, int32_t* first, int32_t* last) __asm__("_ExpandDefaultArguments");
#else
bool zir_foreign_zir_f_91ae99e11753ff79_ExpandDefaultArguments(ZirFunction* fn, ZirModule* module, ZirSourceSpan span, int32_t stmt_index, int32_t callee, int32_t* first, int32_t* last) __asm__("ExpandDefaultArguments");
#endif
static bool
zir_f_91ae99e11753ff79_ExpandDefaultArguments(ZirFunction* fn, ZirModule* module, ZirSourceSpan span, int32_t stmt_index, int32_t callee, int32_t* first, int32_t* last)
{
return zir_foreign_zir_f_91ae99e11753ff79_ExpandDefaultArguments(fn, module, span,
stmt_index, callee, first, last);
}
#endif
void
compiler_services_Diagnose__overload_1(ZirSourceSpan span, String code, String message)
{
zir_f_91ae99e11753ff79_ZiranDiagnose(span, code, message);
}
void
compiler_services_Diagnose__overload_2(ZirSourceSpan span, String code, String message, String subject, String tail)
{
uint8_t text[4096] = {0};
int64_t at = 0LL;
String parts[3] = {message, subject, tail};
for (int64_t i = 0LL; i <= 2LL; i++) {
if (at < 4095LL) {
Slice value_0 = {text, 4096};
compiler_ir_CopyText(SliceRange(value_0, (int64_t)at, (int64_t)4096LL, sizeof(uint8_t)), (parts)[i]);
at = (int64_t)((uint64_t)at + (uint64_t)((int64_t)(parts[i]).length));
}
}
Slice value_1 = {text, 4096};
zir_f_91ae99e11753ff79_ZiranDiagnose(span, code, compiler_ir_BufferText(value_1));
}
uint8_t*
compiler_services_Keep(String text)
{
return zir_f_91ae99e11753ff79_ZiranKeepText(text);
}
uint8_t*
compiler_services_KeepName(String text)
{
return zir_f_91ae99e11753ff79_ZiranKeepName(text);
}
uint8_t*
compiler_services_KeepParameters(String text)
{
return zir_f_91ae99e11753ff79_ZiranKeepParameters(text);
}
uint8_t*
compiler_services_SpanPath(ZirSourceSpan span)
{
return zir_f_91ae99e11753ff79_CSpanPath(span);
}
void
compiler_services_LookupsChanged(void)
{
zir_f_91ae99e11753ff79_SymbolLookupsChanged();
}
int32_t
compiler_services_ResolveFunction(ZirModule* module, uint8_t* name, uint8_t* path, ZirModule** owner, ZirFunction** function)
{
return zir_f_91ae99e11753ff79_ResolveFunctionAt(module, name, path, owner, function);
}
int32_t
compiler_services_MapPrimitiveName(uint8_t* name)
{
return zir_f_91ae99e11753ff79_CMapPrimitiveName(name);
}
ZirImport*
compiler_services_AddImport(ZirModule* module, ZirImportKind kind, String name, String target, String signature, ZirSourceSpan span)
{
return zir_f_91ae99e11753ff79_ZiranAddImport(module, kind, name, target, signature, span);
}
ZirExpr*
compiler_services_AddExpr(ZirFunction* fn, ZirExprKind kind, String text, ZirSourceSpan span)
{
return zir_f_91ae99e11753ff79_FunctionAddExpr(fn, kind, compiler_services_Keep(text), span);
}
ZirType*
compiler_services_FindType(ZirModule* module, String name, ZirModule** owner)
{
uint8_t spelled[256] = {0};
bool value_0 = (int64_t)(name).length >= 128LL;
if (!value_0) {
Slice value_1 = {spelled, 256};
bool value_2 = compiler_ir_CopyText(value_1, name);
value_0 = !value_2;
}
if (value_0) {
return (void *)0;
}
return zir_f_91ae99e11753ff79_CFindType(module, &(spelled[0]), owner);
}
int32_t
compiler_services_NextField(ZirType* record, size_t* offset, ZirTypeField* field)
{
return zir_f_91ae99e11753ff79_TypeNextField(record, offset, field);
}
void
compiler_services_Fatal(ZirSourceSpan span, String code, String message)
{
zir_f_91ae99e11753ff79_ZiranDiagnose(span, code, message);
zir_f_91ae99e11753ff79_exit(1);
}
bool
compiler_services_ExpandDefaults(ZirFunction* fn, ZirModule* module, ZirSourceSpan span, int32_t stmt_index, int32_t callee, int32_t* first, int32_t* last)
{
return zir_f_91ae99e11753ff79_ExpandDefaultArguments(fn, module, span, stmt_index, callee, first, last);
}