blob: 0ff1d0c5ab262c7598a64f3bf5da946ba60ab9a9 [file] [log] [blame]
Renato Golin94cc1042016-04-26 11:02:23 +01001#!/usr/bin/env bash
2
3# This script run one cycle of the bisect, by building (or self-hosting)
4# LLVM+Clang, running the compiler tests and the test-suite, if required.
5# Please, use the sequential.sh script to drive this one.
6
7. common.sh
8
9CORE=`grep "CPU part" /proc/cpuinfo | awk '{print $4}'`
10if [[ $CORE = '0xc08' ]]; then
11 CORE="-mcpu=cortex-a8"
12else if [[ $CORE = '0xc09' ]]; then
13 CORE="-mcpu=cortex-a9"
14else if [[ $CORE = '0xc0f' ]]; then
15 CORE="-mcpu=cortex-a15"
16else if [[ $CORE = '0xd03' ]]; then
17 CORE="-mcpu=cortex-a53"
18else if [[ $CORE = '0xd07' ]]; then
19 CORE="-mcpu=cortex-a57"
20else
21 CORE=''
22fi fi fi fi fi
23
Diana Picus0df00012016-09-15 16:10:44 +030024PARALLEL=-j`grep -c proc /proc/cpuinfo`
25
Renato Golin94cc1042016-04-26 11:02:23 +010026selfhost=false
27check=false
28cflags=$CORE
29full=false
30keepbuild=false
31while getopts "sct:hfvk" opt; do
32 case $opt in
33 s)
34 selfhost=true
35 ;;
36 c)
37 check=true
38 ;;
39 t)
40 test=$OPTARG
41 ;;
42 h)
43 cflags="$cflags -mthumb"
44 ;;
45 v)
46 cflags="$cflags -mfpu=vfpv3"
47 ;;
48 f)
49 full=true
50 ;;
51 k)
52 keepbuild=true
53 ;;
54 *)
55 echo "Syntax: $0 [-(s)elfhost | -(c)heck-all | -(t)est <test-suite-name>] | -T(h)umb | -(v)fp3 | -(f)ull-with-RT | -(k)eep build dir"
56 exit 1
57 ;;
58 esac
59done
60
61flush() {
62 if ! $keepbuild; then
63 if [[ -d $1 && $1 != '/' ]]; then
64 rm -rf $1
65 fi
66 fi
67 mkdir -p $1
68 cd $1
69}
70
71build() {
72 CC=gcc
73 CXX=g++
74 if [[ $1 != '' ]]; then
75 CC=$1/bin/clang
76 CXX=$1/bin/clang++
77 fi
78 CC=$CC CXX=$CXX \
79 cmake -G Ninja ../llvm -DCMAKE_BUILD_TYPE=Release \
80 -DCMAKE_C_FLAGS="$cflags" \
81 -DCMAKE_CXX_FLAGS="$cflags" \
82 -DLLVM_TARGETS_TO_BUILD="ARM;AArch64" \
83 -DLLVM_BUILD_TESTS=True \
Diana Picus0df00012016-09-15 16:10:44 +030084 -DLLVM_ENABLE_ASSERTIONS=True \
85 -DLLVM_LIT_ARGS="-sv $PARALLEL"
86 safe_run ninja $PARALLEL
Renato Golin94cc1042016-04-26 11:02:23 +010087 if $check; then
88 safe_run ninja check-all
89 fi
90}
91
92ROOT=`pwd`
93
94if $full; then
95 ln -sf `pwd`/compiler-rt `pwd`/llvm/projects/compiler-rt
96else
97 rm -f `pwd`/llvm/projects/compiler-rt
98fi
99
100# Native build
101flush $ROOT/build
102build
103
104if $selfhost; then
105 # Self-hosting build
106 flush $ROOT/build2
107 build $ROOT/build
108fi
109
110if [[ $test != '' ]]; then
111 cd $ROOT
112 safe_run ./test.sh $test
113fi
114
115# SVN info
116cd $ROOT
117svn info llvm