{
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;
}
/* 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 */
chp++;
/* now process it */
if (pass == 2)
- lf_printf (file, ",\n");
+ lf_printf (file, ", \\\n");
if (strncmp (fmt, "<", 1) == 0)
/* implicit long int format */
{
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");
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)
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)
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);
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");
}
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 == '!')
model_filter_option,
multi_sim_option,
format_names_option,
+ gen_delayed_branch,
unknown_option,
} option_names;
{ "model-filter", model_filter_option },
{ "multi-sim", multi_sim_option },
{ "format-names", format_names_option },
+ { "gen-delayed-branch", gen_delayed_branch },
{ NULL, unknown_option },
};
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);
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;