Auto merge of #83864 - Dylan-DPC:rollup-78an86n, r=Dylan-DPC
Rollup of 7 pull requests Successful merges: - #80525 (wasm64 support) - #83019 (core: disable `ptr::swap_nonoverlapping_one`'s block optimization on SPIR-V.) - #83717 (rustdoc: Separate filter-empty-string out into its own function) - #83807 (Tests: Remove redundant `ignore-tidy-linelength` annotations) - #83815 (ptr::addr_of documentation improvements) - #83820 (Remove attribute `#[link_args]`) - #83841 (Allow clobbering unsupported registers in asm!) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
015d2bc3fe
319 changed files with 1934 additions and 2162 deletions
|
@ -1499,46 +1499,64 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
// previous iteration.
|
||||
required_features.clear();
|
||||
|
||||
// Validate register classes against currently enabled target
|
||||
// features. We check that at least one type is available for
|
||||
// the current target.
|
||||
let reg_class = reg.reg_class();
|
||||
if reg_class == asm::InlineAsmRegClass::Err {
|
||||
continue;
|
||||
}
|
||||
for &(_, feature) in reg_class.supported_types(asm_arch.unwrap()) {
|
||||
if let Some(feature) = feature {
|
||||
if self.sess.target_features.contains(&Symbol::intern(feature)) {
|
||||
|
||||
// We ignore target feature requirements for clobbers: if the
|
||||
// feature is disabled then the compiler doesn't care what we
|
||||
// do with the registers.
|
||||
//
|
||||
// Note that this is only possible for explicit register
|
||||
// operands, which cannot be used in the asm string.
|
||||
let is_clobber = matches!(
|
||||
op,
|
||||
hir::InlineAsmOperand::Out {
|
||||
reg: asm::InlineAsmRegOrRegClass::Reg(_),
|
||||
late: _,
|
||||
expr: None
|
||||
}
|
||||
);
|
||||
|
||||
if !is_clobber {
|
||||
// Validate register classes against currently enabled target
|
||||
// features. We check that at least one type is available for
|
||||
// the current target.
|
||||
for &(_, feature) in reg_class.supported_types(asm_arch.unwrap()) {
|
||||
if let Some(feature) = feature {
|
||||
if self.sess.target_features.contains(&Symbol::intern(feature)) {
|
||||
required_features.clear();
|
||||
break;
|
||||
} else {
|
||||
required_features.push(feature);
|
||||
}
|
||||
} else {
|
||||
required_features.clear();
|
||||
break;
|
||||
} else {
|
||||
required_features.push(feature);
|
||||
}
|
||||
} else {
|
||||
required_features.clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
// We are sorting primitive strs here and can use unstable sort here
|
||||
required_features.sort_unstable();
|
||||
required_features.dedup();
|
||||
match &required_features[..] {
|
||||
[] => {}
|
||||
[feature] => {
|
||||
let msg = format!(
|
||||
"register class `{}` requires the `{}` target feature",
|
||||
reg_class.name(),
|
||||
feature
|
||||
);
|
||||
sess.struct_span_err(op_sp, &msg).emit();
|
||||
}
|
||||
features => {
|
||||
let msg = format!(
|
||||
"register class `{}` requires at least one target feature: {}",
|
||||
reg_class.name(),
|
||||
features.join(", ")
|
||||
);
|
||||
sess.struct_span_err(op_sp, &msg).emit();
|
||||
// We are sorting primitive strs here and can use unstable sort here
|
||||
required_features.sort_unstable();
|
||||
required_features.dedup();
|
||||
match &required_features[..] {
|
||||
[] => {}
|
||||
[feature] => {
|
||||
let msg = format!(
|
||||
"register class `{}` requires the `{}` target feature",
|
||||
reg_class.name(),
|
||||
feature
|
||||
);
|
||||
sess.struct_span_err(op_sp, &msg).emit();
|
||||
}
|
||||
features => {
|
||||
let msg = format!(
|
||||
"register class `{}` requires at least one target feature: {}",
|
||||
reg_class.name(),
|
||||
features.join(", ")
|
||||
);
|
||||
sess.struct_span_err(op_sp, &msg).emit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ use rustc_data_structures::fx::FxHashMap;
|
|||
use rustc_hir as hir;
|
||||
use rustc_middle::ty::layout::TyAndLayout;
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_span::{Pos, Span};
|
||||
use rustc_span::{Pos, Span, Symbol};
|
||||
use rustc_target::abi::*;
|
||||
use rustc_target::asm::*;
|
||||
|
||||
|
@ -125,15 +125,39 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
|
|||
|
||||
// Collect the types of output operands
|
||||
let mut constraints = vec![];
|
||||
let mut clobbers = vec![];
|
||||
let mut output_types = vec![];
|
||||
let mut op_idx = FxHashMap::default();
|
||||
for (idx, op) in operands.iter().enumerate() {
|
||||
match *op {
|
||||
InlineAsmOperandRef::Out { reg, late, place } => {
|
||||
let is_target_supported = |reg_class: InlineAsmRegClass| {
|
||||
for &(_, feature) in reg_class.supported_types(asm_arch) {
|
||||
if let Some(feature) = feature {
|
||||
if self.tcx.sess.target_features.contains(&Symbol::intern(feature))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// Register class is unconditionally supported
|
||||
return true;
|
||||
}
|
||||
}
|
||||
false
|
||||
};
|
||||
|
||||
let mut layout = None;
|
||||
let ty = if let Some(ref place) = place {
|
||||
layout = Some(&place.layout);
|
||||
llvm_fixup_output_type(self.cx, reg.reg_class(), &place.layout)
|
||||
} else if !is_target_supported(reg.reg_class()) {
|
||||
// We turn discarded outputs into clobber constraints
|
||||
// if the target feature needed by the register class is
|
||||
// disabled. This is necessary otherwise LLVM will try
|
||||
// to actually allocate a register for the dummy output.
|
||||
assert!(matches!(reg, InlineAsmRegOrRegClass::Reg(_)));
|
||||
clobbers.push(format!("~{}", reg_to_llvm(reg, None)));
|
||||
continue;
|
||||
} else {
|
||||
// If the output is discarded, we don't really care what
|
||||
// type is used. We're just using this to tell LLVM to
|
||||
|
@ -244,6 +268,7 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
constraints.append(&mut clobbers);
|
||||
if !options.contains(InlineAsmOptions::PRESERVES_FLAGS) {
|
||||
match asm_arch {
|
||||
InlineAsmArch::AArch64 | InlineAsmArch::Arm => {
|
||||
|
|
|
@ -317,7 +317,7 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::
|
|||
// Note that currently the `wasm-import-module` doesn't do anything, but
|
||||
// eventually LLVM 7 should read this and ferry the appropriate import
|
||||
// module to the output file.
|
||||
if cx.tcx.sess.target.arch == "wasm32" {
|
||||
if cx.tcx.sess.target.is_like_wasm {
|
||||
if let Some(module) = wasm_import_module(cx.tcx, instance.def_id()) {
|
||||
llvm::AddFunctionAttrStringValue(
|
||||
llfn,
|
||||
|
|
|
@ -170,10 +170,7 @@ pub fn target_machine_factory(
|
|||
// On the wasm target once the `atomics` feature is enabled that means that
|
||||
// we're no longer single-threaded, or otherwise we don't want LLVM to
|
||||
// lower atomic operations to single-threaded operations.
|
||||
if singlethread
|
||||
&& sess.target.llvm_target.contains("wasm32")
|
||||
&& sess.target_features.contains(&sym::atomics)
|
||||
{
|
||||
if singlethread && sess.target.is_like_wasm && sess.target_features.contains(&sym::atomics) {
|
||||
singlethread = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1083,9 +1083,9 @@ pub fn compile_unit_metadata(
|
|||
);
|
||||
}
|
||||
|
||||
// Insert `llvm.ident` metadata on the wasm32 targets since that will
|
||||
// Insert `llvm.ident` metadata on the wasm targets since that will
|
||||
// get hooked up to the "producer" sections `processed-by` information.
|
||||
if tcx.sess.opts.target_triple.triple().starts_with("wasm32") {
|
||||
if tcx.sess.target.is_like_wasm {
|
||||
let name_metadata = llvm::LLVMMDStringInContext(
|
||||
debug_context.llcontext,
|
||||
rustc_producer.as_ptr().cast(),
|
||||
|
|
|
@ -1411,15 +1411,10 @@ fn add_link_script(cmd: &mut dyn Linker, sess: &Session, tmpdir: &Path, crate_ty
|
|||
}
|
||||
}
|
||||
|
||||
/// Add arbitrary "user defined" args defined from command line and by `#[link_args]` attributes.
|
||||
/// Add arbitrary "user defined" args defined from command line.
|
||||
/// FIXME: Determine where exactly these args need to be inserted.
|
||||
fn add_user_defined_link_args(
|
||||
cmd: &mut dyn Linker,
|
||||
sess: &Session,
|
||||
codegen_results: &CodegenResults,
|
||||
) {
|
||||
fn add_user_defined_link_args(cmd: &mut dyn Linker, sess: &Session) {
|
||||
cmd.args(&sess.opts.cg.link_args);
|
||||
cmd.args(&*codegen_results.crate_info.link_args);
|
||||
}
|
||||
|
||||
/// Add arbitrary "late link" args defined by the target spec.
|
||||
|
@ -1761,7 +1756,7 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
|
|||
add_rpath_args(cmd, sess, codegen_results, out_filename);
|
||||
|
||||
// OBJECT-FILES-MAYBE, CUSTOMIZATION-POINT
|
||||
add_user_defined_link_args(cmd, sess, codegen_results);
|
||||
add_user_defined_link_args(cmd, sess);
|
||||
|
||||
// NO-OPT-OUT, OBJECT-FILES-NO, AUDIT-ORDER
|
||||
cmd.finalize();
|
||||
|
|
|
@ -186,7 +186,7 @@ impl<'a> GccLinker<'a> {
|
|||
// * On OSX they have their own linker, not binutils'
|
||||
// * For WebAssembly the only functional linker is LLD, which doesn't
|
||||
// support hint flags
|
||||
!self.sess.target.is_like_osx && self.sess.target.arch != "wasm32"
|
||||
!self.sess.target.is_like_osx && !self.sess.target.is_like_wasm
|
||||
}
|
||||
|
||||
// Some platforms take hints about whether a library is static or dynamic.
|
||||
|
|
|
@ -754,7 +754,6 @@ impl CrateInfo {
|
|||
is_no_builtins: Default::default(),
|
||||
native_libraries: Default::default(),
|
||||
used_libraries: tcx.native_libraries(LOCAL_CRATE).iter().map(Into::into).collect(),
|
||||
link_args: tcx.link_args(LOCAL_CRATE),
|
||||
crate_name: Default::default(),
|
||||
used_crates_dynamic: cstore::used_crates(tcx, LinkagePreference::RequireDynamic),
|
||||
used_crates_static: cstore::used_crates(tcx, LinkagePreference::RequireStatic),
|
||||
|
|
|
@ -139,7 +139,6 @@ pub struct CrateInfo {
|
|||
pub native_libraries: FxHashMap<CrateNum, Vec<NativeLib>>,
|
||||
pub crate_name: FxHashMap<CrateNum, String>,
|
||||
pub used_libraries: Vec<NativeLib>,
|
||||
pub link_args: Lrc<Vec<String>>,
|
||||
pub used_crate_source: FxHashMap<CrateNum, Lrc<CrateSource>>,
|
||||
pub used_crates_static: Vec<(CrateNum, LibSource)>,
|
||||
pub used_crates_dynamic: Vec<(CrateNum, LibSource)>,
|
||||
|
|
|
@ -161,7 +161,7 @@ pub fn supported_target_features(sess: &Session) -> &'static [(&'static str, Opt
|
|||
"mips" | "mips64" => MIPS_ALLOWED_FEATURES,
|
||||
"powerpc" | "powerpc64" => POWERPC_ALLOWED_FEATURES,
|
||||
"riscv32" | "riscv64" => RISCV_ALLOWED_FEATURES,
|
||||
"wasm32" => WASM_ALLOWED_FEATURES,
|
||||
"wasm32" | "wasm64" => WASM_ALLOWED_FEATURES,
|
||||
_ => &[],
|
||||
}
|
||||
}
|
||||
|
|
|
@ -258,9 +258,6 @@ declare_features! (
|
|||
// feature-group-start: actual feature gates
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/// Allows using the `#[link_args]` attribute.
|
||||
(active, link_args, "1.0.0", Some(29596), None),
|
||||
|
||||
/// Allows defining identifiers beyond ASCII.
|
||||
(active, non_ascii_idents, "1.0.0", Some(55467), None),
|
||||
|
||||
|
|
|
@ -279,11 +279,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
|||
|
||||
// Linking:
|
||||
gated!(naked, AssumedUsed, template!(Word), naked_functions, experimental!(naked)),
|
||||
gated!(
|
||||
link_args, Normal, template!(NameValueStr: "args"),
|
||||
"the `link_args` attribute is experimental and not portable across platforms, \
|
||||
it is recommended to use `#[link(name = \"foo\")] instead",
|
||||
),
|
||||
gated!(
|
||||
link_ordinal, AssumedUsed, template!(List: "ordinal"), raw_dylib,
|
||||
experimental!(link_ordinal)
|
||||
|
|
|
@ -128,6 +128,10 @@ declare_features! (
|
|||
/// Allows comparing raw pointers during const eval.
|
||||
(removed, const_compare_raw_pointers, "1.46.0", Some(53020), None,
|
||||
Some("cannot be allowed in const eval in any meaningful way")),
|
||||
/// Allows using the `#[link_args]` attribute.
|
||||
(removed, link_args, "1.53.0", Some(29596), None,
|
||||
Some("removed in favor of using `-C link-arg=ARG` on command line, \
|
||||
which is available from cargo build scripts with `cargo:rustc-link-arg` now")),
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// feature-group-end: removed features
|
||||
|
|
|
@ -26,7 +26,6 @@ pub use rmeta::{provide, provide_extern};
|
|||
|
||||
mod dependency_format;
|
||||
mod foreign_modules;
|
||||
mod link_args;
|
||||
mod native_libs;
|
||||
mod rmeta;
|
||||
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
crate fn collect(tcx: TyCtxt<'_>) -> Vec<String> {
|
||||
let mut collector = Collector { tcx, args: Vec::new() };
|
||||
tcx.hir().krate().visit_all_item_likes(&mut collector);
|
||||
|
||||
for attr in tcx.hir().attrs(hir::CRATE_HIR_ID).iter() {
|
||||
if attr.has_name(sym::link_args) {
|
||||
if let Some(linkarg) = attr.value_str() {
|
||||
collector.add_link_args(linkarg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
collector.args
|
||||
}
|
||||
|
||||
struct Collector<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
args: Vec<String>,
|
||||
}
|
||||
|
||||
impl<'tcx> ItemLikeVisitor<'tcx> for Collector<'tcx> {
|
||||
fn visit_item(&mut self, it: &'tcx hir::Item<'tcx>) {
|
||||
let abi = match it.kind {
|
||||
hir::ItemKind::ForeignMod { abi, .. } => abi,
|
||||
_ => return,
|
||||
};
|
||||
if abi == Abi::Rust || abi == Abi::RustIntrinsic || abi == Abi::PlatformIntrinsic {
|
||||
return;
|
||||
}
|
||||
|
||||
// First, add all of the custom #[link_args] attributes
|
||||
let sess = &self.tcx.sess;
|
||||
for m in
|
||||
self.tcx.hir().attrs(it.hir_id()).iter().filter(|a| sess.check_name(a, sym::link_args))
|
||||
{
|
||||
if let Some(linkarg) = m.value_str() {
|
||||
self.add_link_args(linkarg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_trait_item(&mut self, _it: &'tcx hir::TraitItem<'tcx>) {}
|
||||
fn visit_impl_item(&mut self, _it: &'tcx hir::ImplItem<'tcx>) {}
|
||||
fn visit_foreign_item(&mut self, _it: &'tcx hir::ForeignItem<'tcx>) {}
|
||||
}
|
||||
|
||||
impl<'tcx> Collector<'tcx> {
|
||||
fn add_link_args(&mut self, args: Symbol) {
|
||||
self.args.extend(args.as_str().split(' ').filter(|s| !s.is_empty()).map(|s| s.to_string()))
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
use crate::creader::{CStore, LoadedMacro};
|
||||
use crate::foreign_modules;
|
||||
use crate::link_args;
|
||||
use crate::native_libs;
|
||||
use crate::rmeta::{self, encoder};
|
||||
|
||||
|
@ -295,10 +294,6 @@ pub fn provide(providers: &mut Providers) {
|
|||
foreign_modules::collect(tcx).into_iter().map(|m| (m.def_id, m)).collect();
|
||||
Lrc::new(modules)
|
||||
},
|
||||
link_args: |tcx, cnum| {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
Lrc::new(link_args::collect(tcx))
|
||||
},
|
||||
|
||||
// Returns a map from a sufficiently visible external item (i.e., an
|
||||
// external item that is visible from at least one local module) to a
|
||||
|
|
|
@ -1253,11 +1253,6 @@ rustc_queries! {
|
|||
desc { |tcx| "native_library_kind({})", tcx.def_path_str(def_id) }
|
||||
}
|
||||
|
||||
query link_args(_: CrateNum) -> Lrc<Vec<String>> {
|
||||
eval_always
|
||||
desc { "looking up link arguments for a crate" }
|
||||
}
|
||||
|
||||
/// Does lifetime resolution, but does not descend into trait items. This
|
||||
/// should only be used for resolving lifetimes of on trait definitions,
|
||||
/// and is used to avoid cycles. Importantly, `resolve_lifetimes` still visits
|
||||
|
|
|
@ -822,6 +822,9 @@ pub fn default_configuration(sess: &Session) -> CrateConfig {
|
|||
}
|
||||
}
|
||||
ret.insert((sym::target_arch, Some(Symbol::intern(arch))));
|
||||
if sess.target.is_like_wasm {
|
||||
ret.insert((sym::wasm, None));
|
||||
}
|
||||
ret.insert((sym::target_endian, Some(Symbol::intern(end.as_str()))));
|
||||
ret.insert((sym::target_pointer_width, Some(Symbol::intern(&wordsz))));
|
||||
ret.insert((sym::target_env, Some(Symbol::intern(env))));
|
||||
|
|
|
@ -1294,6 +1294,7 @@ symbols! {
|
|||
vreg,
|
||||
vreg_low16,
|
||||
warn,
|
||||
wasm,
|
||||
wasm_import_module,
|
||||
wasm_target_feature,
|
||||
while_let,
|
||||
|
|
|
@ -198,7 +198,7 @@ fn compute_symbol_name(
|
|||
//
|
||||
// [1]: https://bugs.llvm.org/show_bug.cgi?id=44316
|
||||
if is_foreign
|
||||
&& (tcx.sess.target.arch != "wasm32"
|
||||
&& (!tcx.sess.target.is_like_wasm
|
||||
|| !tcx.wasm_import_module_map(def_id.krate).contains_key(&def_id))
|
||||
{
|
||||
if let Some(name) = attrs.link_name {
|
||||
|
|
|
@ -20,6 +20,7 @@ mod sparc;
|
|||
mod sparc64;
|
||||
mod wasm32;
|
||||
mod wasm32_bindgen_compat;
|
||||
mod wasm64;
|
||||
mod x86;
|
||||
mod x86_64;
|
||||
mod x86_win64;
|
||||
|
@ -652,6 +653,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
|
|||
_ => wasm32_bindgen_compat::compute_abi_info(self),
|
||||
},
|
||||
"asmjs" => wasm32::compute_abi_info(cx, self),
|
||||
"wasm64" => wasm64::compute_abi_info(cx, self),
|
||||
a => return Err(format!("unrecognized arch \"{}\" in target specification", a)),
|
||||
}
|
||||
|
||||
|
|
58
compiler/rustc_target/src/abi/call/wasm64.rs
Normal file
58
compiler/rustc_target/src/abi/call/wasm64.rs
Normal file
|
@ -0,0 +1,58 @@
|
|||
use crate::abi::call::{ArgAbi, FnAbi, Uniform};
|
||||
use crate::abi::{HasDataLayout, LayoutOf, TyAndLayout, TyAndLayoutMethods};
|
||||
|
||||
fn unwrap_trivial_aggregate<'a, Ty, C>(cx: &C, val: &mut ArgAbi<'a, Ty>) -> bool
|
||||
where
|
||||
Ty: TyAndLayoutMethods<'a, C> + Copy,
|
||||
C: LayoutOf<Ty = Ty, TyAndLayout = TyAndLayout<'a, Ty>> + HasDataLayout,
|
||||
{
|
||||
if val.layout.is_aggregate() {
|
||||
if let Some(unit) = val.layout.homogeneous_aggregate(cx).ok().and_then(|ha| ha.unit()) {
|
||||
let size = val.layout.size;
|
||||
if unit.size == size {
|
||||
val.cast_to(Uniform { unit, total: size });
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
fn classify_ret<'a, Ty, C>(cx: &C, ret: &mut ArgAbi<'a, Ty>)
|
||||
where
|
||||
Ty: TyAndLayoutMethods<'a, C> + Copy,
|
||||
C: LayoutOf<Ty = Ty, TyAndLayout = TyAndLayout<'a, Ty>> + HasDataLayout,
|
||||
{
|
||||
ret.extend_integer_width_to(64);
|
||||
if ret.layout.is_aggregate() && !unwrap_trivial_aggregate(cx, ret) {
|
||||
ret.make_indirect();
|
||||
}
|
||||
}
|
||||
|
||||
fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>)
|
||||
where
|
||||
Ty: TyAndLayoutMethods<'a, C> + Copy,
|
||||
C: LayoutOf<Ty = Ty, TyAndLayout = TyAndLayout<'a, Ty>> + HasDataLayout,
|
||||
{
|
||||
arg.extend_integer_width_to(64);
|
||||
if arg.layout.is_aggregate() && !unwrap_trivial_aggregate(cx, arg) {
|
||||
arg.make_indirect_byval();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
|
||||
where
|
||||
Ty: TyAndLayoutMethods<'a, C> + Copy,
|
||||
C: LayoutOf<Ty = Ty, TyAndLayout = TyAndLayout<'a, Ty>> + HasDataLayout,
|
||||
{
|
||||
if !fn_abi.ret.is_ignore() {
|
||||
classify_ret(cx, &mut fn_abi.ret);
|
||||
}
|
||||
|
||||
for arg in &mut fn_abi.args {
|
||||
if arg.is_ignore() {
|
||||
continue;
|
||||
}
|
||||
classify_arg(cx, arg);
|
||||
}
|
||||
}
|
|
@ -79,7 +79,7 @@ mod solaris_base;
|
|||
mod thumb_base;
|
||||
mod uefi_msvc_base;
|
||||
mod vxworks_base;
|
||||
mod wasm32_base;
|
||||
mod wasm_base;
|
||||
mod windows_gnu_base;
|
||||
mod windows_msvc_base;
|
||||
mod windows_uwp_gnu_base;
|
||||
|
@ -842,6 +842,7 @@ supported_targets! {
|
|||
("wasm32-unknown-emscripten", wasm32_unknown_emscripten),
|
||||
("wasm32-unknown-unknown", wasm32_unknown_unknown),
|
||||
("wasm32-wasi", wasm32_wasi),
|
||||
("wasm64-unknown-unknown", wasm64_unknown_unknown),
|
||||
|
||||
("thumbv6m-none-eabi", thumbv6m_none_eabi),
|
||||
("thumbv7m-none-eabi", thumbv7m_none_eabi),
|
||||
|
@ -1076,6 +1077,8 @@ pub struct TargetOptions {
|
|||
pub is_like_emscripten: bool,
|
||||
/// Whether the target toolchain is like Fuchsia's.
|
||||
pub is_like_fuchsia: bool,
|
||||
/// Whether a target toolchain is like WASM.
|
||||
pub is_like_wasm: bool,
|
||||
/// Version of DWARF to use if not using the default.
|
||||
/// Useful because some platforms (osx, bsd) only want up to DWARF2.
|
||||
pub dwarf_version: Option<u32>,
|
||||
|
@ -1295,6 +1298,7 @@ impl Default for TargetOptions {
|
|||
is_like_emscripten: false,
|
||||
is_like_msvc: false,
|
||||
is_like_fuchsia: false,
|
||||
is_like_wasm: false,
|
||||
dwarf_version: None,
|
||||
linker_is_gnu: false,
|
||||
allows_weak_linkage: true,
|
||||
|
@ -1789,6 +1793,7 @@ impl Target {
|
|||
key!(is_like_msvc, bool);
|
||||
key!(is_like_emscripten, bool);
|
||||
key!(is_like_fuchsia, bool);
|
||||
key!(is_like_wasm, bool);
|
||||
key!(dwarf_version, Option<u32>);
|
||||
key!(linker_is_gnu, bool);
|
||||
key!(allows_weak_linkage, bool);
|
||||
|
@ -2027,6 +2032,7 @@ impl ToJson for Target {
|
|||
target_option_val!(is_like_msvc);
|
||||
target_option_val!(is_like_emscripten);
|
||||
target_option_val!(is_like_fuchsia);
|
||||
target_option_val!(is_like_wasm);
|
||||
target_option_val!(dwarf_version);
|
||||
target_option_val!(linker_is_gnu);
|
||||
target_option_val!(allows_weak_linkage);
|
||||
|
|
|
@ -50,6 +50,7 @@ impl Target {
|
|||
// and you certainly want "unknown" for the OS name.
|
||||
fn can_use_os_unknown(&self) -> bool {
|
||||
self.llvm_target == "wasm32-unknown-unknown"
|
||||
|| self.llvm_target == "wasm64-unknown-unknown"
|
||||
|| (self.env == "sgx" && self.vendor == "fortanix")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use super::wasm32_base;
|
||||
use super::wasm_base;
|
||||
use super::{LinkArgs, LinkerFlavor, PanicStrategy, Target, TargetOptions};
|
||||
|
||||
pub fn target() -> Target {
|
||||
let mut options = wasm32_base::options();
|
||||
let mut options = wasm_base::options();
|
||||
|
||||
let clang_args = options.pre_link_args.entry(LinkerFlavor::Gcc).or_default();
|
||||
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
//! This target is more or less managed by the Rust and WebAssembly Working
|
||||
//! Group nowadays at <https://github.com/rustwasm>.
|
||||
|
||||
use super::wasm32_base;
|
||||
use super::wasm_base;
|
||||
use super::{LinkerFlavor, LldFlavor, Target};
|
||||
|
||||
pub fn target() -> Target {
|
||||
let mut options = wasm32_base::options();
|
||||
let mut options = wasm_base::options();
|
||||
options.os = "unknown".to_string();
|
||||
options.linker_flavor = LinkerFlavor::Lld(LldFlavor::Wasm);
|
||||
let clang_args = options.pre_link_args.entry(LinkerFlavor::Gcc).or_default();
|
||||
|
|
|
@ -72,11 +72,11 @@
|
|||
//! best we can with this target. Don't start relying on too much here unless
|
||||
//! you know what you're getting in to!
|
||||
|
||||
use super::wasm32_base;
|
||||
use super::wasm_base;
|
||||
use super::{crt_objects, LinkerFlavor, LldFlavor, Target};
|
||||
|
||||
pub fn target() -> Target {
|
||||
let mut options = wasm32_base::options();
|
||||
let mut options = wasm_base::options();
|
||||
|
||||
options.os = "wasi".to_string();
|
||||
options.linker_flavor = LinkerFlavor::Lld(LldFlavor::Wasm);
|
||||
|
|
39
compiler/rustc_target/src/spec/wasm64_unknown_unknown.rs
Normal file
39
compiler/rustc_target/src/spec/wasm64_unknown_unknown.rs
Normal file
|
@ -0,0 +1,39 @@
|
|||
//! A "bare wasm" target representing a WebAssembly output that makes zero
|
||||
//! assumptions about its environment.
|
||||
//!
|
||||
//! The `wasm64-unknown-unknown` target is intended to encapsulate use cases
|
||||
//! that do not rely on any imported functionality. The binaries generated are
|
||||
//! entirely self-contained by default when using the standard library. Although
|
||||
//! the standard library is available, most of it returns an error immediately
|
||||
//! (e.g. trying to create a TCP stream or something like that).
|
||||
|
||||
use super::wasm_base;
|
||||
use super::{LinkerFlavor, LldFlavor, Target};
|
||||
|
||||
pub fn target() -> Target {
|
||||
let mut options = wasm_base::options();
|
||||
options.os = "unknown".to_string();
|
||||
options.linker_flavor = LinkerFlavor::Lld(LldFlavor::Wasm);
|
||||
let clang_args = options.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap();
|
||||
|
||||
// Make sure clang uses LLD as its linker and is configured appropriately
|
||||
// otherwise
|
||||
clang_args.push("--target=wasm64-unknown-unknown".to_string());
|
||||
|
||||
// For now this target just never has an entry symbol no matter the output
|
||||
// type, so unconditionally pass this.
|
||||
clang_args.push("-Wl,--no-entry".to_string());
|
||||
options
|
||||
.pre_link_args
|
||||
.get_mut(&LinkerFlavor::Lld(LldFlavor::Wasm))
|
||||
.unwrap()
|
||||
.push("--no-entry".to_string());
|
||||
|
||||
Target {
|
||||
llvm_target: "wasm64-unknown-unknown".to_string(),
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-p:64:64-i64:64-n32:64-S128".to_string(),
|
||||
arch: "wasm64".to_string(),
|
||||
options,
|
||||
}
|
||||
}
|
|
@ -60,6 +60,8 @@ pub fn options() -> TargetOptions {
|
|||
pre_link_args.insert(LinkerFlavor::Gcc, clang_args);
|
||||
|
||||
TargetOptions {
|
||||
is_like_wasm: true,
|
||||
|
||||
// we allow dynamic linking, but only cdylibs. Basically we allow a
|
||||
// final library artifact that exports some symbols (a wasm module) but
|
||||
// we don't allow intermediate `dylib` crate types
|
|
@ -190,6 +190,8 @@ use crate::ptr;
|
|||
/// let ptr = uninit.as_mut_ptr();
|
||||
///
|
||||
/// // Initializing the `name` field
|
||||
/// // Using `write` instead of assignment via `=` to not call `drop` on the
|
||||
/// // old, uninitialized value.
|
||||
/// unsafe { addr_of_mut!((*ptr).name).write("Bob".to_string()); }
|
||||
///
|
||||
/// // Initializing the `list` field
|
||||
|
|
|
@ -428,19 +428,32 @@ pub const unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) {
|
|||
#[inline]
|
||||
#[rustc_const_unstable(feature = "const_swap", issue = "83163")]
|
||||
pub(crate) const unsafe fn swap_nonoverlapping_one<T>(x: *mut T, y: *mut T) {
|
||||
// For types smaller than the block optimization below,
|
||||
// just swap directly to avoid pessimizing codegen.
|
||||
if mem::size_of::<T>() < 32 {
|
||||
// SAFETY: the caller must guarantee that `x` and `y` are valid
|
||||
// for writes, properly aligned, and non-overlapping.
|
||||
unsafe {
|
||||
let z = read(x);
|
||||
copy_nonoverlapping(y, x, 1);
|
||||
write(y, z);
|
||||
// NOTE(eddyb) SPIR-V's Logical addressing model doesn't allow for arbitrary
|
||||
// reinterpretation of values as (chunkable) byte arrays, and the loop in the
|
||||
// block optimization in `swap_nonoverlapping_bytes` is hard to rewrite back
|
||||
// into the (unoptimized) direct swapping implementation, so we disable it.
|
||||
// FIXME(eddyb) the block optimization also prevents MIR optimizations from
|
||||
// understanding `mem::replace`, `Option::take`, etc. - a better overall
|
||||
// solution might be to make `swap_nonoverlapping` into an intrinsic, which
|
||||
// a backend can choose to implement using the block optimization, or not.
|
||||
#[cfg(not(target_arch = "spirv"))]
|
||||
{
|
||||
// Only apply the block optimization in `swap_nonoverlapping_bytes` for types
|
||||
// at least as large as the block size, to avoid pessimizing codegen.
|
||||
if mem::size_of::<T>() >= 32 {
|
||||
// SAFETY: the caller must uphold the safety contract for `swap_nonoverlapping`.
|
||||
unsafe { swap_nonoverlapping(x, y, 1) };
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// SAFETY: the caller must uphold the safety contract for `swap_nonoverlapping`.
|
||||
unsafe { swap_nonoverlapping(x, y, 1) };
|
||||
}
|
||||
|
||||
// Direct swapping, for the cases not going through the block optimization.
|
||||
// SAFETY: the caller must guarantee that `x` and `y` are valid
|
||||
// for writes, properly aligned, and non-overlapping.
|
||||
unsafe {
|
||||
let z = read(x);
|
||||
copy_nonoverlapping(y, x, 1);
|
||||
write(y, z);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1479,6 +1492,10 @@ fnptr_impls_args! { A, B, C, D, E, F, G, H, I, J, K, L }
|
|||
/// as all other references. This macro can create a raw pointer *without* creating
|
||||
/// a reference first.
|
||||
///
|
||||
/// Note, however, that the `expr` in `addr_of!(expr)` is still subject to all
|
||||
/// the usual rules. In particular, `addr_of!(*ptr::null())` is Undefined
|
||||
/// Behavior because it dereferences a NULL pointer.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
|
@ -1495,6 +1512,10 @@ fnptr_impls_args! { A, B, C, D, E, F, G, H, I, J, K, L }
|
|||
/// let raw_f2 = ptr::addr_of!(packed.f2);
|
||||
/// assert_eq!(unsafe { raw_f2.read_unaligned() }, 2);
|
||||
/// ```
|
||||
///
|
||||
/// See [`addr_of_mut`] for how to create a pointer to unininitialized data.
|
||||
/// Doing that with `addr_of` would not make much sense since one could only
|
||||
/// read the data, and that would be Undefined Behavior.
|
||||
#[stable(feature = "raw_ref_macros", since = "1.51.0")]
|
||||
#[rustc_macro_transparency = "semitransparent"]
|
||||
#[allow_internal_unstable(raw_ref_op)]
|
||||
|
@ -1511,7 +1532,13 @@ pub macro addr_of($place:expr) {
|
|||
/// as all other references. This macro can create a raw pointer *without* creating
|
||||
/// a reference first.
|
||||
///
|
||||
/// # Example
|
||||
/// Note, however, that the `expr` in `addr_of_mut!(expr)` is still subject to all
|
||||
/// the usual rules. In particular, `addr_of_mut!(*ptr::null_mut())` is Undefined
|
||||
/// Behavior because it dereferences a NULL pointer.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// **Creating a pointer to unaligned data:**
|
||||
///
|
||||
/// ```
|
||||
/// use std::ptr;
|
||||
|
@ -1528,6 +1555,23 @@ pub macro addr_of($place:expr) {
|
|||
/// unsafe { raw_f2.write_unaligned(42); }
|
||||
/// assert_eq!({packed.f2}, 42); // `{...}` forces copying the field instead of creating a reference.
|
||||
/// ```
|
||||
///
|
||||
/// **Creating a pointer to uninitialized data:**
|
||||
///
|
||||
/// ```rust
|
||||
/// use std::{ptr, mem::MaybeUninit};
|
||||
///
|
||||
/// struct Demo {
|
||||
/// field: bool,
|
||||
/// }
|
||||
///
|
||||
/// let mut uninit = MaybeUninit::<Demo>::uninit();
|
||||
/// // `&uninit.as_mut().field` would create a reference to an uninitialized `bool`,
|
||||
/// // and thus be Undefined Behavior!
|
||||
/// let f1_ptr = unsafe { ptr::addr_of_mut!((*uninit.as_mut_ptr()).field) };
|
||||
/// unsafe { f1_ptr.write(true); }
|
||||
/// let init = unsafe { uninit.assume_init() };
|
||||
/// ```
|
||||
#[stable(feature = "raw_ref_macros", since = "1.51.0")]
|
||||
#[rustc_macro_transparency = "semitransparent"]
|
||||
#[allow_internal_unstable(raw_ref_op)]
|
||||
|
|
|
@ -282,7 +282,6 @@
|
|||
#![feature(intra_doc_pointers)]
|
||||
#![feature(iter_zip)]
|
||||
#![feature(lang_items)]
|
||||
#![feature(link_args)]
|
||||
#![feature(linkage)]
|
||||
#![feature(llvm_asm)]
|
||||
#![feature(log_syntax)]
|
||||
|
|
|
@ -216,6 +216,7 @@ target | std | host | notes
|
|||
`thumbv7a-uwp-windows-msvc` | ✓ | |
|
||||
`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode ARMv7a Linux with NEON, MUSL
|
||||
`thumbv4t-none-eabi` | * | | ARMv4T T32
|
||||
`wasm64-unknown-unknown` | * | | WebAssembly
|
||||
`x86_64-apple-ios-macabi` | ✓ | | Apple Catalyst on x86_64
|
||||
`x86_64-apple-tvos` | * | | x86 64-bit tvOS
|
||||
`x86_64-unknown-none-linuxkernel` | * | | Linux kernel modules
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
# `link_args`
|
||||
|
||||
The tracking issue for this feature is: [#29596]
|
||||
|
||||
[#29596]: https://github.com/rust-lang/rust/issues/29596
|
||||
|
||||
------------------------
|
||||
|
||||
You can tell `rustc` how to customize linking, and that is via the `link_args`
|
||||
attribute. This attribute is applied to `extern` blocks and specifies raw flags
|
||||
which need to get passed to the linker when producing an artifact. An example
|
||||
usage would be:
|
||||
|
||||
```rust,no_run
|
||||
#![feature(link_args)]
|
||||
|
||||
#[link_args = "-foo -bar -baz"]
|
||||
extern "C" {}
|
||||
# fn main() {}
|
||||
```
|
||||
|
||||
Note that this feature is currently hidden behind the `feature(link_args)` gate
|
||||
because this is not a sanctioned way of performing linking. Right now `rustc`
|
||||
shells out to the system linker (`gcc` on most systems, `link.exe` on MSVC), so
|
||||
it makes sense to provide extra command line arguments, but this will not
|
||||
always be the case. In the future `rustc` may use LLVM directly to link native
|
||||
libraries, in which case `link_args` will have no meaning. You can achieve the
|
||||
same effect as the `link_args` attribute with the `-C link-args` argument to
|
||||
`rustc`.
|
||||
|
||||
It is highly recommended to *not* use this attribute, and rather use the more
|
||||
formal `#[link(...)]` attribute on `extern` blocks instead.
|
|
@ -306,13 +306,19 @@ fn call_foo(arg: i32) {
|
|||
sym foo,
|
||||
// 1st argument in rdi, which is caller-saved
|
||||
inout("rdi") arg => _,
|
||||
// All caller-saved registers must be marked as clobberred
|
||||
// All caller-saved registers must be marked as clobbered
|
||||
out("rax") _, out("rcx") _, out("rdx") _, out("rsi") _,
|
||||
out("r8") _, out("r9") _, out("r10") _, out("r11") _,
|
||||
out("xmm0") _, out("xmm1") _, out("xmm2") _, out("xmm3") _,
|
||||
out("xmm4") _, out("xmm5") _, out("xmm6") _, out("xmm7") _,
|
||||
out("xmm8") _, out("xmm9") _, out("xmm10") _, out("xmm11") _,
|
||||
out("xmm12") _, out("xmm13") _, out("xmm14") _, out("xmm15") _,
|
||||
// Also mark AVX-512 registers as clobbered. This is accepted by the
|
||||
// compiler even if AVX-512 is not enabled on the current target.
|
||||
out("xmm16") _, out("xmm17") _, out("xmm18") _, out("xmm19") _,
|
||||
out("xmm20") _, out("xmm21") _, out("xmm22") _, out("xmm13") _,
|
||||
out("xmm24") _, out("xmm25") _, out("xmm26") _, out("xmm27") _,
|
||||
out("xmm28") _, out("xmm29") _, out("xmm30") _, out("xmm31") _,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -487,6 +487,7 @@ impl<'a> fmt::Display for Display<'a> {
|
|||
"windows" => "Windows",
|
||||
_ => "",
|
||||
},
|
||||
(sym::wasm, None) => "WebAssembly",
|
||||
(sym::target_arch, Some(arch)) => match &*arch.as_str() {
|
||||
"aarch64" => "AArch64",
|
||||
"arm" => "ARM",
|
||||
|
@ -498,7 +499,7 @@ impl<'a> fmt::Display for Display<'a> {
|
|||
"powerpc64" => "PowerPC-64",
|
||||
"s390x" => "s390x",
|
||||
"sparc64" => "SPARC64",
|
||||
"wasm32" => "WebAssembly",
|
||||
"wasm32" | "wasm64" => "WebAssembly",
|
||||
"x86" => "x86",
|
||||
"x86_64" => "x86-64",
|
||||
_ => "",
|
||||
|
|
|
@ -219,6 +219,15 @@ function hideThemeButtonState() {
|
|||
var titleBeforeSearch = document.title;
|
||||
var searchTitle = null;
|
||||
|
||||
function removeEmptyStringsFromArray(x) {
|
||||
for (var i = 0, len = x.length; i < len; ++i) {
|
||||
if (x[i] === "") {
|
||||
x.splice(i, 1);
|
||||
i -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function clearInputTimeout() {
|
||||
if (searchTimeout !== null) {
|
||||
clearTimeout(searchTimeout);
|
||||
|
@ -756,7 +765,7 @@ function hideThemeButtonState() {
|
|||
results = {}, results_in_args = {}, results_returned = {},
|
||||
split = valLower.split("::");
|
||||
|
||||
split = split.filter(function(segment) { return segment !== ""; });
|
||||
removeEmptyStringsFromArray(split);
|
||||
|
||||
function transformResults(results, isType) {
|
||||
var out = [];
|
||||
|
@ -1338,17 +1347,11 @@ function hideThemeButtonState() {
|
|||
var valGenerics = extractGenerics(val);
|
||||
|
||||
var paths = valLower.split("::");
|
||||
var j;
|
||||
for (j = 0, len = paths.length; j < len; ++j) {
|
||||
if (paths[j] === "") {
|
||||
paths.splice(j, 1);
|
||||
j -= 1;
|
||||
}
|
||||
}
|
||||
removeEmptyStringsFromArray(paths);
|
||||
val = paths[paths.length - 1];
|
||||
var contains = paths.slice(0, paths.length > 1 ? paths.length - 1 : 1);
|
||||
|
||||
var lev;
|
||||
var lev, j;
|
||||
for (j = 0; j < nSearchWords; ++j) {
|
||||
ty = searchIndex[j];
|
||||
if (!ty || (filterCrates !== undefined && ty.crate !== filterCrates)) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags:-Zprint-mono-items=eager
|
||||
// compile-flags:-Zinline-in-all-cgus
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags:-Zprint-mono-items=eager
|
||||
|
||||
#![deny(dead_code)]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags:-Zprint-mono-items=eager
|
||||
// compile-flags:-Zinline-in-all-cgus
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags:-Zprint-mono-items=eager -Zinline-in-all-cgus -Zmir-opt-level=0
|
||||
|
||||
#![deny(dead_code)]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// ignoring this test until MIR codegen has taken over completely
|
||||
// ignore-test
|
||||
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags:-Zprint-mono-items=eager
|
||||
|
||||
#![deny(dead_code)]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags:-Zprint-mono-items=eager
|
||||
// compile-flags:-Zinline-in-all-cgus
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags:-Zprint-mono-items=eager
|
||||
|
||||
#![deny(dead_code)]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags:-Zprint-mono-items=eager
|
||||
// compile-flags:-Zinline-in-all-cgus
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags:-Zprint-mono-items=eager
|
||||
// compile-flags:-Zinline-in-all-cgus
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
|
||||
// We specify -C incremental here because we want to test the partitioning for
|
||||
// incremental compilation
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// We specify -C incremental here because we want to test the partitioning for
|
||||
// incremental compilation
|
||||
// compile-flags:-Zprint-mono-items=eager -Cincremental=tmp/partitioning-tests/extern-generic -Zshare-generics=y
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// We specify -C incremental here because we want to test the partitioning for
|
||||
// incremental compilation
|
||||
// compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/inlining-from-extern-crate
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// We specify -C incremental here because we want to test the partitioning for
|
||||
// incremental compilation
|
||||
// We specify opt-level=0 because `drop_in_place` is `Internal` when optimizing
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// We specify -C incremental here because we want to test the partitioning for
|
||||
// incremental compilation
|
||||
// compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/local-inlining-but-not-all
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// We specify -C incremental here because we want to test the partitioning for
|
||||
// incremental compilation
|
||||
// compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/local-inlining
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// We specify -C incremental here because we want to test the partitioning for
|
||||
// incremental compilation
|
||||
// compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/local-transitive-inlining
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// much sense at the moment.
|
||||
// ignore-test
|
||||
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
// We specify -C incremental here because we want to test the partitioning for
|
||||
// incremental compilation
|
||||
// compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/methods-are-with-self-type
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// no-prefer-dynamic
|
||||
// NOTE: We always compile this test with -Copt-level=0 because higher opt-levels
|
||||
// prevent drop-glue from participating in share-generics.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
|
||||
// We specify -C incremental here because we want to test the partitioning for
|
||||
// incremental compilation
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// compile-flags: -C no-prepopulate-passes -Z mir-opt-level=0
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// compile-flags: -C no-prepopulate-passes -Z mir-opt-level=0
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
21
src/test/codegen/asm-target-clobbers.rs
Normal file
21
src/test/codegen/asm-target-clobbers.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
// only-x86_64
|
||||
// revisions: base avx512
|
||||
// [avx512]compile-flags: -C target-feature=+avx512f
|
||||
|
||||
#![crate_type = "rlib"]
|
||||
#![feature(asm)]
|
||||
|
||||
// CHECK-LABEL: @avx512_clobber
|
||||
// base: call void asm sideeffect inteldialect "", "~{xmm31}"()
|
||||
// avx512: call float asm sideeffect inteldialect "", "=&{xmm31}"()
|
||||
#[no_mangle]
|
||||
pub unsafe fn avx512_clobber() {
|
||||
asm!("", out("zmm31") _, options(nostack, nomem, preserves_flags));
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @eax_clobber
|
||||
// CHECK: call i32 asm sideeffect inteldialect "", "=&{ax}"()
|
||||
#[no_mangle]
|
||||
pub unsafe fn eax_clobber() {
|
||||
asm!("", out("eax") _, options(nostack, nomem, preserves_flags));
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
// - The generator types and variants are marked artificial
|
||||
// - Captured vars from the source are not marked artificial
|
||||
//
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags: -C debuginfo=2 --edition=2018
|
||||
// only-msvc
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// - The generator types and variants are marked artificial
|
||||
// - Captured vars from the source are not marked artificial
|
||||
//
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags: -C debuginfo=2 --edition=2018
|
||||
// ignore-msvc
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// ignore-wasm32-bare compiled with panic=abort by default
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(c_variadic)]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// compile-flags: -C no-prepopulate-passes
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// compile-flags: -g --remap-path-prefix={{cwd}}=/cwd/ --remap-path-prefix={{src-base}}=/base/
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
//
|
||||
// Ensure that we remap the compile unit directory and that we set it to the compilers current
|
||||
// working directory and not something else.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// This tests that debug info for "c-like" enums is properly emitted.
|
||||
// This is ignored for the fallback mode on MSVC due to problems with PDB.
|
||||
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
// ignore-msvc
|
||||
|
||||
// compile-flags: -g -C no-prepopulate-passes
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// This tests that optimized enum debug info accurately reflects the enum layout.
|
||||
// This is ignored for the fallback mode on MSVC due to problems with PDB.
|
||||
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
// ignore-msvc
|
||||
|
||||
// compile-flags: -g -C no-prepopulate-passes
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// compile-flags: -O -C no-prepopulate-passes
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
// min-system-llvm-version: 12.0
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// ignore-windows
|
||||
// ignore-macos
|
||||
// ignore-wasm
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// - The generator types and variants are marked artificial
|
||||
// - Captured vars from the source are not marked artificial
|
||||
//
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags: -C debuginfo=2
|
||||
// only-msvc
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// - The generator types and variants are marked artificial
|
||||
// - Captured vars from the source are not marked artificial
|
||||
//
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags: -C debuginfo=2 --edition=2018
|
||||
// ignore-msvc
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![crate_type="rlib"]
|
||||
// compile-flags: -Copt-level=3 -g
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
|
||||
#[no_mangle]
|
||||
#[inline(always)]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags: -Z instrument-mcount
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// only-macos
|
||||
// no-system-llvm
|
||||
// compile-flags: -O
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags: -O -C no-prepopulate-passes
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
|
||||
// compile-flags: -g --remap-path-prefix={{cwd}}=/the/aux-cwd --remap-path-prefix={{src-base}}/remap_path_prefix/auxiliary=/the/aux-src
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags: -g --remap-path-prefix={{cwd}}=/the/aux-cwd --remap-path-prefix={{src-base}}/remap_path_prefix/auxiliary=/the/aux-src
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// ignore-windows
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
|
||||
// compile-flags: -g -C no-prepopulate-passes --remap-path-prefix={{cwd}}=/the/cwd --remap-path-prefix={{src-base}}=/the/src
|
||||
// aux-build:remap_path_prefix_aux.rs
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// compile-flags: -O
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// compile-flags: -C no-prepopulate-passes
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
|
||||
// min-system-llvm-version: 12.0
|
||||
// ignore-arm
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// compile-flags: -C no-prepopulate-passes
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
|
||||
// min-system-llvm-version: 12.0
|
||||
// ignore-aarch64
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// compile-flags: -C no-prepopulate-passes
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
|
||||
// min-system-llvm-version: 12.0
|
||||
// only-mips64
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
// only-riscv64
|
||||
// only-linux
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
// only-riscv64
|
||||
// only-linux
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
// only-riscv64
|
||||
// only-linux
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// compile-flags: -C no-prepopulate-passes
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// compile-flags: -C no-prepopulate-passes
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// compile-flags: -C no-prepopulate-passes
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// "target-cpu" attribute in LLVM.
|
||||
|
||||
// no-prefer-dynamic
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags: -C no-prepopulate-passes -C panic=abort -C linker-plugin-lto -Cpasses=name-anon-globals
|
||||
|
||||
#![crate_type = "staticlib"]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// "tune-cpu" attribute in LLVM.
|
||||
|
||||
// no-prefer-dynamic
|
||||
// ignore-tidy-linelength
|
||||
//
|
||||
// compile-flags: -C no-prepopulate-passes -C panic=abort -C linker-plugin-lto -Cpasses=name-anon-globals -Z tune-cpu=generic
|
||||
|
||||
#![crate_type = "staticlib"]
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// ignore-tidy-linelength
|
||||
|
||||
// Require a gdb or lldb that can read DW_TAG_variant_part.
|
||||
// min-gdb-version: 8.2
|
||||
// rust-lldb
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// ignore-tidy-linelength
|
||||
|
||||
// min-lldb-version: 310
|
||||
|
||||
// compile-flags:-g
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// ignore-tidy-linelength
|
||||
// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
|
||||
// min-lldb-version: 310
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// ignore-tidy-linelength
|
||||
// min-lldb-version: 310
|
||||
|
||||
// compile-flags:-g
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// ignore-tidy-linelength
|
||||
|
||||
// ignore-aarch64
|
||||
// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
|
||||
// min-lldb-version: 310
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// ignore-tidy-linelength
|
||||
|
||||
// min-lldb-version: 310
|
||||
|
||||
// This fails on lldb 6.0.1 on x86-64 Fedora 28; so mark it macOS-only
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// ignore-tidy-linelength
|
||||
|
||||
// min-lldb-version: 310
|
||||
|
||||
// compile-flags:-g
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// ignore-tidy-linelength
|
||||
// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
|
||||
// min-lldb-version: 310
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue