From 134d3ac4caff6d87c79b0892e57073594cb0064c Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 9 Oct 2026 14:43:11 +0200 Subject: Remove Pointer and nil support --- gcc/gcc/elna-builtins.cc | 1 - gcc/gcc/elna-generic.cc | 6 ------ gcc/gcc/elna-tree.cc | 16 ++++++++++------ 3 files changed, 10 insertions(+), 13 deletions(-) (limited to 'gcc') diff --git a/gcc/gcc/elna-builtins.cc b/gcc/gcc/elna-builtins.cc index 8eb5ce1..69b8229 100644 --- a/gcc/gcc/elna-builtins.cc +++ b/gcc/gcc/elna-builtins.cc @@ -142,7 +142,6 @@ namespace elna::gcc declare_builtin_type(builtin_table, "Word64", unsigned_intDI_type_node); declare_builtin_type(builtin_table, "Char", elna_char_type_node); declare_builtin_type(builtin_table, "Bool", elna_bool_type_node); - declare_builtin_type(builtin_table, "Pointer", elna_pointer_type_node); declare_builtin_type(builtin_table, "Single", float_type_node); declare_builtin_type(builtin_table, "Double", double_type_node); diff --git a/gcc/gcc/elna-generic.cc b/gcc/gcc/elna-generic.cc index bb93270..bf4784b 100644 --- a/gcc/gcc/elna-generic.cc +++ b/gcc/gcc/elna-generic.cc @@ -662,12 +662,6 @@ namespace elna::gcc this->symbols, elna_char_type_node); } - void generic_visitor::visit(boot::literal *) - { - this->current_expression = constant_to_tree(boot::constant_value{ std::nullptr_t{} }, - this->symbols, elna_pointer_type_node); - } - void generic_visitor::visit(boot::literal *string) { tree slice_type = get_inner_alias(string->type_decoration, symbols); diff --git a/gcc/gcc/elna-tree.cc b/gcc/gcc/elna-tree.cc index 0f94864..9612ae2 100644 --- a/gcc/gcc/elna-tree.cc +++ b/gcc/gcc/elna-tree.cc @@ -85,12 +85,9 @@ namespace elna::gcc return field_declaration; } - // The generic Pointer has no pointee size; it advances byte by byte. static tree pointer_stride(tree pointer_type, tree offset_type) { - return pointer_type == elna_pointer_type_node - ? size_one_node - : fold_convert(offset_type, size_in_bytes(TREE_TYPE(pointer_type))); + return fold_convert(offset_type, size_in_bytes(TREE_TYPE(pointer_type))); } tree do_pointer_arithmetic(boot::binary_operator binary_operator, @@ -293,9 +290,16 @@ namespace elna::gcc { return build_int_cstu(elna_char_type_node, std::get(constant_value)); } - else if (std::holds_alternative(constant_value)) + else if (std::holds_alternative(constant_value)) { - return null_pointer_node; + const boot::integer_literal& address = + std::get(constant_value).address; + + if (auto converted = address.try_to()) + { + return build_int_cstu(type, *converted); + } + return NULL_TREE; } else if (std::holds_alternative(constant_value)) { -- cgit v1.2.3