From ebfac97e76e10cf609162e21a99cd62eb6fdbfed Mon Sep 17 00:00:00 2001 From: Gordon Tisher Date: Sat, 10 Mar 2018 18:10:38 -0800 Subject: [PATCH 01/16] Updates for LLVM 6.0.0 on Windows --- src/libponyc/codegen/codegen.c | 21 +++++++++++++++++++++ src/libponyc/codegen/gendebug.cc | 2 ++ src/libponyc/codegen/gendebug.h | 9 +++++++-- src/libponyc/codegen/genopt.cc | 15 +++++++++++++-- src/libponyc/codegen/gentype.c | 8 ++++++++ src/libponyc/codegen/host.cc | 4 ++++ wscript | 7 ++++--- 7 files changed, 59 insertions(+), 7 deletions(-) diff --git a/src/libponyc/codegen/codegen.c b/src/libponyc/codegen/codegen.c index d3777636bc..51c89b6cfd 100644 --- a/src/libponyc/codegen/codegen.c +++ b/src/libponyc/codegen/codegen.c @@ -16,6 +16,9 @@ #include "ponyassert.h" #include +#if PONY_LLVM >= 600 +#include +#endif #include #include #include @@ -672,10 +675,22 @@ static bool init_module(compile_t* c, ast_t* program, pass_opt_t* opt, bool jit) c->builder = LLVMCreateBuilderInContext(c->context); c->di = LLVMNewDIBuilder(c->module); +#if PONY_LLVM < 600 // TODO: what LANG id should be used? c->di_unit = LLVMDIBuilderCreateCompileUnit(c->di, 0x0004, package_filename(package), package_path(package), "ponyc-" PONY_VERSION, c->opt->release); +#else + const char* filename = package_filename(package); + const char* dirname = package_path(package); + const char* version = "ponyc-" PONY_VERSION; + LLVMMetadataRef fileRef = LLVMDIBuilderCreateFile(c->di, filename, + strlen(filename), dirname, strlen(dirname)); + c->di_unit = LLVMDIBuilderCreateCompileUnit(c->di, + LLVMDWARFSourceLanguageC_plus_plus, fileRef, version, strlen(version), + opt->release, "", 0, 0, "", 0, LLVMDWARFEmissionKind::LLVMDWARFEmissionFull, + 0, false, false); +#endif // Empty frame stack. c->frame = NULL; @@ -722,6 +737,12 @@ bool codegen_merge_runtime_bitcode(compile_t* c) return true; } +#if defined(PLATFORM_IS_WINDOWS) && PONY_LLVM == 600 +// remove for 6.0.1: https://reviews.llvm.org/D44140 +extern void LLVMInitializeInstCombine_Pony(LLVMPassRegistryRef R); +#define LLVMInitializeInstCombine LLVMInitializeInstCombine_Pony +#endif + bool codegen_llvm_init() { LLVMLoadLibraryPermanently(NULL); diff --git a/src/libponyc/codegen/gendebug.cc b/src/libponyc/codegen/gendebug.cc index 655004ee67..f8eb5163ca 100644 --- a/src/libponyc/codegen/gendebug.cc +++ b/src/libponyc/codegen/gendebug.cc @@ -69,6 +69,7 @@ void LLVMDIBuilderDestroy(LLVMDIBuilderRef d) delete pd; } +#if PONY_LLVM < 600 void LLVMDIBuilderFinalize(LLVMDIBuilderRef d) { unwrap(d)->finalize(); @@ -101,6 +102,7 @@ LLVMMetadataRef LLVMDIBuilderCreateFile(LLVMDIBuilderRef d, const char* file) return wrap(pd->createFile(filename, dir)); } +#endif LLVMMetadataRef LLVMDIBuilderCreateNamespace(LLVMDIBuilderRef d, LLVMMetadataRef scope, const char* name, LLVMMetadataRef file, unsigned line) diff --git a/src/libponyc/codegen/gendebug.h b/src/libponyc/codegen/gendebug.h index ae03a0881c..32976d91dc 100644 --- a/src/libponyc/codegen/gendebug.h +++ b/src/libponyc/codegen/gendebug.h @@ -3,6 +3,9 @@ #include #include +#if PONY_LLVM >= 600 +#include +#endif PONY_EXTERN_C_BEGIN @@ -46,6 +49,7 @@ LLVMDIBuilderRef LLVMNewDIBuilder(LLVMModuleRef m); void LLVMDIBuilderDestroy(LLVMDIBuilderRef d); +#if PONY_LLVM < 600 void LLVMDIBuilderFinalize(LLVMDIBuilderRef d); LLVMMetadataRef LLVMDIBuilderCreateCompileUnit(LLVMDIBuilderRef d, @@ -53,9 +57,10 @@ LLVMMetadataRef LLVMDIBuilderCreateCompileUnit(LLVMDIBuilderRef d, int optimized); LLVMMetadataRef LLVMDIBuilderCreateFile(LLVMDIBuilderRef d, const char* file); +#endif -LLVMMetadataRef LLVMDIBuilderCreateNamespace(LLVMDIBuilderRef d, - LLVMMetadataRef scope, const char* name, LLVMMetadataRef file, +LLVMMetadataRef LLVMDIBuilderCreateNamespace(LLVMDIBuilderRef d, + LLVMMetadataRef scope, const char* name, LLVMMetadataRef file, unsigned line); LLVMMetadataRef LLVMDIBuilderCreateLexicalBlock(LLVMDIBuilderRef d, diff --git a/src/libponyc/codegen/genopt.cc b/src/libponyc/codegen/genopt.cc index d0e83d9d2d..2d1a6ab596 100644 --- a/src/libponyc/codegen/genopt.cc +++ b/src/libponyc/codegen/genopt.cc @@ -32,6 +32,10 @@ #include #include +#if PONY_LLVM >= 600 +#include +#endif + #include "../../libponyrt/mem/heap.h" #include "ponyassert.h" @@ -87,6 +91,13 @@ static void print_transform(compile_t* c, Instruction* i, const char* s) } } +// remove for 6.0.1: https://reviews.llvm.org/D44140 +#if defined(PLATFORM_IS_WINDOWS) && PONY_LLVM == 600 +void LLVMInitializeInstCombine_Pony(LLVMPassRegistryRef R) { + initializeInstructionCombiningPassPass(*unwrap(R)); +} +#endif + class HeapToStack : public FunctionPass { public: @@ -302,9 +313,9 @@ class HeapToStack : public FunctionPass } case Instruction::Load: - // This is a workaround for a problem with LLVM 4 & 5 on *nix when + // This is a workaround for a problem with LLVM 4 & 5 on *nix when // hoisting loads (see #2303, #2061, #1592). - // TODO: figure out the real reason LLVM 4 and 5 produce bad code + // TODO: figure out the real reason LLVM 4 and 5 produce bad code // when hoisting stack allocated loads. #if PONY_LLVM >= 400 && !defined(_MSC_VER) // fall through diff --git a/src/libponyc/codegen/gentype.c b/src/libponyc/codegen/gentype.c index 1f32b89514..300b51c887 100644 --- a/src/libponyc/codegen/gentype.c +++ b/src/libponyc/codegen/gentype.c @@ -20,6 +20,10 @@ #include #include +#if PONY_LLVM >= 600 +#include +#endif + static size_t tbaa_metadata_hash(tbaa_metadata_t* a) { return ponyint_hash_ptr(a->name); @@ -391,7 +395,11 @@ static void make_debug_info(compile_t* c, reach_type_t* t) file = ""; compile_type_t* c_t = (compile_type_t*)t->c_type; +#if PONY_LLVM < 600 c_t->di_file = LLVMDIBuilderCreateFile(c->di, file); +#else + c_t->di_file = LLVMDIBuilderCreateFile(c->di, file, strlen(file), "", 0); +#endif switch(t->underlying) { diff --git a/src/libponyc/codegen/host.cc b/src/libponyc/codegen/host.cc index e9ee975ade..34496f60eb 100644 --- a/src/libponyc/codegen/host.cc +++ b/src/libponyc/codegen/host.cc @@ -105,7 +105,11 @@ char* LLVMGetHostCPUFeatures() void LLVMSetUnsafeAlgebra(LLVMValueRef inst) { +#if PONY_LLVM < 600 unwrap(inst)->setHasUnsafeAlgebra(true); +#else // See https://reviews.llvm.org/D39304 for this change + unwrap(inst)->setHasAllowReassoc(true); +#endif } void LLVMSetNoUnsignedWrap(LLVMValueRef inst) diff --git a/wscript b/wscript index 4a74cbd816..f1302ad84a 100644 --- a/wscript +++ b/wscript @@ -51,12 +51,13 @@ MSVC_VERSIONS = [ '15.6', '15.4', '15.0', '14.0' ] LLVM_VERSIONS = [ '3.9.1', '4.0.1', - '5.0.1' + '5.0.1', + '6.0.0' ] -WINDOWS_LIBS_TAG = "v1.6.0" +WINDOWS_LIBS_TAG = "v1.7.0" LIBRESSL_VERSION = "2.6.4" -PCRE2_VERSION = "10.30" +PCRE2_VERSION = "10.31" # Adds an option for specifying debug or release mode. def options(ctx): From ec54837e4232eafde921a0db570bff2ead3cfd4b Mon Sep 17 00:00:00 2001 From: Gordon Tisher Date: Sat, 10 Mar 2018 18:25:39 -0800 Subject: [PATCH 02/16] Update AppVeyor configuration to include LLVM 6.0.0 builds --- .appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.appveyor.yml b/.appveyor.yml index 203aceea0e..c6b2020421 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -12,6 +12,7 @@ environment: - llvm: 3.9.1 - llvm: 4.0.1 - llvm: 5.0.1 + - llvm: 6.0.0 configuration: - release From 4c8dae6d3783cb4b9060562cbe95dd0e13c80dbf Mon Sep 17 00:00:00 2001 From: Gordon Tisher Date: Sun, 11 Mar 2018 14:12:08 -0700 Subject: [PATCH 03/16] Linux updates for LLVM 6.0.0 --- Makefile | 9 ++++++--- src/libponyc/codegen/codegen.c | 6 +++--- src/libponyc/codegen/genopt.cc | 6 ++++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index df74153e29..ef75c392b6 100644 --- a/Makefile +++ b/Makefile @@ -205,6 +205,8 @@ endif ifndef LLVM_CONFIG ifneq (,$(shell which /usr/local/opt/llvm/bin/llvm-config 2> /dev/null)) LLVM_CONFIG = /usr/local/opt/llvm/bin/llvm-config + else ifneq (,$(shell which llvm-config-6.0 2> /dev/null)) + LLVM_CONFIG = llvm-config-6.0 else ifneq (,$(shell which llvm-config-3.9 2> /dev/null)) LLVM_CONFIG = llvm-config-3.9 else ifneq (,$(shell which /usr/local/opt/llvm@3.9/bin/llvm-config 2> /dev/null)) @@ -254,7 +256,8 @@ ifeq ($(OSTYPE),osx) endif endif -ifeq ($(llvm_version),3.9.1) +ifeq ($(llvm_version),6.0.0) +else ifeq ($(llvm_version),3.9.1) else ifeq ($(llvm_version),4.0.1) $(warning WARNING: LLVM 4 support is experimental and may result in decreased performance or crashes) else ifeq ($(llvm_version),5.0.0) @@ -615,12 +618,12 @@ define CONFIGURE_COMPILER compiler := $(CC) flags := $(ALL_CFLAGS) $(CFLAGS) endif - + ifeq ($(suffix $(1)),.bc) compiler := $(CC) flags := $(ALL_CFLAGS) $(CFLAGS) endif - + ifeq ($(suffix $(1)),.ll) compiler := $(CC) flags := $(ALL_CFLAGS) $(CFLAGS) -Wno-override-module diff --git a/src/libponyc/codegen/codegen.c b/src/libponyc/codegen/codegen.c index 51c89b6cfd..5c5d7df34f 100644 --- a/src/libponyc/codegen/codegen.c +++ b/src/libponyc/codegen/codegen.c @@ -688,7 +688,7 @@ static bool init_module(compile_t* c, ast_t* program, pass_opt_t* opt, bool jit) strlen(filename), dirname, strlen(dirname)); c->di_unit = LLVMDIBuilderCreateCompileUnit(c->di, LLVMDWARFSourceLanguageC_plus_plus, fileRef, version, strlen(version), - opt->release, "", 0, 0, "", 0, LLVMDWARFEmissionKind::LLVMDWARFEmissionFull, + opt->release, "", 0, 0, "", 0, LLVMDWARFEmissionFull, 0, false, false); #endif @@ -737,8 +737,8 @@ bool codegen_merge_runtime_bitcode(compile_t* c) return true; } -#if defined(PLATFORM_IS_WINDOWS) && PONY_LLVM == 600 -// remove for 6.0.1: https://reviews.llvm.org/D44140 +#if PONY_LLVM == 600 +// TODO: remove for 6.0.1: https://reviews.llvm.org/D44140 extern void LLVMInitializeInstCombine_Pony(LLVMPassRegistryRef R); #define LLVMInitializeInstCombine LLVMInitializeInstCombine_Pony #endif diff --git a/src/libponyc/codegen/genopt.cc b/src/libponyc/codegen/genopt.cc index 2d1a6ab596..6421cda33f 100644 --- a/src/libponyc/codegen/genopt.cc +++ b/src/libponyc/codegen/genopt.cc @@ -91,11 +91,13 @@ static void print_transform(compile_t* c, Instruction* i, const char* s) } } -// remove for 6.0.1: https://reviews.llvm.org/D44140 -#if defined(PLATFORM_IS_WINDOWS) && PONY_LLVM == 600 +// TODO: remove for 6.0.1: https://reviews.llvm.org/D44140 +#if PONY_LLVM == 600 +PONY_EXTERN_C_BEGIN void LLVMInitializeInstCombine_Pony(LLVMPassRegistryRef R) { initializeInstructionCombiningPassPass(*unwrap(R)); } +PONY_EXTERN_C_END #endif class HeapToStack : public FunctionPass From 1743778f991836667ea288f55dc59e46f9d68884 Mon Sep 17 00:00:00 2001 From: Gordon Tisher Date: Sun, 11 Mar 2018 14:21:11 -0700 Subject: [PATCH 04/16] Remove heap-to-stack workaround for LLVM 6.0.0 --- src/libponyc/codegen/genopt.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libponyc/codegen/genopt.cc b/src/libponyc/codegen/genopt.cc index 6421cda33f..0d420be1ae 100644 --- a/src/libponyc/codegen/genopt.cc +++ b/src/libponyc/codegen/genopt.cc @@ -319,7 +319,7 @@ class HeapToStack : public FunctionPass // hoisting loads (see #2303, #2061, #1592). // TODO: figure out the real reason LLVM 4 and 5 produce bad code // when hoisting stack allocated loads. -#if PONY_LLVM >= 400 && !defined(_MSC_VER) +#if PONY_LLVM >= 400 && PONY_LLVM < 600 && !defined(_MSC_VER) // fall through #else break; From f925fc7314762bfd5553d0d1024db256b4057c9b Mon Sep 17 00:00:00 2001 From: Gordon Tisher Date: Sun, 11 Mar 2018 14:31:25 -0700 Subject: [PATCH 05/16] CI configuration for Linux and MacOS --- .ci-dockerfiles/llvm-6.0.0/Dockerfile | 18 ++++++++++++++++++ .ci-dockerfiles/llvm-6.0.0/README.md | 21 +++++++++++++++++++++ .circleci/config.yml | 12 ++++++++++++ .travis_script.bash | 18 ++++++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 .ci-dockerfiles/llvm-6.0.0/Dockerfile create mode 100644 .ci-dockerfiles/llvm-6.0.0/README.md diff --git a/.ci-dockerfiles/llvm-6.0.0/Dockerfile b/.ci-dockerfiles/llvm-6.0.0/Dockerfile new file mode 100644 index 0000000000..b10d5f6cd3 --- /dev/null +++ b/.ci-dockerfiles/llvm-6.0.0/Dockerfile @@ -0,0 +1,18 @@ +FROM ubuntu:16.04 + +ENV LLVM_VERSION 6.0.0 + +RUN apt-get update \ + && apt-get install -y \ + apt-transport-https \ + g++ \ + git \ + libncurses5-dev \ + libpcre2-dev \ + libssl-dev \ + make \ + wget \ + xz-utils \ + zlib1g-dev \ + && wget -O - http://llvm.org/releases/${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-16.04.tar.xz \ + | tar xJf - --strip-components 1 -C /usr/local/ clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-16.04 diff --git a/.ci-dockerfiles/llvm-6.0.0/README.md b/.ci-dockerfiles/llvm-6.0.0/README.md new file mode 100644 index 0000000000..bd58a8f569 --- /dev/null +++ b/.ci-dockerfiles/llvm-6.0.0/README.md @@ -0,0 +1,21 @@ +# Build image + +```bash +docker build -t ponylang/ponyc-ci:llvm-6.0.0 . +``` + +# Run image to test + +Will get you a bash shell in the image to try cloning Pony into where you can test a build to make sure everything will work before pushing + +```bash +docker run --name ponyc-ci-llvm-600 --rm -i -t ponylang/ponyc-ci:llvm-6.0.1 bash +``` + +# Push to dockerhub + +You'll need credentials for the ponylang dockerhub account. Talk to @jemc or @seantallen for access + +```bash +docker push ponylang/ponyc-ci:llvm-6.0.0 +``` diff --git a/.circleci/config.yml b/.circleci/config.yml index e254353086..983f219431 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,6 +12,18 @@ jobs: steps: - checkout - run: find . -name '*.bash' -exec shellcheck {} \; + llvm-600-debug: + docker: + - image: ponylang/ponyc-ci:llvm-600 + steps: + - checkout + - run: make test-ci config=debug default_pic=true + llvm-600-release: + docker: + - image: ponylang/ponyc-ci:llvm-600 + steps: + - checkout + - run: make test-ci config=release default_pic=true llvm-501-debug: docker: - image: ponylang/ponyc-ci:llvm-5.0.1 diff --git a/.travis_script.bash b/.travis_script.bash index 1b35672b6c..31eaf37a0f 100644 --- a/.travis_script.bash +++ b/.travis_script.bash @@ -84,6 +84,24 @@ case "${TRAVIS_OS_NAME}" in make clean brew uninstall llvm@5 + + # 6.0.x + brew install llvm@6 + brew link --overwrite --force llvm@6 + ln -fs "$(which llvm-config)" llvmsym/llvm-config-6.0 + ln -fs "$(which clang++)" llvmsym/clang++-6.0 + + export CC1=clang-6.0 + export CXX1=clang++-6.0 + #echo "Running LLVM 5.0 config=debug build..." + #export config=debug + #ponyc-test + echo "Running LLVM 6.0 config=release build..." + export config=release + ponyc-test + + make clean + brew uninstall llvm@6 fi ;; From 730575d7c28bc964ccda6b85404f9ebc0d43369c Mon Sep 17 00:00:00 2001 From: Sean T Allen Date: Sun, 11 Mar 2018 18:47:39 -0400 Subject: [PATCH 06/16] Fix LLVM 6 install for OSX --- .travis_script.bash | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/.travis_script.bash b/.travis_script.bash index 31eaf37a0f..f8d817a98c 100644 --- a/.travis_script.bash +++ b/.travis_script.bash @@ -49,24 +49,6 @@ case "${TRAVIS_OS_NAME}" in make clean brew uninstall llvm@3.9 - # 4.0.x - brew install llvm@4 - brew link --overwrite --force llvm@4 - ln -fs "$(which llvm-config)" llvmsym/llvm-config-4.0 - ln -fs "$(which clang++)" llvmsym/clang++-4.0 - - export CC1=clang-4.0 - export CXX1=clang++-4.0 - #echo "Running LLVM 4.0 config=debug build..." - #export config=debug - #ponyc-test - echo "Running LLVM 4.0 config=release build..." - export config=release - ponyc-test - - make clean - brew uninstall llvm@4 - # 5.0.x brew install llvm@5 brew link --overwrite --force llvm@5 @@ -75,9 +57,6 @@ case "${TRAVIS_OS_NAME}" in export CC1=clang-5.0 export CXX1=clang++-5.0 - #echo "Running LLVM 5.0 config=debug build..." - #export config=debug - #ponyc-test echo "Running LLVM 5.0 config=release build..." export config=release ponyc-test @@ -86,22 +65,23 @@ case "${TRAVIS_OS_NAME}" in brew uninstall llvm@5 # 6.0.x - brew install llvm@6 - brew link --overwrite --force llvm@6 + # There is no llvm@6 package right now, so this will break once LLVM 7 + # is released. Hopefully when they do that there will be a llvm@6 package + # at which point both `brew install llvm` and `brew uninstall llvm` + # should be updated to replace `llvm` with `llvm@6` + brew install llvm + brew link --overwrite --force llvm ln -fs "$(which llvm-config)" llvmsym/llvm-config-6.0 ln -fs "$(which clang++)" llvmsym/clang++-6.0 export CC1=clang-6.0 export CXX1=clang++-6.0 - #echo "Running LLVM 5.0 config=debug build..." - #export config=debug - #ponyc-test echo "Running LLVM 6.0 config=release build..." export config=release ponyc-test make clean - brew uninstall llvm@6 + brew uninstall llvm fi ;; From 70beb0d91493e8975098b6769f6180391cebfcf7 Mon Sep 17 00:00:00 2001 From: Gordon Tisher Date: Mon, 12 Mar 2018 11:29:05 -0700 Subject: [PATCH 07/16] Fix Windows build --- src/libponyc/codegen/codegen.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libponyc/codegen/codegen.c b/src/libponyc/codegen/codegen.c index 5c5d7df34f..9858f0c189 100644 --- a/src/libponyc/codegen/codegen.c +++ b/src/libponyc/codegen/codegen.c @@ -739,7 +739,9 @@ bool codegen_merge_runtime_bitcode(compile_t* c) #if PONY_LLVM == 600 // TODO: remove for 6.0.1: https://reviews.llvm.org/D44140 +PONY_EXTERN_C_BEGIN extern void LLVMInitializeInstCombine_Pony(LLVMPassRegistryRef R); +PONY_EXTERN_C_END #define LLVMInitializeInstCombine LLVMInitializeInstCombine_Pony #endif From 97beea7c35cf989201a8a2a50ba4c08452859b74 Mon Sep 17 00:00:00 2001 From: Gordon Tisher Date: Sat, 17 Mar 2018 11:43:07 -0700 Subject: [PATCH 08/16] Update docker configuration for LLVM 6 container. --- .ci-dockerfiles/llvm-6.0.0/Dockerfile | 22 +++++++++++++++++----- .ci-dockerfiles/llvm-6.0.0/README.md | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.ci-dockerfiles/llvm-6.0.0/Dockerfile b/.ci-dockerfiles/llvm-6.0.0/Dockerfile index b10d5f6cd3..90f036457f 100644 --- a/.ci-dockerfiles/llvm-6.0.0/Dockerfile +++ b/.ci-dockerfiles/llvm-6.0.0/Dockerfile @@ -1,18 +1,30 @@ -FROM ubuntu:16.04 +FROM ubuntu:14.04 ENV LLVM_VERSION 6.0.0 RUN apt-get update \ + && apt-get install -y software-properties-common \ + && add-apt-repository -y ppa:ubuntu-toolchain-r/test \ + && apt-get update \ && apt-get install -y \ apt-transport-https \ - g++ \ + build-essential \ + g++-6 \ git \ libncurses5-dev \ - libpcre2-dev \ libssl-dev \ make \ wget \ xz-utils \ zlib1g-dev \ - && wget -O - http://llvm.org/releases/${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-16.04.tar.xz \ - | tar xJf - --strip-components 1 -C /usr/local/ clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-16.04 + && wget -O - http://llvm.org/releases/${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz \ + | tar xJf - --strip-components 1 -C /usr/local/ clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04 + +# install pcre2 +RUN wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-10.21.tar.bz2 \ + && tar xvf pcre2-10.21.tar.bz2 \ + && cd pcre2-10.21 \ + && ./configure --prefix=/usr \ + && make install \ + && cd .. \ + && rm -rf pcre2-10.21* diff --git a/.ci-dockerfiles/llvm-6.0.0/README.md b/.ci-dockerfiles/llvm-6.0.0/README.md index bd58a8f569..7169658023 100644 --- a/.ci-dockerfiles/llvm-6.0.0/README.md +++ b/.ci-dockerfiles/llvm-6.0.0/README.md @@ -9,7 +9,7 @@ docker build -t ponylang/ponyc-ci:llvm-6.0.0 . Will get you a bash shell in the image to try cloning Pony into where you can test a build to make sure everything will work before pushing ```bash -docker run --name ponyc-ci-llvm-600 --rm -i -t ponylang/ponyc-ci:llvm-6.0.1 bash +docker run --name ponyc-ci-llvm-600 --rm -i -t ponylang/ponyc-ci:llvm-6.0.0 bash ``` # Push to dockerhub From 59175ea97884f242ca1e490fe4fffb64709d5480 Mon Sep 17 00:00:00 2001 From: Gordon Tisher Date: Sat, 17 Mar 2018 12:44:38 -0700 Subject: [PATCH 09/16] Add LLVM 6 to CircleCI config. --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 983f219431..459eabeb8f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -73,6 +73,8 @@ workflows: jobs: - verify-changelog - validate-shell-scripts + - llvm-600-debug + - llvm-600-release - llvm-501-debug - llvm-501-release - llvm-401-debug From 5fb8c55d5c48b063c22817a8909a8f631e68de47 Mon Sep 17 00:00:00 2001 From: Gordon Tisher Date: Sat, 17 Mar 2018 12:45:10 -0700 Subject: [PATCH 10/16] Add back Heap2Stack workaround for the time being. --- src/libponyc/codegen/genopt.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libponyc/codegen/genopt.cc b/src/libponyc/codegen/genopt.cc index 0d420be1ae..6421cda33f 100644 --- a/src/libponyc/codegen/genopt.cc +++ b/src/libponyc/codegen/genopt.cc @@ -319,7 +319,7 @@ class HeapToStack : public FunctionPass // hoisting loads (see #2303, #2061, #1592). // TODO: figure out the real reason LLVM 4 and 5 produce bad code // when hoisting stack allocated loads. -#if PONY_LLVM >= 400 && PONY_LLVM < 600 && !defined(_MSC_VER) +#if PONY_LLVM >= 400 && !defined(_MSC_VER) // fall through #else break; From 82f2fd6b63430e044d8cdc8595850cb9c7debca2 Mon Sep 17 00:00:00 2001 From: Gordon Tisher Date: Wed, 21 Mar 2018 13:06:24 -0700 Subject: [PATCH 11/16] Fix typos in CircleCI config. --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 459eabeb8f..477920ab6f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,13 +14,13 @@ jobs: - run: find . -name '*.bash' -exec shellcheck {} \; llvm-600-debug: docker: - - image: ponylang/ponyc-ci:llvm-600 + - image: ponylang/ponyc-ci:llvm-6.0.0 steps: - checkout - run: make test-ci config=debug default_pic=true llvm-600-release: docker: - - image: ponylang/ponyc-ci:llvm-600 + - image: ponylang/ponyc-ci:llvm-6.0.0 steps: - checkout - run: make test-ci config=release default_pic=true From 0e22fd0396b0f174e1beb45d266d2028b5ea7e7e Mon Sep 17 00:00:00 2001 From: Gordon Tisher Date: Wed, 4 Apr 2018 16:05:57 -0700 Subject: [PATCH 12/16] Update for rebase --- src/libponyc/codegen/host.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libponyc/codegen/host.cc b/src/libponyc/codegen/host.cc index 34496f60eb..e6af24ab39 100644 --- a/src/libponyc/codegen/host.cc +++ b/src/libponyc/codegen/host.cc @@ -39,8 +39,6 @@ LLVMTargetMachineRef codegen_machine(LLVMTargetRef target, pass_opt_t* opt, if(opt->pic || opt->library) reloc = Reloc::PIC_; - CodeModel::Model model = jit ? CodeModel::JITDefault : CodeModel::Default; - CodeGenOpt::Level opt_level = opt->release ? CodeGenOpt::Aggressive : CodeGenOpt::None; @@ -49,8 +47,15 @@ LLVMTargetMachineRef codegen_machine(LLVMTargetRef target, pass_opt_t* opt, Target* t = reinterpret_cast(target); +#if PONY_LLVM < 600 + CodeModel::Model model = jit ? CodeModel::JITDefault : CodeModel::Default; TargetMachine* m = t->createTargetMachine(opt->triple, opt->cpu, opt->features, options, reloc, model, opt_level); +#else + CodeModel::Model model = jit ? CodeModel::Large : CodeModel::Small; + TargetMachine* m = t->createTargetMachine(opt->triple, opt->cpu, + opt->features, options, reloc, model, opt_level, jit); +#endif return reinterpret_cast(m); } From 05e4a1e64b11e5db219fd9c6c044e8e5cb6c4d7c Mon Sep 17 00:00:00 2001 From: Gordon Tisher Date: Wed, 4 Apr 2018 16:06:13 -0700 Subject: [PATCH 13/16] Add build system warning for LLVM 6 --- Makefile | 5 +++-- wscript | 7 +++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index ef75c392b6..95adaab3c7 100644 --- a/Makefile +++ b/Makefile @@ -256,14 +256,15 @@ ifeq ($(OSTYPE),osx) endif endif -ifeq ($(llvm_version),6.0.0) -else ifeq ($(llvm_version),3.9.1) +ifeq ($(llvm_version),3.9.1) else ifeq ($(llvm_version),4.0.1) $(warning WARNING: LLVM 4 support is experimental and may result in decreased performance or crashes) else ifeq ($(llvm_version),5.0.0) $(warning WARNING: LLVM 5 support is experimental and may result in decreased performance or crashes) else ifeq ($(llvm_version),5.0.1) $(warning WARNING: LLVM 5 support is experimental and may result in decreased performance or crashes) +else ifeq ($(llvm_version),6.0.0) + $(warning WARNING: LLVM 6 support is experimental and may result in decreased performance or crashes) else $(warning WARNING: Unsupported LLVM version: $(llvm_version)) $(warning Please use LLVM 3.9.1) diff --git a/wscript b/wscript index f1302ad84a..6336ef0790 100644 --- a/wscript +++ b/wscript @@ -50,9 +50,8 @@ MSVC_VERSIONS = [ '15.6', '15.4', '15.0', '14.0' ] # keep these in sync with the list in .appveyor.yml LLVM_VERSIONS = [ '3.9.1', - '4.0.1', '5.0.1', - '6.0.0' + '6.0.0' ] WINDOWS_LIBS_TAG = "v1.7.0" @@ -260,8 +259,8 @@ def build(ctx): # build targets: - if ctx.options.llvm.startswith('4') or ctx.options.llvm.startswith('5'): - print('WARNING: LLVM 4 and 5 support is experimental and may result in decreased performance or crashes') + if ctx.options.llvm.startswith('4') or ctx.options.llvm.startswith('5') or ctx.options.llvm.startswith('6'): + print('WARNING: LLVM 4, 5 and 6 support is experimental and may result in decreased performance or crashes') # gtest ctx( From bc4e98d76e635a9775dc9ca0a9c2916db650ac71 Mon Sep 17 00:00:00 2001 From: Gordon Tisher Date: Wed, 4 Apr 2018 16:07:10 -0700 Subject: [PATCH 14/16] Update Dockerfile with changes from @jemc --- .ci-dockerfiles/llvm-6.0.0/Dockerfile | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/.ci-dockerfiles/llvm-6.0.0/Dockerfile b/.ci-dockerfiles/llvm-6.0.0/Dockerfile index 90f036457f..07c0b42c44 100644 --- a/.ci-dockerfiles/llvm-6.0.0/Dockerfile +++ b/.ci-dockerfiles/llvm-6.0.0/Dockerfile @@ -3,13 +3,10 @@ FROM ubuntu:14.04 ENV LLVM_VERSION 6.0.0 RUN apt-get update \ - && apt-get install -y software-properties-common \ - && add-apt-repository -y ppa:ubuntu-toolchain-r/test \ - && apt-get update \ && apt-get install -y \ apt-transport-https \ build-essential \ - g++-6 \ + g++ \ git \ libncurses5-dev \ libssl-dev \ @@ -17,14 +14,14 @@ RUN apt-get update \ wget \ xz-utils \ zlib1g-dev \ - && wget -O - http://llvm.org/releases/${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz \ - | tar xJf - --strip-components 1 -C /usr/local/ clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04 - -# install pcre2 -RUN wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-10.21.tar.bz2 \ - && tar xvf pcre2-10.21.tar.bz2 \ + && cd /tmp \ + && wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-10.21.tar.bz2 \ + && tar xjvf pcre2-10.21.tar.bz2 \ && cd pcre2-10.21 \ && ./configure --prefix=/usr \ - && make install \ - && cd .. \ - && rm -rf pcre2-10.21* + && make \ + && sudo make install \ + && cd / \ + && rm -rf /tmp/pcre* \ + && wget -O - http://releases.llvm.org/${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz \ + | tar xJf - --no-same-owner --strip-components 1 -C /usr/local/ clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04 From a6ae93a92d43dda27419081c3f001573c7f08a7f Mon Sep 17 00:00:00 2001 From: Gordon Tisher Date: Thu, 5 Apr 2018 08:15:15 -0700 Subject: [PATCH 15/16] Update per @Praetonus's comment. --- src/libponyc/codegen/host.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libponyc/codegen/host.cc b/src/libponyc/codegen/host.cc index e6af24ab39..a1ea54de99 100644 --- a/src/libponyc/codegen/host.cc +++ b/src/libponyc/codegen/host.cc @@ -52,9 +52,8 @@ LLVMTargetMachineRef codegen_machine(LLVMTargetRef target, pass_opt_t* opt, TargetMachine* m = t->createTargetMachine(opt->triple, opt->cpu, opt->features, options, reloc, model, opt_level); #else - CodeModel::Model model = jit ? CodeModel::Large : CodeModel::Small; - TargetMachine* m = t->createTargetMachine(opt->triple, opt->cpu, - opt->features, options, reloc, model, opt_level, jit); +TargetMachine* m = t->createTargetMachine(opt->triple, opt->cpu, + opt->features, options, reloc, llvm::None, opt_level, jit); #endif return reinterpret_cast(m); From 7a4bd1dc1e86eafa384a3b45e42a80319b1d5a4e Mon Sep 17 00:00:00 2001 From: Gordon Tisher Date: Thu, 5 Apr 2018 11:21:29 -0700 Subject: [PATCH 16/16] Remove LLVM 4 from AppVeyor config --- .appveyor.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index c6b2020421..db414739f6 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -10,7 +10,6 @@ branches: environment: matrix: - llvm: 3.9.1 - - llvm: 4.0.1 - llvm: 5.0.1 - llvm: 6.0.0