mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fixes to header gen.
This commit is contained in:
@@ -519,5 +519,5 @@ void scratch_buffer_set_extern_decl_name(Decl *decl, bool clear)
|
||||
}
|
||||
if (decl->unit && decl->unit->module) scratch_buffer_append_module(decl->unit->module, decl->is_export);
|
||||
scratch_buffer_append(decl->is_export ? "__" : ".");
|
||||
scratch_buffer_append(decl->name);
|
||||
scratch_buffer_append(decl->name ? decl->name : "$anon");
|
||||
}
|
||||
|
||||
@@ -2219,7 +2219,6 @@ INLINE bool decl_poison(Decl *decl);
|
||||
INLINE bool decl_is_struct_type(Decl *decl);
|
||||
INLINE bool decl_is_user_defined_type(Decl *decl);
|
||||
INLINE Decl *decl_flatten(Decl *decl);
|
||||
INLINE const char *decl_get_extname(Decl *decl);
|
||||
static inline Decl *decl_raw(Decl *decl);
|
||||
static inline DeclKind decl_from_token(TokenType type);
|
||||
static inline bool decl_is_var_local(Decl *decl);
|
||||
|
||||
@@ -4,15 +4,63 @@
|
||||
|
||||
#include "compiler_internal.h"
|
||||
|
||||
#define PRINTF(x, ...) fprintf(file, x, ## __VA_ARGS__) /* NOLINT */
|
||||
#define INDENT() indent_line(file, indent)
|
||||
#define OUT(file, x, ...) fprintf(file, x, ## __VA_ARGS__) /* NOLINT */
|
||||
#define PRINTF(x, ...) fprintf(c->file, x, ## __VA_ARGS__) /* NOLINT */
|
||||
#define INDENT() indent_line(c->file, indent)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GEN_DONE,
|
||||
GEN_FULL,
|
||||
GEN_POINTER,
|
||||
GEN_DEFINITION,
|
||||
} GenType;
|
||||
|
||||
typedef struct HeaderContext__
|
||||
{
|
||||
FILE *file;
|
||||
HTable *gen_decl;
|
||||
HTable *gen_def;
|
||||
Decl **type_queue;
|
||||
} HeaderContext;
|
||||
|
||||
static void header_ensure_member_types_exist(HeaderContext *c, Decl **members);
|
||||
static void header_gen_struct_union(HeaderContext *c, int indent, Decl *decl);
|
||||
static void header_gen_maybe_generate_type(HeaderContext *c, Type *type, bool is_pointer);
|
||||
static GenType try_gen(HeaderContext *c, Decl *decl, GenType gen);
|
||||
|
||||
INLINE bool header_try_gen_definition(HeaderContext *c, Type *type)
|
||||
{
|
||||
if (htable_get(c->gen_def, type) != NULL) return false;
|
||||
htable_set(c->gen_def, type, type);
|
||||
return true;
|
||||
}
|
||||
|
||||
INLINE bool header_try_gen_decl(HeaderContext *c, Type *type)
|
||||
{
|
||||
if (htable_get(c->gen_decl, type) != NULL) return false;
|
||||
htable_set(c->gen_decl, type, type);
|
||||
return true;
|
||||
}
|
||||
INLINE bool header_try_gen_both(HeaderContext *c, Type *type)
|
||||
{
|
||||
if (header_try_gen_definition(c, type))
|
||||
{
|
||||
bool success = header_try_gen_decl(c, type);
|
||||
assert(success);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void header_gen_struct_union(FILE *file, int indent, Decl *decl);
|
||||
static void header_gen_maybe_generate_type(FILE *file, HTable *table, Type *type);
|
||||
|
||||
INLINE const char *decl_get_extname(Decl *decl)
|
||||
{
|
||||
if (!decl->extname)
|
||||
{
|
||||
decl->is_export = true;
|
||||
scratch_buffer_set_extern_decl_name(decl, true);
|
||||
decl->extname = scratch_buffer_copy();
|
||||
}
|
||||
return decl->extname;
|
||||
}
|
||||
|
||||
@@ -36,9 +84,7 @@ static const char *struct_union_str(Decl *decl)
|
||||
return decl->decl_kind == DECL_UNION ? "union" : "struct";
|
||||
}
|
||||
|
||||
static void header_gen_type_decl(FILE *file, int indent, Decl *decl);
|
||||
|
||||
static void header_print_type(FILE *file, Type *type)
|
||||
static void header_print_type(HeaderContext *c, Type *type)
|
||||
{
|
||||
if (type_is_func_pointer(type))
|
||||
{
|
||||
@@ -106,7 +152,7 @@ static void header_print_type(FILE *file, Type *type)
|
||||
PRINTF("c3typeid_t");
|
||||
return;
|
||||
case TYPE_POINTER:
|
||||
header_print_type(file, type->pointer);
|
||||
header_print_type(c, type->pointer);
|
||||
PRINTF("*");
|
||||
return;
|
||||
case TYPE_FUNC_PTR:
|
||||
@@ -126,7 +172,7 @@ static void header_print_type(FILE *file, Type *type)
|
||||
PRINTF("%s", decl_get_extname(type->decl));
|
||||
return;
|
||||
}
|
||||
header_print_type(file, type->decl->bitstruct.base_type->type);
|
||||
header_print_type(c, type->decl->bitstruct.base_type->type);
|
||||
return;
|
||||
case TYPE_ANYFAULT:
|
||||
case TYPE_FAULTTYPE:
|
||||
@@ -138,7 +184,7 @@ static void header_print_type(FILE *file, Type *type)
|
||||
PRINTF("%s", decl_get_extname(type->decl));
|
||||
return;
|
||||
}
|
||||
header_print_type(file, type->decl->distinct->type);
|
||||
header_print_type(c, type->decl->distinct->type);
|
||||
return;
|
||||
case TYPE_TYPEDEF:
|
||||
if (!type->decl)
|
||||
@@ -147,7 +193,7 @@ static void header_print_type(FILE *file, Type *type)
|
||||
if (type == type_isz) { PRINTF("ptrdiff_t"); return; }
|
||||
if (type == type_iptr) { PRINTF("intptr_t"); return; }
|
||||
if (type == type_uptr) { PRINTF("uintptr_t"); return; }
|
||||
header_print_type(file, type->canonical);
|
||||
header_print_type(c, type->canonical);
|
||||
return;
|
||||
}
|
||||
if (type->decl->is_export)
|
||||
@@ -155,13 +201,13 @@ static void header_print_type(FILE *file, Type *type)
|
||||
PRINTF("%s", decl_get_extname(type->decl));
|
||||
return;
|
||||
}
|
||||
header_print_type(file, type->canonical);
|
||||
header_print_type(c, type->canonical);
|
||||
return;
|
||||
case TYPE_FLEXIBLE_ARRAY:
|
||||
UNREACHABLE
|
||||
case TYPE_ARRAY:
|
||||
PRINTF("struct { ");
|
||||
header_print_type(file, type->array.base);
|
||||
header_print_type(c, type->array.base);
|
||||
PRINTF(" arr[%d]; }", type->array.len);
|
||||
return;
|
||||
case TYPE_ANY:
|
||||
@@ -191,7 +237,7 @@ static void header_print_type(FILE *file, Type *type)
|
||||
}
|
||||
}
|
||||
|
||||
static void header_gen_function_ptr(FILE *file, HTable *table, Type *type)
|
||||
static void header_gen_function_ptr(HeaderContext *c, Type *type)
|
||||
{
|
||||
TypeFunction *fun = &type_flatten(type)->pointer->function;
|
||||
Signature *sig = fun->signature;
|
||||
@@ -200,16 +246,16 @@ static void header_gen_function_ptr(FILE *file, HTable *table, Type *type)
|
||||
if (type_is_optional(rtype))
|
||||
{
|
||||
extra_ret = rtype->optional;
|
||||
header_gen_maybe_generate_type(file, table, extra_ret);
|
||||
header_gen_maybe_generate_type(c, extra_ret, false);
|
||||
rtype = type_anyfault;
|
||||
}
|
||||
header_gen_maybe_generate_type(file, table, rtype);
|
||||
header_gen_maybe_generate_type(c, rtype, false);
|
||||
FOREACH_BEGIN_IDX(i, Decl *param, sig->params)
|
||||
header_gen_maybe_generate_type(file, table, param->type);
|
||||
header_gen_maybe_generate_type(c, param->type, false);
|
||||
FOREACH_END();
|
||||
|
||||
PRINTF("typedef ");
|
||||
header_print_type(file, rtype);
|
||||
header_print_type(c, rtype);
|
||||
PRINTF("(*%s)(", decl_get_extname(type->decl));
|
||||
if (!vec_size(sig->params) && !extra_ret)
|
||||
{
|
||||
@@ -218,18 +264,18 @@ static void header_gen_function_ptr(FILE *file, HTable *table, Type *type)
|
||||
}
|
||||
if (extra_ret)
|
||||
{
|
||||
header_print_type(file, type_get_ptr(extra_ret));
|
||||
header_print_type(c, type_get_ptr(extra_ret));
|
||||
PRINTF(" return_ref");
|
||||
}
|
||||
FOREACH_BEGIN_IDX(i, Decl *param, sig->params)
|
||||
if (i || extra_ret) PRINTF(", ");
|
||||
header_print_type(file, param->type);
|
||||
header_print_type(c, param->type);
|
||||
if (param->name) PRINTF(" %s", param->name);
|
||||
FOREACH_END();
|
||||
PRINTF(");\n");
|
||||
}
|
||||
|
||||
static void header_gen_function(FILE *file, HTable *table, Decl *decl, bool print_fn, bool* fn_found)
|
||||
static void header_gen_function(HeaderContext *c, Decl *decl, bool print_fn, bool* fn_found)
|
||||
{
|
||||
if (!decl->is_export) return;
|
||||
if (decl->extname[0] == '_' && decl->extname[1] == '_') return;
|
||||
@@ -251,14 +297,14 @@ static void header_gen_function(FILE *file, HTable *table, Decl *decl, bool prin
|
||||
if (type_is_optional(rtype))
|
||||
{
|
||||
extra_ret = rtype->optional;
|
||||
if (!print_fn) header_gen_maybe_generate_type(file, table, extra_ret);
|
||||
if (!print_fn) header_gen_maybe_generate_type(c, extra_ret, false);
|
||||
rtype = type_anyfault;
|
||||
}
|
||||
if (!print_fn) header_gen_maybe_generate_type(file, table, rtype);
|
||||
if (!print_fn) header_gen_maybe_generate_type(c, rtype, false);
|
||||
if (print_fn)
|
||||
{
|
||||
PRINTF("extern ");
|
||||
header_print_type(file, rtype);
|
||||
header_print_type(c, rtype);
|
||||
PRINTF(" %s(", decl_get_extname(decl));
|
||||
if (!vec_size(sig->params) && !extra_ret)
|
||||
{
|
||||
@@ -267,7 +313,7 @@ static void header_gen_function(FILE *file, HTable *table, Decl *decl, bool prin
|
||||
}
|
||||
if (extra_ret)
|
||||
{
|
||||
header_print_type(file, type_get_ptr(extra_ret));
|
||||
header_print_type(c, type_get_ptr(extra_ret));
|
||||
PRINTF(" return_ref");
|
||||
}
|
||||
}
|
||||
@@ -275,18 +321,18 @@ static void header_gen_function(FILE *file, HTable *table, Decl *decl, bool prin
|
||||
if (print_fn)
|
||||
{
|
||||
if (i || extra_ret) PRINTF(", ");
|
||||
header_print_type(file, param->type);
|
||||
header_print_type(c, param->type);
|
||||
if (param->name) PRINTF(" %s", param->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
header_gen_maybe_generate_type(file, table, param->type);
|
||||
header_gen_maybe_generate_type(c, param->type, false);
|
||||
}
|
||||
FOREACH_END();
|
||||
if (print_fn) PRINTF(");\n");
|
||||
}
|
||||
|
||||
static void header_gen_members(FILE *file, int indent, Decl **members)
|
||||
static void header_gen_members(HeaderContext *c, int indent, Decl **members)
|
||||
{
|
||||
VECEACH(members, i)
|
||||
{
|
||||
@@ -299,26 +345,26 @@ static void header_gen_members(FILE *file, int indent, Decl **members)
|
||||
switch (type->type_kind)
|
||||
{
|
||||
case TYPE_ARRAY:
|
||||
header_print_type(file, type->array.base);
|
||||
header_print_type(c, type->array.base);
|
||||
PRINTF(" %s[%d];\n", member->name, type->array.len);
|
||||
break;
|
||||
case TYPE_FLEXIBLE_ARRAY:
|
||||
header_print_type(file, type->array.base);
|
||||
header_print_type(c, type->array.base);
|
||||
PRINTF(" %s[];\n", member->name);
|
||||
break;
|
||||
default:
|
||||
header_print_type(file, member->type);
|
||||
header_print_type(c, member->type);
|
||||
PRINTF(" %s;\n", member->name);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DECL_STRUCT:
|
||||
case DECL_UNION:
|
||||
header_gen_struct_union(file, indent, member);
|
||||
header_gen_struct_union(c, indent, member);
|
||||
break;
|
||||
case DECL_BITSTRUCT:
|
||||
INDENT();
|
||||
header_print_type(file, member->bitstruct.base_type->type->canonical);
|
||||
header_print_type(c, member->bitstruct.base_type->type->canonical);
|
||||
if (member->name)
|
||||
{
|
||||
PRINTF(" %s;\n", member->name);
|
||||
@@ -331,7 +377,28 @@ static void header_gen_members(FILE *file, int indent, Decl **members)
|
||||
}
|
||||
}
|
||||
}
|
||||
static void header_gen_struct_union(FILE *file, int indent, Decl *decl)
|
||||
|
||||
static void header_gen_struct_union_top(HeaderContext *c, Decl *decl, GenType gen_type)
|
||||
{
|
||||
gen_type = try_gen(c, decl, gen_type);
|
||||
if (gen_type == GEN_DONE) return;
|
||||
if (gen_type != GEN_DEFINITION)
|
||||
{
|
||||
PRINTF("typedef %s %s__ %s;\n", struct_union_str(decl), decl_get_extname(decl), decl_get_extname(decl));
|
||||
}
|
||||
if (gen_type == GEN_POINTER)
|
||||
{
|
||||
vec_add(c->type_queue, decl);
|
||||
return;
|
||||
}
|
||||
header_ensure_member_types_exist(c, decl->strukt.members);
|
||||
PRINTF("%s %s__\n", struct_union_str(decl), decl->extname);
|
||||
PRINTF("{\n");
|
||||
header_gen_members(c, 1, decl->strukt.members);
|
||||
PRINTF("};\n");
|
||||
}
|
||||
|
||||
static void header_gen_struct_union(HeaderContext *c, int indent, Decl *decl)
|
||||
{
|
||||
if (!indent)
|
||||
{
|
||||
@@ -348,69 +415,66 @@ static void header_gen_struct_union(FILE *file, int indent, Decl *decl)
|
||||
}
|
||||
INDENT();
|
||||
PRINTF("{\n");
|
||||
header_gen_members(file, indent + 1, decl->strukt.members);
|
||||
header_gen_members(c, indent + 1, decl->strukt.members);
|
||||
INDENT();
|
||||
PRINTF("};\n");
|
||||
}
|
||||
|
||||
|
||||
static void header_gen_enum(FILE *file, int indent, Decl *decl)
|
||||
static GenType try_gen(HeaderContext *c, Decl *decl, GenType gen)
|
||||
{
|
||||
TODO
|
||||
}
|
||||
|
||||
static void header_gen_err(FILE *file, int indent, Decl *decl)
|
||||
{
|
||||
PRINTF("typedef struct %s_error__ %s_error;\n", decl_get_extname(decl), decl_get_extname(decl));
|
||||
PRINTF("struct %s_error__\n{\n", decl_get_extname(decl));
|
||||
header_gen_members(file, indent, decl->strukt.members);
|
||||
PRINTF("};\n");
|
||||
}
|
||||
|
||||
|
||||
static void header_gen_type_decl(FILE *file, int indent, Decl *decl)
|
||||
{
|
||||
switch (decl->decl_kind)
|
||||
Type *type = decl->type;
|
||||
switch (gen)
|
||||
{
|
||||
case NON_TYPE_DECLS:
|
||||
case DECL_FUNC:
|
||||
case DECL_FNTYPE:
|
||||
case GEN_FULL:
|
||||
if (header_try_gen_decl(c, type))
|
||||
{
|
||||
header_try_gen_definition(c, type);
|
||||
return GEN_FULL;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
case GEN_DEFINITION:
|
||||
if (!header_try_gen_definition(c, type)) return GEN_DONE;
|
||||
return GEN_DEFINITION;
|
||||
case GEN_DONE:
|
||||
UNREACHABLE
|
||||
case DECL_ERASED:
|
||||
return;
|
||||
case DECL_BITSTRUCT:
|
||||
header_print_type(file, decl->bitstruct.base_type->type);
|
||||
return;
|
||||
case DECL_TYPEDEF:
|
||||
case DECL_DISTINCT:
|
||||
case DECL_INTERFACE:
|
||||
// Ignore
|
||||
return;
|
||||
case DECL_STRUCT:
|
||||
case DECL_UNION:
|
||||
header_gen_struct_union(file, indent, decl);
|
||||
return;
|
||||
case DECL_ENUM:
|
||||
header_gen_enum(file, indent, decl);
|
||||
return;
|
||||
case DECL_FAULT:
|
||||
header_gen_err(file, indent, decl);
|
||||
return;
|
||||
case GEN_POINTER:
|
||||
if (!header_try_gen_decl(c, type)) return GEN_DONE;
|
||||
return GEN_POINTER;
|
||||
}
|
||||
UNREACHABLE
|
||||
}
|
||||
static void header_gen_enum(HeaderContext *c, int indent, Decl *decl)
|
||||
{
|
||||
if (!header_try_gen_both(c, decl->type)) return;
|
||||
Type *underlying_type = decl->enums.type_info->type->canonical;
|
||||
if (underlying_type != type_cint->canonical)
|
||||
{
|
||||
PRINTF("typedef ");
|
||||
header_print_type(c, underlying_type);
|
||||
PRINTF(" %s;\n", decl_get_extname(decl));FOREACH_BEGIN_IDX(i, Decl *enum_member, decl->enums.values)
|
||||
PRINTF("%s %s_%s = %d;\n", decl_get_extname(decl), decl_get_extname(decl), enum_member->name, i);
|
||||
FOREACH_END();
|
||||
return;
|
||||
}
|
||||
PRINTF("typedef enum %s__\n{\n", decl_get_extname(decl));
|
||||
FOREACH_BEGIN(Decl *enum_member, decl->enums.values)
|
||||
PRINTF("\t %s_%s,\n", decl_get_extname(decl), enum_member->name);
|
||||
FOREACH_END();
|
||||
PRINTF("} %s;\n", decl_get_extname(decl));
|
||||
}
|
||||
|
||||
void header_ensure_member_types_exist(FILE *file, HTable *table, Decl **members)
|
||||
static void header_ensure_member_types_exist(HeaderContext *c, Decl **members)
|
||||
{
|
||||
FOREACH_BEGIN(Decl *member, members)
|
||||
switch (member->decl_kind)
|
||||
{
|
||||
case DECL_VAR:
|
||||
header_gen_maybe_generate_type(file, table, member->type);
|
||||
header_gen_maybe_generate_type(c, member->type, false);
|
||||
break;
|
||||
case DECL_STRUCT:
|
||||
case DECL_UNION:
|
||||
header_ensure_member_types_exist(file, table, member->strukt.members);
|
||||
header_ensure_member_types_exist(c, member->strukt.members);
|
||||
break;
|
||||
case DECL_BITSTRUCT:
|
||||
break;
|
||||
@@ -419,13 +483,12 @@ void header_ensure_member_types_exist(FILE *file, HTable *table, Decl **members)
|
||||
}
|
||||
FOREACH_END();
|
||||
}
|
||||
static void header_gen_maybe_generate_type(FILE *file, HTable *table, Type *type)
|
||||
static void header_gen_maybe_generate_type(HeaderContext *c, Type *type, bool is_pointer)
|
||||
{
|
||||
if (type_is_func_pointer(type))
|
||||
{
|
||||
if (htable_get(table, type)) return;
|
||||
htable_set(table, type, type);
|
||||
header_gen_function_ptr(file, table, type);
|
||||
if (!header_try_gen_definition(c, type)) return;
|
||||
header_gen_function_ptr(c, type);
|
||||
return;
|
||||
}
|
||||
RETRY:
|
||||
@@ -454,12 +517,11 @@ RETRY:
|
||||
return;
|
||||
case TYPE_DISTINCT:
|
||||
{
|
||||
if (htable_get(table, type)) return;
|
||||
if (!header_try_gen_both(c, type)) return;
|
||||
Type *underlying_type = type->decl->distinct->type;
|
||||
htable_set(table, type, type);
|
||||
header_gen_maybe_generate_type(file, table, underlying_type);
|
||||
header_gen_maybe_generate_type(c, underlying_type, is_pointer);
|
||||
PRINTF("typedef ");
|
||||
header_print_type(file, underlying_type);
|
||||
header_print_type(c, underlying_type);
|
||||
PRINTF(" %s;\n", decl_get_extname(type->decl));
|
||||
return;
|
||||
}
|
||||
@@ -470,70 +532,42 @@ RETRY:
|
||||
type = type->canonical;
|
||||
goto RETRY;
|
||||
}
|
||||
if (htable_get(table, type)) return;
|
||||
htable_set(table, type, type);
|
||||
if (!header_try_gen_both(c, type)) return;
|
||||
Type *underlying_type = type->canonical;
|
||||
header_gen_maybe_generate_type(file, table, underlying_type);
|
||||
header_gen_maybe_generate_type(c, underlying_type, is_pointer);
|
||||
PRINTF("typedef ");
|
||||
header_print_type(file, underlying_type);
|
||||
header_print_type(c, underlying_type);
|
||||
PRINTF(" %s;\n", decl_get_extname(type->decl));
|
||||
return;
|
||||
}
|
||||
case TYPE_BITSTRUCT:
|
||||
{
|
||||
if (htable_get(table, type)) return;
|
||||
htable_set(table, type, type);
|
||||
if (!header_try_gen_both(c, type)) return;
|
||||
Type *underlying_type = type->decl->bitstruct.base_type->type;
|
||||
header_gen_maybe_generate_type(file, table, underlying_type);
|
||||
header_gen_maybe_generate_type(c, underlying_type, is_pointer);
|
||||
PRINTF("typedef ");
|
||||
header_print_type(file, underlying_type);
|
||||
header_print_type(c, underlying_type);
|
||||
PRINTF(" %s;\n", decl_get_extname(type->decl));
|
||||
return;
|
||||
}
|
||||
case TYPE_POINTER:
|
||||
type = type->pointer;
|
||||
if (htable_get(c->gen_decl, type)) return;
|
||||
is_pointer = true;
|
||||
goto RETRY;
|
||||
case TYPE_FUNC_PTR:
|
||||
type = type->pointer;
|
||||
goto RETRY;
|
||||
case TYPE_ENUM:
|
||||
if (htable_get(table, type)) return;
|
||||
{
|
||||
Decl *decl = type->decl;
|
||||
htable_set(table, type, type);
|
||||
Type *underlying_type = decl->enums.type_info->type->canonical;
|
||||
if (underlying_type == type_cint->canonical)
|
||||
{
|
||||
PRINTF("typedef enum %s__\n{\n", decl_get_extname(decl));
|
||||
FOREACH_BEGIN(Decl *enum_member, decl->enums.values)
|
||||
PRINTF("\t %s_%s,\n", decl_get_extname(decl), enum_member->name);
|
||||
FOREACH_END();
|
||||
PRINTF("} %s;\n", decl_get_extname(decl));
|
||||
return;
|
||||
}
|
||||
PRINTF("typedef ");
|
||||
header_print_type(file, underlying_type);
|
||||
PRINTF(" %s;\n", decl_get_extname(decl));
|
||||
FOREACH_BEGIN_IDX(i, Decl *enum_member, decl->enums.values)
|
||||
PRINTF("%s %s_%s = %d;\n", decl_get_extname(decl), decl_get_extname(decl), enum_member->name, i);
|
||||
FOREACH_END();
|
||||
return;
|
||||
}
|
||||
header_gen_enum(c, 0, type->decl);
|
||||
return;
|
||||
case TYPE_FUNC_RAW:
|
||||
UNREACHABLE
|
||||
return;
|
||||
case TYPE_STRUCT:
|
||||
case TYPE_UNION:
|
||||
if (htable_get(table, type)) return;
|
||||
{
|
||||
Decl *decl = type->decl;
|
||||
PRINTF("typedef %s %s__ %s;\n", struct_union_str(decl), decl_get_extname(decl), decl_get_extname(decl));
|
||||
htable_set(table, type, type);
|
||||
header_ensure_member_types_exist(file, table, decl->strukt.members);
|
||||
PRINTF("%s %s__\n", struct_union_str(decl), decl->extname);
|
||||
PRINTF("{\n");
|
||||
header_gen_members(file, 1, decl->strukt.members);
|
||||
PRINTF("};\n");
|
||||
return;
|
||||
}
|
||||
header_gen_struct_union_top(c, type->decl, is_pointer ? GEN_POINTER : GEN_FULL);
|
||||
return;
|
||||
case TYPE_ARRAY:
|
||||
type = type->array.base;
|
||||
goto RETRY;
|
||||
@@ -542,20 +576,19 @@ RETRY:
|
||||
goto RETRY;
|
||||
case TYPE_VECTOR:
|
||||
{
|
||||
if (htable_get(table, type)) return;
|
||||
if (!header_try_gen_both(c, type)) return;
|
||||
PRINTF("typedef ");
|
||||
Type *flat_type = type_flatten(type->array.base);
|
||||
header_print_type(file, flat_type);
|
||||
htable_set(table, type, type);
|
||||
header_print_type(c, flat_type);
|
||||
PRINTF(" ");
|
||||
header_print_type(file, type);
|
||||
header_print_type(c, type);
|
||||
PRINTF(" __attribute__((vector_size(%d)));\n", (int)type_size(flat_type) * type->array.len);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void header_gen_global_var(FILE *file, HTable *table, Decl *decl, bool fn_globals, bool *globals_found)
|
||||
static void header_gen_global_var(HeaderContext *c, Decl *decl, bool fn_globals, bool *globals_found)
|
||||
{
|
||||
assert(decl->decl_kind == DECL_VAR);
|
||||
// Only exports.
|
||||
@@ -610,13 +643,13 @@ static void header_gen_global_var(FILE *file, HTable *table, Decl *decl, bool fn
|
||||
PRINTF("(void*)0x%llx\n", (unsigned long long)init->const_expr.ptr);
|
||||
return;
|
||||
case CONST_STRING:
|
||||
putc('\"', file);
|
||||
putc('\"', c->file);
|
||||
for (unsigned i = 0; i < init->const_expr.bytes.len; i++)
|
||||
{
|
||||
char ch = init->const_expr.bytes.ptr[i];
|
||||
if (ch >= ' ' && ch <= 127 && ch != '"')
|
||||
{
|
||||
fputc(ch, file);
|
||||
fputc(ch, c->file);
|
||||
continue;
|
||||
}
|
||||
PRINTF("\\x%02x", ch);
|
||||
@@ -637,17 +670,17 @@ static void header_gen_global_var(FILE *file, HTable *table, Decl *decl, bool fn
|
||||
}
|
||||
if (!fn_globals)
|
||||
{
|
||||
header_gen_maybe_generate_type(file, table, decl->type);
|
||||
header_gen_maybe_generate_type(c, decl->type, false);
|
||||
return;
|
||||
}
|
||||
header_print_type(file, decl->type);
|
||||
header_print_type(c, decl->type);
|
||||
assert(decl->var.kind == VARDECL_GLOBAL || decl->var.kind == VARDECL_CONST);
|
||||
PRINTF("extern ");
|
||||
if (decl->var.kind == VARDECL_CONST) PRINTF("const ");
|
||||
PRINTF(" %s;\n", decl_get_extname(decl));
|
||||
}
|
||||
|
||||
static void header_gen_global_decls(FILE *file, HTable *table, Module **modules, unsigned module_count, bool fn_globals)
|
||||
static void header_gen_global_decls(HeaderContext *c, Module **modules, unsigned module_count, bool fn_globals)
|
||||
{
|
||||
bool constants_found = false;
|
||||
for (unsigned i = 0; i < module_count; i++)
|
||||
@@ -657,7 +690,7 @@ static void header_gen_global_decls(FILE *file, HTable *table, Module **modules,
|
||||
FOREACH_BEGIN(CompilationUnit *unit, module->units)
|
||||
FOREACH_BEGIN(Decl *var, unit->vars)
|
||||
if (var->var.kind != VARDECL_CONST) continue;
|
||||
header_gen_global_var(file, table, var, fn_globals, &constants_found);
|
||||
header_gen_global_var(c, var, fn_globals, &constants_found);
|
||||
FOREACH_END();
|
||||
FOREACH_END();
|
||||
}
|
||||
@@ -671,7 +704,7 @@ static void header_gen_global_decls(FILE *file, HTable *table, Module **modules,
|
||||
FOREACH_BEGIN(CompilationUnit *unit, module->units)
|
||||
FOREACH_BEGIN(Decl *var, unit->vars)
|
||||
if (var->var.kind != VARDECL_GLOBAL) continue;
|
||||
header_gen_global_var(file, table, var, fn_globals, &globals_found);
|
||||
header_gen_global_var(c, var, fn_globals, &globals_found);
|
||||
FOREACH_END();
|
||||
FOREACH_END();
|
||||
}
|
||||
@@ -684,7 +717,7 @@ static void header_gen_global_decls(FILE *file, HTable *table, Module **modules,
|
||||
// Generate all functions
|
||||
FOREACH_BEGIN(CompilationUnit *unit, module->units)
|
||||
FOREACH_BEGIN(Decl *fn, unit->functions)
|
||||
header_gen_function(file, table, fn, fn_globals, &functions_found);
|
||||
header_gen_function(c, fn, fn_globals, &functions_found);
|
||||
FOREACH_END();
|
||||
FOREACH_END();
|
||||
}
|
||||
@@ -700,19 +733,39 @@ static void header_gen_global_decls(FILE *file, HTable *table, Module **modules,
|
||||
// Generate all functions
|
||||
FOREACH_BEGIN(CompilationUnit *unit, module->units)
|
||||
FOREACH_BEGIN(Decl *method, unit->methods)
|
||||
header_gen_function(file, table, method, fn_globals, &methods_found);
|
||||
header_gen_function(c, method, fn_globals, &methods_found);
|
||||
FOREACH_END();
|
||||
FOREACH_END();
|
||||
}
|
||||
|
||||
}
|
||||
static void process_queue(HeaderContext *c)
|
||||
{
|
||||
for (uint32_t i = 0; i < vec_size(c->type_queue); i++)
|
||||
{
|
||||
Decl *decl = c->type_queue[i];
|
||||
switch (decl->decl_kind)
|
||||
{
|
||||
case DECL_STRUCT:
|
||||
case DECL_UNION:
|
||||
header_gen_struct_union_top(c, decl, GEN_DEFINITION);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE
|
||||
}
|
||||
}
|
||||
vec_resize(c->type_queue, 0);
|
||||
}
|
||||
void header_gen(Module **modules, unsigned module_count)
|
||||
{
|
||||
HTable table;
|
||||
htable_init(&table, 1024);
|
||||
HTable table1, table2;
|
||||
htable_init(&table1, 1024);
|
||||
htable_init(&table2, 1024);
|
||||
const char *name = build_base_name();
|
||||
const char *filename = str_printf("%s.h", name);
|
||||
FILE *file = fopen(filename, "w");
|
||||
HeaderContext context = { .file = file, .gen_def = &table1, .gen_decl = &table2 };
|
||||
HeaderContext *c = &context;
|
||||
PRINTF("#include <stdint.h>\n");
|
||||
PRINTF("#include <stddef.h>\n");
|
||||
PRINTF("#include <stdbool.h>\n");
|
||||
@@ -732,12 +785,15 @@ void header_gen(Module **modules, unsigned module_count)
|
||||
FOREACH_BEGIN(CompilationUnit *unit, module->units)
|
||||
FOREACH_BEGIN(Decl *type, unit->types)
|
||||
if (!type->is_export) continue;
|
||||
header_gen_maybe_generate_type(file, &table, type->type);
|
||||
header_gen_maybe_generate_type(c, type->type, false);
|
||||
FOREACH_END();
|
||||
FOREACH_END();
|
||||
process_queue(c);
|
||||
}
|
||||
header_gen_global_decls(file, &table, modules, module_count, false);
|
||||
header_gen_global_decls(file, &table, modules, module_count, true);
|
||||
process_queue(c);
|
||||
header_gen_global_decls(c, modules, module_count, false);
|
||||
process_queue(c);
|
||||
header_gen_global_decls(c, modules, module_count, true);
|
||||
fclose(file);
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,13 @@ void scratch_buffer_append_module(Module *module, bool is_export)
|
||||
scratch_buffer_append_char(is_export ? '_' : '.');
|
||||
name++;
|
||||
break;
|
||||
case '.':
|
||||
if (is_export)
|
||||
{
|
||||
scratch_buffer_append_char('_');
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
default:
|
||||
scratch_buffer_append_char(c);
|
||||
break;
|
||||
|
||||
@@ -3735,7 +3735,7 @@ static bool sema_generate_parameterized_name_to_scratch(SemaContext *context, Mo
|
||||
scratch_buffer_clear();
|
||||
if (mangled)
|
||||
{
|
||||
scratch_buffer_append_len(module->name->module, module->name->len);
|
||||
scratch_buffer_append_module(module, true);
|
||||
scratch_buffer_append("$");
|
||||
}
|
||||
else
|
||||
|
||||
@@ -667,13 +667,8 @@ void type_mangle_introspect_name_to_buffer(Type *type)
|
||||
case TYPE_FAULTTYPE:
|
||||
case TYPE_DISTINCT:
|
||||
case TYPE_INTERFACE:
|
||||
{
|
||||
CompilationUnit *unit = type->decl->unit;
|
||||
scratch_buffer_append(unit ? unit->module->name->module : "$");
|
||||
scratch_buffer_append(".");
|
||||
scratch_buffer_append(type->decl->name ? type->decl->name : "$anon");
|
||||
scratch_buffer_set_extern_decl_name(type->decl, false);
|
||||
return;
|
||||
}
|
||||
case TYPE_TYPEDEF:
|
||||
type_mangle_introspect_name_to_buffer(type->canonical);
|
||||
return;
|
||||
|
||||
@@ -33,7 +33,7 @@ fn void main() {
|
||||
@.taddr.9 = private global i32 42, align 4
|
||||
@.taddr.10 = private global i8 99, align 1
|
||||
@.taddr.11 = private global %"char[]" { ptr @.str, i64 3 }, align 8
|
||||
@main.x = internal unnamed_addr global [3 x %any] [%any { ptr @.taddr.9, i64 ptrtoint (ptr @"$ct.int" to i64) }, %any { ptr @.taddr.10, i64 ptrtoint (ptr @"$ct.char" to i64) }, %any { ptr @.taddr.11, i64 ptrtoint (ptr @"$ct.$.String" to i64) }], align 16
|
||||
@main.x = internal unnamed_addr global [3 x %any] [%any { ptr @.taddr.9, i64 ptrtoint (ptr @"$ct.int" to i64) }, %any { ptr @.taddr.10, i64 ptrtoint (ptr @"$ct.char" to i64) }, %any { ptr @.taddr.11, i64 ptrtoint (ptr @"$ct.String" to i64) }], align 16
|
||||
|
||||
; Function Attrs:
|
||||
define void @test.main() #0 {
|
||||
@@ -56,7 +56,7 @@ entry:
|
||||
%ptradd2 = getelementptr inbounds i8, ptr %y, i64 32
|
||||
store %"char[]" { ptr @.str.12, i64 3 }, ptr %taddr3, align 8
|
||||
%4 = insertvalue %any undef, ptr %taddr3, 0
|
||||
%5 = insertvalue %any %4, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%5 = insertvalue %any %4, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %5, ptr %ptradd2, align 16
|
||||
ret void
|
||||
}
|
||||
|
||||
@@ -504,116 +504,116 @@ noerr_block149: ; preds = %after_check147
|
||||
voiderr151: ; preds = %noerr_block149, %guard_block148, %guard_block142, %guard_block136
|
||||
store %"char[]" { ptr @.str.17, i64 3 }, ptr %taddr, align 8
|
||||
%64 = insertvalue %any undef, ptr %taddr, 0
|
||||
%65 = insertvalue %any %64, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%65 = insertvalue %any %64, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %65, ptr %varargslots, align 16
|
||||
%66 = call i64 @std.io.printfn(ptr %retparam152, ptr @.str.16, i64 8, ptr %varargslots, i64 1)
|
||||
store %"char[]" { ptr @.str.19, i64 1 }, ptr %taddr156, align 8
|
||||
%67 = insertvalue %any undef, ptr %taddr156, 0
|
||||
%68 = insertvalue %any %67, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%68 = insertvalue %any %67, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %68, ptr %varargslots155, align 16
|
||||
store %"char[]" { ptr @.str.20, i64 3 }, ptr %taddr157, align 8
|
||||
%69 = insertvalue %any undef, ptr %taddr157, 0
|
||||
%70 = insertvalue %any %69, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%70 = insertvalue %any %69, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
%ptradd = getelementptr inbounds i8, ptr %varargslots155, i64 16
|
||||
store %any %70, ptr %ptradd, align 16
|
||||
%71 = call i64 @std.io.printfn(ptr %retparam158, ptr @.str.18, i64 6, ptr %varargslots155, i64 2)
|
||||
store %"char[]" { ptr @.str.22, i64 4 }, ptr %taddr162, align 8
|
||||
%72 = insertvalue %any undef, ptr %taddr162, 0
|
||||
%73 = insertvalue %any %72, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%73 = insertvalue %any %72, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %73, ptr %varargslots161, align 16
|
||||
store %"char[]" { ptr @.str.23, i64 4 }, ptr %taddr163, align 8
|
||||
%74 = insertvalue %any undef, ptr %taddr163, 0
|
||||
%75 = insertvalue %any %74, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%75 = insertvalue %any %74, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
%ptradd164 = getelementptr inbounds i8, ptr %varargslots161, i64 16
|
||||
store %any %75, ptr %ptradd164, align 16
|
||||
%76 = call i64 @std.io.printfn(ptr %retparam165, ptr @.str.21, i64 6, ptr %varargslots161, i64 2)
|
||||
store %"char[]" zeroinitializer, ptr %taddr169, align 8
|
||||
%77 = insertvalue %any undef, ptr %taddr169, 0
|
||||
%78 = insertvalue %any %77, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%78 = insertvalue %any %77, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %78, ptr %varargslots168, align 16
|
||||
store %"char[]" { ptr @.str.25, i64 5 }, ptr %taddr170, align 8
|
||||
%79 = insertvalue %any undef, ptr %taddr170, 0
|
||||
%80 = insertvalue %any %79, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%80 = insertvalue %any %79, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
%ptradd171 = getelementptr inbounds i8, ptr %varargslots168, i64 16
|
||||
store %any %80, ptr %ptradd171, align 16
|
||||
%81 = call i64 @std.io.printfn(ptr %retparam172, ptr @.str.24, i64 6, ptr %varargslots168, i64 2)
|
||||
store %"char[]" { ptr @.str.27, i64 1 }, ptr %taddr176, align 8
|
||||
%82 = insertvalue %any undef, ptr %taddr176, 0
|
||||
%83 = insertvalue %any %82, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%83 = insertvalue %any %82, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %83, ptr %varargslots175, align 16
|
||||
store %"char[]" { ptr @.str.28, i64 6 }, ptr %taddr177, align 8
|
||||
%84 = insertvalue %any undef, ptr %taddr177, 0
|
||||
%85 = insertvalue %any %84, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%85 = insertvalue %any %84, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
%ptradd178 = getelementptr inbounds i8, ptr %varargslots175, i64 16
|
||||
store %any %85, ptr %ptradd178, align 16
|
||||
%86 = call i64 @std.io.printfn(ptr %retparam179, ptr @.str.26, i64 6, ptr %varargslots175, i64 2)
|
||||
store %"char[]" { ptr @.str.30, i64 3 }, ptr %taddr183, align 8
|
||||
%87 = insertvalue %any undef, ptr %taddr183, 0
|
||||
%88 = insertvalue %any %87, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%88 = insertvalue %any %87, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %88, ptr %varargslots182, align 16
|
||||
%89 = call i64 @std.io.printfn(ptr %retparam184, ptr @.str.29, i64 8, ptr %varargslots182, i64 1)
|
||||
store %"char[]" { ptr @.str.32, i64 1 }, ptr %taddr188, align 8
|
||||
%90 = insertvalue %any undef, ptr %taddr188, 0
|
||||
%91 = insertvalue %any %90, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%91 = insertvalue %any %90, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %91, ptr %varargslots187, align 16
|
||||
store %"char[]" { ptr @.str.33, i64 4 }, ptr %taddr189, align 8
|
||||
%92 = insertvalue %any undef, ptr %taddr189, 0
|
||||
%93 = insertvalue %any %92, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%93 = insertvalue %any %92, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
%ptradd190 = getelementptr inbounds i8, ptr %varargslots187, i64 16
|
||||
store %any %93, ptr %ptradd190, align 16
|
||||
%94 = call i64 @std.io.printfn(ptr %retparam191, ptr @.str.31, i64 6, ptr %varargslots187, i64 2)
|
||||
store %"char[]" { ptr @.str.35, i64 1 }, ptr %taddr195, align 8
|
||||
%95 = insertvalue %any undef, ptr %taddr195, 0
|
||||
%96 = insertvalue %any %95, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%96 = insertvalue %any %95, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %96, ptr %varargslots194, align 16
|
||||
store %"char[]" { ptr @.str.36, i64 5 }, ptr %taddr196, align 8
|
||||
%97 = insertvalue %any undef, ptr %taddr196, 0
|
||||
%98 = insertvalue %any %97, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%98 = insertvalue %any %97, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
%ptradd197 = getelementptr inbounds i8, ptr %varargslots194, i64 16
|
||||
store %any %98, ptr %ptradd197, align 16
|
||||
%99 = call i64 @std.io.printfn(ptr %retparam198, ptr @.str.34, i64 6, ptr %varargslots194, i64 2)
|
||||
store %"char[]" zeroinitializer, ptr %taddr202, align 8
|
||||
%100 = insertvalue %any undef, ptr %taddr202, 0
|
||||
%101 = insertvalue %any %100, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%101 = insertvalue %any %100, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %101, ptr %varargslots201, align 16
|
||||
store %"char[]" { ptr @.str.38, i64 5 }, ptr %taddr203, align 8
|
||||
%102 = insertvalue %any undef, ptr %taddr203, 0
|
||||
%103 = insertvalue %any %102, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%103 = insertvalue %any %102, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
%ptradd204 = getelementptr inbounds i8, ptr %varargslots201, i64 16
|
||||
store %any %103, ptr %ptradd204, align 16
|
||||
%104 = call i64 @std.io.printfn(ptr %retparam205, ptr @.str.37, i64 6, ptr %varargslots201, i64 2)
|
||||
store %"char[]" { ptr @.str.40, i64 3 }, ptr %taddr209, align 8
|
||||
%105 = insertvalue %any undef, ptr %taddr209, 0
|
||||
%106 = insertvalue %any %105, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%106 = insertvalue %any %105, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %106, ptr %varargslots208, align 16
|
||||
store %"char[]" { ptr @.str.41, i64 3 }, ptr %taddr210, align 8
|
||||
%107 = insertvalue %any undef, ptr %taddr210, 0
|
||||
%108 = insertvalue %any %107, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%108 = insertvalue %any %107, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
%ptradd211 = getelementptr inbounds i8, ptr %varargslots208, i64 16
|
||||
store %any %108, ptr %ptradd211, align 16
|
||||
%109 = call i64 @std.io.printfn(ptr %retparam212, ptr @.str.39, i64 6, ptr %varargslots208, i64 2)
|
||||
store %"char[]" { ptr @.str.43, i64 4 }, ptr %taddr216, align 8
|
||||
%110 = insertvalue %any undef, ptr %taddr216, 0
|
||||
%111 = insertvalue %any %110, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%111 = insertvalue %any %110, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %111, ptr %varargslots215, align 16
|
||||
%112 = call i64 @std.io.printfn(ptr %retparam217, ptr @.str.42, i64 8, ptr %varargslots215, i64 1)
|
||||
store %"char[]" { ptr @.str.45, i64 1 }, ptr %taddr221, align 8
|
||||
%113 = insertvalue %any undef, ptr %taddr221, 0
|
||||
%114 = insertvalue %any %113, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%114 = insertvalue %any %113, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %114, ptr %varargslots220, align 16
|
||||
store %"char[]" { ptr @.str.46, i64 3 }, ptr %taddr222, align 8
|
||||
%115 = insertvalue %any undef, ptr %taddr222, 0
|
||||
%116 = insertvalue %any %115, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%116 = insertvalue %any %115, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
%ptradd223 = getelementptr inbounds i8, ptr %varargslots220, i64 16
|
||||
store %any %116, ptr %ptradd223, align 16
|
||||
%117 = call i64 @std.io.printfn(ptr %retparam224, ptr @.str.44, i64 6, ptr %varargslots220, i64 2)
|
||||
store %"char[]" { ptr @.str.48, i64 1 }, ptr %taddr228, align 8
|
||||
%118 = insertvalue %any undef, ptr %taddr228, 0
|
||||
%119 = insertvalue %any %118, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%119 = insertvalue %any %118, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %119, ptr %varargslots227, align 16
|
||||
store %"char[]" { ptr @.str.49, i64 5 }, ptr %taddr229, align 8
|
||||
%120 = insertvalue %any undef, ptr %taddr229, 0
|
||||
%121 = insertvalue %any %120, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%121 = insertvalue %any %120, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
%ptradd230 = getelementptr inbounds i8, ptr %varargslots227, i64 16
|
||||
store %any %121, ptr %ptradd230, align 16
|
||||
%122 = call i64 @std.io.printfn(ptr %retparam231, ptr @.str.47, i64 6, ptr %varargslots227, i64 2)
|
||||
|
||||
@@ -237,7 +237,7 @@ entry:
|
||||
store <4 x float> %5, ptr %x3, align 16
|
||||
%6 = load ptr, ptr %out2, align 8, !dbg !94
|
||||
%7 = insertvalue %any undef, ptr %6, 0, !dbg !94
|
||||
%8 = insertvalue %any %7, i64 ptrtoint (ptr @"$ct.std::io.File" to i64), 1, !dbg !94
|
||||
%8 = insertvalue %any %7, i64 ptrtoint (ptr @"$ct.std.io.File" to i64), 1, !dbg !94
|
||||
%9 = insertvalue %any undef, ptr %x3, 0, !dbg !97
|
||||
%10 = insertvalue %any %9, i64 ptrtoint (ptr @"$ct.foo.Color" to i64), 1, !dbg !97
|
||||
store %any %10, ptr %varargslots, align 16, !dbg !97
|
||||
|
||||
@@ -34,17 +34,17 @@ entry:
|
||||
%retparam6 = alloca i64, align 8
|
||||
store %"char[]" { ptr @.str.2, i64 3 }, ptr %taddr, align 8
|
||||
%0 = insertvalue %any undef, ptr %taddr, 0
|
||||
%1 = insertvalue %any %0, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%1 = insertvalue %any %0, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %1, ptr %varargslots, align 16
|
||||
%2 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.1, i64 2, ptr %varargslots, i64 1)
|
||||
store %"char[]" { ptr @.str.4, i64 6 }, ptr %taddr2, align 8
|
||||
%3 = insertvalue %any undef, ptr %taddr2, 0
|
||||
%4 = insertvalue %any %3, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%4 = insertvalue %any %3, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %4, ptr %varargslots1, align 16
|
||||
%5 = call i64 @std.io.printfn(ptr %retparam3, ptr @.str.3, i64 2, ptr %varargslots1, i64 1)
|
||||
store %"char[]" { ptr @.str.6, i64 6 }, ptr %taddr5, align 8
|
||||
%6 = insertvalue %any undef, ptr %taddr5, 0
|
||||
%7 = insertvalue %any %6, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%7 = insertvalue %any %6, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %7, ptr %varargslots4, align 16
|
||||
%8 = call i64 @std.io.printfn(ptr %retparam6, ptr @.str.5, i64 2, ptr %varargslots4, i64 1)
|
||||
ret i32 0
|
||||
|
||||
@@ -27,8 +27,8 @@ fn void main()
|
||||
@.str.2 = private unnamed_addr constant [4 x i8] c"BAZ\00", align 1
|
||||
@.__const = private unnamed_addr constant [2 x %"char[]"] [%"char[]" { ptr @.str, i64 3 }, %"char[]" { ptr @.str.2, i64 3 }], align 16
|
||||
@.str.3 = private unnamed_addr constant [14 x i8] c"Foo.names: %s\00", align 1
|
||||
@"$ct.sa$$.String" = linkonce global %.introspect { i8 16, i64 0, ptr null, i64 16, i64 ptrtoint (ptr @"$ct.$.String" to i64), i64 0, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.$.String" = linkonce global %.introspect { i8 18, i64 ptrtoint (ptr @"$ct.sa$char" to i64), ptr null, i64 16, i64 ptrtoint (ptr @"$ct.sa$char" to i64), i64 0, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.sa$String" = linkonce global %.introspect { i8 16, i64 0, ptr null, i64 16, i64 ptrtoint (ptr @"$ct.String" to i64), i64 0, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.String" = linkonce global %.introspect { i8 18, i64 ptrtoint (ptr @"$ct.sa$char" to i64), ptr null, i64 16, i64 ptrtoint (ptr @"$ct.sa$char" to i64), i64 0, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.sa$char" = linkonce global %.introspect { i8 16, i64 0, ptr null, i64 16, i64 ptrtoint (ptr @"$ct.char" to i64), i64 0, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.char" = linkonce global %.introspect { i8 3, i64 0, ptr null, i64 1, i64 0, i64 0, [0 x i64] zeroinitializer }, align 8
|
||||
@.str.4 = private unnamed_addr constant [15 x i8] c"Foo.values: %s\00", align 1
|
||||
@@ -55,7 +55,7 @@ entry:
|
||||
%1 = insertvalue %"char[][]" %0, i64 2, 1
|
||||
store %"char[][]" %1, ptr %x, align 8
|
||||
%2 = insertvalue %any undef, ptr %x, 0
|
||||
%3 = insertvalue %any %2, i64 ptrtoint (ptr @"$ct.sa$$.String" to i64), 1
|
||||
%3 = insertvalue %any %2, i64 ptrtoint (ptr @"$ct.sa$String" to i64), 1
|
||||
store %any %3, ptr %varargslots, align 16
|
||||
%4 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.3, i64 13, ptr %varargslots, i64 1)
|
||||
call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal2, ptr align 16 @.__const.5, i32 16, i1 false)
|
||||
|
||||
@@ -25,7 +25,7 @@ entry:
|
||||
store i64 ptrtoint (ptr @"test.Cde$WORLD" to i64), ptr %x, align 8
|
||||
store %"char[]" { ptr @.str.2, i64 5 }, ptr %taddr, align 8
|
||||
%0 = insertvalue %any undef, ptr %taddr, 0
|
||||
%1 = insertvalue %any %0, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%1 = insertvalue %any %0, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %1, ptr %varargslots, align 16
|
||||
%2 = load i64, ptr %x, align 8
|
||||
%eq = icmp eq i64 %2, 0
|
||||
@@ -43,7 +43,7 @@ faultname_ok: ; preds = %entry
|
||||
faultname_exit: ; preds = %faultname_ok, %faultname_no
|
||||
%faultname = phi ptr [ %faultname_zero, %faultname_no ], [ %4, %faultname_ok ]
|
||||
%5 = insertvalue %any undef, ptr %faultname, 0
|
||||
%6 = insertvalue %any %5, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%6 = insertvalue %any %5, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
%ptradd = getelementptr inbounds i8, ptr %varargslots, i64 16
|
||||
store %any %6, ptr %ptradd, align 16
|
||||
%7 = call i64 @std.io.printf(ptr %retparam, ptr @.str, i64 6, ptr %varargslots, i64 2)
|
||||
|
||||
@@ -37,7 +37,7 @@ fn void main()
|
||||
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
|
||||
@.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
|
||||
@.str.4 = private unnamed_addr constant [12 x i8] c"fn int(int)\00", align 1
|
||||
@"$ct.$.String" = linkonce global %.introspect { i8 18, i64 ptrtoint (ptr @"$ct.sa$char" to i64), ptr null, i64 16, i64 ptrtoint (ptr @"$ct.sa$char" to i64), i64 0, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.String" = linkonce global %.introspect { i8 18, i64 ptrtoint (ptr @"$ct.sa$char" to i64), ptr null, i64 16, i64 ptrtoint (ptr @"$ct.sa$char" to i64), i64 0, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.sa$char" = linkonce global %.introspect { i8 16, i64 0, ptr null, i64 16, i64 ptrtoint (ptr @"$ct.char" to i64), i64 0, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.char" = linkonce global %.introspect { i8 3, i64 0, ptr null, i64 1, i64 0, i64 0, [0 x i64] zeroinitializer }, align 8
|
||||
@.str.5 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
|
||||
@@ -106,27 +106,27 @@ entry:
|
||||
%13 = call i64 @std.io.printfn(ptr %retparam6, ptr @.str.2, i64 2, ptr %varargslots4, i64 1)
|
||||
store %"char[]" { ptr @.str.4, i64 11 }, ptr %taddr8, align 8
|
||||
%14 = insertvalue %any undef, ptr %taddr8, 0
|
||||
%15 = insertvalue %any %14, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%15 = insertvalue %any %14, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %15, ptr %varargslots7, align 16
|
||||
%16 = call i64 @std.io.printfn(ptr %retparam9, ptr @.str.3, i64 2, ptr %varargslots7, i64 1)
|
||||
store %"char[]" { ptr @.str.6, i64 11 }, ptr %taddr11, align 8
|
||||
%17 = insertvalue %any undef, ptr %taddr11, 0
|
||||
%18 = insertvalue %any %17, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%18 = insertvalue %any %17, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %18, ptr %varargslots10, align 16
|
||||
%19 = call i64 @std.io.printfn(ptr %retparam12, ptr @.str.5, i64 2, ptr %varargslots10, i64 1)
|
||||
store %"char[]" { ptr @.str.8, i64 11 }, ptr %taddr14, align 8
|
||||
%20 = insertvalue %any undef, ptr %taddr14, 0
|
||||
%21 = insertvalue %any %20, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%21 = insertvalue %any %20, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %21, ptr %varargslots13, align 16
|
||||
%22 = call i64 @std.io.printfn(ptr %retparam15, ptr @.str.7, i64 2, ptr %varargslots13, i64 1)
|
||||
store %"char[]" { ptr @.str.10, i64 11 }, ptr %taddr17, align 8
|
||||
%23 = insertvalue %any undef, ptr %taddr17, 0
|
||||
%24 = insertvalue %any %23, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%24 = insertvalue %any %23, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %24, ptr %varargslots16, align 16
|
||||
%25 = call i64 @std.io.printfn(ptr %retparam18, ptr @.str.9, i64 2, ptr %varargslots16, i64 1)
|
||||
store %"char[]" { ptr @.str.12, i64 12 }, ptr %taddr20, align 8
|
||||
%26 = insertvalue %any undef, ptr %taddr20, 0
|
||||
%27 = insertvalue %any %26, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%27 = insertvalue %any %26, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %27, ptr %varargslots19, align 16
|
||||
%28 = call i64 @std.io.printfn(ptr %retparam21, ptr @.str.11, i64 2, ptr %varargslots19, i64 1)
|
||||
store ptr @test.test2, ptr %y, align 8
|
||||
|
||||
@@ -428,15 +428,15 @@ entry:
|
||||
%2 = call i32 @test.test_static()
|
||||
call void @hello_world.hello()
|
||||
call void @llvm.memset.p0.i64(ptr align 8 %list, i8 0, i64 40, i1 false)
|
||||
call void @"std.collections.linkedlist$int$.LinkedList.push"(ptr %list, i32 10)
|
||||
call void @"std.collections.linkedlist$int$.LinkedList.push"(ptr %list, i32 15)
|
||||
call void @"std.collections.linkedlist$int$.LinkedList.push"(ptr %list, i32 30)
|
||||
call void @"std_collections_linkedlist$int$.LinkedList.push"(ptr %list, i32 10)
|
||||
call void @"std_collections_linkedlist$int$.LinkedList.push"(ptr %list, i32 15)
|
||||
call void @"std_collections_linkedlist$int$.LinkedList.push"(ptr %list, i32 30)
|
||||
store i32 0, ptr %i, align 4
|
||||
br label %loop.cond
|
||||
|
||||
loop.cond: ; preds = %loop.body, %entry
|
||||
%3 = load i32, ptr %i, align 4
|
||||
%4 = call i64 @"std.collections.linkedlist$int$.LinkedList.len"(ptr %list) #3
|
||||
%4 = call i64 @"std_collections_linkedlist$int$.LinkedList.len"(ptr %list) #3
|
||||
%trunc = trunc i64 %4 to i32
|
||||
%lt = icmp slt i32 %3, %trunc
|
||||
br i1 %lt, label %loop.body, label %loop.exit
|
||||
@@ -444,7 +444,7 @@ loop.cond: ; preds = %loop.body, %entry
|
||||
loop.body: ; preds = %loop.cond
|
||||
%5 = load i32, ptr %i, align 4
|
||||
%sext = sext i32 %5 to i64
|
||||
%6 = call i32 @"std.collections.linkedlist$int$.LinkedList.get"(ptr %list, i64 %sext)
|
||||
%6 = call i32 @"std_collections_linkedlist$int$.LinkedList.get"(ptr %list, i64 %sext)
|
||||
%7 = load i32, ptr %i, align 4
|
||||
%8 = call i32 (ptr, ...) @printf(ptr @.str.2, i32 %7, i32 %6)
|
||||
%9 = load i32, ptr %i, align 4
|
||||
@@ -453,22 +453,22 @@ loop.body: ; preds = %loop.cond
|
||||
br label %loop.cond
|
||||
|
||||
loop.exit: ; preds = %loop.cond
|
||||
call void @"std.collections.linkedlist$int$.LinkedList.free"(ptr %list)
|
||||
call void @"std_collections_linkedlist$int$.LinkedList.free"(ptr %list)
|
||||
%10 = call i32 (ptr, ...) @printf(ptr @.str.3, i32 3)
|
||||
store i32 3, ptr %elements, align 4
|
||||
%11 = call i32 (ptr, ...) @printf(ptr @.str.4)
|
||||
call void @llvm.memset.p0.i64(ptr align 8 %array, i8 0, i64 40, i1 false)
|
||||
call void @"std.collections.list$int$.List.push"(ptr %array, i32 100)
|
||||
call void @"std.collections.list$int$.List.push"(ptr %array, i32 200)
|
||||
call void @"std.collections.list$int$.List.push"(ptr %array, i32 400)
|
||||
call void @"std.collections.list$int$.List.push"(ptr %array, i32 600) #3
|
||||
call void @"std.collections.list$int$.List.insert_at"(ptr %array, i64 2, i32 300)
|
||||
call void @"std_collections_list$int$.List.push"(ptr %array, i32 100)
|
||||
call void @"std_collections_list$int$.List.push"(ptr %array, i32 200)
|
||||
call void @"std_collections_list$int$.List.push"(ptr %array, i32 400)
|
||||
call void @"std_collections_list$int$.List.push"(ptr %array, i32 600) #3
|
||||
call void @"std_collections_list$int$.List.insert_at"(ptr %array, i64 2, i32 300)
|
||||
store i32 0, ptr %i1, align 4
|
||||
br label %loop.cond2
|
||||
|
||||
loop.cond2: ; preds = %loop.body5, %loop.exit
|
||||
%12 = load i32, ptr %i1, align 4
|
||||
%13 = call i64 @"std.collections.list$int$.List.len"(ptr %array) #3
|
||||
%13 = call i64 @"std_collections_list$int$.List.len"(ptr %array) #3
|
||||
%trunc3 = trunc i64 %13 to i32
|
||||
%lt4 = icmp slt i32 %12, %trunc3
|
||||
br i1 %lt4, label %loop.body5, label %loop.exit8
|
||||
@@ -476,7 +476,7 @@ loop.cond2: ; preds = %loop.body5, %loop.e
|
||||
loop.body5: ; preds = %loop.cond2
|
||||
%14 = load i32, ptr %i1, align 4
|
||||
%sext6 = sext i32 %14 to i64
|
||||
%15 = call i32 @"std.collections.list$int$.List.get"(ptr %array, i64 %sext6) #3
|
||||
%15 = call i32 @"std_collections_list$int$.List.get"(ptr %array, i64 %sext6) #3
|
||||
%16 = load i32, ptr %i1, align 4
|
||||
%17 = call i32 (ptr, ...) @printf(ptr @.str.5, i32 %16, i32 %15)
|
||||
%18 = load i32, ptr %i1, align 4
|
||||
@@ -485,7 +485,7 @@ loop.body5: ; preds = %loop.cond2
|
||||
br label %loop.cond2
|
||||
|
||||
loop.exit8: ; preds = %loop.cond2
|
||||
call void @"std.collections.list$int$.List.free"(ptr %array)
|
||||
call void @"std_collections_list$int$.List.free"(ptr %array)
|
||||
call void @llvm.memcpy.p0.p0.i32(ptr align 4 %a, ptr align 4 @.__const.6, i32 4, i1 false)
|
||||
call void @llvm.memcpy.p0.p0.i32(ptr align 8 %b, ptr align 8 @.__const.7, i32 8, i1 false)
|
||||
%19 = load i32, ptr %a, align 4
|
||||
|
||||
@@ -472,15 +472,15 @@ entry:
|
||||
%2 = call i32 @test.test_static()
|
||||
call void @hello_world.hello()
|
||||
call void @llvm.memset.p0.i64(ptr align 8 %list, i8 0, i64 40, i1 false)
|
||||
call void @"std.collections.linkedlist$int$.LinkedList.push"(ptr %list, i32 10)
|
||||
call void @"std.collections.linkedlist$int$.LinkedList.push"(ptr %list, i32 15)
|
||||
call void @"std.collections.linkedlist$int$.LinkedList.push"(ptr %list, i32 30)
|
||||
call void @"std_collections_linkedlist$int$.LinkedList.push"(ptr %list, i32 10)
|
||||
call void @"std_collections_linkedlist$int$.LinkedList.push"(ptr %list, i32 15)
|
||||
call void @"std_collections_linkedlist$int$.LinkedList.push"(ptr %list, i32 30)
|
||||
store i32 0, ptr %i, align 4
|
||||
br label %loop.cond
|
||||
|
||||
loop.cond: ; preds = %loop.body, %entry
|
||||
%3 = load i32, ptr %i, align 4
|
||||
%4 = call i64 @"std.collections.linkedlist$int$.LinkedList.len"(ptr %list) #3
|
||||
%4 = call i64 @"std_collections_linkedlist$int$.LinkedList.len"(ptr %list) #3
|
||||
%trunc = trunc i64 %4 to i32
|
||||
%lt = icmp slt i32 %3, %trunc
|
||||
br i1 %lt, label %loop.body, label %loop.exit
|
||||
@@ -488,7 +488,7 @@ loop.cond: ; preds = %loop.body, %entry
|
||||
loop.body: ; preds = %loop.cond
|
||||
%5 = load i32, ptr %i, align 4
|
||||
%sext = sext i32 %5 to i64
|
||||
%6 = call i32 @"std.collections.linkedlist$int$.LinkedList.get"(ptr %list, i64 %sext)
|
||||
%6 = call i32 @"std_collections_linkedlist$int$.LinkedList.get"(ptr %list, i64 %sext)
|
||||
%7 = load i32, ptr %i, align 4
|
||||
%8 = call i32 (ptr, ...) @printf(ptr @.str.2, i32 %7, i32 %6)
|
||||
%9 = load i32, ptr %i, align 4
|
||||
@@ -497,22 +497,22 @@ loop.body: ; preds = %loop.cond
|
||||
br label %loop.cond
|
||||
|
||||
loop.exit: ; preds = %loop.cond
|
||||
call void @"std.collections.linkedlist$int$.LinkedList.free"(ptr %list)
|
||||
call void @"std_collections_linkedlist$int$.LinkedList.free"(ptr %list)
|
||||
%10 = call i32 (ptr, ...) @printf(ptr @.str.3, i32 3)
|
||||
store i32 3, ptr %elements, align 4
|
||||
%11 = call i32 (ptr, ...) @printf(ptr @.str.4)
|
||||
call void @llvm.memset.p0.i64(ptr align 8 %array, i8 0, i64 40, i1 false)
|
||||
call void @"std.collections.list$int$.List.push"(ptr %array, i32 100)
|
||||
call void @"std.collections.list$int$.List.push"(ptr %array, i32 200)
|
||||
call void @"std.collections.list$int$.List.push"(ptr %array, i32 400)
|
||||
call void @"std.collections.list$int$.List.push"(ptr %array, i32 600) #3
|
||||
call void @"std.collections.list$int$.List.insert_at"(ptr %array, i64 2, i32 300)
|
||||
call void @"std_collections_list$int$.List.push"(ptr %array, i32 100)
|
||||
call void @"std_collections_list$int$.List.push"(ptr %array, i32 200)
|
||||
call void @"std_collections_list$int$.List.push"(ptr %array, i32 400)
|
||||
call void @"std_collections_list$int$.List.push"(ptr %array, i32 600) #3
|
||||
call void @"std_collections_list$int$.List.insert_at"(ptr %array, i64 2, i32 300)
|
||||
store i32 0, ptr %i1, align 4
|
||||
br label %loop.cond2
|
||||
|
||||
loop.cond2: ; preds = %loop.body5, %loop.exit
|
||||
%12 = load i32, ptr %i1, align 4
|
||||
%13 = call i64 @"std.collections.list$int$.List.len"(ptr %array) #3
|
||||
%13 = call i64 @"std_collections_list$int$.List.len"(ptr %array) #3
|
||||
%trunc3 = trunc i64 %13 to i32
|
||||
%lt4 = icmp slt i32 %12, %trunc3
|
||||
br i1 %lt4, label %loop.body5, label %loop.exit8
|
||||
@@ -520,7 +520,7 @@ loop.cond2: ; preds = %loop.body5, %loop.e
|
||||
loop.body5: ; preds = %loop.cond2
|
||||
%14 = load i32, ptr %i1, align 4
|
||||
%sext6 = sext i32 %14 to i64
|
||||
%15 = call i32 @"std.collections.list$int$.List.get"(ptr %array, i64 %sext6) #3
|
||||
%15 = call i32 @"std_collections_list$int$.List.get"(ptr %array, i64 %sext6) #3
|
||||
%16 = load i32, ptr %i1, align 4
|
||||
%17 = call i32 (ptr, ...) @printf(ptr @.str.5, i32 %16, i32 %15)
|
||||
%18 = load i32, ptr %i1, align 4
|
||||
@@ -529,7 +529,7 @@ loop.body5: ; preds = %loop.cond2
|
||||
br label %loop.cond2
|
||||
|
||||
loop.exit8: ; preds = %loop.cond2
|
||||
call void @"std.collections.list$int$.List.free"(ptr %array)
|
||||
call void @"std_collections_list$int$.List.free"(ptr %array)
|
||||
call void @llvm.memcpy.p0.p0.i32(ptr align 4 %a, ptr align 4 @.__const.6, i32 4, i1 false)
|
||||
call void @llvm.memcpy.p0.p0.i32(ptr align 8 %b, ptr align 8 @.__const.7, i32 8, i1 false)
|
||||
%19 = load i32, ptr %a, align 4
|
||||
@@ -599,15 +599,15 @@ loop.exit8: ; preds = %loop.cond2
|
||||
declare void @llvm.memcpy.p0.p0.i32(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i32, i1 immarg) #1
|
||||
declare void @hello_world.hello() #0
|
||||
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
|
||||
declare void @"std.collections.linkedlist$int$.LinkedList.push"(ptr, i32) #0
|
||||
declare i64 @"std.collections.linkedlist$int$.LinkedList.len"(ptr) #0
|
||||
declare i32 @"std.collections.linkedlist$int$.LinkedList.get"(ptr, i64) #0
|
||||
declare void @"std.collections.linkedlist$int$.LinkedList.free"(ptr) #0
|
||||
declare void @"std.collections.list$int$.List.push"(ptr, i32) #0
|
||||
declare void @"std.collections.list$int$.List.insert_at"(ptr, i64, i32) #0
|
||||
declare i64 @"std.collections.list$int$.List.len"(ptr) #0
|
||||
declare i32 @"std.collections.list$int$.List.get"(ptr, i64) #0
|
||||
declare void @"std.collections.list$int$.List.free"(ptr) #0
|
||||
declare void @"std_collections_linkedlist$int$.LinkedList.push"(ptr, i32) #0
|
||||
declare i64 @"std_collections_linkedlist$int$.LinkedList.len"(ptr) #0
|
||||
declare i32 @"std_collections_linkedlist$int$.LinkedList.get"(ptr, i64) #0
|
||||
declare void @"std_collections_linkedlist$int$.LinkedList.free"(ptr) #0
|
||||
declare void @"std_collections_list$int$.List.push"(ptr, i32) #0
|
||||
declare void @"std_collections_list$int$.List.insert_at"(ptr, i64, i32) #0
|
||||
declare i64 @"std_collections_list$int$.List.len"(ptr) #0
|
||||
declare i32 @"std_collections_list$int$.List.get"(ptr, i64) #0
|
||||
declare void @"std_collections_list$int$.List.free"(ptr) #0
|
||||
declare i32 @"test2$int$.getValue"(i32) #0
|
||||
declare double @"test2$double$.getValue"(i64) #0
|
||||
declare i32 @"test2$int$.getMult"(i32) #0
|
||||
|
||||
@@ -47,21 +47,21 @@ entry:
|
||||
%taddr11 = alloca i8, align 1
|
||||
%retparam12 = alloca i64, align 8
|
||||
store i32 0, ptr %set, align 4
|
||||
%0 = call i8 @"std.collections.enumset$test.Abc$.EnumSet.has"(ptr %set, i32 1)
|
||||
%0 = call i8 @"std_collections_enumset$test.Abc$.EnumSet.has"(ptr %set, i32 1)
|
||||
store i8 %0, ptr %taddr, align 1
|
||||
%1 = insertvalue %any undef, ptr %taddr, 0
|
||||
%2 = insertvalue %any %1, i64 ptrtoint (ptr @"$ct.bool" to i64), 1
|
||||
store %any %2, ptr %varargslots, align 16
|
||||
%3 = call i64 @std.io.printf(ptr %retparam, ptr @.str, i64 14, ptr %varargslots, i64 1)
|
||||
call void @"std.collections.enumset$test.Abc$.EnumSet.add"(ptr %set, i32 0)
|
||||
%4 = call i8 @"std.collections.enumset$test.Abc$.EnumSet.has"(ptr %set, i32 1)
|
||||
call void @"std_collections_enumset$test.Abc$.EnumSet.add"(ptr %set, i32 0)
|
||||
%4 = call i8 @"std_collections_enumset$test.Abc$.EnumSet.has"(ptr %set, i32 1)
|
||||
store i8 %4, ptr %taddr2, align 1
|
||||
%5 = insertvalue %any undef, ptr %taddr2, 0
|
||||
%6 = insertvalue %any %5, i64 ptrtoint (ptr @"$ct.bool" to i64), 1
|
||||
store %any %6, ptr %varargslots1, align 16
|
||||
%7 = call i64 @std.io.printf(ptr %retparam3, ptr @.str.1, i64 14, ptr %varargslots1, i64 1)
|
||||
call void @"std.collections.enumset$test.Abc$.EnumSet.add"(ptr %set, i32 1)
|
||||
%8 = call i8 @"std.collections.enumset$test.Abc$.EnumSet.has"(ptr %set, i32 1)
|
||||
call void @"std_collections_enumset$test.Abc$.EnumSet.add"(ptr %set, i32 1)
|
||||
%8 = call i8 @"std_collections_enumset$test.Abc$.EnumSet.has"(ptr %set, i32 1)
|
||||
store i8 %8, ptr %taddr5, align 1
|
||||
%9 = insertvalue %any undef, ptr %taddr5, 0
|
||||
%10 = insertvalue %any %9, i64 ptrtoint (ptr @"$ct.bool" to i64), 1
|
||||
@@ -69,16 +69,16 @@ entry:
|
||||
%11 = call i64 @std.io.printf(ptr %retparam6, ptr @.str.2, i64 14, ptr %varargslots4, i64 1)
|
||||
store i32 0, ptr %set2, align 4
|
||||
%12 = load i32, ptr %set, align 4
|
||||
call void @"std.collections.enumset$test.Abc$.EnumSet.add_all"(ptr %set2, i32 %12)
|
||||
%13 = call i8 @"std.collections.enumset$test.Abc$.EnumSet.has"(ptr %set2, i32 1)
|
||||
call void @"std_collections_enumset$test.Abc$.EnumSet.add_all"(ptr %set2, i32 %12)
|
||||
%13 = call i8 @"std_collections_enumset$test.Abc$.EnumSet.has"(ptr %set2, i32 1)
|
||||
store i8 %13, ptr %taddr8, align 1
|
||||
%14 = insertvalue %any undef, ptr %taddr8, 0
|
||||
%15 = insertvalue %any %14, i64 ptrtoint (ptr @"$ct.bool" to i64), 1
|
||||
store %any %15, ptr %varargslots7, align 16
|
||||
%16 = call i64 @std.io.printf(ptr %retparam9, ptr @.str.3, i64 14, ptr %varargslots7, i64 1)
|
||||
%17 = load i32, ptr %set2, align 4
|
||||
call void @"std.collections.enumset$test.Abc$.EnumSet.remove_all"(ptr %set, i32 %17)
|
||||
%18 = call i8 @"std.collections.enumset$test.Abc$.EnumSet.has"(ptr %set, i32 1)
|
||||
call void @"std_collections_enumset$test.Abc$.EnumSet.remove_all"(ptr %set, i32 %17)
|
||||
%18 = call i8 @"std_collections_enumset$test.Abc$.EnumSet.has"(ptr %set, i32 1)
|
||||
store i8 %18, ptr %taddr11, align 1
|
||||
%19 = insertvalue %any undef, ptr %taddr11, 0
|
||||
%20 = insertvalue %any %19, i64 ptrtoint (ptr @"$ct.bool" to i64), 1
|
||||
|
||||
@@ -194,7 +194,7 @@ if.then: ; preds = %entry
|
||||
if.exit: ; preds = %if.then, %entry
|
||||
%1 = load ptr, ptr @std.core.mem.allocator.thread_temp_allocator, align 8
|
||||
%2 = insertvalue %any undef, ptr %1, 0
|
||||
%3 = insertvalue %any %2, i64 ptrtoint (ptr @"$ct.std::core::mem::allocator.TempAllocator" to i64), 1
|
||||
%3 = insertvalue %any %2, i64 ptrtoint (ptr @"$ct.std.core.mem.allocator.TempAllocator" to i64), 1
|
||||
%lo = load ptr, ptr %foo_tmpl, align 8
|
||||
%ptradd = getelementptr inbounds i8, ptr %foo_tmpl, i64 8
|
||||
%hi = load i64, ptr %ptradd, align 8
|
||||
|
||||
@@ -184,7 +184,7 @@ voiderr36: ; preds = %noerr_block34, %gua
|
||||
store i32 %add46, ptr %26, align 4
|
||||
store %"char[]" { ptr @.str.5, i64 3 }, ptr %taddr, align 8
|
||||
%28 = insertvalue %any undef, ptr %taddr, 0
|
||||
%29 = insertvalue %any %28, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%29 = insertvalue %any %28, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %29, ptr %varargslots47, align 16
|
||||
%30 = call i64 @std.io.printfn(ptr %retparam48, ptr @.str.4, i64 16, ptr %varargslots47, i64 1)
|
||||
%31 = insertvalue %any undef, ptr %b, 0
|
||||
|
||||
@@ -142,13 +142,13 @@ entry:
|
||||
store i32 0, ptr %x, align 4
|
||||
store %"char[]" { ptr @.str.6, i64 3 }, ptr %taddr12, align 8
|
||||
%18 = insertvalue %any undef, ptr %taddr12, 0
|
||||
%19 = insertvalue %any %18, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%19 = insertvalue %any %18, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %19, ptr %varargslots11, align 16
|
||||
%20 = call i64 @std.io.printfn(ptr %retparam13, ptr @.str.5, i64 2, ptr %varargslots11, i64 1)
|
||||
store double 0.000000e+00, ptr %x14, align 8
|
||||
store %"char[]" { ptr @.str.8, i64 6 }, ptr %taddr16, align 8
|
||||
%21 = insertvalue %any undef, ptr %taddr16, 0
|
||||
%22 = insertvalue %any %21, i64 ptrtoint (ptr @"$ct.$.String" to i64), 1
|
||||
%22 = insertvalue %any %21, i64 ptrtoint (ptr @"$ct.String" to i64), 1
|
||||
store %any %22, ptr %varargslots15, align 16
|
||||
%23 = call i64 @std.io.printfn(ptr %retparam17, ptr @.str.7, i64 2, ptr %varargslots15, i64 1)
|
||||
store i32 105, ptr %taddr19, align 4
|
||||
|
||||
@@ -37,7 +37,7 @@ entry:
|
||||
store ptr null, ptr %.cachedtype, align 8
|
||||
call void @llvm.memset.p0.i64(ptr align 8 %r, i8 0, i64 24, i1 false)
|
||||
%0 = insertvalue %any undef, ptr %r, 0
|
||||
%1 = insertvalue %any %0, i64 ptrtoint (ptr @"$ct.std::io.ByteReader" to i64), 1
|
||||
%1 = insertvalue %any %0, i64 ptrtoint (ptr @"$ct.std.io.ByteReader" to i64), 1
|
||||
store %any %1, ptr %s, align 8
|
||||
%ptradd = getelementptr inbounds i8, ptr %s, i64 8
|
||||
%2 = load i64, ptr %ptradd, align 8
|
||||
|
||||
@@ -18,7 +18,7 @@ define void @test.main() #0 {
|
||||
entry:
|
||||
%map = alloca %HashMap, align 8
|
||||
call void @llvm.memset.p0.i64(ptr align 8 %map, i8 0, i64 48, i1 false)
|
||||
%0 = call i8 @"std.collections.map$sa$char$int$.HashMap.set"(ptr %map, ptr @.str, i64 5, i32 4)
|
||||
%1 = call i8 @"std.collections.map$sa$char$int$.HashMap.set"(ptr %map, ptr @.str.1, i64 3, i32 5)
|
||||
%0 = call i8 @"std_collections_map$sa$char$int$.HashMap.set"(ptr %map, ptr @.str, i64 5, i32 4)
|
||||
%1 = call i8 @"std_collections_map$sa$char$int$.HashMap.set"(ptr %map, ptr @.str.1, i64 3, i32 5)
|
||||
ret void
|
||||
}
|
||||
@@ -133,7 +133,7 @@ entry:
|
||||
call void @llvm.memset.p0.i64(ptr align 8 %map, i8 0, i64 48, i1 false)
|
||||
%lo = load i64, ptr @std.core.mem.allocator.thread_allocator, align 8
|
||||
%hi = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.allocator.thread_allocator, i64 8), align 8
|
||||
%0 = call ptr @"std.collections.map$int$test.Foo$.HashMap.new_init"(ptr %map, i32 16, float 7.500000e-01, i64 %lo, ptr %hi)
|
||||
%0 = call ptr @"std_collections_map$int$test.Foo$.HashMap.new_init"(ptr %map, i32 16, float 7.500000e-01, i64 %lo, ptr %hi)
|
||||
%ptradd = getelementptr inbounds i8, ptr %map, i64 32
|
||||
%1 = insertvalue %any undef, ptr %ptradd, 0
|
||||
%2 = insertvalue %any %1, i64 ptrtoint (ptr @"$ct.uint" to i64), 1
|
||||
@@ -143,7 +143,7 @@ entry:
|
||||
%lo1 = load i32, ptr %literal, align 8
|
||||
%ptradd2 = getelementptr inbounds i8, ptr %literal, i64 8
|
||||
%hi3 = load ptr, ptr %ptradd2, align 8
|
||||
%4 = call i8 @"std.collections.map$int$test.Foo$.HashMap.set"(ptr %map, i32 1, i32 %lo1, ptr %hi3)
|
||||
%4 = call i8 @"std_collections_map$int$test.Foo$.HashMap.set"(ptr %map, i32 1, i32 %lo1, ptr %hi3)
|
||||
%ptradd5 = getelementptr inbounds i8, ptr %map, i64 32
|
||||
%5 = insertvalue %any undef, ptr %ptradd5, 0
|
||||
%6 = insertvalue %any %5, i64 ptrtoint (ptr @"$ct.uint" to i64), 1
|
||||
@@ -153,13 +153,13 @@ entry:
|
||||
%lo8 = load i32, ptr %literal7, align 8
|
||||
%ptradd9 = getelementptr inbounds i8, ptr %literal7, i64 8
|
||||
%hi10 = load ptr, ptr %ptradd9, align 8
|
||||
%8 = call i8 @"std.collections.map$int$test.Foo$.HashMap.set"(ptr %map, i32 1, i32 %lo8, ptr %hi10)
|
||||
%8 = call i8 @"std_collections_map$int$test.Foo$.HashMap.set"(ptr %map, i32 1, i32 %lo8, ptr %hi10)
|
||||
%ptradd12 = getelementptr inbounds i8, ptr %map, i64 32
|
||||
%9 = insertvalue %any undef, ptr %ptradd12, 0
|
||||
%10 = insertvalue %any %9, i64 ptrtoint (ptr @"$ct.uint" to i64), 1
|
||||
store %any %10, ptr %varargslots11, align 16
|
||||
%11 = call i64 @std.io.printfn(ptr %retparam13, ptr @.str.3, i64 12, ptr %varargslots11, i64 1)
|
||||
%12 = call i64 @"std.collections.map$int$test.Foo$.HashMap.get"(ptr %retparam15, ptr %map, i32 1)
|
||||
%12 = call i64 @"std_collections_map$int$test.Foo$.HashMap.get"(ptr %retparam15, ptr %map, i32 1)
|
||||
%not_err = icmp eq i64 %12, 0
|
||||
%13 = call i1 @llvm.expect.i1(i1 %not_err, i1 true)
|
||||
br i1 %13, label %after_check, label %after_check18
|
||||
@@ -174,13 +174,13 @@ after_check: ; preds = %entry
|
||||
br i1 %17, label %after_check18, label %after_check18
|
||||
|
||||
after_check18: ; preds = %entry, %after_check, %after_check
|
||||
%18 = call i8 @"std.collections.map$int$test.Foo$.HashMap.has_key"(ptr %map, i32 1)
|
||||
%18 = call i8 @"std_collections_map$int$test.Foo$.HashMap.has_key"(ptr %map, i32 1)
|
||||
store i8 %18, ptr %taddr, align 1
|
||||
%19 = insertvalue %any undef, ptr %taddr, 0
|
||||
%20 = insertvalue %any %19, i64 ptrtoint (ptr @"$ct.bool" to i64), 1
|
||||
store %any %20, ptr %varargslots19, align 16
|
||||
%21 = call i64 @std.io.printfn(ptr %retparam20, ptr @.str.5, i64 9, ptr %varargslots19, i64 1)
|
||||
%22 = call i8 @"std.collections.map$int$test.Foo$.HashMap.has_key"(ptr %map, i32 2)
|
||||
%22 = call i8 @"std_collections_map$int$test.Foo$.HashMap.has_key"(ptr %map, i32 2)
|
||||
store i8 %22, ptr %taddr24, align 1
|
||||
%23 = insertvalue %any undef, ptr %taddr24, 0
|
||||
%24 = insertvalue %any %23, i64 ptrtoint (ptr @"$ct.bool" to i64), 1
|
||||
@@ -190,10 +190,10 @@ after_check18: ; preds = %entry, %after_check
|
||||
%lo29 = load i32, ptr %literal28, align 8
|
||||
%ptradd30 = getelementptr inbounds i8, ptr %literal28, i64 8
|
||||
%hi31 = load ptr, ptr %ptradd30, align 8
|
||||
%26 = call i8 @"std.collections.map$int$test.Foo$.HashMap.set"(ptr %map, i32 7, i32 %lo29, ptr %hi31)
|
||||
%26 = call i8 @"std_collections_map$int$test.Foo$.HashMap.set"(ptr %map, i32 7, i32 %lo29, ptr %hi31)
|
||||
%lo33 = load i64, ptr @std.core.mem.allocator.thread_allocator, align 8
|
||||
%hi34 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.allocator.thread_allocator, i64 8), align 8
|
||||
%27 = call { ptr, i64 } @"std.collections.map$int$test.Foo$.HashMap.value_new_list"(ptr %map, i64 %lo33, ptr %hi34)
|
||||
%27 = call { ptr, i64 } @"std_collections_map$int$test.Foo$.HashMap.value_new_list"(ptr %map, i64 %lo33, ptr %hi34)
|
||||
store { ptr, i64 } %27, ptr %result, align 8
|
||||
%28 = insertvalue %any undef, ptr %result, 0
|
||||
%29 = insertvalue %any %28, i64 ptrtoint (ptr @"$ct.sa$test.Foo" to i64), 1
|
||||
@@ -202,24 +202,24 @@ after_check18: ; preds = %entry, %after_check
|
||||
call void @llvm.memset.p0.i64(ptr align 8 %map2, i8 0, i64 48, i1 false)
|
||||
%lo38 = load i64, ptr @std.core.mem.allocator.thread_allocator, align 8
|
||||
%hi39 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.allocator.thread_allocator, i64 8), align 8
|
||||
%31 = call ptr @"std.collections.map$int$double$.HashMap.new_init"(ptr %map2, i32 16, float 7.500000e-01, i64 %lo38, ptr %hi39)
|
||||
%32 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map2, i32 4, double 1.300000e+00)
|
||||
%33 = call i8 @"std.collections.map$int$double$.HashMap.has_value"(ptr %map2, double 1.300000e+00)
|
||||
%31 = call ptr @"std_collections_map$int$double$.HashMap.new_init"(ptr %map2, i32 16, float 7.500000e-01, i64 %lo38, ptr %hi39)
|
||||
%32 = call i8 @"std_collections_map$int$double$.HashMap.set"(ptr %map2, i32 4, double 1.300000e+00)
|
||||
%33 = call i8 @"std_collections_map$int$double$.HashMap.has_value"(ptr %map2, double 1.300000e+00)
|
||||
store i8 %33, ptr %taddr41, align 1
|
||||
%34 = insertvalue %any undef, ptr %taddr41, 0
|
||||
%35 = insertvalue %any %34, i64 ptrtoint (ptr @"$ct.bool" to i64), 1
|
||||
store %any %35, ptr %varargslots40, align 16
|
||||
%36 = call i64 @std.io.printfn(ptr %retparam42, ptr @.str.9, i64 12, ptr %varargslots40, i64 1)
|
||||
%37 = call i8 @"std.collections.map$int$double$.HashMap.has_value"(ptr %map2, double 1.200000e+00)
|
||||
%37 = call i8 @"std_collections_map$int$double$.HashMap.has_value"(ptr %map2, double 1.200000e+00)
|
||||
store i8 %37, ptr %taddr46, align 1
|
||||
%38 = insertvalue %any undef, ptr %taddr46, 0
|
||||
%39 = insertvalue %any %38, i64 ptrtoint (ptr @"$ct.bool" to i64), 1
|
||||
store %any %39, ptr %varargslots45, align 16
|
||||
%40 = call i64 @std.io.printfn(ptr %retparam47, ptr @.str.10, i64 12, ptr %varargslots45, i64 1)
|
||||
%41 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map2, i32 100, double 3.400000e+00)
|
||||
%41 = call i8 @"std_collections_map$int$double$.HashMap.set"(ptr %map2, i32 100, double 3.400000e+00)
|
||||
%lo51 = load i64, ptr @std.core.mem.allocator.thread_allocator, align 8
|
||||
%hi52 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.allocator.thread_allocator, i64 8), align 8
|
||||
%42 = call { ptr, i64 } @"std.collections.map$int$double$.HashMap.key_new_list"(ptr %map2, i64 %lo51, ptr %hi52)
|
||||
%42 = call { ptr, i64 } @"std_collections_map$int$double$.HashMap.key_new_list"(ptr %map2, i64 %lo51, ptr %hi52)
|
||||
store { ptr, i64 } %42, ptr %result53, align 8
|
||||
%43 = insertvalue %any undef, ptr %result53, 0
|
||||
%44 = insertvalue %any %43, i64 ptrtoint (ptr @"$ct.sa$int" to i64), 1
|
||||
@@ -227,7 +227,7 @@ after_check18: ; preds = %entry, %after_check
|
||||
%45 = call i64 @std.io.printfn(ptr %retparam54, ptr @.str.11, i64 2, ptr %varargslots50, i64 1)
|
||||
%lo58 = load i64, ptr @std.core.mem.allocator.thread_allocator, align 8
|
||||
%hi59 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.allocator.thread_allocator, i64 8), align 8
|
||||
%46 = call { ptr, i64 } @"std.collections.map$int$double$.HashMap.value_new_list"(ptr %map2, i64 %lo58, ptr %hi59)
|
||||
%46 = call { ptr, i64 } @"std_collections_map$int$double$.HashMap.value_new_list"(ptr %map2, i64 %lo58, ptr %hi59)
|
||||
store { ptr, i64 } %46, ptr %result60, align 8
|
||||
%47 = insertvalue %any undef, ptr %result60, 0
|
||||
%48 = insertvalue %any %47, i64 ptrtoint (ptr @"$ct.sa$double" to i64), 1
|
||||
@@ -251,12 +251,12 @@ if.exit: ; preds = %if.then, %after_che
|
||||
call void @llvm.memset.p0.i64(ptr align 8 %map3, i8 0, i64 48, i1 false)
|
||||
%lo65 = load i64, ptr @std.core.mem.allocator.thread_allocator, align 8
|
||||
%hi66 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.allocator.thread_allocator, i64 8), align 8
|
||||
%54 = call ptr @"std.collections.map$int$double$.HashMap.new_init"(ptr %map3, i32 16, float 7.500000e-01, i64 %lo65, ptr %hi66)
|
||||
%55 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map3, i32 5, double 3.200000e+00)
|
||||
%56 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map3, i32 7, double 5.200000e+00)
|
||||
%54 = call ptr @"std_collections_map$int$double$.HashMap.new_init"(ptr %map3, i32 16, float 7.500000e-01, i64 %lo65, ptr %hi66)
|
||||
%55 = call i8 @"std_collections_map$int$double$.HashMap.set"(ptr %map3, i32 5, double 3.200000e+00)
|
||||
%56 = call i8 @"std_collections_map$int$double$.HashMap.set"(ptr %map3, i32 7, double 5.200000e+00)
|
||||
%lo68 = load i64, ptr @std.core.mem.allocator.thread_allocator, align 8
|
||||
%hi69 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.allocator.thread_allocator, i64 8), align 8
|
||||
%57 = call { ptr, i64 } @"std.collections.map$int$double$.HashMap.key_new_list"(ptr %map3, i64 %lo68, ptr %hi69)
|
||||
%57 = call { ptr, i64 } @"std_collections_map$int$double$.HashMap.key_new_list"(ptr %map3, i64 %lo68, ptr %hi69)
|
||||
store { ptr, i64 } %57, ptr %result70, align 8
|
||||
%58 = insertvalue %any undef, ptr %result70, 0
|
||||
%59 = insertvalue %any %58, i64 ptrtoint (ptr @"$ct.sa$int" to i64), 1
|
||||
|
||||
@@ -133,7 +133,7 @@ entry:
|
||||
call void @llvm.memset.p0.i64(ptr align 8 %map, i8 0, i64 48, i1 false)
|
||||
%lo = load i64, ptr @std.core.mem.allocator.thread_allocator, align 8
|
||||
%hi = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.allocator.thread_allocator, i64 8), align 8
|
||||
%0 = call ptr @"std.collections.map$int$test.Foo$.HashMap.new_init"(ptr %map, i32 16, float 7.500000e-01, i64 %lo, ptr %hi)
|
||||
%0 = call ptr @"std_collections_map$int$test.Foo$.HashMap.new_init"(ptr %map, i32 16, float 7.500000e-01, i64 %lo, ptr %hi)
|
||||
%ptradd = getelementptr inbounds i8, ptr %map, i64 32
|
||||
%1 = insertvalue %any undef, ptr %ptradd, 0
|
||||
%2 = insertvalue %any %1, i64 ptrtoint (ptr @"$ct.uint" to i64), 1
|
||||
@@ -143,7 +143,7 @@ entry:
|
||||
%lo1 = load i32, ptr %literal, align 8
|
||||
%ptradd2 = getelementptr inbounds i8, ptr %literal, i64 8
|
||||
%hi3 = load ptr, ptr %ptradd2, align 8
|
||||
%4 = call i8 @"std.collections.map$int$test.Foo$.HashMap.set"(ptr %map, i32 1, i32 %lo1, ptr %hi3)
|
||||
%4 = call i8 @"std_collections_map$int$test.Foo$.HashMap.set"(ptr %map, i32 1, i32 %lo1, ptr %hi3)
|
||||
%ptradd5 = getelementptr inbounds i8, ptr %map, i64 32
|
||||
%5 = insertvalue %any undef, ptr %ptradd5, 0
|
||||
%6 = insertvalue %any %5, i64 ptrtoint (ptr @"$ct.uint" to i64), 1
|
||||
@@ -153,13 +153,13 @@ entry:
|
||||
%lo8 = load i32, ptr %literal7, align 8
|
||||
%ptradd9 = getelementptr inbounds i8, ptr %literal7, i64 8
|
||||
%hi10 = load ptr, ptr %ptradd9, align 8
|
||||
%8 = call i8 @"std.collections.map$int$test.Foo$.HashMap.set"(ptr %map, i32 1, i32 %lo8, ptr %hi10)
|
||||
%8 = call i8 @"std_collections_map$int$test.Foo$.HashMap.set"(ptr %map, i32 1, i32 %lo8, ptr %hi10)
|
||||
%ptradd12 = getelementptr inbounds i8, ptr %map, i64 32
|
||||
%9 = insertvalue %any undef, ptr %ptradd12, 0
|
||||
%10 = insertvalue %any %9, i64 ptrtoint (ptr @"$ct.uint" to i64), 1
|
||||
store %any %10, ptr %varargslots11, align 16
|
||||
%11 = call i64 @std.io.printfn(ptr %retparam13, ptr @.str.3, i64 12, ptr %varargslots11, i64 1)
|
||||
%12 = call i64 @"std.collections.map$int$test.Foo$.HashMap.get"(ptr %retparam15, ptr %map, i32 1)
|
||||
%12 = call i64 @"std_collections_map$int$test.Foo$.HashMap.get"(ptr %retparam15, ptr %map, i32 1)
|
||||
%not_err = icmp eq i64 %12, 0
|
||||
%13 = call i1 @llvm.expect.i1(i1 %not_err, i1 true)
|
||||
br i1 %13, label %after_check, label %after_check18
|
||||
@@ -174,13 +174,13 @@ after_check: ; preds = %entry
|
||||
br i1 %17, label %after_check18, label %after_check18
|
||||
|
||||
after_check18: ; preds = %entry, %after_check, %after_check
|
||||
%18 = call i8 @"std.collections.map$int$test.Foo$.HashMap.has_key"(ptr %map, i32 1)
|
||||
%18 = call i8 @"std_collections_map$int$test.Foo$.HashMap.has_key"(ptr %map, i32 1)
|
||||
store i8 %18, ptr %taddr, align 1
|
||||
%19 = insertvalue %any undef, ptr %taddr, 0
|
||||
%20 = insertvalue %any %19, i64 ptrtoint (ptr @"$ct.bool" to i64), 1
|
||||
store %any %20, ptr %varargslots19, align 16
|
||||
%21 = call i64 @std.io.printfn(ptr %retparam20, ptr @.str.5, i64 9, ptr %varargslots19, i64 1)
|
||||
%22 = call i8 @"std.collections.map$int$test.Foo$.HashMap.has_key"(ptr %map, i32 2)
|
||||
%22 = call i8 @"std_collections_map$int$test.Foo$.HashMap.has_key"(ptr %map, i32 2)
|
||||
store i8 %22, ptr %taddr24, align 1
|
||||
%23 = insertvalue %any undef, ptr %taddr24, 0
|
||||
%24 = insertvalue %any %23, i64 ptrtoint (ptr @"$ct.bool" to i64), 1
|
||||
@@ -190,10 +190,10 @@ after_check18: ; preds = %entry, %after_check
|
||||
%lo29 = load i32, ptr %literal28, align 8
|
||||
%ptradd30 = getelementptr inbounds i8, ptr %literal28, i64 8
|
||||
%hi31 = load ptr, ptr %ptradd30, align 8
|
||||
%26 = call i8 @"std.collections.map$int$test.Foo$.HashMap.set"(ptr %map, i32 7, i32 %lo29, ptr %hi31)
|
||||
%26 = call i8 @"std_collections_map$int$test.Foo$.HashMap.set"(ptr %map, i32 7, i32 %lo29, ptr %hi31)
|
||||
%lo33 = load i64, ptr @std.core.mem.allocator.thread_allocator, align 8
|
||||
%hi34 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.allocator.thread_allocator, i64 8), align 8
|
||||
%27 = call { ptr, i64 } @"std.collections.map$int$test.Foo$.HashMap.value_new_list"(ptr %map, i64 %lo33, ptr %hi34)
|
||||
%27 = call { ptr, i64 } @"std_collections_map$int$test.Foo$.HashMap.value_new_list"(ptr %map, i64 %lo33, ptr %hi34)
|
||||
store { ptr, i64 } %27, ptr %result, align 8
|
||||
%28 = insertvalue %any undef, ptr %result, 0
|
||||
%29 = insertvalue %any %28, i64 ptrtoint (ptr @"$ct.sa$test.Foo" to i64), 1
|
||||
@@ -202,24 +202,24 @@ after_check18: ; preds = %entry, %after_check
|
||||
call void @llvm.memset.p0.i64(ptr align 8 %map2, i8 0, i64 48, i1 false)
|
||||
%lo38 = load i64, ptr @std.core.mem.allocator.thread_allocator, align 8
|
||||
%hi39 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.allocator.thread_allocator, i64 8), align 8
|
||||
%31 = call ptr @"std.collections.map$int$double$.HashMap.new_init"(ptr %map2, i32 16, float 7.500000e-01, i64 %lo38, ptr %hi39)
|
||||
%32 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map2, i32 4, double 1.300000e+00)
|
||||
%33 = call i8 @"std.collections.map$int$double$.HashMap.has_value"(ptr %map2, double 1.300000e+00)
|
||||
%31 = call ptr @"std_collections_map$int$double$.HashMap.new_init"(ptr %map2, i32 16, float 7.500000e-01, i64 %lo38, ptr %hi39)
|
||||
%32 = call i8 @"std_collections_map$int$double$.HashMap.set"(ptr %map2, i32 4, double 1.300000e+00)
|
||||
%33 = call i8 @"std_collections_map$int$double$.HashMap.has_value"(ptr %map2, double 1.300000e+00)
|
||||
store i8 %33, ptr %taddr41, align 1
|
||||
%34 = insertvalue %any undef, ptr %taddr41, 0
|
||||
%35 = insertvalue %any %34, i64 ptrtoint (ptr @"$ct.bool" to i64), 1
|
||||
store %any %35, ptr %varargslots40, align 16
|
||||
%36 = call i64 @std.io.printfn(ptr %retparam42, ptr @.str.9, i64 12, ptr %varargslots40, i64 1)
|
||||
%37 = call i8 @"std.collections.map$int$double$.HashMap.has_value"(ptr %map2, double 1.200000e+00)
|
||||
%37 = call i8 @"std_collections_map$int$double$.HashMap.has_value"(ptr %map2, double 1.200000e+00)
|
||||
store i8 %37, ptr %taddr46, align 1
|
||||
%38 = insertvalue %any undef, ptr %taddr46, 0
|
||||
%39 = insertvalue %any %38, i64 ptrtoint (ptr @"$ct.bool" to i64), 1
|
||||
store %any %39, ptr %varargslots45, align 16
|
||||
%40 = call i64 @std.io.printfn(ptr %retparam47, ptr @.str.10, i64 12, ptr %varargslots45, i64 1)
|
||||
%41 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map2, i32 100, double 3.400000e+00)
|
||||
%41 = call i8 @"std_collections_map$int$double$.HashMap.set"(ptr %map2, i32 100, double 3.400000e+00)
|
||||
%lo51 = load i64, ptr @std.core.mem.allocator.thread_allocator, align 8
|
||||
%hi52 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.allocator.thread_allocator, i64 8), align 8
|
||||
%42 = call { ptr, i64 } @"std.collections.map$int$double$.HashMap.key_new_list"(ptr %map2, i64 %lo51, ptr %hi52)
|
||||
%42 = call { ptr, i64 } @"std_collections_map$int$double$.HashMap.key_new_list"(ptr %map2, i64 %lo51, ptr %hi52)
|
||||
store { ptr, i64 } %42, ptr %result53, align 8
|
||||
%43 = insertvalue %any undef, ptr %result53, 0
|
||||
%44 = insertvalue %any %43, i64 ptrtoint (ptr @"$ct.sa$int" to i64), 1
|
||||
@@ -227,7 +227,7 @@ after_check18: ; preds = %entry, %after_check
|
||||
%45 = call i64 @std.io.printfn(ptr %retparam54, ptr @.str.11, i64 2, ptr %varargslots50, i64 1)
|
||||
%lo58 = load i64, ptr @std.core.mem.allocator.thread_allocator, align 8
|
||||
%hi59 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.allocator.thread_allocator, i64 8), align 8
|
||||
%46 = call { ptr, i64 } @"std.collections.map$int$double$.HashMap.value_new_list"(ptr %map2, i64 %lo58, ptr %hi59)
|
||||
%46 = call { ptr, i64 } @"std_collections_map$int$double$.HashMap.value_new_list"(ptr %map2, i64 %lo58, ptr %hi59)
|
||||
store { ptr, i64 } %46, ptr %result60, align 8
|
||||
%47 = insertvalue %any undef, ptr %result60, 0
|
||||
%48 = insertvalue %any %47, i64 ptrtoint (ptr @"$ct.sa$double" to i64), 1
|
||||
@@ -251,12 +251,12 @@ if.exit: ; preds = %if.then, %after_che
|
||||
call void @llvm.memset.p0.i64(ptr align 8 %map3, i8 0, i64 48, i1 false)
|
||||
%lo65 = load i64, ptr @std.core.mem.allocator.thread_allocator, align 8
|
||||
%hi66 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.allocator.thread_allocator, i64 8), align 8
|
||||
%54 = call ptr @"std.collections.map$int$double$.HashMap.new_init"(ptr %map3, i32 16, float 7.500000e-01, i64 %lo65, ptr %hi66)
|
||||
%55 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map3, i32 5, double 3.200000e+00)
|
||||
%56 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map3, i32 7, double 5.200000e+00)
|
||||
%54 = call ptr @"std_collections_map$int$double$.HashMap.new_init"(ptr %map3, i32 16, float 7.500000e-01, i64 %lo65, ptr %hi66)
|
||||
%55 = call i8 @"std_collections_map$int$double$.HashMap.set"(ptr %map3, i32 5, double 3.200000e+00)
|
||||
%56 = call i8 @"std_collections_map$int$double$.HashMap.set"(ptr %map3, i32 7, double 5.200000e+00)
|
||||
%lo68 = load i64, ptr @std.core.mem.allocator.thread_allocator, align 8
|
||||
%hi69 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.allocator.thread_allocator, i64 8), align 8
|
||||
%57 = call { ptr, i64 } @"std.collections.map$int$double$.HashMap.key_new_list"(ptr %map3, i64 %lo68, ptr %hi69)
|
||||
%57 = call { ptr, i64 } @"std_collections_map$int$double$.HashMap.key_new_list"(ptr %map3, i64 %lo68, ptr %hi69)
|
||||
store { ptr, i64 } %57, ptr %result70, align 8
|
||||
%58 = insertvalue %any undef, ptr %result70, 0
|
||||
%59 = insertvalue %any %58, i64 ptrtoint (ptr @"$ct.sa$int" to i64), 1
|
||||
|
||||
@@ -708,7 +708,7 @@ fn void test()
|
||||
@.str.4 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
|
||||
@.str.5 = private unnamed_addr constant [3 x i8] c"*/\00", align 1
|
||||
@"lexer_test.Comment$end" = linkonce constant [2 x %"char[]"] [%"char[]" { ptr @.str.4, i64 1 }, %"char[]" { ptr @.str.5, i64 2 }], align 8
|
||||
@"$ct.std::io.ByteReader" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 24, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.std.io.ByteReader" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 24, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8
|
||||
@std.core.mem.allocator.thread_allocator = external thread_local global %any, align 8
|
||||
|
||||
; Function Attrs:
|
||||
@@ -784,7 +784,7 @@ loop.body: ; preds = %loop.cond
|
||||
%hi = load i64, ptr %ptradd2, align 8
|
||||
%5 = call ptr @std.io.ByteReader.init(ptr %br, ptr %lo, i64 %hi)
|
||||
%6 = insertvalue %any undef, ptr %5, 0
|
||||
%7 = insertvalue %any %6, i64 ptrtoint (ptr @"$ct.std::io.ByteReader" to i64), 1
|
||||
%7 = insertvalue %any %6, i64 ptrtoint (ptr @"$ct.std.io.ByteReader" to i64), 1
|
||||
store %any %7, ptr %taddr, align 8
|
||||
%lo3 = load i64, ptr %taddr, align 8
|
||||
%ptradd4 = getelementptr inbounds i8, ptr %taddr, i64 8
|
||||
|
||||
Reference in New Issue
Block a user