dereferences_param: mark more parameters as dereferenced
[smatch.git] / sparsec
blob3f9b60c67e0a41ce7abed492e6b3377d61040fc5
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 TMPFILE=`mktemp -t tmp.XXXXXX`
35 LLC=`"${LLVM_CONFIG:-llvm-config}" --bindir`/llc
37 LLC_ARCH_OPTS=
38 case "$(uname -s)" in
39 *CYGWIN*)
40 # cygwin uses the sjlj (setjmp-longjmp) exception model
41 LLC_ARCH_OPTS="-exception-model=sjlj"
42 LLC_ARCH_OPTS="$LLC_ARCH_OPTS -mtriple=$(llvm-config --host-target)"
46 esac
48 $DIRNAME/sparse-llvm $SPARSEOPTS | $LLC ${LLC_ARCH_OPTS} | as -o $TMPFILE
50 if [ $NEED_LINK -eq 1 ]; then
51 if [ -z $OUTFILE ]; then
52 OUTFILE=a.out
54 gcc $TMPFILE -o $OUTFILE
55 rm -f $TMPFILE
56 else
57 if [ -z $OUTFILE ]; then
58 echo "`basename $0`: no output file"
59 exit 1
61 mv $TMPFILE $OUTFILE