From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14271 invoked by alias); 2 Aug 2004 14:22:04 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 14259 invoked from network); 2 Aug 2004 14:22:02 -0000 Received: from unknown (HELO main.gmane.org) (80.91.224.249) by sourceware.org with SMTP; 2 Aug 2004 14:22:02 -0000 Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1BrdhS-00047l-00 for ; Mon, 02 Aug 2004 16:22:02 +0200 Received: from paride.rett.polimi.it ([131.175.65.135]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 02 Aug 2004 16:22:01 +0200 Received: from bonzini by paride.rett.polimi.it with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 02 Aug 2004 16:22:01 +0200 To: gcc-patches@gcc.gnu.org From: Paolo Bonzini Subject: Re: RFC: define_predicate Date: Mon, 02 Aug 2004 14:33:00 -0000 Message-ID: <410E4EF3.603@gnu.org> References: <87u0vx99j5.fsf@codesourcery.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: paride.rett.polimi.it User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) In-Reply-To: <87u0vx99j5.fsf@codesourcery.com> X-SW-Source: 2004-08/txt/msg00049.txt.bz2 > (define_predicate "call_operand" "subreg,reg,symbol_ref" > { > if (mode != GET_MODE (op) && mode != VOIDmode) > return 0; > > return (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == REG > || (GET_CODE (op) == SUBREG && GET_CODE (XEXP (op, 0)) == REG)); > }) This could be simplified more, as in if (GET_CODE (op) == SUBREG) return REG_P (XEXP (op, 0)) && call_operand (XEXP (op, 0), mode); else return (mode == GET_MODE (op) || mode == VOIDmode); if genpreds.c would put an additional switch statement before the user code. Well, maybe in this case it is not that much more readable (maybe the opposite is true), but in many predicates the third argument to define_predicate would be superfluous, as in +;; Return 1 if OP refers to a symbol. +(define_predicate "symbolic_operand" "symbol_ref,const,label_ref" +{ + switch (GET_CODE (op)) + { + case CONST: + case SYMBOL_REF: + case LABEL_REF: + return 1; + + default: + break; + } + return 0; +}) and that argument could be made optional (defaulting to "return 1;"). Does this make sense? Paolo