> + /* Special case regparm/sseregparm, which are either cdecl or stdcall. */
> + if ((ret & (IX86_CALLCVT_REGPARM | IX86_CALLCVT_SSEREGPARM)) != 0)
> + return (ret | ((TARGET_RTD && !stdarg_p (type)) ? IX86_CALLCVT_STDCALL
> + : IX86_CALLCVT_CDECL));
> +
> + /* We don't have found a default call-convention specifier,
> + so apply default. */
> + if (TARGET_RTD && !stdarg_p (type))
> + return IX86_CALLCVT_STDCALL;
> + else if (TREE_CODE (type) != METHOD_TYPE || stdarg_p (type)
> + || ix86_function_type_abi (type) != MS_ABI)
> + return IX86_CALLCVT_CDECL;
> + return IX86_CALLCVT_THISCALL;
Perhaps clearer as
bool stdarg = stdarg_p (type);
if (TARGET_RTD && !stdarg)
return IX86_CALLCVT_STDCALL | ret;
if (ret != 0
|| stdarg
|| TREE_CODE (type) != METHOD_TYPE
|| ix86_function_type_abi (type) != MS_ABI)
return IX86_CALLCVT_CDECL | ret;
return IX86_CALLCVT_THISCALL;
> + case IX86_CALLCVT_STDCALL:
> + case IX86_CALLCVT_FASTCALL:
> + case IX86_CALLCVT_THISCALL:
> + rtd = 1;
> + break;
> }
>
> + if (rtd && ! stdarg_p (funtype))
> + return size;
You can move the stdarg_p test into the switch and drop the rtd variable.
> + if ((ccvt & IX86_CALLCVT_STDCALL) != 0)
> new_id = gen_stdcall_or_fastcall_decoration (decl, id, '_');
> + else if (ccvt == IX86_CALLCVT_FASTCALL)
> new_id = gen_stdcall_or_fastcall_decoration (decl, id, FASTCALL_PREFIX);
I think perhaps it would be cleaner to consistently test bits,
rather than sometimes test bits and sometimes test equality.
I know that FASTCALL isn't supposed to have any other bits set,
but we shouldn't have to constantly think about which is which.
Not just here in netware.c, where I noticed, but elsewhere as well.
r~