Commit fed87ca4 authored by Matthias Braun's avatar Matthias Braun
Browse files

ia32: small structs are returned in int regs on darwin

parent 1c3acfb9
......@@ -1691,8 +1691,12 @@ static void ia32_lower_for_target(void)
* on the callframe and we can't just use an arbitrary position on the
* stackframe)
*/
lower_calls_with_compounds(LF_RETURN_HIDDEN | LF_DONT_LOWER_ARGUMENTS
| LF_RETURN_SMALL_ARRAY_IN_INTS);
bool darwin_abi = be_gas_object_file_format == OBJECT_FILE_FORMAT_MACH_O;
compound_call_lowering_flags lower_call_flags
= LF_RETURN_HIDDEN | LF_DONT_LOWER_ARGUMENTS
| LF_RETURN_SMALL_ARRAY_IN_INTS
| (darwin_abi ? LF_RETURN_SMALL_STRUCT_IN_INTS : LF_NONE);
lower_calls_with_compounds(lower_call_flags);
be_after_irp_transform("lower-calls");
/* replace floating point operations by function calls */
......
......@@ -86,10 +86,13 @@ static void remove_compound_param_entities(ir_graph *irg)
static unsigned return_in_ints(compound_call_lowering_flags flags, ir_type *tp)
{
if (!(flags & LF_RETURN_SMALL_ARRAY_IN_INTS))
return 0;
if (!is_Array_type(tp))
if (is_Array_type(tp)) {
if (!(flags&LF_RETURN_SMALL_ARRAY_IN_INTS))
return 0;
} else if (!(flags & LF_RETURN_SMALL_STRUCT_IN_INTS)) {
assert(is_aggregate_type(tp));
return 0;
}
unsigned size = get_type_size_bytes(tp);
unsigned n_regs = size / get_mode_size_bytes(int_return_mode);
if (n_regs > 2)
......
......@@ -24,6 +24,8 @@ typedef enum compound_call_lowering_flags {
/** Return small arays as integer values instead of storing them into
* memory. */
LF_RETURN_SMALL_ARRAY_IN_INTS = 1 << 2,
/** Return small structs as integer values */
LF_RETURN_SMALL_STRUCT_IN_INTS = 1 << 3,
} compound_call_lowering_flags;
ENUM_BITSET(compound_call_lowering_flags)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment