aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-09-12 01:29:43 +0200
committerEugen Wissner <belka@caraus.de>2026-09-12 01:29:43 +0200
commit2d3ba9b352478e5a3d3add482f56f1c801965428 (patch)
tree48b7809c054ceb09f86918dd8bb7352222e8940a /gcc
parenteb1d068beeaaa420b558595751295eec35ad0c3c (diff)
downloadelna-2d3ba9b352478e5a3d3add482f56f1c801965428.tar.gz
Fix enumeration size to be hardware word in the backend
Diffstat (limited to 'gcc')
-rw-r--r--gcc/gcc/elna-generic.cc21
-rw-r--r--gcc/gcc/elna-tree.cc2
2 files changed, 10 insertions, 13 deletions
diff --git a/gcc/gcc/elna-generic.cc b/gcc/gcc/elna-generic.cc
index 8fd2ec8..94a70df 100644
--- a/gcc/gcc/elna-generic.cc
+++ b/gcc/gcc/elna-generic.cc
@@ -44,11 +44,10 @@ namespace elna::gcc
void generic_visitor::build_procedure_call(location_t call_location,
tree procedure_address, const std::vector<boot::expression *>& arguments,
- const std::vector<boot::type>& variadic_types)
+ const std::vector<boot::type>& argument_types)
{
vec<tree, va_gc> *argument_trees = nullptr;
tree symbol_type = TREE_TYPE(TREE_TYPE(procedure_address));
- const std::size_t fixed_count = arguments.size() - variadic_types.size();
vec_alloc(argument_trees, arguments.size());
for (std::size_t i = 0; i < arguments.size(); ++i)
@@ -56,15 +55,13 @@ namespace elna::gcc
arguments.at(i)->accept(this);
this->current_expression = prepare_rvalue(this->current_expression);
- if (i >= fixed_count)
- {
- tree passed_type = get_inner_alias(variadic_types.at(i - fixed_count), this->symbols);
+ tree passed_type = get_inner_alias(argument_types.at(i), this->symbols);
+ const bool scalar_target = INTEGRAL_TYPE_P(passed_type)
+ || SCALAR_FLOAT_TYPE_P(passed_type) || POINTER_TYPE_P(passed_type);
- if (passed_type != TREE_TYPE(this->current_expression)
- && (INTEGRAL_TYPE_P(passed_type) || SCALAR_FLOAT_TYPE_P(passed_type)))
- {
- this->current_expression = fold_convert(passed_type, this->current_expression);
- }
+ if (scalar_target && passed_type != TREE_TYPE(this->current_expression))
+ {
+ this->current_expression = fold_convert(passed_type, this->current_expression);
}
argument_trees->quick_push(this->current_expression);
}
@@ -128,12 +125,12 @@ namespace elna::gcc
this->current_expression = build1(ADDR_EXPR,
build_pointer_type(expression_type), this->current_expression);
build_procedure_call(call_location, this->current_expression,
- call->arguments, call->variadic_types);
+ call->arguments, call->argument_types);
}
else if (POINTER_TYPE_P(expression_type) && TREE_CODE(TREE_TYPE(expression_type)) == FUNCTION_TYPE)
{
build_procedure_call(call_location, this->current_expression,
- call->arguments, call->variadic_types);
+ call->arguments, call->argument_types);
}
else
{
diff --git a/gcc/gcc/elna-tree.cc b/gcc/gcc/elna-tree.cc
index 7aa4012..7e9197f 100644
--- a/gcc/gcc/elna-tree.cc
+++ b/gcc/gcc/elna-tree.cc
@@ -201,7 +201,7 @@ namespace elna::gcc
tree build_enumeration_type(const std::vector<std::string>& members)
{
tree composite_type_node = make_node(ENUMERAL_TYPE);
- tree base_type = integer_type_node;
+ tree base_type = elna_word_type_node;
TREE_TYPE(composite_type_node) = base_type;
ENUM_IS_SCOPED(composite_type_node) = 1;