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 <mikest...@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. 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))