Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [Sim] New sim/common/cgen.sh
@ 2000-12-03 19:24 Ben Elliston
  0 siblings, 0 replies; 4+ messages in thread
From: Ben Elliston @ 2000-12-03 19:24 UTC (permalink / raw)
  To: gdb-patches; +Cc: cgen

It's not very often that I advocate complete rewrites :-), but in this
case, the cgen.sh script (used to generate the sim files with cgen)
was a rats' nest.  Rather than post diffs, I have included the new
script for review.  (Diffs are left as an exercise for the reader).

I think this script is much clearer and certainly more maintainable.
In the future, we need to allow finer control over files that are
generated -- for example, you might want the cpu files, but not
model.c.

The reason I did this is that the script provides a new "defs" action,
to emit a defs.h file using last week's CGEN modifications.

Comments?

Ben


2000-12-04  Ben Elliston  <bje@redhat.com>

	* cgen.sh: Rewrite. Add "defs" action.


#! /bin/sh
# Generate CGEN simulator files.
#
# Usage: /bin/sh cgen.sh {"arch"|"cpu"|"decode"|"defs"|"cpu-decode"} srcdir \
#	cgen cgendir cgenflags \
#	arch archflags cpu mach suffix [extrafiles...]
#
# We store the generated files in the source directory until we decide to
# ship a Scheme interpreter (or other implementation) with gdb/binutils.
# Maybe we never will.

# We want to behave like make, any error forces us to stop.
set -e

action=$1
srcdir=$2
cgen=$3
cgendir=$4
cgenflags=$5
arch=$6
archflags=$7
cpu=$8
isa=$9
# portably bring parameters beyond $9 into view
shift ; mach=$9
shift ; suffix=$9
shift ; extrafiles=$9

rootdir=${srcdir}/../..

if test -z "$isa" ; then
  isa=all
  prefix=${cpu}
else
  prefix=${cpu}_${isa}
fi

lowercase='abcdefghijklmnopqrstuvwxyz'
uppercase='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ARCH=`echo ${arch} | tr "${lowercase}" "${uppercase}"`
CPU=`echo ${cpu} | tr "${lowercase}" "${uppercase}"`
PREFIX=`echo ${prefix} | tr "${lowercase}" "${uppercase}"`

sedscript="\
-e s/@ARCH@/${ARCH}/g -e s/@arch@/${arch}/g \
-e s/@CPU@/${CPU}/g -e s/@cpu@/${cpu}/g \
-e s/@PREFIX@/${PREFIX}/g -e s/@prefix@/${prefix}/g"

tmp_postprocessed=\
"tmp-all.h tmp-arch.h tmp-arch.c tmp-cpu.c tmp-cpu.h tmp-dec.h tmp-dec.c tmp-defs.h tmp-desc.h tmp-desc.c tmp-ext.c tmp-mod.c tmp-opc.h tmp-read.c tmp-sem.c tmp-semsw.c tmp-write.c"

for file in ${tmp_postprocessed} ; do
  tmp_preprocessed="${file}1 $tmp_preprocessed" 
done

# Step 1: clean up.
rm -f ${tmp_preprocessed} ${tmp_postprocessed}

# Step 2: run cgen to produce pre-processed files.
case $action in
arch)
	${cgen} -s ${cgendir}/cgen-sim.scm \
		-s ${cgendir} \
		${cgenflags} \
		-f "${archflags}" \
		-m ${mach} \
		-a ${arch} \
		-i ${isa} \
		-A tmp-arch.h1 \
		-B tmp-arch.c1 \
		-N tmp-all.h1
	;;

cpu | decode | cpu-decode)
	fileopts=""
	case $action in
	*cpu*)
		fileopts="$fileopts \
			-C tmp-cpu.h1 \
			-U tmp-cpu.c1 \
			-M tmp-mod.c1 \
			${extrafiles}"
		;;
	esac
	case $action in
	*decode*)
		fileopts="$fileopts \
			-T tmp-dec.h1 \
			-D tmp-dec.c1" 
		case ${extrafiles} in
		  ignored) # Do nothing.
		           ;; 
		  *)       fileopts="$fileopts ${extrafiles}"
		           ;;
		esac
		;;
	esac

	${cgen} -s ${cgendir}/cgen-sim.scm \
		-s ${cgendir} \
		${cgenflags} \
		-f "${archflags}" \
		-m ${mach} \
		-a ${arch} \
		-i ${isa} \
		${fileopts}
	;;

defs)
	${cgen} -s ${cgendir}/cgen-sim.scm \
		-s ${cgendir} \
		${cgenflags} \
		-f "${archflags}" \
		-m ${mach} \
		-a ${arch} \
		-i ${isa} \
		-G tmp-defs.h1
	;;

desc)
	${cgen} -s ${cgendir}/cgen-opc.scm \
		-s ${cgendir} \
		${cgenflags} \
		-f "${archflags}" \
		-m ${mach} \
		-a ${arch} \
		-i ${isa} \
		-H tmp-desc.h1 \
		-C tmp-desc.c1 \
		-O tmp-opc.h1
	;;

*)
	echo "`basename $0`: unknown action: ${action}" >&2
	exit 1
	;;
esac

# Step 3: post-process files.
for file in ${tmp_preprocessed} ; do
  if test -f $file ; then
    postproc=`basename $file 1`
    sed ${sedscript} < $file > $postproc
    if grep '@[^ ]*@' $postproc >/dev/null ; then
      echo "Warning: $postproc may contain unsubstituted macros" >&2
    fi
    rm $file
    case $postproc in
      tmp-all.h)   srcfile=cpuall.h ;;
      tmp-arch.h)  srcfile=arch.h ;;
      tmp-arch.c)  srcfile=arch.c ;;
      tmp-cpu.h)   srcfile=cpu${suffix}.h ;;
      tmp-cpu.c)   srcfile=cpu${suffix}.c ;;
      tmp-dec.c)   srcfile=decode${suffix}.c ;;
      tmp-dec.h)   srcfile=decode${suffix}.h ;;
      tmp-defs.h)  srcfile=defs${suffix}.h ;;
      tmp-desc.c)  srcfile=${arch}-desc.c ;;
      tmp-desc.h)  srcfile=${arch}-desc.h ;;
      tmp-ext.c)   srcfile=extract${suffix}.c ;;
      tmp-mod.c)   srcfile=model${suffix}.c ;;
      tmp-opc.h)   srcfile=${arch}-opc.h ;;
      tmp-read.c)  srcfile=read${suffix}.c ;;
      tmp-sem.c)   srcfile=sem${suffix}.c ;;
      tmp-semsw.c) srcfile=sem${suffix}-switch.c ;;
      tmp-write.c) srcfile=write${suffix}.c ;; 

      *) echo "Unknown post-processed file $postproc"
	 exit 1
	 ;;
    esac
    ${rootdir}/move-if-change ${postproc} ${srcdir}/${srcfile}
  fi
done

if ls *1 2>/dev/null ; then
  echo "Warning: output files were left behind!" >&2
  exit 1
fi

exit 0
From bje@redhat.com Sun Dec 03 20:00:00 2000
From: Ben Elliston <bje@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [Sim] Patch to sim/common/cgen-ops.h
Date: Sun, 03 Dec 2000 20:00:00 -0000
Message-id: <200012040359.eB43xtU23007@scooby.cygnus.com>
X-SW-Source: 2000-12/msg00055.html
Content-length: 1604

FYI, I am commiting the following patch:

2000-12-04  Ben Elliston  <bje@redhat.com>

	* cgen-ops.h (SUBWORDSIQI): Mask off top bits.
	(SUBWORDSIUQI): Likewise.
	(SUBWORDDIHI): Likewise.
	(SUBWORDDIQI): New function.

*** cgen-ops.h	2000/11/19 22:31:55	1.17
--- cgen-ops.h	2000/12/04 03:59:06
***************
*** 323,343 ****
  SUBWORDSIQI (SI in, int byte)
  {
    assert (byte >= 0 && byte <= 3);
!   return (UQI) (in >> (8 * (3 - byte)));
  }
  
  SEMOPS_INLINE UQI
  SUBWORDSIUQI (SI in, int byte)
  {
    assert (byte >= 0 && byte <= 3);
!   return (UQI) (in >> (8 * (3 - byte)));
  }
  
  SEMOPS_INLINE HI
  SUBWORDDIHI (DI in, int word)
  {
    assert (word >= 0 && word <= 3);
!   return (UHI) (in >> (16 * (3 - word)));
  }
  
  SEMOPS_INLINE HI
--- 323,350 ----
  SUBWORDSIQI (SI in, int byte)
  {
    assert (byte >= 0 && byte <= 3);
!   return (UQI) (in >> (8 * (3 - byte))) & 0xFF;
  }
  
  SEMOPS_INLINE UQI
  SUBWORDSIUQI (SI in, int byte)
  {
    assert (byte >= 0 && byte <= 3);
!   return (UQI) (in >> (8 * (3 - byte))) & 0xFF;
  }
  
+ SEMOPS_INLINE QI
+ SUBWORDDIQI (DI in, int byte)
+ {
+   assert (byte >= 0 && byte <= 7);
+   return (UQI) (in >> (8 * (7 - byte))) & 0xFF;
+ }
+ 
  SEMOPS_INLINE HI
  SUBWORDDIHI (DI in, int word)
  {
    assert (word >= 0 && word <= 3);
!   return (UHI) (in >> (16 * (3 - word))) & 0xFFFF;
  }
  
  SEMOPS_INLINE HI
***************
*** 450,455 ****
--- 457,463 ----
  SI SUBWORDSFSI (SF);
  SF SUBWORDSISF (SI);
  DF SUBWORDDIDF (DI);
+ QI SUBWORDDIQI (DI, int);
  HI SUBWORDDIHI (DI, int);
  SI SUBWORDDISI (DI, int);
  SI SUBWORDDFSI (DF, int);
From bje@redhat.com Sun Dec 03 20:02:00 2000
From: Ben Elliston <bje@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [Sim] Patch to sim/common/cgen-ops.h
Date: Sun, 03 Dec 2000 20:02:00 -0000
Message-id: <200012040402.eB442Sk23037@scooby.cygnus.com>
X-SW-Source: 2000-12/msg00056.html
Content-length: 1604

FYI, I am commiting the following patch:

2000-12-04  Ben Elliston  <bje@redhat.com>

	* cgen-ops.h (SUBWORDSIQI): Mask off top bits.
	(SUBWORDSIUQI): Likewise.
	(SUBWORDDIHI): Likewise.
	(SUBWORDDIQI): New function.

*** cgen-ops.h	2000/11/19 22:31:55	1.17
--- cgen-ops.h	2000/12/04 03:59:06
***************
*** 323,343 ****
  SUBWORDSIQI (SI in, int byte)
  {
    assert (byte >= 0 && byte <= 3);
!   return (UQI) (in >> (8 * (3 - byte)));
  }
  
  SEMOPS_INLINE UQI
  SUBWORDSIUQI (SI in, int byte)
  {
    assert (byte >= 0 && byte <= 3);
!   return (UQI) (in >> (8 * (3 - byte)));
  }
  
  SEMOPS_INLINE HI
  SUBWORDDIHI (DI in, int word)
  {
    assert (word >= 0 && word <= 3);
!   return (UHI) (in >> (16 * (3 - word)));
  }
  
  SEMOPS_INLINE HI
--- 323,350 ----
  SUBWORDSIQI (SI in, int byte)
  {
    assert (byte >= 0 && byte <= 3);
!   return (UQI) (in >> (8 * (3 - byte))) & 0xFF;
  }
  
  SEMOPS_INLINE UQI
  SUBWORDSIUQI (SI in, int byte)
  {
    assert (byte >= 0 && byte <= 3);
!   return (UQI) (in >> (8 * (3 - byte))) & 0xFF;
  }
  
+ SEMOPS_INLINE QI
+ SUBWORDDIQI (DI in, int byte)
+ {
+   assert (byte >= 0 && byte <= 7);
+   return (UQI) (in >> (8 * (7 - byte))) & 0xFF;
+ }
+ 
  SEMOPS_INLINE HI
  SUBWORDDIHI (DI in, int word)
  {
    assert (word >= 0 && word <= 3);
!   return (UHI) (in >> (16 * (3 - word))) & 0xFFFF;
  }
  
  SEMOPS_INLINE HI
***************
*** 450,455 ****
--- 457,463 ----
  SI SUBWORDSFSI (SF);
  SF SUBWORDSISF (SI);
  DF SUBWORDDIDF (DI);
+ QI SUBWORDDIQI (DI, int);
  HI SUBWORDDIHI (DI, int);
  SI SUBWORDDISI (DI, int);
  SI SUBWORDDFSI (DF, int);
From ac131313@cygnus.com Sun Dec 03 20:08:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: Re: [rfc/rfa] multi-arch *_REG_TO_REGNUM()
Date: Sun, 03 Dec 2000 20:08:00 -0000
Message-id: <3A2B168C.C07A41F6@cygnus.com>
References: <3A25F04A.DD2D108@cygnus.com>
X-SW-Source: 2000-12/msg00057.html
Content-length: 2229

FYI,  I've checked this part in.  MichaelS needs it.

> Thu Nov 30 16:33:36 2000  Andrew Cagney  <cagney@b1.cygnus.com>
> 
>         * gdbarch.sh (STAB_REG_TO_REGNUM, ECOFF_REG_TO_REGNUM,
>         DWARF_REG_TO_REGNUM, SDB_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM):
>         Add.
>         * gdbarch.h, gdbarch.c: Regenerate.
>         * arch-utils.c (no_op_reg_to_regnum): New function.
>         * arch-utils.h (no_op_reg_to_regnum): Declare.
> 
>         * dwarfread.c (DWARF_REG_TO_REGNUM), coffread.c
>         (SDB_REG_TO_REGNUM), stabsread.h (STAB_REG_TO_REGNUM),
>         mdebugread.c (ECOFF_REG_TO_REGNUM): Delete macro.
> 
>         * config/mips/tm-mips.h (ECOFF_REG_TO_REGNUM, STAB_REG_TO_REGNUM):
>         Delete.  Moved to mips-tdep.c.
>         * mips-tdep.c (mips_ecoff_reg_to_regnum, mips_stab_reg_to_regnum):
>         New functions.
>         (mips_gdbarch_init): Add ``mips_ecoff_reg_to_regnum'' and
>         ``mips_stab_reg_to_regnum'' to multi-arch vector.
> 

I'll follow up the attatched later.

	Andrew
Index: doc/ChangeLog
Thu Nov 30 16:57:19 2000  Andrew Cagney  <cagney@b1.cygnus.com>

	* gdbint.texinfo (ECOFF_REG_TO_REGNUM, DWARF_REG_TO_REGNUM,
 	DWARF2_REG_TO_REGNUM): Document.

Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.16
diff -p -r1.16 gdbint.texinfo
*** gdbint.texinfo	2000/11/24 11:02:59	1.16
--- gdbint.texinfo	2000/11/30 06:10:08
*************** library in which breakpoints cannot be s
*** 1640,1645 ****
--- 1640,1657 ----
  @item DO_REGISTERS_INFO
  If defined, use this to print the value of a register or all registers.
  
+ @item DWARF_REG_TO_REGNUM
+ Convert DWARF register number into @value{GDBN} regnum.  If not defined,
+ no conversion will be performed.
+ 
+ @item DWARF2_REG_TO_REGNUM
+ Convert DWARF2 register number into @value{GDBN} regnum.  If not
+ defined, no conversion will be performed.
+ 
+ @item ECOFF_REG_TO_REGNUM
+ Convert ECOFF register number into @value{GDBN} regnum.  If not defined,
+ no conversion will be performed.
+ 
  @item END_OF_TEXT_DEFAULT
  This is an expression that should designate the end of the text section
  (? FIXME ?)
From ac131313@cygnus.com Sun Dec 03 20:12:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Ben Elliston <bje@redhat.com>
Cc: gdb-patches@sources.redhat.com, cgen@sources.redhat.com
Subject: Re: [Sim] Patch to sim/common/cgen-ops.h
Date: Sun, 03 Dec 2000 20:12:00 -0000
Message-id: <3A2B176E.F17BD9DA@cygnus.com>
References: <200012040402.eB442Sk23037@scooby.cygnus.com>
X-SW-Source: 2000-12/msg00058.html
Content-length: 157

Oh, what the heck.

Why is CGEN follow the GCC convention of SI, UI, BI, ZI, NFI, rather
than the sim-common convention of signed8, unsigned64, ...

	Andrew
From ac131313@cygnus.com Sun Dec 03 20:41:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Fernando Nasser <fnasser@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: RFA: remote.c (remote_send): Do not assume what to do on error
Date: Sun, 03 Dec 2000 20:41:00 -0000
Message-id: <3A2B1E33.6DFCFAD7@cygnus.com>
References: <3A072F27.5E5F9EDC@cygnus.com>
X-SW-Source: 2000-12/msg00059.html
Content-length: 724

Fernando Nasser wrote:
> 
> remote_send() makes assumptions about what the caller wants to do about
> errors reported by the stub.  And it assumes it should longjump!
> 
> I believe it should just return the error code (in the buffer) and let
> the caller decide.  The patch below makes this change and adds a test for
> the error in the only place it makes sense to do it.
> 
>         * remote.c (remote_send): Do not call error(). Do not assume what
>         the caller wants to do on an error condition.  Just return the
>         buffer with the error code.
>         (store_register_using_P): Test for write register result.

Should all calls to remote_send() be changed so that they check the
return value?

	Andrew
From bje@redhat.com Sun Dec 03 20:42:00 2000
From: Ben Elliston <bje@redhat.com>
To: gdb-patches@sources.redhat.com
Cc: cgen@sources.redhat.com
Subject: [Sim] Patch to sim/common/Make-common.in
Date: Sun, 03 Dec 2000 20:42:00 -0000
Message-id: <200012040442.eB44gNM27093@scooby.cygnus.com>
X-SW-Source: 2000-12/msg00060.html
Content-length: 1845

The following patch activates the new "defs" file support in cgen-sim.
Okay to commit?  This is the last one -- I promise. :-)

Ben


2000-12-04  Ben Elliston  <bje@redhat.com>

	* Make-common.in (cgen-defs): New target.
	(cgen-decode): Pass $(EXTRAFILES).

*** Make-common.in	2000/09/14 21:01:42	1.97
--- Make-common.in	2000/12/04 04:40:24
***************
*** 1,5 ****
  # Makefile fragment for common parts of all simulators.
! # Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
  # Contributed by Cygnus Support.
  
  # This program is free software; you can redistribute it and/or modify
--- 1,5 ----
  # Makefile fragment for common parts of all simulators.
! # Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
  # Contributed by Cygnus Support.
  
  # This program is free software; you can redistribute it and/or modify
***************
*** 691,700 ****
  		$(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
  		$(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" "$(EXTRAFILES)"
  
  cgen-decode: force
  	$(SHELL) $(srccom)/cgen.sh decode $(srcdir) \
  		$(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
! 		$(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" ignored
  
  cgen-cpu-decode: force
  	$(SHELL) $(srccom)/cgen.sh cpu-decode $(srcdir) \
--- 691,705 ----
  		$(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
  		$(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" "$(EXTRAFILES)"
  
+ cgen-defs: force
+ 	$(SHELL) $(srccom)/cgen.sh defs $(srcdir) \
+ 		$(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
+ 		$(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" ignored
+ 
  cgen-decode: force
  	$(SHELL) $(srccom)/cgen.sh decode $(srcdir) \
  		$(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
! 		$(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" "$(EXTRAFILES)"
  
  cgen-cpu-decode: force
  	$(SHELL) $(srccom)/cgen.sh cpu-decode $(srcdir) \
From dje@transmeta.com Sun Dec 03 21:09:00 2000
From: Doug Evans <dje@transmeta.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: Ben Elliston <bje@redhat.com>, gdb-patches@sources.redhat.com, cgen@sources.redhat.com
Subject: Re: [Sim] Patch to sim/common/cgen-ops.h
Date: Sun, 03 Dec 2000 21:09:00 -0000
Message-id: <14891.9921.841994.631587@casey.transmeta.com>
References: <200012040402.eB442Sk23037@scooby.cygnus.com> <3A2B176E.F17BD9DA@cygnus.com>
X-SW-Source: 2000-12/msg00061.html
Content-length: 292

Andrew Cagney writes:
 > Oh, what the heck.
 > 
 > Why is CGEN follow the GCC convention of SI, UI, BI, ZI, NFI, rather
 > than the sim-common convention of signed8, unsigned64, ...

'cus cgen rtl is based on gcc rtl and I like having the types
be the same in the emitted code as in the rtl.
From dje@transmeta.com Sun Dec 03 21:28:00 2000
From: Doug Evans <dje@transmeta.com>
To: Ben Elliston <bje@redhat.com>
Cc: gdb-patches@sources.redhat.com, cgen@sources.redhat.com
Subject: [Sim] New sim/common/cgen.sh
Date: Sun, 03 Dec 2000 21:28:00 -0000
Message-id: <14891.11078.968497.248125@casey.transmeta.com>
References: <200012040323.eB43Nv011864@scooby.cygnus.com>
X-SW-Source: 2000-12/msg00062.html
Content-length: 5734

Ben Elliston writes:
 > It's not very often that I advocate complete rewrites :-), but in this
 > case, the cgen.sh script (used to generate the sim files with cgen)
 > was a rats' nest.  Rather than post diffs, I have included the new
 > script for review.  (Diffs are left as an exercise for the reader).
 > 
 > I think this script is much clearer and certainly more maintainable.
 > In the future, we need to allow finer control over files that are
 > generated -- for example, you might want the cpu files, but not
 > model.c.
 > 
 > The reason I did this is that the script provides a new "defs" action,
 > to emit a defs.h file using last week's CGEN modifications.
 > 
 > Comments?

The nice thing about the way things are now is that each section
is self contained.  In and of itself that's not a bad thing.

Also, while the existing script has problems with parallel makes,
your version has even worse problems.  You might want to fix that.

 > 2000-12-04  Ben Elliston  <bje@redhat.com>
 > 
 > 	* cgen.sh: Rewrite. Add "defs" action.
 > 
 > 
 > #! /bin/sh
 > # Generate CGEN simulator files.
 > #
 > # Usage: /bin/sh cgen.sh {"arch"|"cpu"|"decode"|"defs"|"cpu-decode"} srcdir \
 > #	cgen cgendir cgenflags \
 > #	arch archflags cpu mach suffix [extrafiles...]
 > #
 > # We store the generated files in the source directory until we decide to
 > # ship a Scheme interpreter (or other implementation) with gdb/binutils.
 > # Maybe we never will.
 > 
 > # We want to behave like make, any error forces us to stop.
 > set -e
 > 
 > action=$1
 > srcdir=$2
 > cgen=$3
 > cgendir=$4
 > cgenflags=$5
 > arch=$6
 > archflags=$7
 > cpu=$8
 > isa=$9
 > # portably bring parameters beyond $9 into view
 > shift ; mach=$9
 > shift ; suffix=$9
 > shift ; extrafiles=$9
 > 
 > rootdir=${srcdir}/../..
 > 
 > if test -z "$isa" ; then
 >   isa=all
 >   prefix=${cpu}
 > else
 >   prefix=${cpu}_${isa}
 > fi
 > 
 > lowercase='abcdefghijklmnopqrstuvwxyz'
 > uppercase='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 > ARCH=`echo ${arch} | tr "${lowercase}" "${uppercase}"`
 > CPU=`echo ${cpu} | tr "${lowercase}" "${uppercase}"`
 > PREFIX=`echo ${prefix} | tr "${lowercase}" "${uppercase}"`
 > 
 > sedscript="\
 > -e s/@ARCH@/${ARCH}/g -e s/@arch@/${arch}/g \
 > -e s/@CPU@/${CPU}/g -e s/@cpu@/${cpu}/g \
 > -e s/@PREFIX@/${PREFIX}/g -e s/@prefix@/${prefix}/g"
 > 
 > tmp_postprocessed=\
 > "tmp-all.h tmp-arch.h tmp-arch.c tmp-cpu.c tmp-cpu.h tmp-dec.h tmp-dec.c tmp-defs.h tmp-desc.h tmp-desc.c tmp-ext.c tmp-mod.c tmp-opc.h tmp-read.c tmp-sem.c tmp-semsw.c tmp-write.c"
 > 
 > for file in ${tmp_postprocessed} ; do
 >   tmp_preprocessed="${file}1 $tmp_preprocessed" 
 > done
 > 
 > # Step 1: clean up.
 > rm -f ${tmp_preprocessed} ${tmp_postprocessed}
 > 
 > # Step 2: run cgen to produce pre-processed files.
 > case $action in
 > arch)
 > 	${cgen} -s ${cgendir}/cgen-sim.scm \
 > 		-s ${cgendir} \
 > 		${cgenflags} \
 > 		-f "${archflags}" \
 > 		-m ${mach} \
 > 		-a ${arch} \
 > 		-i ${isa} \
 > 		-A tmp-arch.h1 \
 > 		-B tmp-arch.c1 \
 > 		-N tmp-all.h1
 > 	;;
 > 
 > cpu | decode | cpu-decode)
 > 	fileopts=""
 > 	case $action in
 > 	*cpu*)
 > 		fileopts="$fileopts \
 > 			-C tmp-cpu.h1 \
 > 			-U tmp-cpu.c1 \
 > 			-M tmp-mod.c1 \
 > 			${extrafiles}"
 > 		;;
 > 	esac
 > 	case $action in
 > 	*decode*)
 > 		fileopts="$fileopts \
 > 			-T tmp-dec.h1 \
 > 			-D tmp-dec.c1" 
 > 		case ${extrafiles} in
 > 		  ignored) # Do nothing.
 > 		           ;; 
 > 		  *)       fileopts="$fileopts ${extrafiles}"
 > 		           ;;
 > 		esac
 > 		;;
 > 	esac
 > 
 > 	${cgen} -s ${cgendir}/cgen-sim.scm \
 > 		-s ${cgendir} \
 > 		${cgenflags} \
 > 		-f "${archflags}" \
 > 		-m ${mach} \
 > 		-a ${arch} \
 > 		-i ${isa} \
 > 		${fileopts}
 > 	;;
 > 
 > defs)
 > 	${cgen} -s ${cgendir}/cgen-sim.scm \
 > 		-s ${cgendir} \
 > 		${cgenflags} \
 > 		-f "${archflags}" \
 > 		-m ${mach} \
 > 		-a ${arch} \
 > 		-i ${isa} \
 > 		-G tmp-defs.h1
 > 	;;
 > 
 > desc)
 > 	${cgen} -s ${cgendir}/cgen-opc.scm \
 > 		-s ${cgendir} \
 > 		${cgenflags} \
 > 		-f "${archflags}" \
 > 		-m ${mach} \
 > 		-a ${arch} \
 > 		-i ${isa} \
 > 		-H tmp-desc.h1 \
 > 		-C tmp-desc.c1 \
 > 		-O tmp-opc.h1
 > 	;;
 > 
 > *)
 > 	echo "`basename $0`: unknown action: ${action}" >&2
 > 	exit 1
 > 	;;
 > esac
 > 
 > # Step 3: post-process files.
 > for file in ${tmp_preprocessed} ; do
 >   if test -f $file ; then
 >     postproc=`basename $file 1`
 >     sed ${sedscript} < $file > $postproc
 >     if grep '@[^ ]*@' $postproc >/dev/null ; then
 >       echo "Warning: $postproc may contain unsubstituted macros" >&2
 >     fi
 >     rm $file
 >     case $postproc in
 >       tmp-all.h)   srcfile=cpuall.h ;;
 >       tmp-arch.h)  srcfile=arch.h ;;
 >       tmp-arch.c)  srcfile=arch.c ;;
 >       tmp-cpu.h)   srcfile=cpu${suffix}.h ;;
 >       tmp-cpu.c)   srcfile=cpu${suffix}.c ;;
 >       tmp-dec.c)   srcfile=decode${suffix}.c ;;
 >       tmp-dec.h)   srcfile=decode${suffix}.h ;;
 >       tmp-defs.h)  srcfile=defs${suffix}.h ;;
 >       tmp-desc.c)  srcfile=${arch}-desc.c ;;
 >       tmp-desc.h)  srcfile=${arch}-desc.h ;;
 >       tmp-ext.c)   srcfile=extract${suffix}.c ;;
 >       tmp-mod.c)   srcfile=model${suffix}.c ;;
 >       tmp-opc.h)   srcfile=${arch}-opc.h ;;
 >       tmp-read.c)  srcfile=read${suffix}.c ;;
 >       tmp-sem.c)   srcfile=sem${suffix}.c ;;
 >       tmp-semsw.c) srcfile=sem${suffix}-switch.c ;;
 >       tmp-write.c) srcfile=write${suffix}.c ;; 
 > 
 >       *) echo "Unknown post-processed file $postproc"
 > 	 exit 1
 > 	 ;;
 >     esac
 >     ${rootdir}/move-if-change ${postproc} ${srcdir}/${srcfile}
 >   fi
 > done
 > 
 > if ls *1 2>/dev/null ; then
 >   echo "Warning: output files were left behind!" >&2
 >   exit 1
 > fi
 > 
 > exit 0
From dje@transmeta.com Sun Dec 03 21:32:00 2000
From: Doug Evans <dje@transmeta.com>
To: Ben Elliston <bje@redhat.com>
Cc: <gdb-patches@sources.redhat.com>, <cgen@sources.redhat.com>
Subject: Re: [Sim] Large patch to sim/common/genmloop.sh
Date: Sun, 03 Dec 2000 21:32:00 -0000
Message-id: <14891.11249.377825.198559@casey.transmeta.com>
References: <14891.3324.103652.732423@casey.transmeta.com> <Pine.LNX.4.30.0012041421080.3435-100000@moshpit.cygnus.com>
X-SW-Source: 2000-12/msg00063.html
Content-length: 346

Ben Elliston writes:
 > dje wrote:
 > 
 >    What's the reason for this patch again?
 > 
 > I may (actually, I do!) want to generate two main loops (one per ISA), where
 > they will share the same CPU name.  The @prefix@ notation is also more
 > general.

Except for minimizing the amount of changes,
is there any reason to keep the cpu prefix?


^ permalink raw reply	[flat|nested] 4+ messages in thread
[parent not found: <14891.11078.968497.248125@casey.transmeta.com>]

end of thread, other threads:[~2000-12-04  1:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-03 19:24 [Sim] New sim/common/cgen.sh Ben Elliston
     [not found] <14891.11078.968497.248125@casey.transmeta.com>
2000-12-03 23:49 ` Ben Elliston
2000-12-04  1:47 ` Ben Elliston
2000-12-04  1:57   ` Ben Elliston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox