Remove support for LLVM 17 and 18. Update to 0.7.11

This commit is contained in:
Christoffer Lerno
2026-02-26 22:15:34 +01:00
parent 1a3cdc01ec
commit 54ddc9a81c
9 changed files with 20 additions and 38 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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");

View File

@@ -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)

View File

@@ -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 };

View File

@@ -1,2 +1,2 @@
#define COMPILER_VERSION "0.7.10"
#define PRERELEASE 0
#define COMPILER_VERSION "0.7.11"
#define PRERELEASE 1

View File

@@ -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<const char *> 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;