From 8a3600aba3cb3e9b5d47243b8e720c34e16018be Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Tue, 26 May 2020 15:26:16 +0200 Subject: [PATCH] misc: removed unused code --- crates/mun_codegen/src/code_gen/symbols.rs | 12 +++--- crates/mun_codegen/src/ir.rs | 1 - crates/mun_codegen/src/ir/abi_types.rs | 47 ---------------------- crates/mun_codegen/src/ir/file_group.rs | 5 --- crates/mun_codegen_macros/src/lib.rs | 2 + 5 files changed, 7 insertions(+), 60 deletions(-) delete mode 100644 crates/mun_codegen/src/ir/abi_types.rs diff --git a/crates/mun_codegen/src/code_gen/symbols.rs b/crates/mun_codegen/src/code_gen/symbols.rs index 015ad6c5a..fd947b1b5 100644 --- a/crates/mun_codegen/src/code_gen/symbols.rs +++ b/crates/mun_codegen/src/code_gen/symbols.rs @@ -1,6 +1,5 @@ use crate::ir::ir_types as ir; use crate::ir::{ - abi_types::{gen_abi_types, AbiTypes}, dispatch_table::{DispatchTable, DispatchableFunction}, function, type_table::TypeTable, @@ -207,9 +206,6 @@ pub(super) fn gen_reflection_ir( ) { let module = context.module; - // Get all the types - let abi_types = gen_abi_types(context.type_context); - let num_functions = api.len() as u32; let functions = get_function_definition_array(db, context, api.iter()); @@ -234,7 +230,7 @@ pub(super) fn gen_reflection_ir( let dispatch_table = gen_dispatch_table(context, dispatch_table); // Construct the actual `get_info` function - gen_get_info_fn(db, context, &abi_types, module_info, dispatch_table); + gen_get_info_fn(db, context, module_info, dispatch_table); gen_set_allocator_handle_fn(db, context); } @@ -242,7 +238,6 @@ pub(super) fn gen_reflection_ir( fn gen_get_info_fn( db: &impl IrDatabase, context: &IrValueContext, - abi_types: &AbiTypes, module_info: ir::ModuleInfo, dispatch_table: ir::DispatchTable, ) { @@ -292,7 +287,10 @@ fn gen_get_info_fn( .unwrap() .into_pointer_value() } else { - builder.build_alloca(abi_types.assembly_info_type, "") + builder.build_alloca( + Value::::get_ir_type(context.type_context), + "", + ) }; // Get access to the structs internals diff --git a/crates/mun_codegen/src/ir.rs b/crates/mun_codegen/src/ir.rs index 5c4b2e48f..444858acf 100644 --- a/crates/mun_codegen/src/ir.rs +++ b/crates/mun_codegen/src/ir.rs @@ -6,7 +6,6 @@ use inkwell::types::{ }; use inkwell::AddressSpace; -pub(crate) mod abi_types; pub mod adt; pub mod body; #[macro_use] diff --git a/crates/mun_codegen/src/ir/abi_types.rs b/crates/mun_codegen/src/ir/abi_types.rs deleted file mode 100644 index 6ab369c50..000000000 --- a/crates/mun_codegen/src/ir/abi_types.rs +++ /dev/null @@ -1,47 +0,0 @@ -use super::ir_types as ir; -use crate::value::{IrTypeContext, Value}; -use inkwell::types::{ArrayType, IntType, StructType}; - -#[derive(Debug, PartialEq, Eq)] -pub(crate) struct AbiTypes { - pub guid_type: ArrayType, - pub type_group_type: IntType, - pub privacy_type: IntType, - pub type_info_type: StructType, - pub function_signature_type: StructType, - pub function_prototype_type: StructType, - pub function_definition_type: StructType, - pub struct_info_type: StructType, - pub module_info_type: StructType, - pub dispatch_table_type: StructType, - pub assembly_info_type: StructType, -} - -/// Returns an `AbiTypes` struct that contains references to all LLVM ABI types. -pub(crate) fn gen_abi_types(context: &IrTypeContext) -> AbiTypes { - let guid_type = Value::::get_ir_type(context); - let type_group_type = Value::::get_ir_type(context); - let privacy_type = Value::::get_ir_type(context); - let type_info_type = Value::::get_ir_type(context); - let function_signature_type = Value::::get_ir_type(context); - let function_prototype_type = Value::::get_ir_type(context); - let function_definition_type = Value::::get_ir_type(context); - let struct_info_type = Value::::get_ir_type(context); - let module_info_type = Value::::get_ir_type(context); - let dispatch_table_type = Value::::get_ir_type(context); - let assembly_info_type = Value::::get_ir_type(context); - - AbiTypes { - guid_type, - type_group_type, - privacy_type, - type_info_type, - function_signature_type, - function_prototype_type, - function_definition_type, - struct_info_type, - module_info_type, - dispatch_table_type, - assembly_info_type, - } -} diff --git a/crates/mun_codegen/src/ir/file_group.rs b/crates/mun_codegen/src/ir/file_group.rs index 88a775455..bc9cb95a9 100644 --- a/crates/mun_codegen/src/ir/file_group.rs +++ b/crates/mun_codegen/src/ir/file_group.rs @@ -1,5 +1,4 @@ use super::{ - abi_types::{gen_abi_types, AbiTypes}, adt, dispatch_table::{DispatchTable, DispatchTableBuilder}, intrinsics, @@ -17,8 +16,6 @@ use std::{collections::BTreeMap, sync::Arc}; pub struct FileGroupIR { /// The LLVM module that contains the IR pub(crate) llvm_module: Module, - /// Contains references to all of the ABI's IR types. - pub(crate) abi_types: AbiTypes, /// The dispatch table pub(crate) dispatch_table: DispatchTable, /// The type table @@ -86,7 +83,6 @@ pub(crate) fn ir_query(db: &impl IrDatabase, file_id: hir::FileId) -> Arc Arc