]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: mloop: add #line pragmas everywhere
authorMike Frysinger <vapier@gentoo.org>
Wed, 20 Dec 2023 01:13:22 +0000 (20:13 -0500)
committerMike Frysinger <vapier@gentoo.org>
Fri, 22 Dec 2023 01:16:26 +0000 (20:16 -0500)
This will make compiler diagnostics much better with generated code
so people can understand the original source file.

sim/common/genmloop.sh
sim/cris/mloop.in
sim/frv/mloop.in
sim/iq2000/mloop.in
sim/lm32/mloop.in
sim/m32r/mloop.in
sim/m32r/mloop2.in
sim/m32r/mloopx.in
sim/or1k/mloop.in

index 007582ec8fc95021e63182faf9d3a6ef34ff8f85..765cce853a2348f7db86d09eb876f5a0149665f4 100755 (executable)
@@ -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));
index 21cbb6923baa4c480b7cb31e00fedd547a9b3fe0..d0f3ee5341678d76c89d261f2b69746573c02eb5 100644 (file)
@@ -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
index dc77f06651dc82bc9da9ea96983cd38cbee6115c..9429bf05d72e36faf77363d59b9d1472dd686a8b 100644 (file)
@@ -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;
index e0ec847ada9ddc96fe46bf7ff15e98c2f07f1103..1d3df32ee777e8c1e51467bd3017bfee7f040b94 100644 (file)
@@ -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
index 574f00a51193c2035fa376c818aefcdfcf077d15..d5dc1ed959a52bbb6acfcca6a877945e9a7ae65f 100644 (file)
@@ -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)
index 1d4d51b9007157891ce7ee3a9e0c31d14e8a83df..cec2190b28c2ba061696f05420ba8c66bf80512a 100644 (file)
@@ -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"
index e7982fc9e4190ae266451dcdeedd68c2072ede95..462c8be9267e37d6762282c54d790256197fc893 100644 (file)
@@ -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
index e601dcad446b783457e931769447130dbc3e8557..a7371ed2fbe8c8998d856d45ad00ce9ac5e2c5d2 100644 (file)
@@ -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
index a1cb117dc61de989f8959653c661e1fd0802b9bc..0b707ea0766fe2c013a1f6f045afb7a1d7262c08 100644 (file)
@@ -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