diff mbox

genattrtab error reporting

Message ID 639C18E7-D6C5-4A5C-A32B-F1BE674A8462@comcast.net
State New
Headers show

Commit Message

Mike Stump May 12, 2014, 7:15 a.m. UTC
Ping?

On May 7, 2014, at 2:21 PM, Mike Stump <mikestump@comcast.net> 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  <mikestump@comcast.net>

	* 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.

Comments

Jeff Law May 12, 2014, 4:14 p.m. UTC | #1
On 05/12/14 01:15, Mike Stump wrote:
> 2014-05-07  Mike Stump<mikestump@comcast.net>
>
> 	* 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.
OK for the trunk.

Jeff
diff mbox

Patch

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))