mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 14:49:38 +08:00
Output line-ref to original igen source file when generating trace
statements. Define NIA macro (dependant on gen-delayed-branch). Verify opening/closing quote in input assembler strings.
This commit is contained in:
@ -1,3 +1,19 @@
|
||||
Tue Oct 14 11:13:27 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* igen.c (print_itrace): Output line-ref to igen source file when
|
||||
generating trace statements.
|
||||
(print_itrace_prefix, print_itrace_format): Escape newline at end
|
||||
of each line of generated call to trace function.
|
||||
|
||||
Mon Oct 13 11:27:31 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* gen-support.c (gen_support_h): Generate #define NIA. Definition
|
||||
dependant on gen-delayed-branch mode.
|
||||
|
||||
* ld-insn.c (parse_insn_mnemonic_record): Check for opening and
|
||||
closing double quote in mnemonic field.
|
||||
(parse_option_record): Add gen-delayed-branch option.
|
||||
|
||||
Wed Oct 8 13:10:16 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* gen.c (insn_list_insert): Missing \n in warning.
|
||||
|
@ -338,12 +338,12 @@ print_itrace_prefix (lf *file,
|
||||
{
|
||||
const char *prefix = "trace_one_insn (";
|
||||
int indent = strlen (prefix);
|
||||
lf_printf (file, "%sSD, CPU, %s, TRACE_LINENUM_P (CPU),\n",
|
||||
lf_printf (file, "%sSD, CPU, %s, TRACE_LINENUM_P (CPU), \\\n",
|
||||
prefix, (options.gen.delayed_branch ? "cia.ip" : "cia"));
|
||||
lf_indent (file, +indent);
|
||||
lf_printf (file, "%sitable[MY_INDEX].file,\n", options.prefix.itable.name);
|
||||
lf_printf (file, "%sitable[MY_INDEX].line_nr,\n", options.prefix.itable.name);
|
||||
lf_printf (file, "\"%s\",\n", phase_lc);
|
||||
lf_printf (file, "%sitable[MY_INDEX].file, \\\n", options.prefix.itable.name);
|
||||
lf_printf (file, "%sitable[MY_INDEX].line_nr, \\\n", options.prefix.itable.name);
|
||||
lf_printf (file, "\"%s\", \\\n", phase_lc);
|
||||
lf_printf (file, "\"%%-18s - ");
|
||||
return indent;
|
||||
}
|
||||
@ -363,7 +363,7 @@ print_itrace_format (lf *file,
|
||||
/* prefix the format with the insn `name' */
|
||||
if (pass == 2)
|
||||
{
|
||||
lf_printf (file, ",\n");
|
||||
lf_printf (file, ", \\\n");
|
||||
lf_printf (file, "%sitable[MY_INDEX].name", options.prefix.itable.name);
|
||||
}
|
||||
/* write out the format/args */
|
||||
@ -409,7 +409,7 @@ print_itrace_format (lf *file,
|
||||
chp++;
|
||||
/* now process it */
|
||||
if (pass == 2)
|
||||
lf_printf (file, ",\n");
|
||||
lf_printf (file, ", \\\n");
|
||||
if (strncmp (fmt, "<", 1) == 0)
|
||||
/* implicit long int format */
|
||||
{
|
||||
@ -485,6 +485,10 @@ print_itrace (lf *file,
|
||||
insn_entry *insn,
|
||||
int idecode)
|
||||
{
|
||||
/* NB: Here we escape each eoln. This is so that the the compiler
|
||||
treats a trace function call as a single line. Consequently any
|
||||
errors in the line are refered back to the same igen assembler
|
||||
source line */
|
||||
const char *phase = (idecode) ? "DECODE" : "INSN";
|
||||
const char *phase_lc = (idecode) ? "decode" : "insn";
|
||||
lf_printf (file, "\n");
|
||||
@ -492,12 +496,12 @@ print_itrace (lf *file,
|
||||
lf_printf (file, "#if defined (WITH_TRACE)\n");
|
||||
lf_printf (file, "/* trace the instructions execution if enabled */\n");
|
||||
lf_printf (file, "if (TRACE_%s_P (CPU))\n", phase);
|
||||
lf_printf (file, " {\n");
|
||||
lf_indent (file, +4);
|
||||
if (insn->mnemonics != NULL)
|
||||
{
|
||||
insn_mnemonic_entry *assembler = insn->mnemonics;
|
||||
int is_first = 1;
|
||||
lf_printf (file, " {\n");
|
||||
lf_indent (file, +4);
|
||||
do
|
||||
{
|
||||
if (assembler->condition != NULL)
|
||||
@ -507,8 +511,10 @@ print_itrace (lf *file,
|
||||
is_first ? "" : "else ",
|
||||
assembler->condition);
|
||||
lf_indent (file, +2);
|
||||
lf_print__line_ref (file, assembler->line);
|
||||
indent = print_itrace_prefix (file, phase_lc);
|
||||
print_itrace_format (file, assembler);
|
||||
lf_print__internal_ref (file);
|
||||
lf_indent (file, -indent);
|
||||
lf_indent (file, -2);
|
||||
if (assembler->next == NULL)
|
||||
@ -522,8 +528,10 @@ print_itrace (lf *file,
|
||||
lf_printf (file, "else\n");
|
||||
lf_indent (file, +2);
|
||||
}
|
||||
lf_print__line_ref (file, assembler->line);
|
||||
indent = print_itrace_prefix (file, phase_lc);
|
||||
print_itrace_format (file, assembler);
|
||||
lf_print__internal_ref (file);
|
||||
lf_indent (file, -indent);
|
||||
if (!is_first)
|
||||
lf_indent (file, -2);
|
||||
@ -534,16 +542,21 @@ print_itrace (lf *file,
|
||||
assembler = assembler->next;
|
||||
}
|
||||
while (assembler != NULL);
|
||||
lf_indent (file, -4);
|
||||
lf_printf (file, " }\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
int indent = print_itrace_prefix (file, phase_lc);
|
||||
lf_printf (file, "?\",\n");
|
||||
int indent;
|
||||
lf_indent (file, +2);
|
||||
lf_print__line_ref (file, insn->line);
|
||||
indent = print_itrace_prefix (file, phase_lc);
|
||||
lf_printf (file, "?\", \\\n");
|
||||
lf_printf (file, "itable[MY_INDEX].name);\n");
|
||||
lf_print__internal_ref (file);
|
||||
lf_indent (file, -indent);
|
||||
lf_indent (file, -2);
|
||||
}
|
||||
lf_indent (file, -4);
|
||||
lf_printf (file, " }\n");
|
||||
lf_indent_suppress (file);
|
||||
lf_printf (file, "#endif\n");
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ parse_insn_word (line_ref *line,
|
||||
chp = skip_spaces (chp);
|
||||
}
|
||||
if (strlen_val == 0)
|
||||
error (line, "Empty value field");
|
||||
error (line, "Empty value field\n");
|
||||
|
||||
/* break out any conditional fields - { "!" <value> } */
|
||||
while (*chp == '!')
|
||||
@ -502,6 +502,7 @@ typedef enum {
|
||||
model_filter_option,
|
||||
multi_sim_option,
|
||||
format_names_option,
|
||||
gen_delayed_branch,
|
||||
unknown_option,
|
||||
} option_names;
|
||||
|
||||
@ -513,6 +514,7 @@ static const name_map option_map[] = {
|
||||
{ "model-filter", model_filter_option },
|
||||
{ "multi-sim", multi_sim_option },
|
||||
{ "format-names", format_names_option },
|
||||
{ "gen-delayed-branch", gen_delayed_branch },
|
||||
{ NULL, unknown_option },
|
||||
};
|
||||
|
||||
@ -579,6 +581,11 @@ parse_option_record (table *file,
|
||||
filter_parse (&options.format_name_filter, value);
|
||||
break;
|
||||
}
|
||||
case gen_delayed_branch:
|
||||
{
|
||||
options.gen.delayed_branch = a2i (value);
|
||||
break;
|
||||
}
|
||||
case unknown_option:
|
||||
{
|
||||
error (option_record->line, "Unknown option - %s\n", name);
|
||||
@ -701,8 +708,11 @@ parse_insn_mnemonic_record (table *file,
|
||||
insn_mnemonic_entry *new_insn_mnemonic = ZALLOC (insn_mnemonic_entry);
|
||||
/* parse it */
|
||||
new_insn_mnemonic->line = record->line;
|
||||
if (record->nr_fields > insn_mnemonic_format_field)
|
||||
new_insn_mnemonic->format = record->field[insn_mnemonic_format_field];
|
||||
ASSERT (record->nr_fields > insn_mnemonic_format_field);
|
||||
new_insn_mnemonic->format = record->field[insn_mnemonic_format_field];
|
||||
ASSERT (new_insn_mnemonic->format[0] == '"');
|
||||
if (new_insn_mnemonic->format[strlen (new_insn_mnemonic->format) - 1] != '"')
|
||||
error (new_insn_mnemonic->line, "Missing closing double quote in mnemonic field\n");
|
||||
if (record->nr_fields > insn_mnemonic_condition_field)
|
||||
new_insn_mnemonic->condition = record->field[insn_mnemonic_condition_field];
|
||||
new_insn_mnemonic->insn = insn;
|
||||
|
Reference in New Issue
Block a user