From patchwork Wed May 7 21:21:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Stump X-Patchwork-Id: 346824 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 518B514019C for ; Thu, 8 May 2014 07:22:07 +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:from :content-type:subject:date:message-id:cc:to:mime-version; q=dns; s=default; b=PcTn5Sf3LnSKyMOom83IpOfEROysFIogwRU1zh+4QNkhlBbJzh Wq2E8nyOAhF22BikbUl3MMuUeNolIGJ7M0ScR8/mXV5AfQ+8DTOomU/wv90sKgsF 9SfDj96j/6FCsNvUSts1+t02A0LdUczkomFbcP6YcSNrHZ2hi53hKdU/E= 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:from :content-type:subject:date:message-id:cc:to:mime-version; s= default; bh=FzXKmeiBy5n2iOi3qGH64wb0t2M=; b=Py5jdcF32mB6ZngtNwVZ lvA2Mut14iv21pX1XUKaAK5pLJVe1cPvQEueISSIkhxxus8KV1KFLSfIWhQTGdov vU4mBpwqKALkWoV483td3Jv4hDd1xtl7rvxW+3C2vNCmt3xFkskUqmRIZNozNMbR WazZEmJAAcesKA9JA0CmUog= Received: (qmail 18221 invoked by alias); 7 May 2014 21:22:00 -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 18206 invoked by uid 89); 7 May 2014 21:21:58 -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: qmta02.emeryville.ca.mail.comcast.net Received: from qmta02.emeryville.ca.mail.comcast.net (HELO qmta02.emeryville.ca.mail.comcast.net) (76.96.30.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 May 2014 21:21:57 +0000 Received: from omta12.emeryville.ca.mail.comcast.net ([76.96.30.44]) by qmta02.emeryville.ca.mail.comcast.net with comcast id z4dv1n0020x6nqcA29MwDy; Wed, 07 May 2014 21:21:56 +0000 Received: from [IPv6:2001:558:6045:a4:7993:2ff5:6ac7:779d] ([IPv6:2001:558:6045:a4:7993:2ff5:6ac7:779d]) by omta12.emeryville.ca.mail.comcast.net with comcast id z9Mu1n00s2t6eyq8Y9Mvci; Wed, 07 May 2014 21:21:55 +0000 From: Mike Stump Subject: genattrtab error reporting Date: Wed, 7 May 2014 14:21:54 -0700 Message-Id: Cc: Kenneth Zadeck To: gcc-patches Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) X-IsSubscribed: yes 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))