mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 19:03:45 +00:00
Estimated hours taken: 2 Rename `mc' as `mmc'. Note: we do not change the names of variables such as MCFLAGS, just the `mc' executable. configure.in: Look for mmc not mc. If you can't find mmc to bootstrap, try for mc. bindist/Mmakefile: bindist/bindist.configure.in: doc/Mmakefile: doc/user_guide.texi: scripts/Mmake.vars.in: scripts/Mmakefile: scripts/msl.in: tools/expand_params: tools/optstages: tools/speedtest: tools/test_mercury: Change references to mc into mmc.
51 lines
899 B
Bash
Executable File
51 lines
899 B
Bash
Executable File
#!/bin/sh
|
|
# Given the name of a file containing output generated by mmc --debug-opt,
|
|
# e.g. Out, generate a series of files Out.stage.N, each containing the
|
|
# output of one stage of the optimization process.
|
|
#
|
|
# This script is most useful if the input file was generated by compiling
|
|
# a Mercury module containing only one procedure.
|
|
|
|
if test $# != 1
|
|
then
|
|
echo "Usage: optstages filename"
|
|
exit 1
|
|
fi
|
|
|
|
TERMCAP=/etc/termcap; export TERMCAP
|
|
cp $1 .tmp
|
|
|
|
/bin/rm $1.stage.* > /dev/null 2>&1
|
|
|
|
# get rid of everything before
|
|
ed - .tmp > /dev/null << END
|
|
/^before optimization/
|
|
1,-d
|
|
/^% Optimizing/
|
|
1,-w $1.stage.0
|
|
1,-d
|
|
w
|
|
q
|
|
END
|
|
echo "created $1.stage.0"
|
|
|
|
i=1
|
|
while test `egrep '^after' .tmp | wc -l` -gt 1
|
|
do
|
|
ed - .tmp > /dev/null << END
|
|
/^after/
|
|
/^% Optimizing/
|
|
1,-w $1.stage.$i
|
|
1,-d
|
|
w
|
|
q
|
|
END
|
|
echo "created $1.stage.$i"
|
|
i=`expr $i + 1`
|
|
done
|
|
|
|
mv .tmp $1.stage.$i
|
|
echo "created $1.stage.$i"
|
|
|
|
exit 0
|