mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Change our IR name mangling rules
This commit is contained in:
@@ -17,7 +17,7 @@ if %release_mode% EQU 0 ( rem Debug
|
|||||||
set compiler_warnings= ^
|
set compiler_warnings= ^
|
||||||
-W4 -WX ^
|
-W4 -WX ^
|
||||||
-wd4100 -wd4101 -wd4127 -wd4189 ^
|
-wd4100 -wd4101 -wd4127 -wd4189 ^
|
||||||
-wd4201 -wd4204 -wd4244 ^
|
-wd4201 -wd4204 ^
|
||||||
-wd4456 -wd4457 ^
|
-wd4456 -wd4457 ^
|
||||||
-wd4512
|
-wd4512
|
||||||
|
|
||||||
|
|||||||
@@ -739,7 +739,7 @@ deprecated_attribute :: proc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
main :: proc() {
|
main :: proc() {
|
||||||
when false {
|
when true {
|
||||||
general_stuff();
|
general_stuff();
|
||||||
union_type();
|
union_type();
|
||||||
parametric_polymorphism();
|
parametric_polymorphism();
|
||||||
@@ -753,8 +753,4 @@ main :: proc() {
|
|||||||
cstring_example();
|
cstring_example();
|
||||||
deprecated_attribute();
|
deprecated_attribute();
|
||||||
}
|
}
|
||||||
|
|
||||||
x := f32(-123);
|
|
||||||
fmt.println(abs(x));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
-7
@@ -6147,7 +6147,7 @@ irValue *ir_build_cond(irProcedure *proc, AstNode *cond, irBlock *true_block, ir
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ir_build_poly_proc(irProcedure *proc, AstNodeProcLit *pd, Entity *e) {
|
void ir_build_nested_proc(irProcedure *proc, AstNodeProcLit *pd, Entity *e) {
|
||||||
GB_ASSERT(pd->body != nullptr);
|
GB_ASSERT(pd->body != nullptr);
|
||||||
|
|
||||||
if (ir_min_dep_entity(proc->module, e) == false) {
|
if (ir_min_dep_entity(proc->module, e) == false) {
|
||||||
@@ -6165,8 +6165,13 @@ void ir_build_poly_proc(irProcedure *proc, AstNodeProcLit *pd, Entity *e) {
|
|||||||
|
|
||||||
isize name_len = proc->name.len + 1 + pd_name.len + 1 + 10 + 1;
|
isize name_len = proc->name.len + 1 + pd_name.len + 1 + 10 + 1;
|
||||||
u8 *name_text = gb_alloc_array(proc->module->allocator, u8, name_len);
|
u8 *name_text = gb_alloc_array(proc->module->allocator, u8, name_len);
|
||||||
i32 guid = cast(i32)proc->children.count;
|
|
||||||
name_len = gb_snprintf(cast(char *)name_text, name_len, "%.*s.%.*s-%d", LIT(proc->name), LIT(pd_name), guid);
|
if (is_type_polymorphic(e->type)) {
|
||||||
|
i32 guid = cast(i32)proc->children.count;
|
||||||
|
name_len = gb_snprintf(cast(char *)name_text, name_len, "%.*s.%.*s-%d", LIT(proc->name), LIT(pd_name), guid);
|
||||||
|
} else {
|
||||||
|
name_len = gb_snprintf(cast(char *)name_text, name_len, "%.*s.%.*s", LIT(proc->name), LIT(pd_name));
|
||||||
|
}
|
||||||
String name = make_string(name_text, name_len-1);
|
String name = make_string(name_text, name_len-1);
|
||||||
|
|
||||||
|
|
||||||
@@ -6221,8 +6226,12 @@ void ir_build_constant_value_decl(irProcedure *proc, AstNodeValueDecl *vd) {
|
|||||||
irModule *m = proc->module;
|
irModule *m = proc->module;
|
||||||
isize name_len = proc->name.len + 1 + ts_name.len + 1 + 10 + 1;
|
isize name_len = proc->name.len + 1 + ts_name.len + 1 + 10 + 1;
|
||||||
u8 *name_text = gb_alloc_array(m->allocator, u8, name_len);
|
u8 *name_text = gb_alloc_array(m->allocator, u8, name_len);
|
||||||
i32 guid = cast(i32)m->members.entries.count;
|
if (is_type_polymorphic(e->type)) {
|
||||||
name_len = gb_snprintf(cast(char *)name_text, name_len, "%.*s.%.*s-%d", LIT(proc->name), LIT(ts_name), guid);
|
i32 guid = cast(i32)m->members.entries.count;
|
||||||
|
name_len = gb_snprintf(cast(char *)name_text, name_len, "%.*s.%.*s-%d", LIT(proc->name), LIT(ts_name), guid);
|
||||||
|
} else {
|
||||||
|
name_len = gb_snprintf(cast(char *)name_text, name_len, "%.*s.%.*s", LIT(proc->name), LIT(ts_name));
|
||||||
|
}
|
||||||
String name = make_string(name_text, name_len-1);
|
String name = make_string(name_text, name_len-1);
|
||||||
|
|
||||||
irValue *value = ir_value_type_name(m->allocator, name, e->type);
|
irValue *value = ir_value_type_name(m->allocator, name, e->type);
|
||||||
@@ -6242,10 +6251,10 @@ void ir_build_constant_value_decl(irProcedure *proc, AstNodeValueDecl *vd) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
DeclInfo *d = decl_info_of_entity(e);
|
DeclInfo *d = decl_info_of_entity(e);
|
||||||
ir_build_poly_proc(proc, &d->proc_lit->ProcLit, e);
|
ir_build_nested_proc(proc, &d->proc_lit->ProcLit, e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ir_build_poly_proc(proc, pl, e);
|
ir_build_nested_proc(proc, pl, e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user