Begin work on making LLVM backend work with multiple modules for possible faster compilation

This commit is contained in:
gingerBill
2021-05-03 17:43:14 +01:00
parent e4286d0ff9
commit 746e880eb5
4 changed files with 415 additions and 277 deletions
+8 -3
View File
@@ -85,6 +85,8 @@ struct lbModule {
LLVMModuleRef mod;
LLVMContextRef ctx;
struct lbGenerator *gen;
CheckerInfo *info;
AstPackage *pkg; // associated
@@ -108,8 +110,6 @@ struct lbModule {
Map<lbProcedure *> equal_procs; // Key: Type *
Map<lbProcedure *> hasher_procs; // Key: Type *
u32 global_array_index;
u32 global_generated_index;
u32 nested_type_name_guid;
Array<lbProcedure *> procedures_to_generate;
@@ -131,7 +131,11 @@ struct lbGenerator {
String output_base;
String output_name;
Map<lbModule *> modules; // Key: AstPackage *
Map<lbModule *> modules_through_ctx; // Key: LLVMContextRef *
lbModule default_module;
gbAtomic32 global_array_index;
gbAtomic32 global_generated_index;
};
@@ -271,7 +275,7 @@ String lb_get_entity_name(lbModule *m, Entity *e, String name = {});
LLVMAttributeRef lb_create_enum_attribute(LLVMContextRef ctx, char const *name, u64 value=0);
void lb_add_proc_attribute_at_index(lbProcedure *p, isize index, char const *name, u64 value);
void lb_add_proc_attribute_at_index(lbProcedure *p, isize index, char const *name);
lbProcedure *lb_create_procedure(lbModule *module, Entity *entity);
lbProcedure *lb_create_procedure(lbModule *module, Entity *entity, bool ignore_body=false);
void lb_end_procedure(lbProcedure *p);
@@ -383,6 +387,7 @@ lbValue lb_gen_map_hash(lbProcedure *p, lbValue key, Type *key_type);
void lb_insert_dynamic_map_key_and_value(lbProcedure *p, lbAddr addr, Type *map_type, lbValue map_key, lbValue map_value, Ast *node);
void lb_store_type_case_implicit(lbProcedure *p, Ast *clause, lbValue value);
lbAddr lb_store_range_stmt_val(lbProcedure *p, Ast *stmt_val, lbValue value);
lbValue lb_emit_source_code_location(lbProcedure *p, String const &procedure, TokenPos const &pos);