diff options
| author | bors <bors@rust-lang.org> | 2025-04-29 02:29:56 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-04-29 02:29:56 +0000 |
| commit | 1b8ab72680f36e783af84c1a3c4f8508572bd9f9 (patch) | |
| tree | 45a5fa6de1b388f0098b401c8c4daa1727ec56c7 /compiler/rustc_codegen_llvm/src/llvm | |
| parent | 25cdf1f67463c9365d8d83778c933ec7480e940b (diff) | |
| parent | bf37847434acfc691553540b5bf0b8cffc09c277 (diff) | |
| download | rust-1b8ab72680f36e783af84c1a3c4f8508572bd9f9.tar.gz rust-1b8ab72680f36e783af84c1a3c4f8508572bd9f9.zip | |
Auto merge of #140415 - ChrisDenton:rollup-r0631fv, r=ChrisDenton
Rollup of 10 pull requests Successful merges: - #139308 (add autodiff inline) - #139656 (Stabilize `slice_as_chunks` library feature) - #140022 (allow deref patterns to move out of boxes) - #140276 (Do not compute type_of for impl item if impl where clauses are unsatisfied) - #140302 (Move inline asm check to typeck, properly handle aliases) - #140323 (Implement the internal feature `cfg_target_has_reliable_f16_f128`) - #140391 (Rename sub_ptr to offset_from_unsigned in docs) - #140394 (Make bootstrap git tests more self-contained) - #140396 (Workaround for windows-gnu rust-lld test failure) - #140402 (only return nested goals for `Certainty::Yes`) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs | 13 | ||||
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm/mod.rs | 26 |
2 files changed, 39 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs index a9b3bdf7344..2ad39fc8538 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs @@ -19,6 +19,19 @@ unsafe extern "C" { pub(crate) fn LLVMRustVerifyFunction(V: &Value, action: LLVMRustVerifierFailureAction) -> Bool; pub(crate) fn LLVMRustHasAttributeAtIndex(V: &Value, i: c_uint, Kind: AttributeKind) -> bool; pub(crate) fn LLVMRustGetArrayNumElements(Ty: &Type) -> u64; + pub(crate) fn LLVMRustHasFnAttribute( + F: &Value, + Name: *const c_char, + NameLen: libc::size_t, + ) -> bool; + pub(crate) fn LLVMRustRemoveFnAttribute(F: &Value, Name: *const c_char, NameLen: libc::size_t); + pub(crate) fn LLVMGetFirstFunction(M: &Module) -> Option<&Value>; + pub(crate) fn LLVMGetNextFunction(Fn: &Value) -> Option<&Value>; + pub(crate) fn LLVMRustRemoveEnumAttributeAtIndex( + Fn: &Value, + index: c_uint, + kind: AttributeKind, + ); } unsafe extern "C" { diff --git a/compiler/rustc_codegen_llvm/src/llvm/mod.rs b/compiler/rustc_codegen_llvm/src/llvm/mod.rs index 6ca81c651ed..d14aab06073 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/mod.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/mod.rs @@ -41,6 +41,32 @@ pub(crate) fn AddFunctionAttributes<'ll>( } } +pub(crate) fn HasAttributeAtIndex<'ll>( + llfn: &'ll Value, + idx: AttributePlace, + kind: AttributeKind, +) -> bool { + unsafe { LLVMRustHasAttributeAtIndex(llfn, idx.as_uint(), kind) } +} + +pub(crate) fn HasStringAttribute<'ll>(llfn: &'ll Value, name: &str) -> bool { + unsafe { LLVMRustHasFnAttribute(llfn, name.as_c_char_ptr(), name.len()) } +} + +pub(crate) fn RemoveStringAttrFromFn<'ll>(llfn: &'ll Value, name: &str) { + unsafe { LLVMRustRemoveFnAttribute(llfn, name.as_c_char_ptr(), name.len()) } +} + +pub(crate) fn RemoveRustEnumAttributeAtIndex( + llfn: &Value, + place: AttributePlace, + kind: AttributeKind, +) { + unsafe { + LLVMRustRemoveEnumAttributeAtIndex(llfn, place.as_uint(), kind); + } +} + pub(crate) fn AddCallSiteAttributes<'ll>( callsite: &'ll Value, idx: AttributePlace, |
