Browse Source

Clean up timings messages showing used module count

gingerBill 1 year ago
parent
commit
2c9ef6907a
2 changed files with 13 additions and 2 deletions
  1. 11 2
      src/llvm_backend.cpp
  2. 2 0
      src/llvm_backend.hpp

+ 11 - 2
src/llvm_backend.cpp

@@ -3437,9 +3437,18 @@ gb_internal bool lb_generate_code(lbGenerator *gen) {
 	TIME_SECTION("LLVM Add Foreign Library Paths");
 	TIME_SECTION("LLVM Add Foreign Library Paths");
 	lb_add_foreign_library_paths(gen);
 	lb_add_foreign_library_paths(gen);
 
 
+
+	////////////////////////////////////////////
+	for (auto const &entry: gen->modules) {
+		lbModule *m = entry.value;
+		if (!lb_is_module_empty(m)) {
+			gen->used_module_count += 1;
+		}
+	}
+
 	gbString label_object_generation = gb_string_make(heap_allocator(), "LLVM Object Generation");
 	gbString label_object_generation = gb_string_make(heap_allocator(), "LLVM Object Generation");
-	if (gen->modules.count > 1) {
-		label_object_generation = gb_string_append_fmt(label_object_generation, " (%td modules)", gen->modules.count);
+	if (gen->used_module_count > 1) {
+		label_object_generation = gb_string_append_fmt(label_object_generation, " (%td used modules)", gen->used_module_count);
 	}
 	}
 	TIME_SECTION_WITH_LEN(label_object_generation, gb_string_length(label_object_generation));
 	TIME_SECTION_WITH_LEN(label_object_generation, gb_string_length(label_object_generation));
 	
 	

+ 2 - 0
src/llvm_backend.hpp

@@ -218,6 +218,8 @@ struct lbGenerator : LinkerData {
 	std::atomic<u32> global_array_index;
 	std::atomic<u32> global_array_index;
 	std::atomic<u32> global_generated_index;
 	std::atomic<u32> global_generated_index;
 
 
+	isize used_module_count;
+
 	lbProcedure *startup_runtime;
 	lbProcedure *startup_runtime;
 	lbProcedure *cleanup_runtime;
 	lbProcedure *cleanup_runtime;
 	lbProcedure *objc_names;
 	lbProcedure *objc_names;