From 73fd9371ebe9e2c6feadbff52fca1c7b4b931e34 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Sun, 28 Aug 2022 16:51:33 +0200 Subject: [PATCH] Exclude LLVM 12 from new optimizer. --- src/compiler/llvm_codegen.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/compiler/llvm_codegen.c b/src/compiler/llvm_codegen.c index 9aa8e2fab..715426adc 100644 --- a/src/compiler/llvm_codegen.c +++ b/src/compiler/llvm_codegen.c @@ -2,8 +2,10 @@ // Use of this source code is governed by the GNU LGPLv3.0 license // a copy of which can be found in the LICENSE file. -#include #include "llvm_codegen_internal.h" + +#if LLVM_VERSION_MAJOR > 12 +#include typedef struct LLVMOpaquePassBuilderOptions *LLVMPassBuilderOptionsRef; LLVMErrorRef LLVMRunPasses(LLVMModuleRef M, const char *Passes, LLVMTargetMachineRef TM, @@ -12,6 +14,7 @@ LLVMPassBuilderOptionsRef LLVMCreatePassBuilderOptions(void); void LLVMPassBuilderOptionsSetVerifyEach(LLVMPassBuilderOptionsRef Options, LLVMBool VerifyEach); void LLVMPassBuilderOptionsSetDebugLogging(LLVMPassBuilderOptionsRef Options, LLVMBool DebugLogging); void LLVMDisposePassBuilderOptions(LLVMPassBuilderOptionsRef Options); +#endif const char* llvm_version = LLVM_VERSION_STRING; const char* llvm_target = LLVM_DEFAULT_TARGET_TRIPLE; @@ -847,7 +850,7 @@ static inline void llvm_opt_old(GenContext *c) LLVMRunPassManager(pass_manager, c->module); LLVMDisposePassManager(pass_manager); } - +#if LLVM_VERSION_MAJOR > 12 static inline void llvm_opt_new(GenContext *c) { LLVMPassBuilderOptionsRef options = LLVMCreatePassBuilderOptions(); @@ -887,14 +890,17 @@ static inline void llvm_opt_new(GenContext *c) } LLVMDisposePassBuilderOptions(options); } +#endif const char *llvm_codegen(void *context) { GenContext *c = context; +#if LLVM_VERSION_MAJOR > 12 if (active_target.use_new_optimizer) { llvm_opt_new(c); } else +#endif { llvm_opt_old(c); }