diff options
| author | bors <bors@rust-lang.org> | 2024-08-14 05:52:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-08-14 05:52:50 +0000 |
| commit | f25ca7eca8379e1d3da0963f2a6c7ab4ed7da452 (patch) | |
| tree | 5790ad14119476292ab169019d5a635a31819b0f /compiler/rustc_codegen_llvm/src/llvm/mod.rs | |
| parent | 6ff09af0cdd55e504b9710b7b67292538b7e0677 (diff) | |
| parent | db3f92144d6f3b4db8aa19357dee42dd256f1f13 (diff) | |
| download | rust-f25ca7eca8379e1d3da0963f2a6c7ab4ed7da452.tar.gz rust-f25ca7eca8379e1d3da0963f2a6c7ab4ed7da452.zip | |
Auto merge of #3803 - RalfJung:rustup, r=RalfJung
Rustup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm/mod.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm/mod.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm/mod.rs b/compiler/rustc_codegen_llvm/src/llvm/mod.rs index 72691907c0d..d0db350a149 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/mod.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/mod.rs @@ -8,7 +8,7 @@ use std::string::FromUtf8Error; use libc::c_uint; use rustc_data_structures::small_c_str::SmallCStr; use rustc_llvm::RustString; -use rustc_target::abi::Align; +use rustc_target::abi::{Align, Size, WrappingRange}; pub use self::AtomicRmwBinOp::*; pub use self::CallConv::*; @@ -105,6 +105,21 @@ pub fn CreateAllocKindAttr(llcx: &Context, kind_arg: AllocKindFlags) -> &Attribu unsafe { LLVMRustCreateAllocKindAttr(llcx, kind_arg.bits()) } } +pub fn CreateRangeAttr(llcx: &Context, size: Size, range: WrappingRange) -> &Attribute { + let lower = range.start; + let upper = range.end.wrapping_add(1); + let lower_words = [lower as u64, (lower >> 64) as u64]; + let upper_words = [upper as u64, (upper >> 64) as u64]; + unsafe { + LLVMRustCreateRangeAttribute( + llcx, + size.bits().try_into().unwrap(), + lower_words.as_ptr(), + upper_words.as_ptr(), + ) + } +} + #[derive(Copy, Clone)] pub enum AttributePlace { ReturnValue, |
