sval: introduce sval_min/max()
[smatch.git] / sparsec
blob9c90b3054f09ffcdb2874b8860dd909a15fcb110
1 #!/bin/sh
3 # GCC compatible C compiler based on Sparse LLVM
5 set +e
7 SPARSEOPTS=""
8 DIRNAME=`dirname $0`
10 NEED_LINK=1
12 if [ $# -eq 0 ]; then
13 echo "`basename $0`: no input files"
14 exit 1
17 while [ $# -gt 0 ]; do
18 case $1 in
19 '-o')
20 OUTFILE=$2
21 shift
23 '-c')
24 NEED_LINK=0
27 SPARSEOPTS="$SPARSEOPTS $1 " ;;
28 esac
29 shift
30 done
32 TMPLLVM=`mktemp -t tmp.XXXXXX`".llvm"
33 TMPFILE=`mktemp -t tmp.XXXXXX`".o"
35 $DIRNAME/sparse-llvm $SPARSEOPTS > $TMPLLVM
37 llc -o - $TMPLLVM | as -o $TMPFILE
39 if [ $NEED_LINK -eq 1 ]; then
40 if [ -z $OUTFILE ]; then
41 OUTFILE=a.out
43 gcc $TMPFILE -o $OUTFILE
44 else
45 if [ -z $OUTFILE ]; then
46 echo "`basename $0`: no output file"
47 exit 1
49 mv $TMPFILE $OUTFILE
52 rm -f $TMPLLVM