aboutsummaryrefslogtreecommitdiff
path: root/sim/igen
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-10-14 02:54:08 +0000
committerAndrew Cagney <cagney@redhat.com>1997-10-14 02:54:08 +0000
commitd5cecca93cccbd347346d68d8bce8371b675a806 (patch)
tree2456c269c20847816289269e44d45e376d6c118f /sim/igen
parentc7eece073ab27cfe0fb9e72f0559cd8dbad8ee49 (diff)
downloadgdb-d5cecca93cccbd347346d68d8bce8371b675a806.zip
gdb-d5cecca93cccbd347346d68d8bce8371b675a806.tar.gz
gdb-d5cecca93cccbd347346d68d8bce8371b675a806.tar.bz2
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.
Diffstat (limited to 'sim/igen')
-rw-r--r--sim/igen/ChangeLog16
-rw-r--r--sim/igen/igen.c37
-rw-r--r--sim/igen/ld-insn.c16
3 files changed, 54 insertions, 15 deletions
diff --git a/sim/igen/ChangeLog b/sim/igen/ChangeLog
index 91f8e5a..cef45a1 100644
--- a/sim/igen/ChangeLog
+++ b/sim/igen/ChangeLog
@@ -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.
diff --git a/sim/igen/igen.c b/sim/igen/igen.c
index 7820603..0fbe8e5 100644
--- a/sim/igen/igen.c
+++ b/sim/igen/igen.c
@@ -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");
}
diff --git a/sim/igen/ld-insn.c b/sim/igen/ld-insn.c
index 8d33a3e..eaa7eca 100644
--- a/sim/igen/ld-insn.c
+++ b/sim/igen/ld-insn.c
@@ -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;