1
Fork 0

Auto merge of #76260 - xd009642:rfc/2867, r=jonas-schievink

Implementation of RFC2867

https://github.com/rust-lang/rust/issues/74727

So I've started work on this, I think my next steps are to make use of the `instruction_set` value in the llvm codegen but this is the point where I begin to get a bit lost. I'm looking at the code but it would be nice to have some guidance on what I've currently done and what I'm doing next 😄
This commit is contained in:
bors 2020-10-09 00:29:47 +00:00
commit 03ef8a081e
22 changed files with 247 additions and 4 deletions

View file

@ -221,6 +221,12 @@ impl<'hir> HashStable<StableHashingContext<'hir>> for attr::InlineAttr {
}
}
impl<'hir> HashStable<StableHashingContext<'hir>> for attr::InstructionSetAttr {
fn hash_stable(&self, hcx: &mut StableHashingContext<'hir>, hasher: &mut StableHasher) {
mem::discriminant(self).hash_stable(hcx, hasher);
}
}
impl<'hir> HashStable<StableHashingContext<'hir>> for attr::OptimizeAttr {
fn hash_stable(&self, hcx: &mut StableHashingContext<'hir>, hasher: &mut StableHasher) {
mem::discriminant(self).hash_stable(hcx, hasher);

View file

@ -1,5 +1,5 @@
use crate::mir::mono::Linkage;
use rustc_attr::{InlineAttr, OptimizeAttr};
use rustc_attr::{InlineAttr, InstructionSetAttr, OptimizeAttr};
use rustc_session::config::SanitizerSet;
use rustc_span::symbol::Symbol;
@ -34,6 +34,10 @@ pub struct CodegenFnAttrs {
/// The `#[no_sanitize(...)]` attribute. Indicates sanitizers for which
/// instrumentation should be disabled inside the annotated function.
pub no_sanitize: SanitizerSet,
/// The `#[instruction_set(set)]` attribute. Indicates if the generated code should
/// be generated against a specific instruction set. Only usable on architectures which allow
/// switching between multiple instruction sets.
pub instruction_set: Option<InstructionSetAttr>,
}
bitflags! {
@ -98,6 +102,7 @@ impl CodegenFnAttrs {
linkage: None,
link_section: None,
no_sanitize: SanitizerSet::empty(),
instruction_set: None,
}
}