mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Add sort for global types and procedures
This commit is contained in:
+1
-1
@@ -519,7 +519,7 @@ gb_internal Entity *scope_insert_no_mutex(Scope *s, Entity *entity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GB_COMPARE_PROC(entity_variable_pos_cmp) {
|
gb_internal GB_COMPARE_PROC(entity_variable_pos_cmp) {
|
||||||
Entity *x = *cast(Entity **)a;
|
Entity *x = *cast(Entity **)a;
|
||||||
Entity *y = *cast(Entity **)b;
|
Entity *y = *cast(Entity **)b;
|
||||||
|
|
||||||
|
|||||||
@@ -1321,6 +1321,24 @@ gb_internal WORKER_TASK_PROC(lb_generate_procedures_and_types_per_module) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gb_internal GB_COMPARE_PROC(llvm_global_entity_cmp) {
|
||||||
|
Entity *x = *cast(Entity **)a;
|
||||||
|
Entity *y = *cast(Entity **)b;
|
||||||
|
if (x == y) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (x->kind != y->kind) {
|
||||||
|
return cast(i32)(x->kind - y->kind);
|
||||||
|
}
|
||||||
|
|
||||||
|
i32 cmp = 0;
|
||||||
|
cmp = token_pos_cmp(x->token.pos, y->token.pos);
|
||||||
|
if (!cmp) {
|
||||||
|
return cmp;
|
||||||
|
}
|
||||||
|
return cmp;
|
||||||
|
}
|
||||||
|
|
||||||
gb_internal void lb_create_global_procedures_and_types(lbGenerator *gen, CheckerInfo *info, bool do_threading) {
|
gb_internal void lb_create_global_procedures_and_types(lbGenerator *gen, CheckerInfo *info, bool do_threading) {
|
||||||
auto *min_dep_set = &info->minimum_dependency_set;
|
auto *min_dep_set = &info->minimum_dependency_set;
|
||||||
|
|
||||||
@@ -1377,6 +1395,12 @@ gb_internal void lb_create_global_procedures_and_types(lbGenerator *gen, Checker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto const &entry : gen->modules) {
|
||||||
|
lbModule *m = entry.value;
|
||||||
|
gb_sort_array(m->global_types_to_create.data, m->global_types_to_create.count, llvm_global_entity_cmp);
|
||||||
|
gb_sort_array(m->global_procedures_to_create.data, m->global_procedures_to_create.count, llvm_global_entity_cmp);
|
||||||
|
}
|
||||||
|
|
||||||
if (do_threading) {
|
if (do_threading) {
|
||||||
for (auto const &entry : gen->modules) {
|
for (auto const &entry : gen->modules) {
|
||||||
lbModule *m = entry.value;
|
lbModule *m = entry.value;
|
||||||
|
|||||||
Reference in New Issue
Block a user