-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcomp.sh
28 lines (22 loc) · 927 Bytes
/
comp.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
#!/bin/bash
# this is left as an example
function compile() {
if [[ -n $CPU2006 && $CPU2006 -eq 1 ]]; then
# rbc -> lnk
$LLVM_PATH/opt -S $rbc_name -o $lnk_name
else
# source_files is the variable with all the files we're gonna compile
parallel --tty --jobs=${JOBS} $LLVM_PATH/$COMPILER $COMPILE_FLAGS \
-Xclang -disable-O0-optnone \
-S -c -emit-llvm {} -o {.}.bc ::: "${source_files[@]}"
parallel --tty --jobs=${JOBS} $LLVM_PATH/opt -S {.}.bc -o {.}.rbc ::: "${source_files[@]}"
#Generate all the bcs into a big bc:
$LLVM_PATH/llvm-link -S *.rbc -o $lnk_name
fi
# optimizations
$LLVM_PATH/opt -S ${OPT} $lnk_name -o $prf_name
# Compile our instrumented file, in IR format, to x86:
$LLVM_PATH/llc -filetype=obj $prf_name -o $obj_name ;
# Compile everything now, producing a final executable file:
$LLVM_PATH/$COMPILER -lm $obj_name -o $exe_name ;
}