From e3445e88c5098f990f08968d72e28d5f3e895d5e Mon Sep 17 00:00:00 2001 From: supergrecko Date: Sun, 28 Feb 2021 14:22:37 +0100 Subject: [PATCH] * Upgrade presets for LLVM 11.1.0 (pull #1001) Also add more data retrieval operations for LLVM nodes to `NamedMetadataOperations.h` --- CHANGELOG.md | 2 +- README.md | 2 +- arrow/cppbuild.sh | 2 +- llvm/README.md | 4 +- llvm/cppbuild.sh | 2 +- llvm/platform/pom.xml | 2 +- llvm/pom.xml | 2 +- llvm/samples/clang/pom.xml | 2 +- llvm/samples/llvm/pom.xml | 2 +- llvm/samples/polly/pom.xml | 2 +- .../java/org/bytedeco/llvm/global/LLVM.java | 37 ++++++++++ .../java/org/bytedeco/llvm/global/clang.java | 58 +++++++-------- .../llvm/include/NamedMetadataOperations.h | 74 +++++++++++++++++++ platform/pom.xml | 2 +- tvm/platform/gpu/pom.xml | 2 +- tvm/platform/pom.xml | 2 +- tvm/pom.xml | 4 +- 17 files changed, 156 insertions(+), 45 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16447fa46d2..39373d7ba65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ * Disable assembly optimizations for libx264 with FFmpeg on Mac to work around crashes ([issue bytedeco/javacv#1519](https://github.com/bytedeco/javacv/issues/1519)) * Add `linux-armhf` and `linux-arm64` builds for librealsense and librealsense2 ([pull #951](https://github.com/bytedeco/javacpp-presets/pull/951)) * License default builds of FFmpeg under LGPL v3 and move GPL-enabled builds to `-gpl` extension ([pull #950](https://github.com/bytedeco/javacpp-presets/pull/950)) - * Upgrade presets for OpenCV 4.5.1, FFmpeg 4.3.2, Arrow 3.0.0, Hyperscan 5.4.0, MKL 2021.1, OpenBLAS 0.3.13, ARPACK-NG 3.8.0, CMINPACK 1.3.8, FFTW 3.3.9, librealsense2 2.40.0 ([pull #946](https://github.com/bytedeco/javacpp-presets/pull/946)), DNNL 2.1.1, CPython 3.9.2, NumPy 1.20.1, SciPy 1.6.1, Gym 0.18.0, LLVM 11.0.1 ([pull #955](https://github.com/bytedeco/javacpp-presets/pull/955)), OpenPose 1.7.0, CUDA 11.2.1, cuDNN 8.1.0, NCCL 2.8.4, TensorFlow 1.15.5, TensorRT 7.2.2.3, ONNX 1.8.1, ONNX Runtime 1.6.0, Qt 5.15.2, Skia 2.80.2, cpu_features 0.6.0, and their dependencies + * Upgrade presets for OpenCV 4.5.1, FFmpeg 4.3.2, Arrow 3.0.0, Hyperscan 5.4.0, MKL 2021.1, OpenBLAS 0.3.13, ARPACK-NG 3.8.0, CMINPACK 1.3.8, FFTW 3.3.9, librealsense2 2.40.0 ([pull #946](https://github.com/bytedeco/javacpp-presets/pull/946)), DNNL 2.1.1, CPython 3.9.2, NumPy 1.20.1, SciPy 1.6.1, Gym 0.18.0, LLVM 11.1.0 ([pull #1001](https://github.com/bytedeco/javacpp-presets/pull/1001)), OpenPose 1.7.0, CUDA 11.2.1, cuDNN 8.1.0, NCCL 2.8.4, TensorFlow 1.15.5, TensorRT 7.2.2.3, ONNX 1.8.1, ONNX Runtime 1.6.0, Qt 5.15.2, Skia 2.80.2, cpu_features 0.6.0, and their dependencies ### September 9, 2020 version 1.5.4 * Bundle `libpostal_data` program, executable via `Loader.load()` for convenience ([issue #939](https://github.com/bytedeco/javacpp-presets/issues/939)) diff --git a/README.md b/README.md index b4f94aebd8e..7f15370eee5 100644 --- a/README.md +++ b/README.md @@ -191,7 +191,7 @@ Each child module in turn relies by default on the included [`cppbuild.sh` scrip * NumPy 1.20.x https://github.com/numpy/numpy * SciPy 1.6.x https://github.com/scipy/scipy * Gym 0.18.x https://github.com/openai/gym - * LLVM 11.0.x http://llvm.org/releases/download.html + * LLVM 11.1.0 http://llvm.org/releases/download.html * libpostal 1.1-alpha https://github.com/openvenues/libpostal * Leptonica 1.80.0 http://www.leptonica.org/download.html * Tesseract 4.1.1 https://github.com/tesseract-ocr/tesseract diff --git a/arrow/cppbuild.sh b/arrow/cppbuild.sh index b3e3870e644..edc1dd6400c 100755 --- a/arrow/cppbuild.sh +++ b/arrow/cppbuild.sh @@ -12,7 +12,7 @@ if [[ $PLATFORM == windows* ]]; then export PYTHON_BIN_PATH=$(which python.exe) fi -LLVM_VERSION=11.0.1 +LLVM_VERSION=11.1.0 OPENSSL_VERSION=1.1.1i ZLIB_VERSION=1.2.11 PROTO_VERSION=3.13.0 diff --git a/llvm/README.md b/llvm/README.md index 201c50e1ef6..c2d8e47edd5 100644 --- a/llvm/README.md +++ b/llvm/README.md @@ -9,7 +9,7 @@ Introduction ------------ This directory contains the JavaCPP Presets module for: - * LLVM 11.0.1 http://llvm.org/ + * LLVM 11.1.0 http://llvm.org/ Please refer to the parent README.md file for more detailed information about the JavaCPP Presets. @@ -49,7 +49,7 @@ We can use [Maven 3](http://maven.apache.org/) to download and install automatic org.bytedeco llvm-platform - 11.0.1-1.5.5-SNAPSHOT + 11.1.0-1.5.5-SNAPSHOT diff --git a/llvm/cppbuild.sh b/llvm/cppbuild.sh index 72d37c1d3d6..4fffa493a64 100755 --- a/llvm/cppbuild.sh +++ b/llvm/cppbuild.sh @@ -7,7 +7,7 @@ if [[ -z "$PLATFORM" ]]; then exit fi -LLVM_VERSION=11.0.1 +LLVM_VERSION=11.1.0 download https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_VERSION/llvm-project-$LLVM_VERSION.src.tar.xz llvm-project-$LLVM_VERSION.src.tar.xz mkdir -p $PLATFORM diff --git a/llvm/platform/pom.xml b/llvm/platform/pom.xml index 2a26a8921f9..af14b1ce488 100644 --- a/llvm/platform/pom.xml +++ b/llvm/platform/pom.xml @@ -12,7 +12,7 @@ org.bytedeco llvm-platform - 11.0.1-${project.parent.version} + 11.1.0-${project.parent.version} JavaCPP Presets Platform for LLVM diff --git a/llvm/pom.xml b/llvm/pom.xml index a399f4cc541..3b7d8a793c8 100644 --- a/llvm/pom.xml +++ b/llvm/pom.xml @@ -11,7 +11,7 @@ org.bytedeco llvm - 11.0.1-${project.parent.version} + 11.1.0-${project.parent.version} JavaCPP Presets for LLVM diff --git a/llvm/samples/clang/pom.xml b/llvm/samples/clang/pom.xml index 70b8fcf873d..5b2ae77c3a3 100644 --- a/llvm/samples/clang/pom.xml +++ b/llvm/samples/clang/pom.xml @@ -10,7 +10,7 @@ org.bytedeco llvm-platform - 11.0.1-1.5.5-SNAPSHOT + 11.1.0-1.5.5-SNAPSHOT diff --git a/llvm/samples/llvm/pom.xml b/llvm/samples/llvm/pom.xml index 0b1a9f73b11..eb45e79ba24 100644 --- a/llvm/samples/llvm/pom.xml +++ b/llvm/samples/llvm/pom.xml @@ -10,7 +10,7 @@ org.bytedeco llvm-platform - 11.0.1-1.5.5-SNAPSHOT + 11.1.0-1.5.5-SNAPSHOT diff --git a/llvm/samples/polly/pom.xml b/llvm/samples/polly/pom.xml index d02792951bc..c368ec74c5c 100644 --- a/llvm/samples/polly/pom.xml +++ b/llvm/samples/polly/pom.xml @@ -13,7 +13,7 @@ org.bytedeco llvm-platform - 11.0.1-1.5.5-SNAPSHOT + 11.1.0-1.5.5-SNAPSHOT net.java.dev.jna diff --git a/llvm/src/gen/java/org/bytedeco/llvm/global/LLVM.java b/llvm/src/gen/java/org/bytedeco/llvm/global/LLVM.java index 024c79e6841..823f1c02e6c 100644 --- a/llvm/src/gen/java/org/bytedeco/llvm/global/LLVM.java +++ b/llvm/src/gen/java/org/bytedeco/llvm/global/LLVM.java @@ -10756,6 +10756,43 @@ public static native void createOptimizedJITCompilerForModule( LLVMValueRef Val ); +/** + * Inlined re-implementation of LLVMGetMDString without providing a wrapped + * MetadataAsValue instance + * + * See /llvm/lib/IR/Core.cpp for original implementation + */ +@Namespace("llvm") public static native @Cast("const char*") BytePointer getMDString(LLVMMetadataRef M, @Cast("unsigned*") IntPointer Length); +@Namespace("llvm") public static native String getMDString(LLVMMetadataRef M, @Cast("unsigned*") IntBuffer Length); +@Namespace("llvm") public static native @Cast("const char*") BytePointer getMDString(LLVMMetadataRef M, @Cast("unsigned*") int[] Length); + +/** + * Inlined re-implementation of LLVMGetMDNodeNumOperands + * + * See /llvm/lib/IR/Core.cpp for original implementation + */ +@Namespace("llvm") public static native @Cast("unsigned") int getMDNodeNumOperands(LLVMMetadataRef M); + +/** + * Inlined re-implementation of LLVMGetMDNodeOperands + * + * Accepts an additional LLVMContextRef argument in which all ConstantAsMetadata + * values will be unwrapped and stored in. (see C API implementation) + * + * This implementation inlines the statically defined "getMDNodeOperandsImpl" in + * Core.cpp which the original implementation uses. + * + * See /llvm/lib/IR/Core.cpp for original implementation + */ +@Namespace("llvm") public static native void getMDNodeOperands( + LLVMMetadataRef M, + LLVMContextRef C, + @ByPtrPtr LLVMValueRef Dest); +@Namespace("llvm") public static native void getMDNodeOperands( + LLVMMetadataRef M, + LLVMContextRef C, + @Cast("LLVMValueRef*") PointerPointer Dest); + // namespace llvm // #endif // NAMED_METADATA_OPERATIONS_H diff --git a/llvm/src/gen/java/org/bytedeco/llvm/global/clang.java b/llvm/src/gen/java/org/bytedeco/llvm/global/clang.java index a1b69b957ca..2c3d4894e98 100644 --- a/llvm/src/gen/java/org/bytedeco/llvm/global/clang.java +++ b/llvm/src/gen/java/org/bytedeco/llvm/global/clang.java @@ -527,7 +527,7 @@ public static native CXCompileCommands clang_CompilationDatabase_getCompileComma * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable. */ public static final int CINDEX_VERSION_MAJOR = 0; -public static final int CINDEX_VERSION_MINOR = 60; +public static final int CINDEX_VERSION_MINOR = 61; // #define CINDEX_VERSION_ENCODE(major, minor) (((major)*10000) + ((minor)*1)) @@ -2551,62 +2551,58 @@ public static class CXTUResourceUsageKind { */ CXCursor_CXXFunctionalCastExpr = 128, - /** OpenCL's addrspace_cast<> expression. - */ - CXCursor_CXXAddrspaceCastExpr = 129, - /** A C++ typeid expression (C++ [expr.typeid]). */ - CXCursor_CXXTypeidExpr = 130, + CXCursor_CXXTypeidExpr = 129, /** [C++ 2.13.5] C++ Boolean Literal. */ - CXCursor_CXXBoolLiteralExpr = 131, + CXCursor_CXXBoolLiteralExpr = 130, /** [C++0x 2.14.7] C++ Pointer Literal. */ - CXCursor_CXXNullPtrLiteralExpr = 132, + CXCursor_CXXNullPtrLiteralExpr = 131, /** Represents the "this" expression in C++ */ - CXCursor_CXXThisExpr = 133, + CXCursor_CXXThisExpr = 132, /** [C++ 15] C++ Throw Expression. * * This handles 'throw' and 'throw' assignment-expression. When * assignment-expression isn't present, Op will be null. */ - CXCursor_CXXThrowExpr = 134, + CXCursor_CXXThrowExpr = 133, /** A new expression for memory allocation and constructor calls, e.g: * "new CXXNewExpr(foo)". */ - CXCursor_CXXNewExpr = 135, + CXCursor_CXXNewExpr = 134, /** A delete expression for memory deallocation and destructor calls, * e.g. "delete[] pArray". */ - CXCursor_CXXDeleteExpr = 136, + CXCursor_CXXDeleteExpr = 135, /** A unary expression. (noexcept, sizeof, or other traits) */ - CXCursor_UnaryExpr = 137, + CXCursor_UnaryExpr = 136, /** An Objective-C string literal i.e. \"foo". */ - CXCursor_ObjCStringLiteral = 138, + CXCursor_ObjCStringLiteral = 137, /** An Objective-C {@literal @}encode expression. */ - CXCursor_ObjCEncodeExpr = 139, + CXCursor_ObjCEncodeExpr = 138, /** An Objective-C {@literal @}selector expression. */ - CXCursor_ObjCSelectorExpr = 140, + CXCursor_ObjCSelectorExpr = 139, /** An Objective-C {@literal @}protocol expression. */ - CXCursor_ObjCProtocolExpr = 141, + CXCursor_ObjCProtocolExpr = 140, /** An Objective-C "bridged" cast expression, which casts between * Objective-C pointers and C pointers, transferring ownership in the process. @@ -2615,7 +2611,7 @@ public static class CXTUResourceUsageKind { * NSString *str = (__bridge_transfer NSString *)CFCreateString(); * } */ - CXCursor_ObjCBridgedCastExpr = 142, + CXCursor_ObjCBridgedCastExpr = 141, /** Represents a C++0x pack expansion that produces a sequence of * expressions. @@ -2630,7 +2626,7 @@ public static class CXTUResourceUsageKind { * } * } */ - CXCursor_PackExpansionExpr = 143, + CXCursor_PackExpansionExpr = 142, /** Represents an expression that computes the length of a parameter * pack. @@ -2642,7 +2638,7 @@ public static class CXTUResourceUsageKind { * }; * } */ - CXCursor_SizeOfPackExpr = 144, + CXCursor_SizeOfPackExpr = 143, /* Represents a C++ lambda expression that produces a local function * object. @@ -2656,39 +2652,43 @@ public static class CXTUResourceUsageKind { * } * \endcode */ - CXCursor_LambdaExpr = 145, + CXCursor_LambdaExpr = 144, /** Objective-c Boolean Literal. */ - CXCursor_ObjCBoolLiteralExpr = 146, + CXCursor_ObjCBoolLiteralExpr = 145, /** Represents the "self" expression in an Objective-C method. */ - CXCursor_ObjCSelfExpr = 147, + CXCursor_ObjCSelfExpr = 146, /** OpenMP 5.0 [2.1.5, Array Section]. */ - CXCursor_OMPArraySectionExpr = 148, + CXCursor_OMPArraySectionExpr = 147, /** Represents an \available(...) check. */ - CXCursor_ObjCAvailabilityCheckExpr = 149, + CXCursor_ObjCAvailabilityCheckExpr = 148, /** * Fixed point literal */ - CXCursor_FixedPointLiteral = 150, + CXCursor_FixedPointLiteral = 149, /** OpenMP 5.0 [2.1.4, Array Shaping]. */ - CXCursor_OMPArrayShapingExpr = 151, + CXCursor_OMPArrayShapingExpr = 150, /** * OpenMP 5.0 [2.1.6 Iterators] */ - CXCursor_OMPIteratorExpr = 152, + CXCursor_OMPIteratorExpr = 151, + + /** OpenCL's addrspace_cast<> expression. + */ + CXCursor_CXXAddrspaceCastExpr = 152, - CXCursor_LastExpr = CXCursor_OMPIteratorExpr, + CXCursor_LastExpr = CXCursor_CXXAddrspaceCastExpr, /* Statements */ CXCursor_FirstStmt = 200, diff --git a/llvm/src/main/resources/org/bytedeco/llvm/include/NamedMetadataOperations.h b/llvm/src/main/resources/org/bytedeco/llvm/include/NamedMetadataOperations.h index 1b2a62108c8..5ea89bc6052 100644 --- a/llvm/src/main/resources/org/bytedeco/llvm/include/NamedMetadataOperations.h +++ b/llvm/src/main/resources/org/bytedeco/llvm/include/NamedMetadataOperations.h @@ -94,6 +94,80 @@ extern "C" void addNamedMDNodeOperand( N->addOperand(Metadata); } +/** + * Inlined re-implementation of LLVMGetMDString without providing a wrapped + * MetadataAsValue instance + * + * See /llvm/lib/IR/Core.cpp for original implementation + */ +extern "C" const char* getMDString(LLVMMetadataRef M, unsigned *Length) { + Metadata *MD = unwrap(M); + + if (const MDString *S = dyn_cast(MD)) { + *Length = S->getString().size(); + return S->getString().data(); + } + *Length = 0; + return nullptr; +} + +/** + * Inlined re-implementation of LLVMGetMDNodeNumOperands + * + * See /llvm/lib/IR/Core.cpp for original implementation + */ +extern "C" unsigned getMDNodeNumOperands(LLVMMetadataRef M) { + Metadata *MD = unwrap(M); + if (isa(MD)) { + return 1; + } + return cast(MD)->getNumOperands(); +} + +/** + * Inlined re-implementation of LLVMGetMDNodeOperands + * + * Accepts an additional LLVMContextRef argument in which all ConstantAsMetadata + * values will be unwrapped and stored in. (see C API implementation) + * + * This implementation inlines the statically defined "getMDNodeOperandsImpl" in + * Core.cpp which the original implementation uses. + * + * See /llvm/lib/IR/Core.cpp for original implementation + */ +extern "C" void getMDNodeOperands( + LLVMMetadataRef M, + LLVMContextRef C, + LLVMValueRef *Dest) { + Metadata *MD = unwrap(M); + LLVMContext *Context = unwrap(C); + + if (auto *MDV = dyn_cast(MD)) { + *Dest = wrap(MDV->getValue()); + return; + } + + const auto *N = cast(MD); + const unsigned numOperands = N->getNumOperands(); + + // Inlined code of "static LLVMValueRef getMDNodeOperandsImpl(LLVMContext &, const MDNode *, unsigned)" + for (unsigned i = 0; i < numOperands; i++) { + Metadata *Op = N->getOperand(i); + + if (!Op) { + Dest[i] = nullptr; + continue; + } + + if (auto *C = dyn_cast(Op)) { + Dest[i] = wrap(C->getValue()); + continue; + } + + Dest[i] = wrap(MetadataAsValue::get(*Context, Op)); + } +} + } // namespace llvm #endif // NAMED_METADATA_OPERATIONS_H \ No newline at end of file diff --git a/platform/pom.xml b/platform/pom.xml index b8147d415ca..98a50b4bec8 100644 --- a/platform/pom.xml +++ b/platform/pom.xml @@ -216,7 +216,7 @@ org.bytedeco llvm-platform - 11.0.1-${project.version} + 11.1.0-${project.version} org.bytedeco diff --git a/tvm/platform/gpu/pom.xml b/tvm/platform/gpu/pom.xml index 64b0655e0ef..15255a2168e 100644 --- a/tvm/platform/gpu/pom.xml +++ b/tvm/platform/gpu/pom.xml @@ -29,7 +29,7 @@ org.bytedeco llvm-platform - 11.0.1-${project.parent.version} + 11.1.0-${project.parent.version} org.bytedeco diff --git a/tvm/platform/pom.xml b/tvm/platform/pom.xml index 4989fcdcfe2..86646e07f56 100644 --- a/tvm/platform/pom.xml +++ b/tvm/platform/pom.xml @@ -28,7 +28,7 @@ org.bytedeco llvm-platform - 11.0.1-${project.parent.version} + 11.1.0-${project.parent.version} org.bytedeco diff --git a/tvm/pom.xml b/tvm/pom.xml index 091f111deb9..46222486c70 100644 --- a/tvm/pom.xml +++ b/tvm/pom.xml @@ -32,7 +32,7 @@ org.bytedeco llvm - 11.0.1-${project.parent.version} + 11.1.0-${project.parent.version} org.bytedeco @@ -70,7 +70,7 @@ org.bytedeco llvm-platform - 11.0.1-${project.parent.version} + 11.1.0-${project.parent.version} org.bytedeco