Don't bother generating trace prefix string when not tracing.

This commit is contained in:
Andrew Cagney
1998-04-03 17:13:40 +00:00
parent ffabaa53e9
commit 72a08ce565
3 changed files with 117 additions and 99 deletions

View File

@@ -1,3 +1,18 @@
Sat Apr 4 01:07:06 1998 Andrew Cagney <cagney@b1.cygnus.com>
* sim-trace.c (set_trace_option_mask): Keep TRACE_ANY_P
up-to-date.
* sim-trace.h (TRACE_ANY_P): Define.
(struct _trace_data): Add trace_any_p.
start-sanitize-sky
Tue Mar 31 16:44:15 1998 Jim Lemke <jlemke@cygnus.com>
* sim-base.h: Add fp_type_opt etc to sim_state_base for
the global option "float_type".
end-sanitize-sky
Mon Mar 30 17:11:55 1998 Andrew Cagney <cagney@b1.cygnus.com> Mon Mar 30 17:11:55 1998 Andrew Cagney <cagney@b1.cygnus.com>
* run.c (main): Handle all alternatives of enum sim_stop. * run.c (main): Handle all alternatives of enum sim_stop.

View File

@@ -1,3 +1,13 @@
Sat Apr 4 02:15:35 1998 Andrew Cagney <cagney@b1.cygnus.com>
* igen.c (print_itrace): Use TRACE_ANY_P macro to determine if any
tracing is needed.
Thu Mar 26 20:51:23 1998 Stu Grossman <grossman@bhuna.cygnus.co.uk>
* table.c (table_push): Redo, using stdio. Fixes NT native
problem with <CRLF>=><LF> translation...
Tue Mar 24 23:30:07 1998 Andrew Cagney <cagney@b1.cygnus.com> Tue Mar 24 23:30:07 1998 Andrew Cagney <cagney@b1.cygnus.com>
* gen-engine.c (print_run_body): Re-extract the CIA after * gen-engine.c (print_run_body): Re-extract the CIA after

View File

@@ -1,6 +1,6 @@
/* This file is part of the program psim. /* This file is part of the program psim.
Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au> Copyright (C) 1994-1998, Andrew Cagney <cagney@highland.com.au>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -333,18 +333,15 @@ print_my_defines (lf *file,
static int static int
print_itrace_prefix (lf *file, print_itrace_prefix (lf *file)
const char *phase_lc)
{ {
const char *prefix = "trace_one_insn ("; const char *prefix = "trace_prefix (";
int indent = strlen (prefix); int indent = strlen (prefix);
lf_printf (file, "%sSD, CPU, %s, TRACE_LINENUM_P (CPU), \\\n", lf_printf (file, "%sSD, CPU, cia, CIA, TRACE_LINENUM_P (CPU), \\\n", prefix);
prefix, (options.gen.delayed_branch ? "cia.ip" : "cia"));
lf_indent (file, +indent); lf_indent (file, +indent);
lf_printf (file, "%sitable[MY_INDEX].file, \\\n", options.prefix.itable.name); 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, "%sitable[MY_INDEX].line_nr, \\\n", options.prefix.itable.name);
lf_printf (file, "\"%s\", \\\n", phase_lc); lf_printf (file, "\"");
lf_printf (file, "\"%%-18s - ");
return indent; return indent;
} }
@@ -360,12 +357,6 @@ print_itrace_format (lf *file,
{ {
const char *chp = assembler->format; const char *chp = assembler->format;
chp++; /* skip the leading quote */ chp++; /* skip the leading quote */
/* prefix the format with the insn `name' */
if (pass == 2)
{
lf_printf (file, ", \\\n");
lf_printf (file, "%sitable[MY_INDEX].name", options.prefix.itable.name);
}
/* write out the format/args */ /* write out the format/args */
while (*chp != '\0') while (*chp != '\0')
{ {
@@ -485,23 +476,23 @@ print_itrace (lf *file,
insn_entry *insn, insn_entry *insn,
int idecode) int idecode)
{ {
/* NB: Here we escape each eoln. This is so that the the compiler /* NB: Here we escape each EOLN. This is so that the the compiler
treats a trace function call as a single line. Consequently any treats a trace function call as a single line. Consequently any
errors in the line are refered back to the same igen assembler errors in the line are refered back to the same igen assembler
source line */ source line */
const char *phase = (idecode) ? "DECODE" : "INSN"; const char *phase = (idecode) ? "DECODE" : "INSN";
const char *phase_lc = (idecode) ? "decode" : "insn";
lf_printf (file, "\n"); lf_printf (file, "\n");
lf_indent_suppress (file); lf_indent_suppress (file);
lf_printf (file, "#if defined (WITH_TRACE)\n"); lf_printf (file, "#if defined (WITH_TRACE)\n");
lf_printf (file, "/* trace the instructions execution if enabled */\n"); lf_printf (file, "/* generate a trace prefix if any tracing enabled */\n");
lf_printf (file, "if (TRACE_%s_P (CPU))\n", phase); lf_printf (file, "if (TRACE_ANY_P (CPU))\n");
lf_printf (file, " {\n");
lf_indent (file, +4);
{
if (insn->mnemonics != NULL) if (insn->mnemonics != NULL)
{ {
insn_mnemonic_entry *assembler = insn->mnemonics; insn_mnemonic_entry *assembler = insn->mnemonics;
int is_first = 1; int is_first = 1;
lf_printf (file, " {\n");
lf_indent (file, +4);
do do
{ {
if (assembler->condition != NULL) if (assembler->condition != NULL)
@@ -512,7 +503,7 @@ print_itrace (lf *file,
assembler->condition); assembler->condition);
lf_indent (file, +2); lf_indent (file, +2);
lf_print__line_ref (file, assembler->line); lf_print__line_ref (file, assembler->line);
indent = print_itrace_prefix (file, phase_lc); indent = print_itrace_prefix (file);
print_itrace_format (file, assembler); print_itrace_format (file, assembler);
lf_print__internal_ref (file); lf_print__internal_ref (file);
lf_indent (file, -indent); lf_indent (file, -indent);
@@ -529,7 +520,7 @@ print_itrace (lf *file,
lf_indent (file, +2); lf_indent (file, +2);
} }
lf_print__line_ref (file, assembler->line); lf_print__line_ref (file, assembler->line);
indent = print_itrace_prefix (file, phase_lc); indent = print_itrace_prefix (file);
print_itrace_format (file, assembler); print_itrace_format (file, assembler);
lf_print__internal_ref (file); lf_print__internal_ref (file);
lf_indent (file, -indent); lf_indent (file, -indent);
@@ -542,21 +533,25 @@ print_itrace (lf *file,
assembler = assembler->next; assembler = assembler->next;
} }
while (assembler != NULL); while (assembler != NULL);
lf_indent (file, -4);
lf_printf (file, " }\n");
} }
else else
{ {
int indent; int indent;
lf_indent (file, +2); lf_indent (file, +2);
lf_print__line_ref (file, insn->line); lf_print__line_ref (file, insn->line);
indent = print_itrace_prefix (file, phase_lc); indent = print_itrace_prefix (file);
lf_printf (file, "?\", \\\n"); lf_printf (file, "%%s\", \\\n");
lf_printf (file, "itable[MY_INDEX].name);\n"); lf_printf (file, "itable[MY_INDEX].name);\n");
lf_print__internal_ref (file); lf_print__internal_ref (file);
lf_indent (file, -indent); lf_indent (file, -indent);
lf_indent (file, -2); lf_indent (file, -2);
} }
lf_printf (file, "/* trace the instruction execution if enabled */\n");
lf_printf (file, "if (TRACE_%s_P (CPU))\n", phase);
lf_printf (file, " trace_generic (SD, CPU, TRACE_%s_IDX, \" %%s\", itable[MY_INDEX].name);\n", phase);
}
lf_indent (file, -4);
lf_printf (file, " }\n");
lf_indent_suppress (file); lf_indent_suppress (file);
lf_printf (file, "#endif\n"); lf_printf (file, "#endif\n");
} }
@@ -786,14 +781,10 @@ gen_idecode_h (lf *file,
gen_list *entry; gen_list *entry;
for (entry = gen->tables; entry != NULL; entry = entry->next) for (entry = gen->tables; entry != NULL; entry = entry->next)
{ {
if (entry->model != NULL)
print_idecode_issue_function_header (file, print_idecode_issue_function_header (file,
entry->model->name, (options.gen.multi_sim
is_function_declaration, ? entry->model->name
1/*ALWAYS ONE WORD*/); : NULL),
else
print_idecode_issue_function_header (file,
NULL,
is_function_declaration, is_function_declaration,
1/*ALWAYS ONE WORD*/); 1/*ALWAYS ONE WORD*/);
} }
@@ -838,14 +829,10 @@ gen_idecode_c (lf *file,
/* output the main idecode routine */ /* output the main idecode routine */
if (!options.gen.icache) if (!options.gen.icache)
{ {
if (entry->model != NULL)
print_idecode_issue_function_header (file, print_idecode_issue_function_header (file,
entry->model->name, (options.gen.multi_sim
1/*is definition*/, ? entry->model->name
1/*ALWAYS ONE WORD*/); : NULL),
else
print_idecode_issue_function_header (file,
NULL,
1/*is definition*/, 1/*is definition*/,
1/*ALWAYS ONE WORD*/); 1/*ALWAYS ONE WORD*/);
lf_printf (file, "{\n"); lf_printf (file, "{\n");
@@ -1057,7 +1044,9 @@ main (int argc,
printf (" -Werror\n"); printf (" -Werror\n");
printf ("\t Make warnings errors\n"); printf ("\t Make warnings errors\n");
printf (" -Wnodiscard\n"); printf (" -Wnodiscard\n");
printf ("\t Suppress warnings about discarded instructions\n"); printf ("\t Suppress warnings about discarded functions and instructions\n");
printf (" -Wnowidth\n");
printf ("\t Suppress warnings about instructions with invalid widths\n");
printf ("\n"); printf ("\n");
printf (" -G [!]<gen-option>\n"); printf (" -G [!]<gen-option>\n");
printf ("\t Any of the following options:\n"); printf ("\t Any of the following options:\n");
@@ -1266,6 +1255,10 @@ main (int argc,
options.warn.discard = 0; options.warn.discard = 0;
else if (strcmp (optarg, "discard") == 0) else if (strcmp (optarg, "discard") == 0)
options.warn.discard = 1; options.warn.discard = 1;
else if (strcmp (optarg, "nowidth") == 0)
options.warn.width = 0;
else if (strcmp (optarg, "width") == 0)
options.warn.width = 1;
else else
error (NULL, "Unknown -W argument `%s'\n", optarg); error (NULL, "Unknown -W argument `%s'\n", optarg);
break; break;