Rollup merge of #103977 - TimNN:memory-effects, r=nikic
LLVM 16: Switch to using MemoryEffects
This adapts the compiler to the changes required by 304f1d59ca
.
AFAICT, `WriteOnly` isn't used by the compiler, all `ReadNone` uses were migrated and the remaining use of `ReadOnly` is only for function parameters.
To simplify the FFI, this PR uses an enum to represent `MemoryEffects` across the FFI boundary, which then gets mapped to the matching static factory method when constructing the attribute.
Fixes #103961.
`@rustbot` label +llvm-main
r? `@nikic`
This commit is contained in:
commit
f6ca5aa19a
8 changed files with 67 additions and 12 deletions
|
@ -285,13 +285,13 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
|
|||
let mut attrs = SmallVec::<[_; 2]>::new();
|
||||
if options.contains(InlineAsmOptions::PURE) {
|
||||
if options.contains(InlineAsmOptions::NOMEM) {
|
||||
attrs.push(llvm::AttributeKind::ReadNone.create_attr(self.cx.llcx));
|
||||
attrs.push(llvm::MemoryEffects::None.create_attr(self.cx.llcx));
|
||||
} else if options.contains(InlineAsmOptions::READONLY) {
|
||||
attrs.push(llvm::AttributeKind::ReadOnly.create_attr(self.cx.llcx));
|
||||
attrs.push(llvm::MemoryEffects::ReadOnly.create_attr(self.cx.llcx));
|
||||
}
|
||||
attrs.push(llvm::AttributeKind::WillReturn.create_attr(self.cx.llcx));
|
||||
} else if options.contains(InlineAsmOptions::NOMEM) {
|
||||
attrs.push(llvm::AttributeKind::InaccessibleMemOnly.create_attr(self.cx.llcx));
|
||||
attrs.push(llvm::MemoryEffects::InaccessibleMemOnly.create_attr(self.cx.llcx));
|
||||
} else {
|
||||
// LLVM doesn't have an attribute to represent ReadOnly + SideEffect
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue