add test case for builtin bswap with constant args
[smatch.git] / sparsec
blob9dc96c956e47d233266180ac827f3fb939bd3272
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=`"${LLVM_CONFIG:-llvm-config}" --bindir`/llc
39 $LLC -o - $TMPLLVM | as -o $TMPFILE
41 if [ $NEED_LINK -eq 1 ]; then
42 if [ -z $OUTFILE ]; then
43 OUTFILE=a.out
45 gcc $TMPFILE -o $OUTFILE
46 else
47 if [ -z $OUTFILE ]; then
48 echo "`basename $0`: no output file"
49 exit 1
51 mv $TMPFILE $OUTFILE
54 rm -f $TMPLLVM