aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbisect/run.sh23
-rwxr-xr-xhelpers/llvm-build27
-rwxr-xr-xstress/build-llvm-forever.sh11
3 files changed, 46 insertions, 15 deletions
diff --git a/bisect/run.sh b/bisect/run.sh
index 0ff1d0c..97d1a68 100755
--- a/bisect/run.sh
+++ b/bisect/run.sh
@@ -9,19 +9,27 @@
CORE=`grep "CPU part" /proc/cpuinfo | awk '{print $4}'`
if [[ $CORE = '0xc08' ]]; then
CORE="-mcpu=cortex-a8"
-else if [[ $CORE = '0xc09' ]]; then
+elif [[ $CORE = '0xc09' ]]; then
CORE="-mcpu=cortex-a9"
-else if [[ $CORE = '0xc0f' ]]; then
+elif [[ $CORE = '0xc0f' ]]; then
CORE="-mcpu=cortex-a15"
-else if [[ $CORE = '0xd03' ]]; then
+elif [[ $CORE = '0xd03' ]]; then
CORE="-mcpu=cortex-a53"
-else if [[ $CORE = '0xd07' ]]; then
+elif [[ $CORE = '0xd07' ]]; then
CORE="-mcpu=cortex-a57"
else
CORE=''
-fi fi fi fi fi
+fi
+
+CPUS=$(grep -c proc /proc/cpuinfo)
+PARALLEL=-j$CPUS
+LINK=$(free -g | awk '/Mem/ {print $2}')
+if [ "$LINK" -gt "$CPUS" ]; then
+ LINK=$CPUS
+else
+ LINK=$((LINK+1))
+fi
-PARALLEL=-j`grep -c proc /proc/cpuinfo`
selfhost=false
check=false
@@ -82,7 +90,8 @@ build() {
-DLLVM_TARGETS_TO_BUILD="ARM;AArch64" \
-DLLVM_BUILD_TESTS=True \
-DLLVM_ENABLE_ASSERTIONS=True \
- -DLLVM_LIT_ARGS="-sv $PARALLEL"
+ -DLLVM_LIT_ARGS="-sv $PARALLEL" \
+ -DLLVM_PARALLEL_LINK_JOBS=$LINK
safe_run ninja $PARALLEL
if $check; then
safe_run ninja check-all
diff --git a/helpers/llvm-build b/helpers/llvm-build
index 0cef8a0..0556b6e 100755
--- a/helpers/llvm-build
+++ b/helpers/llvm-build
@@ -11,7 +11,8 @@
safe_run verify_env
## CMD line options and defaults
-PARALLEL=-j`grep -c proc /proc/cpuinfo`
+CPUS=$(grep -c proc /proc/cpuinfo)
+PARALLEL=-j$CPUS
build_dir=$LLVM_BLD
install_dir=$LLVM_INSTALL
build_type=Release
@@ -23,6 +24,8 @@ update=false
check=false
master=false
inst=false
+minimal_targets="-DLLVM_TARGETS_TO_BUILD='ARM;X86;AArch64'"
+link_jobs=
if [ "$1" = "-h" ]; then
echo $syntax
@@ -32,7 +35,7 @@ fi
## Choose between make and ninja
make=make
generator="Unix Makefiles"
-if which ninja 2>&1 > /dev/null; then
+if which ninja > /dev/null 2>&1; then
make=ninja
generator="Ninja"
fi
@@ -41,7 +44,21 @@ fi
if [ "$LLVM_DEBUG" = true ]; then
build_type=Debug
shared=-DBUILD_SHARED_LIBS=True
- targets=-DLLVM_TARGETS_TO_BUILD="ARM;X86;AArch64"
+ targets=$minimal_targets
+fi
+
+# Building on ARM?
+if grep -q "ARM.* Processor" /proc/cpuinfo; then
+ targets=$minimal_targets
+ if [ "$make" = "ninja" ]; then
+ link=$(free -g | awk '/Mem/ {print $2}')
+ if [ "$link" -gt "$CPUS" ]; then
+ link=$CPUS
+ else
+ link=$((link+1))
+ fi
+ link_jobs="-DLLVM_PARALLEL_LINK_JOBS=$link"
+ fi
fi
## Make sure sure build dir is there
@@ -65,8 +82,8 @@ if [ ! -f build.ninja ] && [ ! -f Makefile ]; then
-DLLVM_ENABLE_ASSERTIONS=True \
-DPYTHON_EXECUTABLE=/usr/bin/python2 \
-DCMAKE_INSTALL_PREFIX=$install_dir \
- -DLLVM_LIT_ARGS="-sv -j$PARALLEL" \
- $LLVM_CMAKE_FLAGS $targets $shared
+ -DLLVM_LIT_ARGS="-sv $PARALLEL" \
+ $LLVM_CMAKE_FLAGS $targets $shared $link_jobs
fi
## Build
diff --git a/stress/build-llvm-forever.sh b/stress/build-llvm-forever.sh
index 5fc4096..2e07ff1 100755
--- a/stress/build-llvm-forever.sh
+++ b/stress/build-llvm-forever.sh
@@ -21,13 +21,18 @@
set +e
-ROOT=`pwd`
-CPUS=`grep -c proc /proc/cpuinfo`
+ROOT=$(pwd)
+CPUS=$(grep -c proc /proc/cpuinfo)
+LINK=$(free -g | awk '/Mem/ {print $2}')
+if [ "$LINK" -gt "$CPUS" ]; then
+ LINK=$CPUS
+else
+ LINK=$((LINK+1))
+fi
LINK_JOBS=
GEN="Unix Makefiles"
BUILD="make"
if ninja --version > /dev/null; then
- LINK=`free -g | awk '/Mem/ {print $2}'`
LINK_JOBS="-DLLVM_PARALLEL_LINK_JOBS=$LINK"
GEN="Ninja"
BUILD="ninja"