* Make-common.in (cgen-utils.o): Depend on cgen-engine.h.

(CGEN_ARCH_SCM): New variable.
	* cgen-engine.h (EXTRACT_[ML]SB0_{INT,UINT}): New macros.
	(EXTRACT_INT,EXTRACT_UINT): New macros.
	(SEM_SEM_ARG): New macro.
	(SEM_NEXT_VPC): New arg `pc'.
	* cgen-sim.h (EXTRACT_SIGNED,EXTRACT_UNSIGNED): Delete.
	(sim_disassemble_insn): Update prototype.
	* cgen-trace.c (current_insn,insn_fields): New static locals.
	(trace_insn): Set them.
	* cgen-utils.scm: #include cgen-engine.h.
	(sim_disassemble_insn): New arg insn_fields.
	Handle variable length insns.
	* genmloop.sh: Only emit pbb decls if -pbb.
	(${cpu}_scache_lookup): New arg `vpc'.
	(scache support): Fetch pc before entering loop.
This commit is contained in:
Doug Evans 1998-11-18 23:45:32 +00:00
parent 95b03313e0
commit 916b11527e
2 changed files with 42 additions and 17 deletions

View File

@ -1,5 +1,22 @@
1998-11-18 Doug Evans <devans@casey.cygnus.com> 1998-11-18 Doug Evans <devans@casey.cygnus.com>
* Make-common.in (cgen-utils.o): Depend on cgen-engine.h.
(CGEN_ARCH_SCM): New variable.
* cgen-engine.h (EXTRACT_[ML]SB0_{INT,UINT}): New macros.
(EXTRACT_INT,EXTRACT_UINT): New macros.
(SEM_SEM_ARG): New macro.
(SEM_NEXT_VPC): New arg `pc'.
* cgen-sim.h (EXTRACT_SIGNED,EXTRACT_UNSIGNED): Delete.
(sim_disassemble_insn): Update prototype.
* cgen-trace.c (current_insn,insn_fields): New static locals.
(trace_insn): Set them.
* cgen-utils.scm: #include cgen-engine.h.
(sim_disassemble_insn): New arg insn_fields.
Handle variable length insns.
* genmloop.sh: Only emit pbb decls if -pbb.
(${cpu}_scache_lookup): New arg `vpc'.
(scache support): Fetch pc before entering loop.
* gennltvals.sh: Add fr30 support. * gennltvals.sh: Add fr30 support.
* nltvals.def: Rebuild. * nltvals.def: Rebuild.

View File

@ -209,12 +209,15 @@ echo " (which doesn't necessarily have that file name). */"
echo "" echo ""
echo "extern ENGINE_FN ${cpu}_engine_run_full;" echo "extern ENGINE_FN ${cpu}_engine_run_full;"
echo "extern ENGINE_FN ${cpu}_engine_run_fast;" echo "extern ENGINE_FN ${cpu}_engine_run_fast;"
echo ""
echo "extern SEM_PC ${cpu}_pbb_begin (SIM_CPU *, int);" if [ x$pbb = xyes ] ; then
echo "extern SEM_PC ${cpu}_pbb_chain (SIM_CPU *, SEM_ARG);" echo ""
echo "extern SEM_PC ${cpu}_pbb_cti_chain (SIM_CPU *, SEM_ARG, SEM_PC *, PCADDR);" echo "extern SEM_PC ${cpu}_pbb_begin (SIM_CPU *, int);"
echo "extern void ${cpu}_pbb_before (SIM_CPU *, SCACHE *);" echo "extern SEM_PC ${cpu}_pbb_chain (SIM_CPU *, SEM_ARG);"
echo "extern void ${cpu}_pbb_after (SIM_CPU *, SCACHE *);" echo "extern SEM_PC ${cpu}_pbb_cti_chain (SIM_CPU *, SEM_ARG, SEM_PC *, PCADDR);"
echo "extern void ${cpu}_pbb_before (SIM_CPU *, SCACHE *);"
echo "extern void ${cpu}_pbb_after (SIM_CPU *, SCACHE *);"
fi
########################################################################## ##########################################################################
@ -349,16 +352,15 @@ if [ x$scache = xyes ] ; then
cat << EOF cat << EOF
static INLINE SCACHE * static INLINE SCACHE *
${cpu}_scache_lookup (SIM_CPU *current_cpu, SCACHE *scache, ${cpu}_scache_lookup (SIM_CPU *current_cpu, PCADDR vpc, SCACHE *scache,
unsigned int hash_mask, int FAST_P) unsigned int hash_mask, int FAST_P)
{ {
/* First step: look up current insn in hash table. */ /* First step: look up current insn in hash table. */
PCADDR pc = PC; SCACHE *sc = scache + SCACHE_HASH_PC (vpc, hash_mask);
SCACHE *sc = scache + SCACHE_HASH_PC (pc, hash_mask);
/* If the entry isn't the one we want (cache miss), /* If the entry isn't the one we want (cache miss),
fetch and decode the instruction. */ fetch and decode the instruction. */
if (sc->argbuf.addr != pc) if (sc->argbuf.addr != vpc)
{ {
insn_t insn; insn_t insn;
@ -378,8 +380,10 @@ cat << EOF
PROFILE_COUNT_SCACHE_HIT (current_cpu); PROFILE_COUNT_SCACHE_HIT (current_cpu);
/* Make core access statistics come out right. /* Make core access statistics come out right.
The size is a guess, but it's currently not used either. */ The size is a guess, but it's currently not used either. */
PROFILE_COUNT_CORE (current_cpu, pc, 2, exec_map); PROFILE_COUNT_CORE (current_cpu, vpc, 2, exec_map);
} }
return sc;
} }
#define FAST_P 0 #define FAST_P 0
@ -390,6 +394,7 @@ ${cpu}_engine_run_full (SIM_CPU *current_cpu)
SIM_DESC current_state = CPU_STATE (current_cpu); SIM_DESC current_state = CPU_STATE (current_cpu);
SCACHE *scache = CPU_SCACHE_CACHE (current_cpu); SCACHE *scache = CPU_SCACHE_CACHE (current_cpu);
unsigned int hash_mask = CPU_SCACHE_HASH_MASK (current_cpu); unsigned int hash_mask = CPU_SCACHE_HASH_MASK (current_cpu);
SEM_PC vpc;
EOF EOF
@ -425,12 +430,13 @@ fi
cat << EOF cat << EOF
vpc = GET_H_PC ();
do do
{ {
PCADDR new_pc;
SCACHE *sc; SCACHE *sc;
sc = ${cpu}_scache_lookup (current_cpu, scache, hash_mask, FAST_P); sc = ${cpu}_scache_lookup (current_cpu, vpc, scache, hash_mask, FAST_P);
/* begin full-exec-scache */ /* begin full-exec-scache */
EOF EOF
@ -440,7 +446,7 @@ ${SHELL} $infile full-exec-scache
cat << EOF cat << EOF
/* end full-exec-scache */ /* end full-exec-scache */
CPU (h_pc) = new_pc; SET_H_PC (vpc);
++ CPU_INSN_COUNT (current_cpu); ++ CPU_INSN_COUNT (current_cpu);
} }
@ -467,6 +473,7 @@ ${cpu}_engine_run_fast (SIM_CPU *current_cpu)
SIM_DESC current_state = CPU_STATE (current_cpu); SIM_DESC current_state = CPU_STATE (current_cpu);
SCACHE *scache = CPU_SCACHE_CACHE (current_cpu); SCACHE *scache = CPU_SCACHE_CACHE (current_cpu);
unsigned int hash_mask = CPU_SCACHE_HASH_MASK (current_cpu); unsigned int hash_mask = CPU_SCACHE_HASH_MASK (current_cpu);
SEM_PC vpc;
EOF EOF
@ -514,12 +521,13 @@ cat << EOF
} }
#endif #endif
vpc = GET_H_PC ();
do do
{ {
PCADDR new_pc;
SCACHE *sc; SCACHE *sc;
sc = ${cpu}_scache_lookup (current_cpu, scache, hash_mask, FAST_P); sc = ${cpu}_scache_lookup (current_cpu, vpc, scache, hash_mask, FAST_P);
/* begin fast-exec-scache */ /* begin fast-exec-scache */
EOF EOF
@ -529,7 +537,7 @@ ${SHELL} $infile fast-exec-scache
cat << EOF cat << EOF
/* end fast-exec-scache */ /* end fast-exec-scache */
CPU (h_pc) = new_pc; SET_H_PC (vpc);
++ CPU_INSN_COUNT (current_cpu); ++ CPU_INSN_COUNT (current_cpu);
} }