aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-06-12 13:29:02 +0545
committerMike Frysinger <vapier@gentoo.org>2015-06-12 04:19:45 -0400
commitdb7858e227f3951c665410314fca62c77349ac24 (patch)
tree01fb8b93600bc89ef86a7e883ca17e3df8387174 /sim/common
parent966f0aefa6a96df2c45ec36a7ecc02419e3842db (diff)
downloadfsf-binutils-gdb-db7858e227f3951c665410314fca62c77349ac24.zip
fsf-binutils-gdb-db7858e227f3951c665410314fca62c77349ac24.tar.gz
fsf-binutils-gdb-db7858e227f3951c665410314fca62c77349ac24.tar.bz2
sim: cgen: namespace custom trace functions
The cgen code declares some macros/funcs using the trace_xxx prefix, but the code isn't generic and only works with cgen targets. This is blocking the creation of new common trace functions. Let's blindly add cgen_xxx prefixes to all these symbols. Some already use this convention to avoid conflicts, so it makes sense to align them. In the future we might want to move some to the common trace core, but one thing at a time.
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog41
-rw-r--r--sim/common/cgen-run.c2
-rw-r--r--sim/common/cgen-trace.c21
-rw-r--r--sim/common/cgen-trace.h39
-rwxr-xr-xsim/common/genmloop.sh8
5 files changed, 77 insertions, 34 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index a20f92d7..1557449 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,44 @@
+2015-06-12 Mike Frysinger <vapier@gentoo.org>
+
+ * cgen-run.c (sim_resume): Rename TRACE_INSN_FINI to
+ CGEN_TRACE_INSN_FINI.
+ * cgen-trace.c: Rename trace_insn to cgen_trace_insn,
+ trace_result to cgen_trace_result, trace_insn_fini to
+ cgen_trace_insn_fini, trace_insn_init to cgen_trace_insn_init,
+ and trace_extract to cgen_trace_extract.
+ * cgen-trace.h (trace_insn_init): Rename to ...
+ (cgen_trace_insn_init): ... this.
+ (trace_insn_fini): Rename to ...
+ (cgen_trace_insn_fini): ... this.
+ (trace_insn): Rename to ...
+ (cgen_trace_insn): ... this.
+ (trace_extract): Rename to ...
+ (cgen_trace_extract): ... this.
+ (trace_result): Rename to ...
+ (cgen_trace_result): ... this.
+ (TRACE_RESULT_P): Rename to ...
+ (CGEN_TRACE_RESULT_P): ... this.
+ (TRACE_INSN_INIT): Rename to ...
+ (CGEN_TRACE_INSN_INIT): ... this. Change trace_insn_init to
+ cgen_trace_insn_init.
+ (TRACE_INSN_FINI): Rename to ...
+ (CGEN_TRACE_INSN_FINI): ... this. Change trace_insn_fini to
+ cgen_trace_insn_fini.
+ (TRACE_PRINTF): Rename to ...
+ (CGEN_TRACE_PRINTF): ... this.
+ (TRACE_INSN): Rename to ...
+ (CGEN_TRACE_INSN): ... this. Change trace_insn to cgen_trace_insn.
+ (TRACE_EXTRACT): Rename to ...
+ (CGEN_TRACE_EXTRACT): ... this. Change trace_extract to
+ cgen_trace_extract.
+ (TRACE_RESULT): Rename to ...
+ (CGEN_TRACE_RESULT): ... this. Change TRACE_RESULT_P to
+ CGEN_TRACE_RESULT_P and trace_result to cgen_trace_result.
+ * genmloop.sh (@prefix@_pbb_before): Change TRACE_INSN_FINI to
+ CGEN_TRACE_INSN_FINI, TRACE_INSN_INIT to CGEN_TRACE_INSN_INIT, and
+ TRACE_INSN to CGEN_TRACE_INSN.
+ (@prefix@_pbb_after): Change TRACE_INSN_FINI to CGEN_TRACE_INSN_FINI.
+
2015-06-11 Mike Frysinger <vapier@gentoo.org>
* sim-events.c (ETRACE_P): Delete.
diff --git a/sim/common/cgen-run.c b/sim/common/cgen-run.c
index 5a25a50..96fe999 100644
--- a/sim/common/cgen-run.c
+++ b/sim/common/cgen-run.c
@@ -115,7 +115,7 @@ sim_resume (SIM_DESC sd, int step, int siggnal)
/* Account for the last insn executed. */
SIM_CPU *cpu = STATE_CPU (sd, sim_engine_last_cpu_nr (sd));
++ CPU_INSN_COUNT (cpu);
- TRACE_INSN_FINI (cpu, NULL, 1);
+ CGEN_TRACE_INSN_FINI (cpu, NULL, 1);
}
#endif
diff --git a/sim/common/cgen-trace.c b/sim/common/cgen-trace.c
index 87aa3ce..566f2e6 100644
--- a/sim/common/cgen-trace.c
+++ b/sim/common/cgen-trace.c
@@ -66,29 +66,30 @@ static char *bufptr;
/* Non-zero if this is the first insn in a set of parallel insns. */
static int first_insn_p;
-/* For communication between trace_insn and trace_result. */
+/* For communication between cgen_trace_insn and cgen_trace_result. */
static int printed_result_p;
/* Insn and its extracted fields.
- Set by trace_insn, used by trace_insn_fini.
+ Set by cgen_trace_insn, used by cgen_trace_insn_fini.
??? Move to SIM_CPU to support heterogeneous multi-cpu case. */
static const struct cgen_insn *current_insn;
static const struct argbuf *current_abuf;
void
-trace_insn_init (SIM_CPU *cpu, int first_p)
+cgen_trace_insn_init (SIM_CPU *cpu, int first_p)
{
bufptr = trace_buf;
*bufptr = 0;
first_insn_p = first_p;
- /* Set to NULL so trace_insn_fini can know if trace_insn was called. */
+ /* Set to NULL so cgen_trace_insn_fini can know if cgen_trace_insn was
+ called. */
current_insn = NULL;
current_abuf = NULL;
}
void
-trace_insn_fini (SIM_CPU *cpu, const struct argbuf *abuf, int last_p)
+cgen_trace_insn_fini (SIM_CPU *cpu, const struct argbuf *abuf, int last_p)
{
SIM_DESC sd = CPU_STATE (cpu);
@@ -143,7 +144,7 @@ trace_insn_fini (SIM_CPU *cpu, const struct argbuf *abuf, int last_p)
++i, ++opinst)
{
if (CGEN_OPINST_TYPE (opinst) == CGEN_OPINST_OUTPUT)
- trace_result (cpu, current_insn, opinst, indices[i]);
+ cgen_trace_result (cpu, current_insn, opinst, indices[i]);
}
}
}
@@ -158,8 +159,8 @@ trace_insn_fini (SIM_CPU *cpu, const struct argbuf *abuf, int last_p)
}
void
-trace_insn (SIM_CPU *cpu, const struct cgen_insn *opcode,
- const struct argbuf *abuf, IADDR pc)
+cgen_trace_insn (SIM_CPU *cpu, const struct cgen_insn *opcode,
+ const struct argbuf *abuf, IADDR pc)
{
char disasm_buf[50];
@@ -183,7 +184,7 @@ trace_insn (SIM_CPU *cpu, const struct cgen_insn *opcode,
}
void
-trace_extract (SIM_CPU *cpu, IADDR pc, char *name, ...)
+cgen_trace_extract (SIM_CPU *cpu, IADDR pc, char *name, ...)
{
va_list args;
int printed_one_p = 0;
@@ -222,7 +223,7 @@ trace_extract (SIM_CPU *cpu, IADDR pc, char *name, ...)
}
void
-trace_result (SIM_CPU *cpu, char *name, int type, ...)
+cgen_trace_result (SIM_CPU *cpu, char *name, int type, ...)
{
va_list args;
diff --git a/sim/common/cgen-trace.h b/sim/common/cgen-trace.h
index ba62f6c..5cc08ae 100644
--- a/sim/common/cgen-trace.h
+++ b/sim/common/cgen-trace.h
@@ -20,46 +20,47 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef CGEN_TRACE_H
#define CGEN_TRACE_H
-void trace_insn_init (SIM_CPU *, int);
-void trace_insn_fini (SIM_CPU *, const struct argbuf *, int);
-void trace_insn (SIM_CPU *, const struct cgen_insn *,
- const struct argbuf *, IADDR);
-void trace_extract (SIM_CPU *, IADDR, char *, ...);
-void trace_result (SIM_CPU *, char *, int, ...);
+void cgen_trace_insn_init (SIM_CPU *, int);
+void cgen_trace_insn_fini (SIM_CPU *, const struct argbuf *, int);
+void cgen_trace_insn (SIM_CPU *, const struct cgen_insn *,
+ const struct argbuf *, IADDR);
+void cgen_trace_extract (SIM_CPU *, IADDR, char *, ...);
+void cgen_trace_result (SIM_CPU *, char *, int, ...);
void cgen_trace_printf (SIM_CPU *, char *fmt, ...);
/* Trace instruction results. */
-#define TRACE_RESULT_P(cpu, abuf) (TRACE_INSN_P (cpu) && ARGBUF_TRACE_P (abuf))
+#define CGEN_TRACE_RESULT_P(cpu, abuf) \
+ (TRACE_INSN_P (cpu) && ARGBUF_TRACE_P (abuf))
-#define TRACE_INSN_INIT(cpu, abuf, first_p) \
+#define CGEN_TRACE_INSN_INIT(cpu, abuf, first_p) \
do { \
if (TRACE_INSN_P (cpu)) \
- trace_insn_init ((cpu), (first_p)); \
+ cgen_trace_insn_init ((cpu), (first_p)); \
} while (0)
-#define TRACE_INSN_FINI(cpu, abuf, last_p) \
+#define CGEN_TRACE_INSN_FINI(cpu, abuf, last_p) \
do { \
if (TRACE_INSN_P (cpu)) \
- trace_insn_fini ((cpu), (abuf), (last_p)); \
+ cgen_trace_insn_fini ((cpu), (abuf), (last_p)); \
} while (0)
-#define TRACE_PRINTF(cpu, what, args) \
+#define CGEN_TRACE_PRINTF(cpu, what, args) \
do { \
if (TRACE_P ((cpu), (what))) \
cgen_trace_printf args ; \
} while (0)
-#define TRACE_INSN(cpu, insn, abuf, pc) \
+#define CGEN_TRACE_INSN(cpu, insn, abuf, pc) \
do { \
if (TRACE_INSN_P (cpu) && ARGBUF_TRACE_P (abuf)) \
- trace_insn ((cpu), (insn), (abuf), (pc)) ; \
+ cgen_trace_insn ((cpu), (insn), (abuf), (pc)) ; \
} while (0)
-#define TRACE_EXTRACT(cpu, abuf, args) \
+#define CGEN_TRACE_EXTRACT(cpu, abuf, args) \
do { \
if (TRACE_EXTRACT_P (cpu)) \
- trace_extract args ; \
+ cgen_trace_extract args ; \
} while (0)
-#define TRACE_RESULT(cpu, abuf, name, type, val) \
+#define CGEN_TRACE_RESULT(cpu, abuf, name, type, val) \
do { \
- if (TRACE_RESULT_P ((cpu), (abuf))) \
- trace_result ((cpu), (name), (type), (val)) ; \
+ if (CGEN_TRACE_RESULT_P ((cpu), (abuf))) \
+ cgen_trace_result ((cpu), (name), (type), (val)) ; \
} while (0)
/* Disassembly support. */
diff --git a/sim/common/genmloop.sh b/sim/common/genmloop.sh
index 2006940..a6bd16b 100755
--- a/sim/common/genmloop.sh
+++ b/sim/common/genmloop.sh
@@ -1112,7 +1112,7 @@ void
}
}
- TRACE_INSN_FINI (current_cpu, cur_abuf, 0 /*last_p*/);
+ CGEN_TRACE_INSN_FINI (current_cpu, cur_abuf, 0 /*last_p*/);
}
/* FIXME: Later make cover macros: PROFILE_INSN_{INIT,FINI}. */
@@ -1120,8 +1120,8 @@ void
&& ARGBUF_PROFILE_P (cur_abuf))
@prefix@_model_insn_before (current_cpu, first_p);
- TRACE_INSN_INIT (current_cpu, cur_abuf, first_p);
- TRACE_INSN (current_cpu, cur_idesc->idata, cur_abuf, pc);
+ CGEN_TRACE_INSN_INIT (current_cpu, cur_abuf, first_p);
+ CGEN_TRACE_INSN (current_cpu, cur_idesc->idata, cur_abuf, pc);
}
/* x-after handler.
@@ -1146,7 +1146,7 @@ void
cycles = (*prev_idesc->timing->model_fn) (current_cpu, prev_sem_arg);
@prefix@_model_insn_after (current_cpu, 1 /*last_p*/, cycles);
}
- TRACE_INSN_FINI (current_cpu, prev_abuf, 1 /*last_p*/);
+ CGEN_TRACE_INSN_FINI (current_cpu, prev_abuf, 1 /*last_p*/);
}
#define FAST_P 0