From patchwork Mon May 12 07:15:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Stump X-Patchwork-Id: 347898 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DD61514008E for ; Mon, 12 May 2014 17:15:41 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; q=dns; s=default; b=gmJuXvNSa1bGER250 KCsL86IkX1BKVY1QcnYpi1ZyNd+KE/nR19NCs5v1iCtHemjXc5Evi0KtLwBlzXcp HpXx2uLCr/8F9DliZCOkwPQ+CiEgWmQ2E8zQY4xDil5pwrZmhqlAtHlTAZaJ98Fq W9zwadVXkIhDcGKnAg99BE33Co= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; s=default; bh=5Tc2poZR1bOe9hkXPiXsdBm lfVQ=; b=GFZkUqKsVhXyBWnDxFDtq0SUaL1TCyP4wiOSTf7BFEtgtE4O2i5O07s QgyuIPVBrGpoLDtbO5h9kevyzn3yC7ntE3lj8DgDWhuBgNPlnhU59btv1rgFXrm0 qy1xOd1ZSR7rl1D9auzuo9wgR2/jy117B5tlqUYkevd4wGgSLJZo= Received: (qmail 5190 invoked by alias); 12 May 2014 07:15:33 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 5160 invoked by uid 89); 12 May 2014 07:15:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: qmta10.emeryville.ca.mail.comcast.net Received: from qmta10.emeryville.ca.mail.comcast.net (HELO qmta10.emeryville.ca.mail.comcast.net) (76.96.30.17) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 12 May 2014 07:15:29 +0000 Received: from omta20.emeryville.ca.mail.comcast.net ([76.96.30.87]) by qmta10.emeryville.ca.mail.comcast.net with comcast id 0vDC1o0021smiN4AAvFUNd; Mon, 12 May 2014 07:15:28 +0000 Received: from [IPv6:2601:9:5f80:ba4::1] ([IPv6:2601:9:5f80:ba4::1]) by omta20.emeryville.ca.mail.comcast.net with comcast id 0vFS1o00K2nwLhK8gvFTWD; Mon, 12 May 2014 07:15:27 +0000 Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Subject: Re: genattrtab error reporting From: Mike Stump In-Reply-To: Date: Mon, 12 May 2014 00:15:10 -0700 Cc: gcc-patches , Kenneth Zadeck Message-Id: <639C18E7-D6C5-4A5C-A32B-F1BE674A8462@comcast.net> References: To: Mike & Elizabeth Stump X-IsSubscribed: yes Ping? On May 7, 2014, at 2:21 PM, Mike Stump wrote: > getattrtab looses track of which file the given rtl came from during error reporting. A port that uses multiple .md files for the port will tend to list the last .md file processed instead of the correct md file. We preserve the filename upon read, and during post processing, we reset the filename to the right context, as we process that context. > > Ok? 2014-05-07 Mike Stump * genattrtab.c (struct insn_def): Add filename. (convert_set_attr_alternative): Improve error message. (check_defs): Ensure read_md_filename is set appropriately. (gen_insn): Save read_md_filename. diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c index 99b1b83..0f14b4d 100644 --- a/gcc/genattrtab.c +++ b/gcc/genattrtab.c @@ -139,6 +139,7 @@ struct insn_def rtx def; /* The DEFINE_... */ int insn_code; /* Instruction number. */ int insn_index; /* Expression number in file, for errors. */ + const char *filename; /* Filename. */ int lineno; /* Line number. */ int num_alternatives; /* Number of alternatives. */ int vec_idx; /* Index of attribute vector in `def'. */ @@ -1066,7 +1067,8 @@ convert_set_attr_alternative (rtx exp, struct insn_def *id) if (XVECLEN (exp, 1) != num_alt) { error_with_line (id->lineno, - "bad number of entries in SET_ATTR_ALTERNATIVE"); + "bad number of entries in SET_ATTR_ALTERNATIVE, was %d expected %d", + XVECLEN (exp, 1), num_alt); return NULL_RTX; } @@ -1137,6 +1139,7 @@ check_defs (void) if (XVEC (id->def, id->vec_idx) == NULL) continue; + read_md_filename = id->filename; for (i = 0; i < XVECLEN (id->def, id->vec_idx); i++) { value = XVECEXP (id->def, id->vec_idx, i); @@ -3280,6 +3283,7 @@ gen_insn (rtx exp, int lineno) id->next = defs; defs = id; id->def = exp; + id->filename = read_md_filename; id->lineno = lineno; switch (GET_CODE (exp))