Debian Codegraph @

misc/change-gvm-regs

raw symbols SCIP
1 #! /bin/shscip-shell filesystem . . `/bin/sh`.
2
3 # Utility to change the number of GVM registers.
4 #
5 # Usage: change-gvm-regs nb-gvm-regs nb-arg-regs
6 #
7 # The setting nb-gvm-regs=5 and nb-arg-regs=3 has been used
8 # for many years, but the best setting depends on the processor.
9
10 NB_GVM_REGS=$1
11 NB_ARG_REGS=$2
12 CONFIGURE_OPTIONS=$3
13
14 if [scip-shell system . . `[`. "$NB_GVM_REGS" == "" ]
15 then
16 NB_GVM_REGS=5
17 fi
18
19 if [scip-shell system . . `[`. $NB_GVM_REGS -lt 3 -o $NB_GVM_REGS -gt 25 ]
20 then
21 echoscip-shell system . . echo. "usage: change-gvm-regs nb-gvm-regs nb-arg-regs"
22 echoscip-shell system . . echo. "nb-gvm-regs must be between 3 and 25"
23 exit 1
24 fi
25
26 if [scip-shell system . . `[`. "$NB_ARG_REGS" == "" ]
27 then
28 NB_ARG_REGS=`eval expr $NB_GVM_REGS - 2`
29 fi
30
31 if [scip-shell system . . `[`. $NB_ARG_REGS -lt 1 -o $NB_ARG_REGS -gt 12 -o $NB_ARG_REGS -gt `eval expr $NB_GVM_REGS - 2` ]
32 then
33 echoscip-shell system . . echo. "usage: change-gvm-regs nb-gvm-regs nb-arg-regs"
34 echoscip-shell system . . echo. "nb-arg-regs must be between 1 and min(12, nb-gvm-regs - 2)"
35 exit 1
36 fi
37
38 echoscip-shell system . . echo. "***************************** new settings: nb-gvm-regs=$NB_GVM_REGS nb-arg-regs=$NB_ARG_REGS"
39
40 if ! makescip-shell system . . make. bootclean > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
41 then
42 echoscip-shell system . . echo. "***************************** 'make bootclean' failed"
43 exit 1
44 fi
45
46 echoscip-shell system . . echo. "***************************** updating include/gambit.h.in and gsc/_t-c-1.scm"
47
48 sedscip-shell system . . sed. -e "s/#define ___NB_GVM_REGS .*/#define ___NB_GVM_REGS $NB_GVM_REGS/g" -e "s/#define ___NB_ARG_REGS .*/#define ___NB_ARG_REGS $NB_ARG_REGS/g" include/gambit.h.in > gambit.h.in-new
49
50 diffscip-shell system . . diff. include/gambit.h.in gambit.h.in-new
51
52 sedscip-shell system . . sed. -e "s/(define targ-default-nb-gvm-regs [0-9]*)/(define targ-default-nb-gvm-regs $NB_GVM_REGS)/g" -e "s/(define targ-default-nb-arg-regs [0-9]*)/(define targ-default-nb-arg-regs $NB_ARG_REGS)/g" gsc/_t-c-1.scm > _t-c-1.scm-new
53
54 diffscip-shell system . . diff. gsc/_t-c-1.scm _t-c-1.scm-new
55
56 mvscip-shell system . . mv. gambit.h.in-new include/gambit.h.in
57 mvscip-shell system . . mv. _t-c-1.scm-new gsc/_t-c-1.scm
58
59 echoscip-shell system . . echo. "***************************** configuring new settings for bootstrap"
60
61 if ! ./configure --enable-single-host $CONFIGURE_OPTIONS COMPILATION_OPTIONS="-nb-gvm-regs $NB_GVM_REGS -nb-arg-regs $NB_ARG_REGS"
62 then
63 echoscip-shell system . . echo. "***************************** './configure --enable-single-host $CONFIGURE_OPTIONS COMPILATION_OPTIONS=\"-nb-gvm-regs $NB_GVM_REGS -nb-arg-regs $NB_ARG_REGS\"' failed"
64 exit 1
65 fi
66
67 echoscip-shell system . . echo. "***************************** generating .c from .scm using new settings"
68
69 if ! makescip-shell system . . make. -j
70 then
71 echoscip-shell system . . echo. "***************************** 'make -j' failed"
72 exit 1
73 fi
74
75 echoscip-shell system . . echo. "***************************** checking that the new settings work"
76
77 if ! makescip-shell system . . make. check
78 then
79 echoscip-shell system . . echo. "***************************** 'make check' failed"
80 exit 1
81 fi
82
83 echoscip-shell system . . echo. "***************************** it appears that the new settings work"
84 echoscip-shell system . . echo. "***************************** and that it is safe to do a 'make bootstrap' now"