diff options
| author | Andreas Jonson <andjo403@users.noreply.github.com> | 2024-07-30 11:06:26 +0200 |
|---|---|---|
| committer | Andreas Jonson <andjo403@users.noreply.github.com> | 2024-08-11 19:40:44 +0200 |
| commit | cfadfabfcd9644628422396fcc8a67244df435c1 (patch) | |
| tree | 76631b2a21fc3d4b77d82a24278b6ea75693fd89 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 9bad7ba324099d124c77c5b06aebf68e11763f7b (diff) | |
| download | rust-cfadfabfcd9644628422396fcc8a67244df435c1.tar.gz rust-cfadfabfcd9644628422396fcc8a67244df435c1.zip | |
Add range attribute to scalar function results and arguments
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index 2ff7335a0fc..79a68b2ff0e 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -397,6 +397,18 @@ LLVMRustCreateAllocSizeAttr(LLVMContextRef C, uint32_t ElementSizeArg) { std::nullopt)); } +extern "C" LLVMAttributeRef +LLVMRustCreateRangeAttribute(LLVMContextRef C, unsigned NumBits, + const uint64_t LowerWords[], + const uint64_t UpperWords[]) { +#if LLVM_VERSION_GE(19, 0) + return LLVMCreateConstantRangeAttribute(C, Attribute::Range, NumBits, + LowerWords, UpperWords); +#else + report_fatal_error("LLVM 19.0 is required for Range Attribute"); +#endif +} + // These values **must** match ffi::AllocKindFlags. // It _happens_ to match the LLVM values of llvm::AllocFnKind, // but that's happenstance and we do explicit conversions before |
