return new_d_Conv(dbgi, value, dest_mode);
}
+static ir_node *conv_to_storage_type(dbg_info *const dbgi, ir_node *const val, type_t *const type)
+{
+ ir_mode *const mode = get_ir_mode_storage(type);
+ return create_conv(dbgi, val, mode);
+}
+
/**
* Creates a SymConst node representing a string constant.
*
for (int n = 0; n < n_parameters; ++n) {
expression_t *expression = argument->expression;
ir_node *arg_node = expression_to_firm(expression);
-
- type_t *arg_type = skip_typeref(expression->base.type);
- if (!is_type_compound(arg_type)) {
- ir_mode *const mode = get_ir_mode_storage(arg_type);
- arg_node = create_conv(dbgi, arg_node, mode);
- }
-
- in[n] = arg_node;
+ type_t *arg_type = skip_typeref(expression->base.type);
+ in[n] = conv_to_storage_type(dbgi, arg_node, arg_type);
argument = argument->next;
}
static void assign_value(dbg_info *dbgi, ir_node *addr, type_t *type,
ir_node *value)
{
- if (is_type_scalar(type)) {
- ir_mode *mode = get_ir_mode_storage(type);
- value = create_conv(dbgi, value, mode);
- }
+ value = conv_to_storage_type(dbgi, value, type);
ir_node *memory = get_store();
{
dbg_info *dbgi = get_dbg_info(&expression->base.pos);
type_t *type = skip_typeref(expression->base.type);
-
- if (!is_type_compound(type)) {
- ir_mode *mode = get_ir_mode_storage(type);
- value = create_conv(dbgi, value, mode);
- }
+ value = conv_to_storage_type(dbgi, value, type);
if (expression->kind == EXPR_REFERENCE) {
const reference_expression_t *ref = &expression->reference;
}
ir_node *value = expression_to_firm(expr);
- if (!is_type_compound(type)) {
- ir_mode *mode = get_ir_mode_storage(type);
- value = create_conv(NULL, value, mode);
- }
+ value = conv_to_storage_type(NULL, value, type);
return create_initializer_const(value);
}
ir_node * node = expression_to_firm(value);
dbg_info *const dbgi = get_dbg_info(&entity->base.pos);
- ir_mode *const mode = get_ir_mode_storage(init_type);
- node = create_conv(dbgi, node, mode);
+ node = conv_to_storage_type(dbgi, node, init_type);
if (declaration_kind == DECLARATION_KIND_LOCAL_VARIABLE) {
set_value(entity->variable.v.value_number, node);
int in_len;
if (!is_type_void(type)) {
- ir_mode *const mode = get_ir_mode_storage(type);
if (res) {
- res = create_conv(dbgi, res, mode);
+ res = conv_to_storage_type(dbgi, res, type);
} else {
- res = new_Unknown(mode);
+ res = new_Unknown(get_ir_mode_storage(type));
}
in_len = 1;
} else {
ir_mode *param_mode = get_type_mode(param_irtype);
long pn = n;
ir_node *value = new_rd_Proj(dbgi, args, param_mode, pn);
-
- ir_mode *mode = get_ir_mode_storage(type);
- value = create_conv(NULL, value, mode);
+ value = conv_to_storage_type(dbgi, value, type);
parameter->declaration.kind = DECLARATION_KIND_PARAMETER;
parameter->variable.v.value_number = next_value_number_function;