-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.sh
51 lines (37 loc) · 859 Bytes
/
demo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
# Regression demo script for Handl (interpreted from MicroC and CFlat)
# LLVM interpreter
LLI="lli"
#LLI="/usr/local/opt/llvm/bin/lli"
# LLVM compiler
LLC="llc"
# C compiler
CC="cc"
# Path to Handl compiler
HANDL="./handl.native"
# Set time limit for all operations
ulimit -t 30
globallog=testall.log
rm -f $globallog
error=0
globalerror=0
keep=0
Usage() {
echo "Usage: demo.sh [.hdl file]"
exit 1
}
Run() {
echo $* 1>&2
eval $* || {
SignalError "$1 failed on $*"
return 1
}
}
basename=`echo $1 | sed 's/.*\\///
s/.hdl//'`
Run "$CC -c handlmusic.c"
Run "$HANDL" "$1" ">" "${basename}.ll" &&
Run "$LLC" "-relocation-model=pic" "${basename}.ll" ">" "${basename}.s" &&
Run "$CC" "-o" "${basename}.exe" "${basename}.s" "handlmusic.o" &&
Run "./${basename}.exe" > "${basename}.out" &&
exit