#!/bin/sh

#
# cmpcg - compare code generators. Compares the old static code generator against the new
#         dynamic code generator.
#
export PATH=$HOME/m2/comp/bin2:$PATH
echo "using compiler from directory:" `type gm2-i386-gas`
gm2-i386-gas -M "../gm2s 386-gas ../libs" -O -Odynamic $1 >& /dev/null
grep -v \^\# $1.s > /tmp/lines.new
echo "$1.mod:  dynamic code generator emitted " `wc -l /tmp/lines.new | cut -b1-8` instructions
gm2-i386-gas -M "../gm2s 386-gas ../libs" -O $1 >& /dev/null
grep -v \^\# $1.s > /tmp/lines.old
echo "$1.mod:  static  code generator emitted " `wc -l /tmp/lines.old | cut -b1-8` instructions
rm -f /tmp/lines.???
