mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-20 21:35:19 +00:00
Update tilde
This commit is contained in:
BIN
src/tilde/tb.lib
BIN
src/tilde/tb.lib
Binary file not shown.
@@ -260,44 +260,6 @@ gb_internal void cg_procedure_begin(cgProcedure *p) {
|
||||
if (e) {
|
||||
map_set(&p->variable_map, e, addr);
|
||||
}
|
||||
|
||||
// if (arg_type->kind == lbArg_Ignore) {
|
||||
// continue;
|
||||
// } else if (arg_type->kind == lbArg_Direct) {
|
||||
// if (e->token.string.len != 0 && !is_blank_ident(e->token.string)) {
|
||||
// LLVMTypeRef param_type = lb_type(p->module, e->type);
|
||||
// LLVMValueRef original_value = LLVMGetParam(p->value, param_offset+param_index);
|
||||
// LLVMValueRef value = OdinLLVMBuildTransmute(p, original_value, param_type);
|
||||
|
||||
// lbValue param = {};
|
||||
// param.value = value;
|
||||
// param.type = e->type;
|
||||
|
||||
// map_set(&p->direct_parameters, e, param);
|
||||
|
||||
// lbValue ptr = lb_address_from_load_or_generate_local(p, param);
|
||||
// GB_ASSERT(LLVMIsAAllocaInst(ptr.value));
|
||||
// lb_add_entity(p->module, e, ptr);
|
||||
|
||||
// lbBlock *block = p->decl_block;
|
||||
// if (original_value != value) {
|
||||
// block = p->curr_block;
|
||||
// }
|
||||
// LLVMValueRef debug_storage_value = value;
|
||||
// if (original_value != value && LLVMIsALoadInst(value)) {
|
||||
// debug_storage_value = LLVMGetOperand(value, 0);
|
||||
// }
|
||||
// lb_add_debug_param_variable(p, debug_storage_value, e->type, e->token, param_index+1, block, arg_type->kind);
|
||||
// }
|
||||
// } else if (arg_type->kind == lbArg_Indirect) {
|
||||
// if (e->token.string.len != 0 && !is_blank_ident(e->token.string)) {
|
||||
// lbValue ptr = {};
|
||||
// ptr.value = LLVMGetParam(p->value, param_offset+param_index);
|
||||
// ptr.type = alloc_type_pointer(e->type);
|
||||
// lb_add_entity(p->module, e, ptr);
|
||||
// lb_add_debug_param_variable(p, ptr.value, e->type, e->token, param_index+1, p->decl_block, arg_type->kind);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
if (is_odin_like_cc) {
|
||||
@@ -351,6 +313,20 @@ gb_internal WORKER_TASK_PROC(cg_procedure_compile_worker_proc) {
|
||||
|
||||
bool emit_asm = false;
|
||||
|
||||
if (false &&
|
||||
string_starts_with(p->name, str_lit("bug@main"))) {
|
||||
TB_Arena *arena = cg_arena();
|
||||
TB_FuncOpt *opt = tb_funcopt_enter(p->func, arena);
|
||||
defer (tb_funcopt_exit(opt));
|
||||
|
||||
tb_funcopt_peephole(opt);
|
||||
tb_funcopt_mem2reg(opt);
|
||||
tb_funcopt_peephole(opt);
|
||||
|
||||
emit_asm = true;
|
||||
}
|
||||
|
||||
|
||||
if (
|
||||
// string_starts_with(p->name, str_lit("bug@main")) ||
|
||||
false
|
||||
@@ -398,7 +374,7 @@ gb_internal void cg_procedure_generate(cgProcedure *p) {
|
||||
|
||||
|
||||
if (
|
||||
// string_starts_with(p->name, str_lit("bug@main")) ||
|
||||
string_starts_with(p->name, str_lit("bug@main")) ||
|
||||
false
|
||||
) { // IR Printing
|
||||
TB_Arena *arena = tb_default_arena();
|
||||
|
||||
@@ -2246,20 +2246,42 @@ gb_internal void cg_build_stmt(cgProcedure *p, Ast *node) {
|
||||
|
||||
TEMPORARY_ALLOCATOR_GUARD();
|
||||
|
||||
auto inits = array_make<cgValue>(temporary_allocator(), 0, vd->values.count != 0 ? vd->names.count : 0);
|
||||
for (Ast *rhs : vd->values) {
|
||||
cgValue init = cg_build_expr(p, rhs);
|
||||
cg_append_tuple_values(p, &inits, init);
|
||||
}
|
||||
|
||||
|
||||
auto lvals = slice_make<cgAddr>(temporary_allocator(), vd->names.count);
|
||||
for_array(i, vd->names) {
|
||||
Ast *name = vd->names[i];
|
||||
if (!is_blank_ident(name)) {
|
||||
Entity *e = entity_of_node(name);
|
||||
lvals[i] = cg_add_local(p, e->type, e, true);
|
||||
bool zero_init = vd->values.count == 0;
|
||||
if (vd->names.count == vd->values.count) {
|
||||
Ast *expr = unparen_expr(vd->values[i]);
|
||||
if (expr->kind == Ast_CompoundLit &&
|
||||
inits[i].kind == cgValue_Addr) {
|
||||
TB_Node *ptr = inits[i].node;
|
||||
|
||||
if (e != nullptr && e->token.string.len > 0 && e->token.string != "_") {
|
||||
// NOTE(bill): for debugging purposes only
|
||||
String name = e->token.string;
|
||||
TB_DebugType *debug_type = cg_debug_type(p->module, e->type);
|
||||
tb_node_append_attrib(ptr, tb_function_attrib_variable(p->func, name.len, cast(char const *)name.text, debug_type));
|
||||
}
|
||||
|
||||
cgAddr addr = cg_addr(inits[i]);
|
||||
map_set(&p->variable_map, e, addr);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
lvals[i] = cg_add_local(p, e->type, e, zero_init);
|
||||
}
|
||||
}
|
||||
|
||||
auto inits = array_make<cgValue>(temporary_allocator(), 0, vd->values.count != 0 ? lvals.count : 0);
|
||||
for (Ast *rhs : vd->values) {
|
||||
cgValue init = cg_build_expr(p, rhs);
|
||||
cg_append_tuple_values(p, &inits, init);
|
||||
}
|
||||
|
||||
GB_ASSERT(vd->values.count == 0 || lvals.count == inits.count);
|
||||
for_array(i, inits) {
|
||||
|
||||
Reference in New Issue
Block a user