Skip to content

Commit

Permalink
* Upgrade presets for LLVM 11.1.0 (pull #1001)
Browse files Browse the repository at this point in the history
Also add more data retrieval operations for LLVM nodes to `NamedMetadataOperations.h`
  • Loading branch information
junlarsen authored Feb 28, 2021
1 parent 60de82c commit e3445e8
Show file tree
Hide file tree
Showing 17 changed files with 156 additions and 45 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion arrow/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions llvm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -49,7 +49,7 @@ We can use [Maven 3](http://maven.apache.org/) to download and install automatic
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>llvm-platform</artifactId>
<version>11.0.1-1.5.5-SNAPSHOT</version>
<version>11.1.0-1.5.5-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
Expand Down
2 changes: 1 addition & 1 deletion llvm/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>org.bytedeco</groupId>
<artifactId>llvm-platform</artifactId>
<version>11.0.1-${project.parent.version}</version>
<version>11.1.0-${project.parent.version}</version>
<name>JavaCPP Presets Platform for LLVM</name>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion llvm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>org.bytedeco</groupId>
<artifactId>llvm</artifactId>
<version>11.0.1-${project.parent.version}</version>
<version>11.1.0-${project.parent.version}</version>
<name>JavaCPP Presets for LLVM</name>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion llvm/samples/clang/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>llvm-platform</artifactId>
<version>11.0.1-1.5.5-SNAPSHOT</version>
<version>11.1.0-1.5.5-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
Expand Down
2 changes: 1 addition & 1 deletion llvm/samples/llvm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>llvm-platform</artifactId>
<version>11.0.1-1.5.5-SNAPSHOT</version>
<version>11.1.0-1.5.5-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
Expand Down
2 changes: 1 addition & 1 deletion llvm/samples/polly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>llvm-platform</artifactId>
<version>11.0.1-1.5.5-SNAPSHOT</version>
<version>11.1.0-1.5.5-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
Expand Down
37 changes: 37 additions & 0 deletions llvm/src/gen/java/org/bytedeco/llvm/global/LLVM.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
58 changes: 29 additions & 29 deletions llvm/src/gen/java/org/bytedeco/llvm/global/clang.java
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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.
Expand All @@ -2615,7 +2611,7 @@ public static class CXTUResourceUsageKind {
* NSString *str = (__bridge_transfer NSString *)CFCreateString();
* }</pre>
*/
CXCursor_ObjCBridgedCastExpr = 142,
CXCursor_ObjCBridgedCastExpr = 141,

/** Represents a C++0x pack expansion that produces a sequence of
* expressions.
Expand All @@ -2630,7 +2626,7 @@ public static class CXTUResourceUsageKind {
* }
* }</pre>
*/
CXCursor_PackExpansionExpr = 143,
CXCursor_PackExpansionExpr = 142,

/** Represents an expression that computes the length of a parameter
* pack.
Expand All @@ -2642,7 +2638,7 @@ public static class CXTUResourceUsageKind {
* };
* }</pre>
*/
CXCursor_SizeOfPackExpr = 144,
CXCursor_SizeOfPackExpr = 143,

/* Represents a C++ lambda expression that produces a local function
* object.
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<MDString>(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<ValueAsMetadata>(MD)) {
return 1;
}
return cast<MDNode>(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<ValueAsMetadata>(MD)) {
*Dest = wrap(MDV->getValue());
return;
}

const auto *N = cast<MDNode>(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<ConstantAsMetadata>(Op)) {
Dest[i] = wrap(C->getValue());
continue;
}

Dest[i] = wrap(MetadataAsValue::get(*Context, Op));
}
}

} // namespace llvm

#endif // NAMED_METADATA_OPERATIONS_H
2 changes: 1 addition & 1 deletion platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>llvm-platform</artifactId>
<version>11.0.1-${project.version}</version>
<version>11.1.0-${project.version}</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
Expand Down
Loading

0 comments on commit e3445e8

Please sign in to comment.