sim: mloop: add #line pragmas everywhere
This will make compiler diagnostics much better with generated code so people can understand the original source file.
This commit is contained in:
parent
c0e97c8525
commit
6003fe166d
@ -314,6 +314,7 @@ exec 1>${outprefix}tmp-mloop-$$.cin
|
||||
# here.
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
/* This file is generated by the genmloop script. DO NOT EDIT! */
|
||||
|
||||
/* This must come before any other includes. */
|
||||
@ -410,6 +411,7 @@ load_infile_section support
|
||||
if [ x$scache != xyes -a x$pbb != xyes ] ; then
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
#define FAST_P 0
|
||||
|
||||
@ -429,6 +431,7 @@ EOF
|
||||
case x$parallel in
|
||||
xread | xwrite)
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
PAREXEC pbufs[MAX_PARALLEL_INSNS];
|
||||
PAREXEC *par_exec;
|
||||
|
||||
@ -442,6 +445,7 @@ load_infile_section init
|
||||
|
||||
if [ x$parallel = xread ] ; then
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
#if defined (__GNUC__)
|
||||
{
|
||||
@ -459,6 +463,7 @@ EOF
|
||||
fi
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
if (! CPU_IDESC_SEM_INIT_P (current_cpu))
|
||||
{
|
||||
@ -482,6 +487,7 @@ EOF
|
||||
load_infile_section full-exec-simple
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
/* end full-exec-simple */
|
||||
|
||||
++ CPU_INSN_COUNT (current_cpu);
|
||||
@ -501,6 +507,7 @@ EOF
|
||||
if [ x$fast = xyes ] ; then
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
#define FAST_P 1
|
||||
|
||||
@ -522,6 +529,7 @@ fi # simple engine
|
||||
if [ x$scache = xyes -a x$parallel = xno ] ; then
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
static INLINE SCACHE *
|
||||
@prefix@_scache_lookup (SIM_CPU *current_cpu, PCADDR vpc, SCACHE *scache,
|
||||
@ -543,6 +551,7 @@ EOF
|
||||
load_infile_section extract-scache
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
/* end extract-scache */
|
||||
}
|
||||
else if (! FAST_P)
|
||||
@ -573,6 +582,7 @@ EOF
|
||||
load_infile_section init
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
if (! CPU_IDESC_SEM_INIT_P (current_cpu))
|
||||
{
|
||||
@ -596,6 +606,7 @@ EOF
|
||||
load_infile_section full-exec-scache
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
/* end full-exec-scache */
|
||||
|
||||
SET_H_PC (vpc);
|
||||
@ -616,6 +627,7 @@ EOF
|
||||
if [ x$fast = xyes ] ; then
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
#define FAST_P 1
|
||||
|
||||
@ -634,6 +646,7 @@ EOF
|
||||
load_infile_section init
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
if (! CPU_IDESC_SEM_INIT_P (current_cpu))
|
||||
{
|
||||
@ -663,6 +676,7 @@ EOF
|
||||
load_infile_section fast-exec-scache
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
/* end fast-exec-scache */
|
||||
|
||||
SET_H_PC (vpc);
|
||||
@ -689,6 +703,7 @@ fi # -scache && ! parallel
|
||||
if [ x$scache = xyes -a x$parallel != xno ] ; then
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
static INLINE SCACHE *
|
||||
@prefix@_scache_lookup (SIM_CPU *current_cpu, PCADDR vpc, SCACHE *scache,
|
||||
@ -711,6 +726,7 @@ EOF
|
||||
load_infile_section extract-scache
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
/* end extract-scache */
|
||||
#undef SET_LAST_INSN_P
|
||||
}
|
||||
@ -743,6 +759,7 @@ load_infile_section init
|
||||
|
||||
if [ x$parallel = xread ] ; then
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
#if defined (__GNUC__)
|
||||
{
|
||||
if (! CPU_IDESC_READ_INIT_P (current_cpu))
|
||||
@ -759,6 +776,7 @@ EOF
|
||||
fi
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
if (! CPU_IDESC_SEM_INIT_P (current_cpu))
|
||||
{
|
||||
@ -778,6 +796,7 @@ EOF
|
||||
load_infile_section full-exec-scache
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
/* end full-exec-scache */
|
||||
}
|
||||
while (0 /*CPU_RUNNING_P (current_cpu)*/);
|
||||
@ -794,6 +813,7 @@ EOF
|
||||
if [ x$fast = xyes ] ; then
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
#define FAST_P 1
|
||||
|
||||
@ -815,6 +835,7 @@ load_infile_section init
|
||||
|
||||
if [ x$parallel = xread ] ; then
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
#if defined (__GNUC__)
|
||||
{
|
||||
@ -832,6 +853,7 @@ EOF
|
||||
fi
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
if (! CPU_IDESC_SEM_INIT_P (current_cpu))
|
||||
{
|
||||
@ -857,6 +879,7 @@ EOF
|
||||
load_infile_section fast-exec-scache
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
/* end fast-exec-scache */
|
||||
}
|
||||
while (0 /*CPU_RUNNING_P (current_cpu)*/);
|
||||
@ -881,6 +904,7 @@ fi # -scache && parallel
|
||||
if [ x$pbb = xyes ] ; then
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
/* Record address of cti terminating a pbb. */
|
||||
#define SET_CTI_VPC(sc) do { _cti_sc = (sc); } while (0)
|
||||
@ -964,6 +988,7 @@ EOF
|
||||
load_infile_section extract-pbb
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
/* end extract-pbb */
|
||||
|
||||
/* The last one is a pseudo-insn to link to the next chain.
|
||||
@ -1185,6 +1210,7 @@ EOF
|
||||
case x$parallel in
|
||||
xread | xwrite)
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
PAREXEC pbufs[MAX_PARALLEL_INSNS];
|
||||
PAREXEC *par_exec = &pbufs[0];
|
||||
|
||||
@ -1197,6 +1223,7 @@ esac
|
||||
load_infile_section init
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
if (! CPU_IDESC_SEM_INIT_P (current_cpu))
|
||||
{
|
||||
@ -1240,6 +1267,7 @@ EOF
|
||||
load_infile_section full-exec-pbb
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
/* end full-exec-pbb */
|
||||
}
|
||||
while (CPU_RUNNING_P (current_cpu));
|
||||
@ -1256,6 +1284,7 @@ EOF
|
||||
if [ x$fast = xyes ] ; then
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
#define FAST_P 1
|
||||
|
||||
@ -1275,6 +1304,7 @@ EOF
|
||||
case x$parallel in
|
||||
xread | xwrite)
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
PAREXEC pbufs[MAX_PARALLEL_INSNS];
|
||||
PAREXEC *par_exec = &pbufs[0];
|
||||
|
||||
@ -1287,6 +1317,7 @@ esac
|
||||
load_infile_section init
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
if (! CPU_IDESC_SEM_INIT_P (current_cpu))
|
||||
{
|
||||
@ -1330,6 +1361,7 @@ EOF
|
||||
load_infile_section fast-exec-pbb
|
||||
|
||||
cat << EOF
|
||||
#line $LINENO "$0"
|
||||
/* end fast-exec-pbb */
|
||||
}
|
||||
while (CPU_RUNNING_P (current_cpu));
|
||||
|
@ -42,6 +42,7 @@ case "x$1" in
|
||||
xsupport)
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
#include <stdlib.h>
|
||||
|
||||
/* It seems we don't have a templated header file corresponding to
|
||||
@ -142,6 +143,7 @@ EOF
|
||||
xinit)
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
/* This seemed the only sane location to emit a call to a
|
||||
model-specific init function. It may not work for all simulator
|
||||
types. FIXME: Introduce a model-init hook. */
|
||||
@ -160,6 +162,7 @@ xextract-simple | xextract-scache)
|
||||
# Outputs: sc filled in
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
{
|
||||
CGEN_INSN_INT insn = GETIMEMUHI (current_cpu, vpc);
|
||||
extract (current_cpu, vpc, insn, SEM_ARGBUF (sc), FAST_P);
|
||||
@ -179,6 +182,7 @@ xextract-pbb)
|
||||
# SET_INSN_COUNT(n) must be called to record number of real insns.
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
{
|
||||
const IDESC *idesc;
|
||||
int icount = 0;
|
||||
@ -276,6 +280,7 @@ xfull-exec-* | xfast-exec-*)
|
||||
# vpc contains the address of the next insn to execute
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
{
|
||||
#if (! FAST_P && WITH_SEM_SWITCH_FULL) || (FAST_P && WITH_SEM_SWITCH_FAST)
|
||||
#define DEFINE_SWITCH
|
||||
|
@ -39,6 +39,7 @@ case "x$1" in
|
||||
xsupport)
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
static INLINE const IDESC *
|
||||
extract (SIM_CPU *current_cpu, PCADDR pc, CGEN_INSN_INT insn, ARGBUF *abuf,
|
||||
@ -411,6 +412,7 @@ EOF
|
||||
xinit)
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
/*xxxinit*/
|
||||
/* If the timer is enabled, then we will enable model profiling during
|
||||
execution. This is because the timer needs accurate cycles counts to
|
||||
@ -428,6 +430,7 @@ xextract-simple | xextract-scache)
|
||||
# SET_LAST_INSN_P(last_p) called to indicate whether insn is last one
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
{
|
||||
CGEN_INSN_INT insn = frvbf_read_imem_USI (current_cpu, vpc);
|
||||
extract (current_cpu, vpc, insn, SEM_ARGBUF (sc), FAST_P);
|
||||
@ -449,6 +452,7 @@ xfull-exec-* | xfast-exec-*)
|
||||
# scache lookup.
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
{
|
||||
FRV_VLIW *vliw;
|
||||
int first_insn_p = 1;
|
||||
|
@ -40,6 +40,7 @@ case "x$1" in
|
||||
xsupport)
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
#include <stdlib.h>
|
||||
|
||||
static INLINE const IDESC *
|
||||
@ -139,6 +140,7 @@ xextract-simple | xextract-scache)
|
||||
# Outputs: sc filled in
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
{
|
||||
CGEN_INSN_INT insn = GETIMEMUSI (current_cpu, CPU2INSN(vpc));
|
||||
extract (current_cpu, vpc, insn, SEM_ARGBUF (sc), FAST_P);
|
||||
@ -159,6 +161,7 @@ xextract-pbb)
|
||||
# SET_INSN_COUNT(n) must be called to record number of real insns.
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
{
|
||||
const IDESC *idesc;
|
||||
int icount = 0;
|
||||
@ -224,6 +227,7 @@ xfull-exec-* | xfast-exec-*)
|
||||
# vpc contains the address of the next insn to execute
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
{
|
||||
#if (! FAST_P && WITH_SEM_SWITCH_FULL) || (FAST_P && WITH_SEM_SWITCH_FAST)
|
||||
#define DEFINE_SWITCH
|
||||
|
@ -32,6 +32,7 @@ case "x$1" in
|
||||
xsupport)
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
#include <stdlib.h>
|
||||
|
||||
static INLINE const IDESC *
|
||||
@ -130,6 +131,7 @@ xinit)
|
||||
xextract-simple | xextract-scache)
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
{
|
||||
CGEN_INSN_INT insn = GETIMEMUSI (current_cpu, vpc);
|
||||
extract (current_cpu, vpc, insn, SEM_ARGBUF (sc), FAST_P);
|
||||
@ -149,6 +151,7 @@ xextract-pbb)
|
||||
# SET_INSN_COUNT(n) must be called to record number of real insns.
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
{
|
||||
const IDESC *idesc;
|
||||
int icount = 0;
|
||||
@ -183,6 +186,7 @@ xfull-exec-* | xfast-exec-*)
|
||||
# Outputs: vpc
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
/* Update cycle counter */
|
||||
SET_H_CSR (LM32_CSR_CC, GET_H_CSR (LM32_CSR_CC) + 1);
|
||||
#if (! FAST_P && WITH_SEM_SWITCH_FULL) || (FAST_P && WITH_SEM_SWITCH_FAST)
|
||||
|
@ -42,6 +42,7 @@ case "x$1" in
|
||||
xsupport)
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
#include <stdlib.h>
|
||||
|
||||
static INLINE const IDESC *
|
||||
@ -157,6 +158,7 @@ xinit)
|
||||
xextract-simple | xextract-scache)
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
{
|
||||
if ((pc & 3) != 0)
|
||||
{
|
||||
@ -199,6 +201,7 @@ xextract-pbb)
|
||||
# SET_INSN_COUNT(n) must be called to record number of real insns.
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
{
|
||||
const IDESC *idesc;
|
||||
int icount = 0;
|
||||
@ -302,6 +305,7 @@ xfull-exec-* | xfast-exec-*)
|
||||
# vpc is the virtual program counter.
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
#if (! FAST_P && WITH_SEM_SWITCH_FULL) || (FAST_P && WITH_SEM_SWITCH_FAST)
|
||||
#define DEFINE_SWITCH
|
||||
#include "sem-switch.c"
|
||||
|
@ -41,6 +41,7 @@ case "x$1" in
|
||||
xsupport)
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
/* Emit insns to write back the results of insns executed in parallel.
|
||||
SC points to a sufficient number of scache entries for the writeback
|
||||
@ -206,6 +207,7 @@ xextract-pbb)
|
||||
# SET_INSN_COUNT(n) must be called to record number of real insns.
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
{
|
||||
const IDESC *idesc;
|
||||
int icount = 0;
|
||||
@ -517,6 +519,7 @@ xfull-exec-pbb)
|
||||
# vpc is the virtual program counter.
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
#define DEFINE_SWITCH
|
||||
#include "sem2-switch.c"
|
||||
EOF
|
||||
|
@ -41,6 +41,7 @@ case "x$1" in
|
||||
xsupport)
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
|
||||
/* Emit insns to write back the results of insns executed in parallel.
|
||||
SC points to a sufficient number of scache entries for the writeback
|
||||
@ -206,6 +207,7 @@ xextract-pbb)
|
||||
# SET_INSN_COUNT(n) must be called to record number of real insns.
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
{
|
||||
const IDESC *idesc;
|
||||
int icount = 0;
|
||||
@ -517,6 +519,7 @@ xfull-exec-pbb)
|
||||
# vpc is the virtual program counter.
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
#define DEFINE_SWITCH
|
||||
#include "semx-switch.c"
|
||||
EOF
|
||||
|
@ -42,6 +42,7 @@ case "x$1" in
|
||||
xsupport)
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
#include <stdlib.h>
|
||||
|
||||
static INLINE const IDESC *
|
||||
@ -144,6 +145,7 @@ xinit)
|
||||
xextract-simple | xextract-scache)
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
{
|
||||
USI insn = GETIMEMUSI (current_cpu, pc);
|
||||
extract (current_cpu, pc, insn, sc, FAST_P);
|
||||
@ -164,6 +166,7 @@ xextract-pbb)
|
||||
# SET_INSN_COUNT(n) must be called to record number of real insns.
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
{
|
||||
const IDESC *idesc;
|
||||
int icount = 0;
|
||||
@ -222,6 +225,7 @@ xfull-exec-* | xfast-exec-*)
|
||||
# vpc is the virtual program counter.
|
||||
|
||||
cat <<EOF
|
||||
#line $LINENO "$0"
|
||||
#if (! FAST_P && WITH_SEM_SWITCH_FULL) || (FAST_P && WITH_SEM_SWITCH_FAST)
|
||||
#define DEFINE_SWITCH
|
||||
#ifdef WANT_CPU_OR1K32BF
|
||||
|
Loading…
x
Reference in New Issue
Block a user