From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3906 invoked by alias); 8 Apr 2011 21:10:20 -0000 Received: (qmail 3892 invoked by uid 22791); 8 Apr 2011 21:10:19 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 08 Apr 2011 21:10:10 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p38LA9c2017299 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 8 Apr 2011 17:10:09 -0400 Received: from pebble.twiddle.home (vpn-231-224.phx2.redhat.com [10.3.231.224]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p38LA8U5017062; Fri, 8 Apr 2011 17:10:08 -0400 Message-ID: <4D9F79B0.5010900@redhat.com> Date: Fri, 08 Apr 2011 21:10:00 -0000 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9 MIME-Version: 1.0 To: Kai Tietz CC: GCC Patches Subject: Re: [patch i386]: Cleanup calling convention handling in i386.c and fix PR target/9601 and PR target/11772 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-04/txt/msg00662.txt.bz2 > + /* 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~