From 88dc77ac30cb37711693ffea22cecfd5a466ba86 Mon Sep 17 00:00:00 2001 From: akashk4 <akashk4@illinois.edu> Date: Tue, 7 Jan 2020 07:27:02 -0600 Subject: [PATCH] Update LLVM installer script to copy HPVM into LLVM tree --- hpvm/llvm_installer/llvm_installer.sh | 138 +++++++++++++++++++++++++- 1 file changed, 134 insertions(+), 4 deletions(-) diff --git a/hpvm/llvm_installer/llvm_installer.sh b/hpvm/llvm_installer/llvm_installer.sh index a3d8072466..cff151dc99 100644 --- a/hpvm/llvm_installer/llvm_installer.sh +++ b/hpvm/llvm_installer/llvm_installer.sh @@ -4,17 +4,29 @@ VERSION="9.0.0" URL="http://releases.llvm.org" -SUFFIX=".tar.xz" -LLVM_SRC="llvm-$VERSION.src" - WGET=wget +cd .. + CURRENT_DIR=`pwd` INSTALL_DIR=`pwd`/install BUILD_DIR=$CURRENT_DIR/$LLVM_SRC/build NUM_THREADS=12 +SUFFIX=".tar.xz" +CLANG_SRC="cfe-$VERSION.src" +LLVM_SRC="llvm-$VERSION.src" +RT_SRC="compiler-rt-$VERSION.src" +LIBCXX_SRC="libcxx-$VERSION.src" +LIBCXXABI_SRC="libcxxabi-$VERSION.src" +LLDB_SRC="lldb-$VERSION.src" +LLD_SRC="lld-$VERSION.src" +POLLY_SRC="polly-$VERSION.src" +OPENMP_SRC="openmp-$VERSION.src" +CLANG_TOOLS_SRC="clang-tools-extra-$VERSION.src" + + if [ -d $LLVM_SRC ]; then echo Found $LLVM_SRC! else @@ -23,8 +35,126 @@ else tar xf $LLVM_SRC$SUFFIX fi +if [ -d $LLVM_SRC ]; then + echo Everything looks sane. + mv $LLVM_SRC llvm +else + echo Install had problems. Quitting. + exit +fi + +LLVM_SRC=llvm + +if [ -d $CURRENT_DIR/$LLVM_SRC/tools ]; then + cd $CURRENT_DIR/$LLVM_SRC/tools + echo In tools. +else + echo Fail! Something is wrong with your $LLVM_SRC checkout! + exit 1 +fi + +if [ -d clang ]; then + echo Found clang! Not downloading clang again. +else + $WGET $URL/$VERSION/$CLANG_SRC$SUFFIX + tar xf $CLANG_SRC$SUFFIX + mv $CLANG_SRC clang + if [ -d clang ]; then + echo Everything looks sane. + else + echo Install had problems. Quitting. + exit + fi +fi + cd $CURRENT_DIR +if [ -d $CURRENT_DIR/$LLVM_SRC/projects ]; then + cd $CURRENT_DIR/$LLVM_SRC/projects +else + echo Fail! Something is wrong wint $LLVM_SRC. + exit 1 +fi + +if [ -d compiler-rt ]; then + echo Found compiler-rt! Not downloading compiler-rt again. +else + $WGET $URL/$VERSION/$RT_SRC$SUFFIX + tar xf $RT_SRC$SUFFIX + mv $RT_SRC compiler-rt + if [ -d compiler-rt ]; then + echo Everything looks sane. + else + echo Install had problems. Quitting. + exit + fi +fi + +if [ -d libcxx ]; then + echo Found libcxx! Not downloading libcxx again. +else + $WGET $URL/$VERSION/$LIBCXX_SRC$SUFFIX + tar xf $LIBCXX_SRC$SUFFIX + mv $LIBCXX_SRC libcxx + if [ -d libcxx ]; then + echo Everything looks sane. + else + echo Install had problems. Quitting. + exit + fi +fi + +if [ $LIBCXXABI_SRC != "" ]; then + if [ -d libcxxabi ]; then + echo Found libcxxabi! Not downloading libcxx again. + else + $WGET $URL/$VERSION/$LIBCXXABI_SRC$SUFFIX + tar xf $LIBCXXABI_SRC$SUFFIX + mv $LIBCXXABI_SRC libcxxabi + if [ -d libcxxabi ]; then + echo Everything looks sane. + else + echo Install had problems. Quitting. + exit + fi + fi +fi + +if [ $LLD_SRC != "" ]; then + if [ -d lld ]; then + echo Found lld! Not downloading lld again. + else + $WGET $URL/$VERSION/$LLD_SRC$SUFFIX + tar xf $LLD_SRC$SUFFIX + mv $LLD_SRC lld + if [ -d lld ]; then + echo Everything looks sane. + else + echo Install had problems. Quitting. + exit + fi + fi +fi + + +mkdir $CURRENT_DIR/$LLVM_SRC/tools/hpvm + +HPVM_DIR=$CURRENT_DIR/$LLVM_SRC/tools/hpvm + +cp -r $CURRENT_DIR/include $HPVM_DIR/ +cp -r $CURRENT_DIR/lib $HPVM_DIR/ +cp -r $CURRENT_DIR/visc-rt $HPVM_DIR/ +cp -r $CURRENT_DIR/test $HPVM_DIR/ + +export LLVM_SRC_ROOT=$CURRENT_DIR/$LLVM_SRC +echo ${LLVM_SRC_ROOT} + +cd $CURRENT_DIR/llvm_patches +/bin/bash ./construct_patch.sh +/bin/bash ./apply_patch.sh + +echo Patches applied. + if [ -d $BUILD_DIR ]; then cd $BUILD_DIR echo Found $BUILD_DIR. @@ -32,7 +162,7 @@ else mkdir -p $BUILD_DIR mkdir -p $INSTALL_DIR cd $BUILD_DIR - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DLLVM_OPTIMIZED_TABLEGEN=On .. + cmake ../$LLVM_SRC -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR fi make -j$NUM_THREADS -- GitLab