diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 250ae14bf..e13bf19d0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -401,7 +401,7 @@ jobs: strategy: fail-fast: false matrix: - llvm_version: [17, 18, 19, 20] + llvm_version: [19, 20] steps: - uses: actions/checkout@v6 diff --git a/CMakeLists.txt b/CMakeLists.txt index 93e2dbfec..1a90e463c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20) -set(C3_LLVM_MIN_VERSION 17) +set(C3_LLVM_MIN_VERSION 19) set(C3_LLVM_MAX_VERSION 22) set(C3_LLVM_DEFAULT_VERSION 21) diff --git a/README.md b/README.md index e87c1bdfc..8c6cb84b2 100644 --- a/README.md +++ b/README.md @@ -366,7 +366,7 @@ See the `build-with-docker.sh` script for more information on other configurable #### Installing on OS X using Homebrew 1. Install [Homebrew](https://brew.sh/) -2. Install LLVM 17+: `brew install llvm` +2. Install LLVM 19+: `brew install llvm` 3. Install lld: `brew install lld` 4. Install CMake: `brew install cmake` 5. Clone the C3C github repository: `git clone https://github.com/c3lang/c3c.git` @@ -505,7 +505,7 @@ After compilation, the `c3c` binary will be located in the `build` directory. Yo #### Compiling on other Linux / Unix variants 1. Install CMake. -2. Install or compile LLVM and LLD *libraries* (version 17+ or higher) +2. Install or compile LLVM and LLD *libraries* (version 19+ or higher) 3. Clone the C3C github repository: `git clone https://github.com/c3lang/c3c.git` 4. Enter the C3C directory `cd c3c`. 5. Set up CMake build for debug: `cmake -B build -S .`. At this point you may need to manually diff --git a/releasenotes.md b/releasenotes.md index 42922a308..4a405a64a 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -1,5 +1,16 @@ # C3C Release Notes +## 0.7.11 Change list + +### Changes / improvements +- Removed support for LLVM 17, 18. + +### Stdlib changes +None + +### Fixes +None + ## 0.7.10 Change list ### Changes / improvements diff --git a/src/compiler/llvm_codegen.c b/src/compiler/llvm_codegen.c index a8a3246f2..12c64c5cd 100644 --- a/src/compiler/llvm_codegen.c +++ b/src/compiler/llvm_codegen.c @@ -835,11 +835,7 @@ static void llvm_codegen_setup() intrinsic_id.fshl = lookup_intrinsic("llvm.fshl"); intrinsic_id.fshr = lookup_intrinsic("llvm.fshr"); intrinsic_id.gather = lookup_intrinsic("llvm.masked.gather"); -#if LLVM_VERSION_MAJOR < 16 - intrinsic_id.get_rounding = lookup_intrinsic("llvm.flt.rounds"); -#else intrinsic_id.get_rounding = lookup_intrinsic("llvm.get.rounding"); -#endif intrinsic_id.lifetime_end = lookup_intrinsic("llvm.lifetime.end"); intrinsic_id.lifetime_start = lookup_intrinsic("llvm.lifetime.start"); intrinsic_id.llrint = lookup_intrinsic("llvm.llrint"); diff --git a/src/compiler/llvm_codegen_debug_info.c b/src/compiler/llvm_codegen_debug_info.c index 4aab52e88..50ed44ca5 100644 --- a/src/compiler/llvm_codegen_debug_info.c +++ b/src/compiler/llvm_codegen_debug_info.c @@ -113,35 +113,20 @@ void llvm_emit_debug_function(GenContext *c, Decl *decl) static void llvm_emit_debug_value(GenContext *c, LLVMValueRef value, LLVMMetadataRef debug_val, unsigned row, unsigned col, LLVMMetadataRef scope) { -#if LLVM_VERSION_MAJOR < 19 - LLVMDIBuilderInsertDbgValueAtEnd(c->debug.builder, value, debug_val, - LLVMDIBuilderCreateExpression(c->debug.builder, NULL, 0), - llvm_create_debug_location_with_inline(c, row, col, c->debug.function), - LLVMGetInsertBlock(c->builder)); -#else LLVMDIBuilderInsertDbgValueRecordAtEnd(c->debug.builder, value, debug_val, LLVMDIBuilderCreateExpression(c->debug.builder, NULL, 0), llvm_create_debug_location_with_inline(c, row, col, c->debug.function), LLVMGetInsertBlock(c->builder)); -#endif } static void llvm_emit_debug_declare(GenContext *c, LLVMValueRef var, LLVMMetadataRef debug_var, unsigned row, unsigned col, LLVMMetadataRef scope) { -#if LLVM_VERSION_MAJOR < 19 - LLVMDIBuilderInsertDeclareAtEnd(c->debug.builder, - var, debug_var, - LLVMDIBuilderCreateExpression(c->debug.builder, NULL, 0), - llvm_create_debug_location_with_inline(c, row, col, scope), - LLVMGetInsertBlock(c->builder)); -#else LLVMDIBuilderInsertDeclareRecordAtEnd(c->debug.builder, var, debug_var, LLVMDIBuilderCreateExpression(c->debug.builder, NULL, 0), llvm_create_debug_location_with_inline(c, row, col, scope), LLVMGetInsertBlock(c->builder)); -#endif } void llvm_emit_debug_local_var(GenContext *c, Decl *decl) diff --git a/src/compiler/target.c b/src/compiler/target.c index 4b46517cd..b454085e8 100644 --- a/src/compiler/target.c +++ b/src/compiler/target.c @@ -1689,11 +1689,6 @@ static AlignData os_target_alignment_of_int(OsType os, ArchType arch, uint32_t b case ARCH_TYPE_XTENSA: return (AlignData) { MIN(64u, bits), MIN(64u, bits) }; case ARCH_TYPE_X86_64: -#if LLVM_AVAILABLE && LLVM_VERSION_MAJOR < 18 - return (AlignData) { MIN(64u, bits), MIN(64u, bits) }; -#else - FALLTHROUGH; -#endif case ARCH_TYPE_RISCV64: return (AlignData) { bits, bits }; case ARCH_TYPE_WASM64: @@ -1709,9 +1704,7 @@ static AlignData os_target_alignment_of_int(OsType os, ArchType arch, uint32_t b return (AlignData) { bits, bits }; case ARCH_TYPE_X86: if (bits <= 32) return (AlignData) { bits, bits }; -#if !LLVM_AVAILABLE || LLVM_VERSION_MAJOR > 17 if (bits == 128) return (AlignData) { 128, 128 }; -#endif if (os == OS_TYPE_ELFIAMCU) return (AlignData) { 32, 32 }; if (os == OS_TYPE_WIN32 || os == OS_TYPE_NACL) return (AlignData) { 64, 64 }; return (AlignData) { 32, 64 }; diff --git a/src/version.h b/src/version.h index 35d182736..2c9065473 100644 --- a/src/version.h +++ b/src/version.h @@ -1,2 +1,2 @@ -#define COMPILER_VERSION "0.7.10" -#define PRERELEASE 0 +#define COMPILER_VERSION "0.7.11" +#define PRERELEASE 1 diff --git a/wrapper/src/wrapper.cpp b/wrapper/src/wrapper.cpp index eedf03aab..00d7e5162 100644 --- a/wrapper/src/wrapper.cpp +++ b/wrapper/src/wrapper.cpp @@ -29,7 +29,7 @@ #include "llvm/Transforms/Scalar/JumpThreading.h" #include "llvm/Transforms/InstCombine/InstCombine.h" #include "llvm/Analysis/GlobalsModRef.h" -static_assert(LLVM_VERSION_MAJOR >= 17, "Unsupported LLVM version, 17+ is needed."); +static_assert(LLVM_VERSION_MAJOR >= 19, "Unsupported LLVM version, 19+ is needed."); #define LINK_SIG \ bool link(llvm::ArrayRef args, llvm::raw_ostream &stdoutOS, \ @@ -96,9 +96,7 @@ static bool llvm_link(ObjFormat format, const char **args, int arg_count, const for (int i = 0; i < arg_count; i++) arg_vector.push_back(strdup(args[i])); std::string output_string {}; std::string output_err_string {}; - /* - llvm::raw_string_ostream output { output_string }; - llvm::raw_string_ostream output_err { output_err_string };*/ + llvm::raw_ostream &output = llvm::outs(); llvm::raw_ostream &output_err = llvm::errs(); bool success; @@ -154,9 +152,8 @@ bool llvm_run_passes(LLVMModuleRef m, LLVMTargetMachineRef tm, LLVMPasses *passe PTO.SLPVectorization = passes->opt.slp_vectorize; PTO.MergeFunctions = passes->opt.merge_functions; PTO.CallGraphProfile = true; // We always use integrated ASM -#if LLVM_VERSION_MAJOR > 16 PTO.UnifiedLTO = false; -#endif + llvm::PassBuilder PB(Machine, PTO, std::nullopt, &PIC); llvm::LoopAnalysisManager LAM;