2000-12-13 Ben Elliston <bje@redhat.com>
* cgen.sh: Set prefix/PREFIX (append ISA if applicable). Factor sed expressions into $sedscript, substituting @prefix@/@PREFIX@. (defs): New action.
This commit is contained in:
parent
9602af5112
commit
fd5d712edf
2 changed files with 53 additions and 24 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2000-12-13 Ben Elliston <bje@redhat.com>
|
||||||
|
|
||||||
|
* cgen.sh: Set prefix/PREFIX (append ISA if applicable). Factor
|
||||||
|
sed expressions into $sedscript, substituting @prefix@/@PREFIX@.
|
||||||
|
(defs): New action.
|
||||||
|
|
||||||
2000-12-12 Geoffrey Keating <geoffk@redhat.com>
|
2000-12-12 Geoffrey Keating <geoffk@redhat.com>
|
||||||
|
|
||||||
* sim-endian.h: Don't have parameters on macro definitions which
|
* sim-endian.h: Don't have parameters on macro definitions which
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Generate CGEN simulator files.
|
# Generate CGEN simulator files.
|
||||||
#
|
#
|
||||||
# Usage: /bin/sh cgen.sh {"arch"|"cpu"|"decode"|"cpu-decode"} srcdir \
|
# Usage: /bin/sh cgen.sh {"arch"|"cpu"|"decode"|"defs"|"cpu-decode"} \
|
||||||
# cgen cgendir cgenflags \
|
# srcdir cgen cgendir cgenflags \
|
||||||
# arch archflags cpu mach suffix extrafiles
|
# arch archflags cpu mach suffix extrafiles
|
||||||
#
|
#
|
||||||
# We store the generated files in the source directory until we decide to
|
# We store the generated files in the source directory until we decide to
|
||||||
|
@ -21,21 +21,30 @@ arch=$6
|
||||||
archflags=$7
|
archflags=$7
|
||||||
cpu=$8
|
cpu=$8
|
||||||
isa=$9
|
isa=$9
|
||||||
# bring parms past 9 portably into view
|
# portably bring parameters beyond $9 into view
|
||||||
shift ; mach=$9
|
shift ; mach=$9
|
||||||
shift ; suffix=$9
|
shift ; suffix=$9
|
||||||
shift ; extrafiles=$9
|
shift ; extrafiles=$9
|
||||||
|
|
||||||
rootdir=${srcdir}/../..
|
rootdir=${srcdir}/../..
|
||||||
|
|
||||||
|
if test -z "$isa" ; then
|
||||||
|
isa=all
|
||||||
|
prefix=$cpu
|
||||||
|
else
|
||||||
|
prefix=${cpu}_$isa
|
||||||
|
fi
|
||||||
|
|
||||||
lowercase='abcdefghijklmnopqrstuvwxyz'
|
lowercase='abcdefghijklmnopqrstuvwxyz'
|
||||||
uppercase='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
uppercase='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
ARCH=`echo ${arch} | tr "${lowercase}" "${uppercase}"`
|
ARCH=`echo ${arch} | tr "${lowercase}" "${uppercase}"`
|
||||||
CPU=`echo ${cpu} | tr "${lowercase}" "${uppercase}"`
|
CPU=`echo ${cpu} | tr "${lowercase}" "${uppercase}"`
|
||||||
|
PREFIX=`echo ${prefix} | tr "${lowercase}" "${uppercase}"`
|
||||||
|
|
||||||
if test -z "$isa" ; then
|
sedscript="\
|
||||||
isa=all
|
-e s/@ARCH@/${ARCH}/g -e s/@arch@/${arch}/g \
|
||||||
fi
|
-e s/@CPU@/${CPU}/g -e s/@cpu@/${cpu}/g \
|
||||||
|
-e s/@PREFIX@/${PREFIX}/g -e s/@prefix@/${prefix}/g"
|
||||||
|
|
||||||
case $action in
|
case $action in
|
||||||
arch)
|
arch)
|
||||||
|
@ -53,11 +62,11 @@ arch)
|
||||||
-A tmp-arch.h1 \
|
-A tmp-arch.h1 \
|
||||||
-B tmp-arch.c1 \
|
-B tmp-arch.c1 \
|
||||||
-N tmp-all.h1
|
-N tmp-all.h1
|
||||||
sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" < tmp-arch.h1 > tmp-arch.h
|
sed $sedscript < tmp-arch.h1 > tmp-arch.h
|
||||||
${rootdir}/move-if-change tmp-arch.h ${srcdir}/arch.h
|
${rootdir}/move-if-change tmp-arch.h ${srcdir}/arch.h
|
||||||
sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" < tmp-arch.c1 > tmp-arch.c
|
sed $sedscript < tmp-arch.c1 > tmp-arch.c
|
||||||
${rootdir}/move-if-change tmp-arch.c ${srcdir}/arch.c
|
${rootdir}/move-if-change tmp-arch.c ${srcdir}/arch.c
|
||||||
sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" < tmp-all.h1 > tmp-all.h
|
sed $sedscript < tmp-all.h1 > tmp-all.h
|
||||||
${rootdir}/move-if-change tmp-all.h ${srcdir}/cpuall.h
|
${rootdir}/move-if-change tmp-all.h ${srcdir}/cpuall.h
|
||||||
|
|
||||||
rm -f tmp-arch.h1 tmp-arch.c1 tmp-all.h1
|
rm -f tmp-arch.h1 tmp-arch.c1 tmp-all.h1
|
||||||
|
@ -102,30 +111,30 @@ cpu | decode | cpu-decode)
|
||||||
|
|
||||||
case $action in
|
case $action in
|
||||||
*cpu*)
|
*cpu*)
|
||||||
sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" -e "s/@CPU@/${CPU}/g" -e "s/@cpu@/${cpu}/g" < tmp-cpu.h1 > tmp-cpu.h
|
sed $sedscript < tmp-cpu.h1 > tmp-cpu.h
|
||||||
${rootdir}/move-if-change tmp-cpu.h ${srcdir}/cpu${suffix}.h
|
${rootdir}/move-if-change tmp-cpu.h ${srcdir}/cpu${suffix}.h
|
||||||
sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" -e "s/@CPU@/${CPU}/g" -e "s/@cpu@/${cpu}/g" < tmp-cpu.c1 > tmp-cpu.c
|
sed $sedscript < tmp-cpu.c1 > tmp-cpu.c
|
||||||
${rootdir}/move-if-change tmp-cpu.c ${srcdir}/cpu${suffix}.c
|
${rootdir}/move-if-change tmp-cpu.c ${srcdir}/cpu${suffix}.c
|
||||||
sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" -e "s/@CPU@/${CPU}/g" -e "s/@cpu@/${cpu}/g" < tmp-mod.c1 > tmp-mod.c
|
sed $sedscript < tmp-mod.c1 > tmp-mod.c
|
||||||
${rootdir}/move-if-change tmp-mod.c ${srcdir}/model${suffix}.c
|
${rootdir}/move-if-change tmp-mod.c ${srcdir}/model${suffix}.c
|
||||||
if test -f tmp-ext.c1 ; then \
|
if test -f tmp-ext.c1 ; then \
|
||||||
sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" -e "s/@CPU@/${CPU}/g" -e "s/@cpu@/${cpu}/g" < tmp-ext.c1 > tmp-ext.c ; \
|
sed $sedscript < tmp-ext.c1 > tmp-ext.c ; \
|
||||||
${rootdir}/move-if-change tmp-ext.c ${srcdir}/extract${suffix}.c ; \
|
${rootdir}/move-if-change tmp-ext.c ${srcdir}/extract${suffix}.c ; \
|
||||||
fi
|
fi
|
||||||
if test -f tmp-read.c1 ; then \
|
if test -f tmp-read.c1 ; then \
|
||||||
sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" -e "s/@CPU@/${CPU}/g" -e "s/@cpu@/${cpu}/g" < tmp-read.c1 > tmp-read.c ; \
|
sed $sedscript < tmp-read.c1 > tmp-read.c ; \
|
||||||
${rootdir}/move-if-change tmp-read.c ${srcdir}/read${suffix}.c ; \
|
${rootdir}/move-if-change tmp-read.c ${srcdir}/read${suffix}.c ; \
|
||||||
fi
|
fi
|
||||||
if test -f tmp-write.c1 ; then \
|
if test -f tmp-write.c1 ; then \
|
||||||
sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" -e "s/@CPU@/${CPU}/g" -e "s/@cpu@/${cpu}/g" < tmp-write.c1 > tmp-write.c ; \
|
sed $sedscript < tmp-write.c1 > tmp-write.c ; \
|
||||||
${rootdir}/move-if-change tmp-write.c ${srcdir}/write${suffix}.c ; \
|
${rootdir}/move-if-change tmp-write.c ${srcdir}/write${suffix}.c ; \
|
||||||
fi
|
fi
|
||||||
if test -f tmp-sem.c1 ; then \
|
if test -f tmp-sem.c1 ; then \
|
||||||
sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" -e "s/@CPU@/${CPU}/g" -e "s/@cpu@/${cpu}/g" < tmp-sem.c1 > tmp-sem.c ; \
|
sed $sedscript < tmp-sem.c1 > tmp-sem.c ; \
|
||||||
${rootdir}/move-if-change tmp-sem.c ${srcdir}/sem${suffix}.c ; \
|
${rootdir}/move-if-change tmp-sem.c ${srcdir}/sem${suffix}.c ; \
|
||||||
fi
|
fi
|
||||||
if test -f tmp-semsw.c1 ; then \
|
if test -f tmp-semsw.c1 ; then \
|
||||||
sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" -e "s/@CPU@/${CPU}/g" -e "s/@cpu@/${cpu}/g" < tmp-semsw.c1 > tmp-semsw.c ; \
|
sed $sedscript < tmp-semsw.c1 > tmp-semsw.c ; \
|
||||||
${rootdir}/move-if-change tmp-semsw.c ${srcdir}/sem${suffix}-switch.c ; \
|
${rootdir}/move-if-change tmp-semsw.c ${srcdir}/sem${suffix}-switch.c ; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -137,9 +146,9 @@ cpu | decode | cpu-decode)
|
||||||
|
|
||||||
case $action in
|
case $action in
|
||||||
*decode*)
|
*decode*)
|
||||||
sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" -e "s/@CPU@/${CPU}/g" -e "s/@cpu@/${cpu}/g" < tmp-dec.h1 > tmp-dec.h
|
sed $sedscript < tmp-dec.h1 > tmp-dec.h
|
||||||
${rootdir}/move-if-change tmp-dec.h ${srcdir}/decode${suffix}.h
|
${rootdir}/move-if-change tmp-dec.h ${srcdir}/decode${suffix}.h
|
||||||
sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" -e "s/@CPU@/${CPU}/g" -e "s/@cpu@/${cpu}/g" < tmp-dec.c1 > tmp-dec.c
|
sed $sedscript < tmp-dec.c1 > tmp-dec.c
|
||||||
${rootdir}/move-if-change tmp-dec.c ${srcdir}/decode${suffix}.c
|
${rootdir}/move-if-change tmp-dec.c ${srcdir}/decode${suffix}.c
|
||||||
|
|
||||||
rm -f tmp-dec.h1 tmp-dec.c1
|
rm -f tmp-dec.h1 tmp-dec.c1
|
||||||
|
@ -148,6 +157,21 @@ cpu | decode | cpu-decode)
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
defs)
|
||||||
|
rm -f tmp-defs.h1 tmp-defs.h
|
||||||
|
|
||||||
|
${cgen} -s ${cgendir}/cgen-sim.scm \
|
||||||
|
-s ${cgendir} \
|
||||||
|
${cgenflags} \
|
||||||
|
-f "${archflags}" \
|
||||||
|
-m ${mach} \
|
||||||
|
-a ${arch} \
|
||||||
|
-i ${isa} \
|
||||||
|
-G tmp-defs.h1
|
||||||
|
sed $sedscript < tmp-defs.h1 > tmp-defs.h
|
||||||
|
${rootdir}/move-if-change tmp-defs.h ${srcdir}/defs${suffix}.h
|
||||||
|
;;
|
||||||
|
|
||||||
desc)
|
desc)
|
||||||
rm -f tmp-desc.h1 tmp-desc.h
|
rm -f tmp-desc.h1 tmp-desc.h
|
||||||
rm -f tmp-desc.c1 tmp-desc.c
|
rm -f tmp-desc.c1 tmp-desc.c
|
||||||
|
@ -163,19 +187,18 @@ desc)
|
||||||
-H tmp-desc.h1 \
|
-H tmp-desc.h1 \
|
||||||
-C tmp-desc.c1 \
|
-C tmp-desc.c1 \
|
||||||
-O tmp-opc.h1
|
-O tmp-opc.h1
|
||||||
sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" < tmp-desc.h1 > tmp-desc.h
|
sed $sedscript < tmp-desc.h1 > tmp-desc.h
|
||||||
${rootdir}/move-if-change tmp-desc.h ${srcdir}/${arch}-desc.h
|
${rootdir}/move-if-change tmp-desc.h ${srcdir}/${arch}-desc.h
|
||||||
sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \
|
sed $sedscript < tmp-desc.c1 > tmp-desc.c
|
||||||
-e "s/@prefix@/${arch}/" < tmp-desc.c1 > tmp-desc.c
|
|
||||||
${rootdir}/move-if-change tmp-desc.c ${srcdir}/${arch}-desc.c
|
${rootdir}/move-if-change tmp-desc.c ${srcdir}/${arch}-desc.c
|
||||||
sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" < tmp-opc.h1 > tmp-opc.h
|
sed $sedscript < tmp-opc.h1 > tmp-opc.h
|
||||||
${rootdir}/move-if-change tmp-opc.h ${srcdir}/${arch}-opc.h
|
${rootdir}/move-if-change tmp-opc.h ${srcdir}/${arch}-opc.h
|
||||||
|
|
||||||
rm -f tmp-desc.h1 tmp-desc.c1 tmp-opc.h1
|
rm -f tmp-desc.h1 tmp-desc.c1 tmp-opc.h1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "cgen.sh: bad action: ${action}" >&2
|
echo "`basename $0`: unknown action: ${action}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue