pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/cad/ghdl
Module Name: pkgsrc
Committed By: ryoon
Date: Tue Jan 2 00:42:03 UTC 2024
Modified Files:
pkgsrc/cad/ghdl: Makefile distinfo
pkgsrc/cad/ghdl/patches: patch-configure
Added Files:
pkgsrc/cad/ghdl/patches: patch-src_ortho_llvm6_llvm-cbindings.cpp
Log Message:
ghdl: Fix build with LLVM 16
To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 pkgsrc/cad/ghdl/Makefile
cvs rdiff -u -r1.9 -r1.10 pkgsrc/cad/ghdl/distinfo
cvs rdiff -u -r1.3 -r1.4 pkgsrc/cad/ghdl/patches/patch-configure
cvs rdiff -u -r0 -r1.3 \
pkgsrc/cad/ghdl/patches/patch-src_ortho_llvm6_llvm-cbindings.cpp
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/cad/ghdl/Makefile
diff -u pkgsrc/cad/ghdl/Makefile:1.16 pkgsrc/cad/ghdl/Makefile:1.17
--- pkgsrc/cad/ghdl/Makefile:1.16 Mon Dec 25 10:23:25 2023
+++ pkgsrc/cad/ghdl/Makefile Tue Jan 2 00:42:03 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.16 2023/12/25 10:23:25 wiz Exp $
+# $NetBSD: Makefile,v 1.17 2024/01/02 00:42:03 ryoon Exp $
DISTNAME= ghdl-3.0.0
PKGREVISION= 1
@@ -12,7 +12,7 @@ HOMEPAGE= https://ghdl.github.io/ghdl/
COMMENT= Open-source simulator/compiler/analyzer for the VHDL
LICENSE= gnu-gpl-v2
-BROKEN= "Does not support llvm 16."
+#BROKEN= "Does not support llvm 16."
USE_TOOLS+= bash:run gmake
Index: pkgsrc/cad/ghdl/distinfo
diff -u pkgsrc/cad/ghdl/distinfo:1.9 pkgsrc/cad/ghdl/distinfo:1.10
--- pkgsrc/cad/ghdl/distinfo:1.9 Sun Jun 11 03:35:39 2023
+++ pkgsrc/cad/ghdl/distinfo Tue Jan 2 00:42:03 2024
@@ -1,7 +1,8 @@
-$NetBSD: distinfo,v 1.9 2023/06/11 03:35:39 mef Exp $
+$NetBSD: distinfo,v 1.10 2024/01/02 00:42:03 ryoon Exp $
BLAKE2s (ghdl-3.0.0.tar.gz) = 3dfcd821e81a470eb1f5b9e42ff69cf56634af8edf531f90ac9839c0c85aa7a6
SHA512 (ghdl-3.0.0.tar.gz) = 11b638d0ae757ce2e247ab438c15a8f5cd78c3a025ba6272aa05df548d2a7276c25dbbf83b846284ded8c9864eca3dcdb8342cb532faecd01e7cefaada524ab0
Size (ghdl-3.0.0.tar.gz) = 7160245 bytes
-SHA1 (patch-configure) = 2a3450627786c2e4f31c045263b6e0a056fab347
+SHA1 (patch-configure) = a6f8f11f5d636d5838461c7b88fc3830891433dd
+SHA1 (patch-src_ortho_llvm6_llvm-cbindings.cpp) = 70de26f55e16c010264236dc1f8e14c3e92f7df9
SHA1 (patch-src_ortho_mcode_memsegs__c.c) = 5669dda0130ade50caf7538c3f2c6cfed061ac5b
Index: pkgsrc/cad/ghdl/patches/patch-configure
diff -u pkgsrc/cad/ghdl/patches/patch-configure:1.3 pkgsrc/cad/ghdl/patches/patch-configure:1.4
--- pkgsrc/cad/ghdl/patches/patch-configure:1.3 Sun Jun 11 03:35:39 2023
+++ pkgsrc/cad/ghdl/patches/patch-configure Tue Jan 2 00:42:03 2024
@@ -1,10 +1,19 @@
-$NetBSD: patch-configure,v 1.3 2023/06/11 03:35:39 mef Exp $
+$NetBSD: patch-configure,v 1.4 2024/01/02 00:42:03 ryoon Exp $
* Support NetBSD for mcode backend. (not used)
+* Support LLVM 16 too.
---- configure.orig 2023-03-08 15:40:01.000000000 +0900
-+++ configure 2023-06-11 12:10:38.287600340 +0900
-@@ -429,6 +429,7 @@ if test $backend = mcode; then
+--- configure.orig 2023-03-08 06:40:01.000000000 +0000
++++ configure
+@@ -315,6 +315,7 @@ if test $backend = llvm; then
+ check_version 13.0 $llvm_version ||
+ check_version 14.0 $llvm_version ||
+ check_version 15.0 $llvm_version ||
++ check_version 16.0 $llvm_version ||
+ false; then
+ echo "Debugging is enabled with llvm $llvm_version"
+ else
+@@ -429,6 +430,7 @@ if test $backend = mcode; then
*mingw32*) ortho_flags="Flags_Windows${mcode64}" ;;
*linux*) ortho_flags="Flags_Linux${mcode64}" ;;
*openbsd*) ortho_flags="Flags_Macosx${mcode64}" ;;
Added files:
Index: pkgsrc/cad/ghdl/patches/patch-src_ortho_llvm6_llvm-cbindings.cpp
diff -u /dev/null pkgsrc/cad/ghdl/patches/patch-src_ortho_llvm6_llvm-cbindings.cpp:1.3
--- /dev/null Tue Jan 2 00:42:03 2024
+++ pkgsrc/cad/ghdl/patches/patch-src_ortho_llvm6_llvm-cbindings.cpp Tue Jan 2 00:42:03 2024
@@ -0,0 +1,157 @@
+$NetBSD: patch-src_ortho_llvm6_llvm-cbindings.cpp,v 1.3 2024/01/02 00:42:03 ryoon Exp $
+
+* Support LLVM 16
+ https://github.com/ghdl/ghdl/commit/776731910064cb6df03be19d788f7f13b2f7d2f1
+* Support LLVM 17
+ https://github.com/ghdl/ghdl/commit/36a2e24f85aa3174d37b3a121632ac0b28bf990a
+
+--- src/ortho/llvm6/llvm-cbindings.cpp.orig 2023-03-08 06:40:01.000000000 +0000
++++ src/ortho/llvm6/llvm-cbindings.cpp
+@@ -31,10 +31,18 @@
+ #include "llvm-c/BitWriter.h"
+
+ #include "llvm-c/Analysis.h"
+-#include "llvm-c/Transforms/Scalar.h"
+-#if LLVM_VERSION_MAJOR >= 7
++
++#if LLVM_VERSION_MAJOR < 17
++# include "llvm-c/Transforms/Scalar.h"
++# if LLVM_VERSION_MAJOR >= 7
+ // Not present in llvm-6, present in llvm-7
+-#include "llvm-c/Transforms/Utils.h"
++# include "llvm-c/Transforms/Utils.h"
++# endif
++#else
++# include "llvm/Passes/OptimizationLevel.h"
++# include "llvm/Analysis/LoopAnalysisManager.h"
++# include "llvm/Analysis/CGSCCPassManager.h"
++# include "llvm/Passes/PassBuilder.h"
+ #endif
+
+ #if LLVM_VERSION_MAJOR >= 6
+@@ -77,7 +85,11 @@ static LLVMTargetRef TheTarget;
+ static LLVMTargetMachineRef TheTargetMachine;
+ static LLVMTargetDataRef TheTargetData;
+ static LLVMRelocMode TheReloc = LLVMRelocDefault;
+-static LLVMCodeGenOptLevel Optimization = LLVMCodeGenLevelDefault;
++static LLVMCodeGenOptLevel OptimizationCGLev = LLVMCodeGenLevelDefault;
++
++#if LLVM_VERSION_MAJOR >= 17
++static OptimizationLevel OptimizationLev = OptimizationLevel::O0;
++#endif
+
+ static LLVMBuilderRef Builder;
+ static LLVMBuilderRef DeclBuilder;
+@@ -118,16 +130,28 @@ set_optimization_level (unsigned level)
+ {
+ switch(level) {
+ case 0:
+- Optimization = LLVMCodeGenLevelNone;
++ OptimizationCGLev = LLVMCodeGenLevelNone;
++#if LLVM_VERSION_MAJOR >= 17
++ OptimizationLev = OptimizationLevel::O0;
++#endif
+ break;
+ case 1:
+- Optimization = LLVMCodeGenLevelLess;
++ OptimizationCGLev = LLVMCodeGenLevelLess;
++#if LLVM_VERSION_MAJOR >= 17
++ OptimizationLev = OptimizationLevel::O1;
++#endif
+ break;
+ case 2:
+- Optimization = LLVMCodeGenLevelDefault;
++ OptimizationCGLev = LLVMCodeGenLevelDefault;
++#if LLVM_VERSION_MAJOR >= 17
++ OptimizationLev = OptimizationLevel::O2;
++#endif
+ break;
+ default:
+- Optimization = LLVMCodeGenLevelAggressive;
++ OptimizationCGLev = LLVMCodeGenLevelAggressive;
++#if LLVM_VERSION_MAJOR >= 17
++ OptimizationLev = OptimizationLevel::O3;
++#endif
+ break;
+ }
+ }
+@@ -201,7 +225,34 @@ generateCommon()
+ }
+ }
+
+- if (Optimization > LLVMCodeGenLevelNone) {
++#if LLVM_VERSION_MAJOR >= 17
++ // Create the analysis managers.
++ LoopAnalysisManager LAM;
++ FunctionAnalysisManager FAM;
++ CGSCCAnalysisManager CGAM;
++ ModuleAnalysisManager MAM;
++
++ // Create the new pass manager builder.
++ // Take a look at the PassBuilder constructor parameters for more
++ // customization, e.g. specifying a TargetMachine or various debugging
++ // options.
++ PassBuilder PB;
++
++ // Register all the basic analyses with the managers.
++ PB.registerModuleAnalyses(MAM);
++ PB.registerCGSCCAnalyses(CGAM);
++ PB.registerFunctionAnalyses(FAM);
++ PB.registerLoopAnalyses(LAM);
++ PB.crossRegisterProxies(LAM, FAM, CGAM, MAM);
++
++ // Create the pass manager.
++ // This one corresponds to a typical -O2 optimization pipeline.
++ ModulePassManager MPM = PB.buildPerModuleDefaultPipeline(OptimizationLev);
++
++ // Optimize the IR!
++ MPM.run(*unwrap(TheModule), MAM);
++#else
++ if (OptimizationCGLev > LLVMCodeGenLevelNone) {
+ LLVMPassManagerRef PassManager;
+ PassManager = LLVMCreateFunctionPassManagerForModule (TheModule);
+
+@@ -214,7 +265,9 @@ generateCommon()
+ LLVMRunFunctionPassManager (PassManager, Func);
+ }
+ }
++#endif
+ }
++
+ extern "C" void
+ generate_object(char *Filename)
+ {
+@@ -292,7 +345,7 @@ ortho_llvm_init(const char *Filename, un
+
+ // Create a target machine
+ TheTargetMachine = LLVMCreateTargetMachine
+- (TheTarget, Triple, "", "", Optimization, TheReloc,
++ (TheTarget, Triple, "", "", OptimizationCGLev, TheReloc,
+ LLVMCodeModelDefault);
+
+ #if LLVM_VERSION_MAJOR < 4
+@@ -353,7 +406,7 @@ ortho_llvm_init(const char *Filename, un
+ StringRef(*DebugCurrentDirectory));
+ DebugCurrentCU = DBuilder->createCompileUnit
+ (llvm::dwarf::DW_LANG_C, DebugCurrentFile, StringRef("ortho-llvm"),
+- Optimization > LLVMCodeGenLevelNone, StringRef(), 0);
++ OptimizationCGLev > LLVMCodeGenLevelNone, StringRef(), 0);
+
+ DebugCurrentScope = DebugCurrentCU;
+ }
+@@ -1040,8 +1093,13 @@ new_type_decl(OIdent Ident, OTnode Atype
+ OTnode Ptr = static_cast<OTnodeAccBase*>(Atype)->Acc;
+ // Possibly still incomplete
+ Atype->Dbg = DBuilder->createPointerType
+- (Ptr ? Ptr->Dbg : nullptr,
+- Atype->getBitSize(), 0, None, StringRef(Ident.cstr));
++ (Ptr ? Ptr->Dbg : nullptr, Atype->getBitSize(), 0,
++#if LLVM_VERSION_MAJOR >= 16
++ std::nullopt,
++#else
++ None,
++#endif
++ StringRef(Ident.cstr));
+ break;
+ }
+
Home |
Main Index |
Thread Index |
Old Index