|
10 | 10 | #include "llvm/IR/IntrinsicsARM.h"
|
11 | 11 | #include "llvm/IR/LLVMRemarkStreamer.h"
|
12 | 12 | #include "llvm/IR/Mangler.h"
|
| 13 | +#include "llvm/IR/Value.h" |
13 | 14 | #include "llvm/Remarks/RemarkStreamer.h"
|
14 | 15 | #include "llvm/Remarks/RemarkSerializer.h"
|
15 | 16 | #include "llvm/Remarks/RemarkFormat.h"
|
@@ -1223,14 +1224,6 @@ extern "C" void LLVMRustWriteValueToString(LLVMValueRef V,
|
1223 | 1224 | }
|
1224 | 1225 | }
|
1225 | 1226 |
|
1226 |
| -// LLVMArrayType function does not support 64-bit ElementCount |
1227 |
| -// FIXME: replace with LLVMArrayType2 when bumped minimal version to llvm-17 |
1228 |
| -// https://github.com/llvm/llvm-project/commit/35276f16e5a2cae0dfb49c0fbf874d4d2f177acc |
1229 |
| -extern "C" LLVMTypeRef LLVMRustArrayType(LLVMTypeRef ElementTy, |
1230 |
| - uint64_t ElementCount) { |
1231 |
| - return wrap(ArrayType::get(unwrap(ElementTy), ElementCount)); |
1232 |
| -} |
1233 |
| - |
1234 | 1227 | DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Twine, LLVMTwineRef)
|
1235 | 1228 |
|
1236 | 1229 | extern "C" void LLVMRustWriteTwineToString(LLVMTwineRef T, RustStringRef Str) {
|
@@ -2114,3 +2107,36 @@ extern "C" bool LLVMRustLLVMHasZlibCompressionForDebugSymbols() {
|
2114 | 2107 | extern "C" bool LLVMRustLLVMHasZstdCompressionForDebugSymbols() {
|
2115 | 2108 | return llvm::compression::zstd::isAvailable();
|
2116 | 2109 | }
|
| 2110 | + |
| 2111 | +// Operations on composite constants. |
| 2112 | +// These are clones of LLVM api functions that will become available in future releases. |
| 2113 | +// They can be removed once Rust's minimum supported LLVM version supports them. |
| 2114 | +// See https://github.com/rust-lang/rust/issues/121868 |
| 2115 | +// See https://llvm.org/doxygen/group__LLVMCCoreValueConstantComposite.html |
| 2116 | + |
| 2117 | +// FIXME: Remove when Rust's minimum supported LLVM version reaches 19. |
| 2118 | +// https://github.com/llvm/llvm-project/commit/e1405e4f71c899420ebf8262d5e9745598419df8 |
| 2119 | +#if LLVM_VERSION_LT(19, 0) |
| 2120 | +extern "C" LLVMValueRef LLVMConstStringInContext2(LLVMContextRef C, |
| 2121 | + const char *Str, |
| 2122 | + size_t Length, |
| 2123 | + bool DontNullTerminate) { |
| 2124 | + return wrap(ConstantDataArray::getString(*unwrap(C), StringRef(Str, Length), !DontNullTerminate)); |
| 2125 | +} |
| 2126 | +#endif |
| 2127 | + |
| 2128 | +// FIXME: Remove when Rust's minimum supported LLVM version reaches 17. |
| 2129 | +// https://github.com/llvm/llvm-project/commit/35276f16e5a2cae0dfb49c0fbf874d4d2f177acc |
| 2130 | +#if LLVM_VERSION_LT(17, 0) |
| 2131 | +extern "C" LLVMValueRef LLVMConstArray2(LLVMTypeRef ElementTy, |
| 2132 | + LLVMValueRef *ConstantVals, |
| 2133 | + uint64_t Length) { |
| 2134 | + ArrayRef<Constant *> V(unwrap<Constant>(ConstantVals, Length), Length); |
| 2135 | + return wrap(ConstantArray::get(ArrayType::get(unwrap(ElementTy), Length), V)); |
| 2136 | +} |
| 2137 | + |
| 2138 | +extern "C" LLVMTypeRef LLVMArrayType2(LLVMTypeRef ElementTy, |
| 2139 | + uint64_t ElementCount) { |
| 2140 | + return wrap(ArrayType::get(unwrap(ElementTy), ElementCount)); |
| 2141 | +} |
| 2142 | +#endif |
0 commit comments