Reformat use
declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
This commit is contained in:
parent
118f9350c5
commit
84ac80f192
1865 changed files with 8367 additions and 9199 deletions
|
@ -23,10 +23,11 @@
|
|||
//! allows for doing a more fine-grained check to see if pre- or post-lto data
|
||||
//! was re-used.
|
||||
|
||||
use crate::errors;
|
||||
use std::borrow::Cow;
|
||||
use std::fmt;
|
||||
|
||||
use rustc_ast as ast;
|
||||
use rustc_data_structures::unord::UnordMap;
|
||||
use rustc_data_structures::unord::UnordSet;
|
||||
use rustc_data_structures::unord::{UnordMap, UnordSet};
|
||||
use rustc_errors::{DiagArgValue, IntoDiagArg};
|
||||
use rustc_hir::def_id::LOCAL_CRATE;
|
||||
use rustc_middle::mir::mono::CodegenUnitNameBuilder;
|
||||
|
@ -34,11 +35,11 @@ use rustc_middle::ty::TyCtxt;
|
|||
use rustc_session::Session;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Span, Symbol};
|
||||
use std::borrow::Cow;
|
||||
use std::fmt;
|
||||
use thin_vec::ThinVec;
|
||||
use tracing::debug;
|
||||
|
||||
use crate::errors;
|
||||
|
||||
#[allow(missing_docs)]
|
||||
pub fn assert_module_sources(tcx: TyCtxt<'_>, set_reuse: &dyn Fn(&mut CguReuseTracker)) {
|
||||
tcx.dep_graph.with_ignore(|| {
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
use rustc_data_structures::fx::FxIndexSet;
|
||||
use rustc_data_structures::memmap::Mmap;
|
||||
use rustc_session::cstore::DllImport;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::Symbol;
|
||||
|
||||
use super::metadata::search_for_section;
|
||||
|
||||
use ar_archive_writer::{write_archive_to_stream, ArchiveKind, NewArchiveMember};
|
||||
pub use ar_archive_writer::{ObjectReader, DEFAULT_OBJECT_READER};
|
||||
use object::read::archive::ArchiveFile;
|
||||
use object::read::macho::FatArch;
|
||||
use tempfile::Builder as TempFileBuilder;
|
||||
|
||||
use std::error::Error;
|
||||
use std::fs::{self, File};
|
||||
use std::io::{self, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use ar_archive_writer::{write_archive_to_stream, ArchiveKind, NewArchiveMember};
|
||||
pub use ar_archive_writer::{ObjectReader, DEFAULT_OBJECT_READER};
|
||||
use object::read::archive::ArchiveFile;
|
||||
use object::read::macho::FatArch;
|
||||
use rustc_data_structures::fx::FxIndexSet;
|
||||
use rustc_data_structures::memmap::Mmap;
|
||||
use rustc_session::cstore::DllImport;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use tempfile::Builder as TempFileBuilder;
|
||||
|
||||
use super::metadata::search_for_section;
|
||||
// Re-exporting for rustc_codegen_llvm::back::archive
|
||||
pub use crate::errors::{ArchiveBuildFailure, ExtractBundledLibsError, UnknownArchiveKind};
|
||||
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
//! read the arguments that are built up.
|
||||
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
use std::mem;
|
||||
use std::process::{self, Output};
|
||||
use std::{fmt, io, mem};
|
||||
|
||||
use rustc_target::spec::LldFlavor;
|
||||
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
use std::collections::BTreeSet;
|
||||
use std::ffi::OsString;
|
||||
use std::fs::{read, File, OpenOptions};
|
||||
use std::io::{BufWriter, Write};
|
||||
use std::ops::Deref;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{ExitStatus, Output, Stdio};
|
||||
use std::{env, fmt, fs, io, mem, str};
|
||||
|
||||
use cc::windows_registry;
|
||||
use itertools::Itertools;
|
||||
use regex::Regex;
|
||||
use rustc_arena::TypedArena;
|
||||
use rustc_ast::CRATE_NODE_ID;
|
||||
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
|
||||
|
@ -12,9 +24,10 @@ use rustc_middle::bug;
|
|||
use rustc_middle::middle::debugger_visualizer::DebuggerVisualizerFile;
|
||||
use rustc_middle::middle::dependency_format::Linkage;
|
||||
use rustc_middle::middle::exported_symbols::SymbolExportKind;
|
||||
use rustc_session::config::LinkerFeaturesCli;
|
||||
use rustc_session::config::{self, CFGuard, CrateType, DebugInfo, OutFileName, Strip};
|
||||
use rustc_session::config::{OutputFilenames, OutputType, PrintKind, SplitDwarfKind};
|
||||
use rustc_session::config::{
|
||||
self, CFGuard, CrateType, DebugInfo, LinkerFeaturesCli, OutFileName, OutputFilenames,
|
||||
OutputType, PrintKind, SplitDwarfKind, Strip,
|
||||
};
|
||||
use rustc_session::cstore::DllImport;
|
||||
use rustc_session::output::{check_file_is_writeable, invalid_output_for_target, out_filename};
|
||||
use rustc_session::search_paths::PathKind;
|
||||
|
@ -24,11 +37,13 @@ use rustc_session::utils::NativeLibKind;
|
|||
use rustc_session::{filesearch, Session};
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_target::spec::crt_objects::CrtObjects;
|
||||
use rustc_target::spec::LinkSelfContainedDefault;
|
||||
use rustc_target::spec::LinkerFlavorCli;
|
||||
use rustc_target::spec::{Cc, LinkOutputKind, LinkerFlavor, Lld, PanicStrategy};
|
||||
use rustc_target::spec::{LinkSelfContainedComponents, LinkerFeatures};
|
||||
use rustc_target::spec::{RelocModel, RelroLevel, SanitizerSet, SplitDebuginfo};
|
||||
use rustc_target::spec::{
|
||||
Cc, LinkOutputKind, LinkSelfContainedComponents, LinkSelfContainedDefault, LinkerFeatures,
|
||||
LinkerFlavor, LinkerFlavorCli, Lld, PanicStrategy, RelocModel, RelroLevel, SanitizerSet,
|
||||
SplitDebuginfo,
|
||||
};
|
||||
use tempfile::Builder as TempFileBuilder;
|
||||
use tracing::{debug, info, warn};
|
||||
|
||||
use super::archive::{ArchiveBuilder, ArchiveBuilderBuilder};
|
||||
use super::command::Command;
|
||||
|
@ -39,21 +54,6 @@ use crate::{
|
|||
errors, looks_like_rust_object_file, CodegenResults, CompiledModule, CrateInfo, NativeLib,
|
||||
};
|
||||
|
||||
use cc::windows_registry;
|
||||
use regex::Regex;
|
||||
use tempfile::Builder as TempFileBuilder;
|
||||
|
||||
use itertools::Itertools;
|
||||
use std::collections::BTreeSet;
|
||||
use std::ffi::OsString;
|
||||
use std::fs::{read, File, OpenOptions};
|
||||
use std::io::{BufWriter, Write};
|
||||
use std::ops::Deref;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{ExitStatus, Output, Stdio};
|
||||
use std::{env, fmt, fs, io, mem, str};
|
||||
use tracing::{debug, info, warn};
|
||||
|
||||
pub fn ensure_removed(dcx: DiagCtxtHandle<'_>, path: &Path) {
|
||||
if let Err(e) = fs::remove_file(path) {
|
||||
if e.kind() != io::ErrorKind::NotFound {
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
use super::command::Command;
|
||||
use super::symbol_export;
|
||||
use crate::errors;
|
||||
use rustc_span::symbol::sym;
|
||||
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use std::fs::{self, File};
|
||||
use std::io::prelude::*;
|
||||
|
@ -10,6 +5,7 @@ use std::io::{self, BufWriter};
|
|||
use std::path::{Path, PathBuf};
|
||||
use std::{env, iter, mem, str};
|
||||
|
||||
use cc::windows_registry;
|
||||
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
|
||||
use rustc_metadata::find_native_static_library;
|
||||
use rustc_middle::bug;
|
||||
|
@ -19,11 +15,14 @@ use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportInfo, S
|
|||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::config::{self, CrateType, DebugInfo, LinkerPluginLto, Lto, OptLevel, Strip};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_target::spec::{Cc, LinkOutputKind, LinkerFlavor, Lld};
|
||||
|
||||
use cc::windows_registry;
|
||||
use tracing::{debug, warn};
|
||||
|
||||
use super::command::Command;
|
||||
use super::symbol_export;
|
||||
use crate::errors;
|
||||
|
||||
/// Disables non-English messages from localized linkers.
|
||||
/// Such messages may cause issues with text encoding on Windows (#35785)
|
||||
/// and prevent inspection of linker output in case of errors, which we occasionally do.
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use super::write::CodegenContext;
|
||||
use crate::traits::*;
|
||||
use crate::ModuleCodegen;
|
||||
use std::ffi::CString;
|
||||
use std::sync::Arc;
|
||||
|
||||
use rustc_data_structures::memmap::Mmap;
|
||||
use rustc_errors::FatalError;
|
||||
|
||||
use std::ffi::CString;
|
||||
use std::sync::Arc;
|
||||
use super::write::CodegenContext;
|
||||
use crate::traits::*;
|
||||
use crate::ModuleCodegen;
|
||||
|
||||
pub struct ThinModule<B: WriteBackendMethods> {
|
||||
pub shared: Arc<ThinShared<B>>,
|
||||
|
|
|
@ -10,7 +10,6 @@ use object::{
|
|||
elf, pe, xcoff, Architecture, BinaryFormat, Endianness, FileFlags, Object, ObjectSection,
|
||||
ObjectSymbol, SectionFlags, SectionKind, SubArchitecture, SymbolFlags, SymbolKind, SymbolScope,
|
||||
};
|
||||
|
||||
use rustc_data_structures::memmap::Mmap;
|
||||
use rustc_data_structures::owned_slice::{try_slice_owned, OwnedSlice};
|
||||
use rustc_metadata::creader::MetadataLoader;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use std::ffi::OsString;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use pathdiff::diff_paths;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_fs_util::try_canonicalize;
|
||||
use std::ffi::OsString;
|
||||
use std::path::{Path, PathBuf};
|
||||
use tracing::debug;
|
||||
|
||||
pub struct RPathConfig<'a> {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use super::RPathConfig;
|
||||
use super::{get_rpath_relative_to_output, minimize_rpaths, rpaths_to_flags};
|
||||
use std::ffi::OsString;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use super::{get_rpath_relative_to_output, minimize_rpaths, rpaths_to_flags, RPathConfig};
|
||||
|
||||
#[test]
|
||||
fn test_rpaths_to_flags() {
|
||||
let flags = rpaths_to_flags(vec!["path1".into(), "path2".into()]);
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use crate::base::allocator_kind_for_codegen;
|
||||
|
||||
use std::collections::hash_map::Entry::*;
|
||||
|
||||
use rustc_ast::expand::allocator::{ALLOCATOR_METHODS, NO_ALLOC_SHIM_IS_UNSTABLE};
|
||||
|
@ -12,14 +10,14 @@ use rustc_middle::middle::exported_symbols::{
|
|||
metadata_symbol_name, ExportedSymbol, SymbolExportInfo, SymbolExportKind, SymbolExportLevel,
|
||||
};
|
||||
use rustc_middle::query::LocalCrate;
|
||||
use rustc_middle::ty::Instance;
|
||||
use rustc_middle::ty::{self, SymbolName, TyCtxt};
|
||||
use rustc_middle::ty::{GenericArgKind, GenericArgsRef};
|
||||
use rustc_middle::ty::{self, GenericArgKind, GenericArgsRef, Instance, SymbolName, TyCtxt};
|
||||
use rustc_middle::util::Providers;
|
||||
use rustc_session::config::{CrateType, OomStrategy};
|
||||
use rustc_target::spec::{SanitizerSet, TlsModel};
|
||||
use tracing::debug;
|
||||
|
||||
use crate::base::allocator_kind_for_codegen;
|
||||
|
||||
pub fn threshold(tcx: TyCtxt<'_>) -> SymbolExportLevel {
|
||||
crates_export_threshold(tcx.crate_types())
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
use super::link::{self, ensure_removed};
|
||||
use super::lto::{self, SerializedModule};
|
||||
use super::symbol_export::symbol_name_for_instance_in_crate;
|
||||
use std::any::Any;
|
||||
use std::marker::PhantomData;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::mpsc::{channel, Receiver, Sender};
|
||||
use std::sync::Arc;
|
||||
use std::{fs, io, mem, str, thread};
|
||||
|
||||
use crate::errors;
|
||||
use crate::traits::*;
|
||||
use crate::{
|
||||
CachedModuleCodegen, CodegenResults, CompiledModule, CrateInfo, ModuleCodegen, ModuleKind,
|
||||
};
|
||||
use jobserver::{Acquired, Client};
|
||||
use rustc_ast::attr;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
|
||||
|
@ -30,27 +28,26 @@ use rustc_middle::bug;
|
|||
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
|
||||
use rustc_middle::middle::exported_symbols::SymbolExportInfo;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::config::{self, CrateType, Lto, OutFileName, OutputFilenames, OutputType};
|
||||
use rustc_session::config::{Passes, SwitchWithOptPath};
|
||||
use rustc_session::config::{
|
||||
self, CrateType, Lto, OutFileName, OutputFilenames, OutputType, Passes, SwitchWithOptPath,
|
||||
};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::source_map::SourceMap;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{BytePos, FileName, InnerSpan, Pos, Span};
|
||||
use rustc_target::spec::{MergeFunctions, SanitizerSet};
|
||||
|
||||
use crate::errors::ErrorCreatingRemarkDir;
|
||||
use std::any::Any;
|
||||
use std::fs;
|
||||
use std::io;
|
||||
use std::marker::PhantomData;
|
||||
use std::mem;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str;
|
||||
use std::sync::mpsc::{channel, Receiver, Sender};
|
||||
use std::sync::Arc;
|
||||
use std::thread;
|
||||
use tracing::debug;
|
||||
|
||||
use super::link::{self, ensure_removed};
|
||||
use super::lto::{self, SerializedModule};
|
||||
use super::symbol_export::symbol_name_for_instance_in_crate;
|
||||
use crate::errors::ErrorCreatingRemarkDir;
|
||||
use crate::traits::*;
|
||||
use crate::{
|
||||
errors, CachedModuleCodegen, CodegenResults, CompiledModule, CrateInfo, ModuleCodegen,
|
||||
ModuleKind,
|
||||
};
|
||||
|
||||
const PRE_LTO_BC_EXT: &str = "pre-lto.bc";
|
||||
|
||||
/// What kind of object file to emit.
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
use crate::assert_module_sources::CguReuse;
|
||||
use crate::back::link::are_upstream_rust_objects_already_included;
|
||||
use crate::back::metadata::create_compressed_metadata_file;
|
||||
use crate::back::write::{
|
||||
compute_per_cgu_lto_type, start_async_codegen, submit_codegened_module_to_llvm,
|
||||
submit_post_lto_module_to_llvm, submit_pre_lto_module_to_llvm, ComputedLtoType, OngoingCodegen,
|
||||
};
|
||||
use crate::common::{self, IntPredicate, RealPredicate, TypeKind};
|
||||
use crate::errors;
|
||||
use crate::meth;
|
||||
use crate::mir;
|
||||
use crate::mir::operand::OperandValue;
|
||||
use crate::mir::place::PlaceRef;
|
||||
use crate::traits::*;
|
||||
use crate::{CachedModuleCodegen, CompiledModule, CrateInfo, ModuleCodegen, ModuleKind};
|
||||
use std::cmp;
|
||||
use std::collections::BTreeSet;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use itertools::Itertools;
|
||||
use rustc_ast::expand::allocator::{global_fn_name, AllocatorKind, ALLOCATOR_METHODS};
|
||||
use rustc_attr as attr;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
|
||||
|
@ -26,9 +15,8 @@ use rustc_metadata::EncodedMetadata;
|
|||
use rustc_middle::bug;
|
||||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
|
||||
use rustc_middle::middle::debugger_visualizer::{DebuggerVisualizerFile, DebuggerVisualizerType};
|
||||
use rustc_middle::middle::exported_symbols;
|
||||
use rustc_middle::middle::exported_symbols::SymbolExportKind;
|
||||
use rustc_middle::middle::lang_items;
|
||||
use rustc_middle::middle::{exported_symbols, lang_items};
|
||||
use rustc_middle::mir::mono::{CodegenUnit, CodegenUnitNameBuilder, MonoItem};
|
||||
use rustc_middle::mir::BinOp;
|
||||
use rustc_middle::query::Providers;
|
||||
|
@ -39,14 +27,23 @@ use rustc_session::Session;
|
|||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Symbol, DUMMY_SP};
|
||||
use rustc_target::abi::FIRST_VARIANT;
|
||||
|
||||
use std::cmp;
|
||||
use std::collections::BTreeSet;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use itertools::Itertools;
|
||||
use tracing::{debug, info};
|
||||
|
||||
use crate::assert_module_sources::CguReuse;
|
||||
use crate::back::link::are_upstream_rust_objects_already_included;
|
||||
use crate::back::metadata::create_compressed_metadata_file;
|
||||
use crate::back::write::{
|
||||
compute_per_cgu_lto_type, start_async_codegen, submit_codegened_module_to_llvm,
|
||||
submit_post_lto_module_to_llvm, submit_pre_lto_module_to_llvm, ComputedLtoType, OngoingCodegen,
|
||||
};
|
||||
use crate::common::{self, IntPredicate, RealPredicate, TypeKind};
|
||||
use crate::mir::operand::OperandValue;
|
||||
use crate::mir::place::PlaceRef;
|
||||
use crate::traits::*;
|
||||
use crate::{
|
||||
errors, meth, mir, CachedModuleCodegen, CompiledModule, CrateInfo, ModuleCodegen, ModuleKind,
|
||||
};
|
||||
|
||||
pub fn bin_op_to_icmp_predicate(op: BinOp, signed: bool) -> IntPredicate {
|
||||
match op {
|
||||
BinOp::Eq => IntPredicate::IntEQ,
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
use rustc_ast::{ast, attr, MetaItemKind, NestedMetaItem};
|
||||
use rustc_attr::{list_contains_name, InlineAttr, InstructionSetAttr, OptimizeAttr};
|
||||
use rustc_errors::{codes::*, struct_span_code_err, DiagMessage, SubdiagMessage};
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{struct_span_code_err, DiagMessage, SubdiagMessage};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId, LOCAL_CRATE};
|
||||
use rustc_hir::{lang_items, weak_lang_items::WEAK_LANG_ITEMS, LangItem};
|
||||
use rustc_hir::weak_lang_items::WEAK_LANG_ITEMS;
|
||||
use rustc_hir::{lang_items, LangItem};
|
||||
use rustc_middle::middle::codegen_fn_attrs::{
|
||||
CodegenFnAttrFlags, CodegenFnAttrs, PatchableFunctionEntry,
|
||||
};
|
||||
use rustc_middle::mir::mono::Linkage;
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::{self as ty, TyCtxt};
|
||||
use rustc_session::{lint, parse::feature_err};
|
||||
use rustc_session::lint;
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::{sym, Span};
|
||||
use rustc_target::spec::{abi, SanitizerSet};
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
#![allow(non_camel_case_types)]
|
||||
|
||||
use rustc_hir::LangItem;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::ty::Instance;
|
||||
use rustc_middle::ty::{self, layout::TyAndLayout, TyCtxt};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_middle::ty::layout::TyAndLayout;
|
||||
use rustc_middle::ty::{self, Instance, TyCtxt};
|
||||
use rustc_middle::{bug, mir, span_bug};
|
||||
use rustc_span::Span;
|
||||
|
||||
use crate::traits::*;
|
||||
|
@ -106,9 +105,10 @@ pub enum TypeKind {
|
|||
// for now we content ourselves with providing a no-op HashStable
|
||||
// implementation for CGUs.
|
||||
mod temp_stable_hash_impls {
|
||||
use crate::ModuleCodegen;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
|
||||
use crate::ModuleCodegen;
|
||||
|
||||
impl<HCX, M> HashStable<HCX> for ModuleCodegen<M> {
|
||||
fn hash_stable(&self, _: &mut HCX, _: &mut StableHasher) {
|
||||
// do nothing
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use rustc_middle::ty::{self, layout::TyAndLayout};
|
||||
use rustc_middle::ty::layout::TyAndLayout;
|
||||
use rustc_middle::ty::{self};
|
||||
use rustc_target::abi::Size;
|
||||
|
||||
// FIXME(eddyb) find a place for this (or a way to replace it).
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
// within the brackets).
|
||||
// * `"` is treated as the start of a string.
|
||||
|
||||
use std::fmt::Write;
|
||||
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::stable_hasher::{Hash64, HashStable, StableHasher};
|
||||
use rustc_hir::def_id::DefId;
|
||||
|
@ -18,14 +20,13 @@ use rustc_hir::definitions::{DefPathData, DefPathDataName, DisambiguatedDefPathD
|
|||
use rustc_hir::{CoroutineDesugaring, CoroutineKind, CoroutineSource, Mutability};
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::layout::{IntegerExt, TyAndLayout};
|
||||
use rustc_middle::ty::{self, ExistentialProjection, ParamEnv, Ty, TyCtxt};
|
||||
use rustc_middle::ty::{GenericArgKind, GenericArgsRef};
|
||||
use rustc_middle::ty::{
|
||||
self, ExistentialProjection, GenericArgKind, GenericArgsRef, ParamEnv, Ty, TyCtxt,
|
||||
};
|
||||
use rustc_span::DUMMY_SP;
|
||||
use rustc_target::abi::Integer;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use std::fmt::Write;
|
||||
|
||||
use crate::debuginfo::wants_c_like_enum_debuginfo;
|
||||
|
||||
/// Compute the name of the type as it should be stored in debuginfo. Does not do
|
||||
|
|
|
@ -1,20 +1,23 @@
|
|||
//! Errors emitted by codegen_ssa
|
||||
|
||||
use crate::assert_module_sources::CguReuse;
|
||||
use crate::back::command::Command;
|
||||
use crate::fluent_generated as fluent;
|
||||
use std::borrow::Cow;
|
||||
use std::io::Error;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::ExitStatus;
|
||||
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{
|
||||
codes::*, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, IntoDiagArg, Level,
|
||||
Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, IntoDiagArg, Level,
|
||||
};
|
||||
use rustc_macros::Diagnostic;
|
||||
use rustc_middle::ty::layout::LayoutError;
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_span::{Span, Symbol};
|
||||
use rustc_type_ir::FloatTy;
|
||||
use std::borrow::Cow;
|
||||
use std::io::Error;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::ExitStatus;
|
||||
|
||||
use crate::assert_module_sources::CguReuse;
|
||||
use crate::back::command::Command;
|
||||
use crate::fluent_generated as fluent;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(codegen_ssa_incorrect_cgu_reuse_type)]
|
||||
|
|
|
@ -17,9 +17,12 @@
|
|||
//! The backend-agnostic functions of this crate use functions defined in various traits that
|
||||
//! have to be implemented by each backend.
|
||||
|
||||
use std::collections::BTreeSet;
|
||||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use rustc_ast as ast;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_data_structures::unord::UnordMap;
|
||||
use rustc_hir::def_id::CrateNum;
|
||||
|
@ -36,9 +39,6 @@ use rustc_session::cstore::{self, CrateSource};
|
|||
use rustc_session::utils::NativeLibKind;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use std::collections::BTreeSet;
|
||||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
pub mod assert_module_sources;
|
||||
pub mod back;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use crate::traits::*;
|
||||
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::{self, GenericArgKind, Ty};
|
||||
use rustc_session::config::Lto;
|
||||
|
@ -7,6 +5,8 @@ use rustc_symbol_mangling::typeid_for_trait_ref;
|
|||
use rustc_target::abi::call::FnAbi;
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use crate::traits::*;
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct VirtualIndex(u64);
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
//! An analysis to determine which locals require allocas and
|
||||
//! which do not.
|
||||
|
||||
use super::FunctionCx;
|
||||
use crate::traits::*;
|
||||
use rustc_data_structures::graph::dominators::Dominators;
|
||||
use rustc_index::bit_set::BitSet;
|
||||
use rustc_index::{IndexSlice, IndexVec};
|
||||
use rustc_middle::mir::traversal;
|
||||
use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor};
|
||||
use rustc_middle::mir::{self, DefLocation, Location, TerminatorKind};
|
||||
use rustc_middle::mir::{self, traversal, DefLocation, Location, TerminatorKind};
|
||||
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use tracing::debug;
|
||||
|
||||
use super::FunctionCx;
|
||||
use crate::traits::*;
|
||||
|
||||
pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
fx: &FunctionCx<'a, 'tcx, Bx>,
|
||||
) -> BitSet<mir::Local> {
|
||||
|
|
|
@ -1,14 +1,4 @@
|
|||
use super::operand::OperandRef;
|
||||
use super::operand::OperandValue::{Immediate, Pair, Ref, ZeroSized};
|
||||
use super::place::{PlaceRef, PlaceValue};
|
||||
use super::{CachedLlbb, FunctionCx, LocalRef};
|
||||
|
||||
use crate::base::{self, is_call_from_compiler_builtins_to_upstream_monomorphization};
|
||||
use crate::common::{self, IntPredicate};
|
||||
use crate::errors::CompilerBuiltinsCannotCall;
|
||||
use crate::meth;
|
||||
use crate::traits::*;
|
||||
use crate::MemFlags;
|
||||
use std::cmp;
|
||||
|
||||
use rustc_ast as ast;
|
||||
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
|
||||
|
@ -19,13 +9,22 @@ use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
|
|||
use rustc_middle::ty::{self, Instance, Ty};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_session::config::OptLevel;
|
||||
use rustc_span::{source_map::Spanned, sym, Span};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::{sym, Span};
|
||||
use rustc_target::abi::call::{ArgAbi, FnAbi, PassMode, Reg};
|
||||
use rustc_target::abi::{self, HasDataLayout, WrappingRange};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use tracing::{debug, info};
|
||||
|
||||
use std::cmp;
|
||||
use super::operand::OperandRef;
|
||||
use super::operand::OperandValue::{Immediate, Pair, Ref, ZeroSized};
|
||||
use super::place::{PlaceRef, PlaceValue};
|
||||
use super::{CachedLlbb, FunctionCx, LocalRef};
|
||||
use crate::base::{self, is_call_from_compiler_builtins_to_upstream_monomorphization};
|
||||
use crate::common::{self, IntPredicate};
|
||||
use crate::errors::CompilerBuiltinsCannotCall;
|
||||
use crate::traits::*;
|
||||
use crate::{meth, MemFlags};
|
||||
|
||||
// Indicates if we are in the middle of merging a BB's successor into it. This
|
||||
// can happen when BB jumps directly to its successor and the successor has no
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
use crate::errors;
|
||||
use crate::mir::operand::OperandRef;
|
||||
use crate::traits::*;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::mir::interpret::ErrorHandled;
|
||||
use rustc_middle::ty::layout::HasTyCtxt;
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_middle::{bug, mir, span_bug};
|
||||
use rustc_target::abi::Abi;
|
||||
|
||||
use super::FunctionCx;
|
||||
use crate::errors;
|
||||
use crate::mir::operand::OperandRef;
|
||||
use crate::traits::*;
|
||||
|
||||
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
pub fn eval_mir_constant_to_operand(
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
use crate::traits::*;
|
||||
|
||||
use rustc_middle::mir::coverage::CoverageKind;
|
||||
use rustc_middle::mir::SourceScope;
|
||||
|
||||
use super::FunctionCx;
|
||||
use crate::traits::*;
|
||||
|
||||
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
pub fn codegen_coverage(&self, bx: &mut Bx, kind: &CoverageKind, scope: SourceScope) {
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
use crate::traits::*;
|
||||
use std::ops::Range;
|
||||
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::ty;
|
||||
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::Instance;
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_middle::ty::{Instance, Ty};
|
||||
use rustc_middle::{bug, mir, ty};
|
||||
use rustc_session::config::DebugInfo;
|
||||
use rustc_span::symbol::{kw, Symbol};
|
||||
use rustc_span::{hygiene, BytePos, Span};
|
||||
|
@ -16,8 +14,7 @@ use rustc_target::abi::{Abi, FieldIdx, FieldsShape, Size, VariantIdx};
|
|||
use super::operand::{OperandRef, OperandValue};
|
||||
use super::place::{PlaceRef, PlaceValue};
|
||||
use super::{FunctionCx, LocalRef};
|
||||
|
||||
use std::ops::Range;
|
||||
use crate::traits::*;
|
||||
|
||||
pub struct FunctionDebugContext<'tcx, S, L> {
|
||||
/// Maps from source code to the corresponding debug info scope.
|
||||
|
|
|
@ -1,21 +1,16 @@
|
|||
use super::operand::OperandRef;
|
||||
use super::place::PlaceRef;
|
||||
use super::FunctionCx;
|
||||
use crate::errors;
|
||||
use crate::errors::InvalidMonomorphization;
|
||||
use crate::meth;
|
||||
use crate::size_of_val;
|
||||
use crate::traits::*;
|
||||
use crate::MemFlags;
|
||||
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_session::config::OptLevel;
|
||||
use rustc_span::{sym, Span};
|
||||
use rustc_target::abi::{
|
||||
call::{FnAbi, PassMode},
|
||||
WrappingRange,
|
||||
};
|
||||
use rustc_target::abi::call::{FnAbi, PassMode};
|
||||
use rustc_target::abi::WrappingRange;
|
||||
|
||||
use super::operand::OperandRef;
|
||||
use super::place::PlaceRef;
|
||||
use super::FunctionCx;
|
||||
use crate::errors::InvalidMonomorphization;
|
||||
use crate::traits::*;
|
||||
use crate::{errors, meth, size_of_val, MemFlags};
|
||||
|
||||
fn copy_intrinsic<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
bx: &mut Bx,
|
||||
|
|
|
@ -2,14 +2,16 @@
|
|||
//! be careful wrt to subtyping. To deal with this we only allow updates by using
|
||||
//! `FunctionCx::overwrite_local` which handles it automatically.
|
||||
|
||||
use crate::mir::{FunctionCx, LocalRef};
|
||||
use crate::traits::BuilderMethods;
|
||||
use std::ops::{Index, IndexMut};
|
||||
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||
use std::ops::{Index, IndexMut};
|
||||
use tracing::{debug, warn};
|
||||
|
||||
use crate::mir::{FunctionCx, LocalRef};
|
||||
use crate::traits::BuilderMethods;
|
||||
|
||||
pub(super) struct Locals<'tcx, V> {
|
||||
values: IndexVec<mir::Local, LocalRef<'tcx, V>>,
|
||||
}
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
use crate::base;
|
||||
use crate::traits::*;
|
||||
use std::iter;
|
||||
|
||||
use rustc_index::bit_set::BitSet;
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::mir::traversal;
|
||||
use rustc_middle::mir::UnwindTerminateReason;
|
||||
use rustc_middle::mir::{traversal, UnwindTerminateReason};
|
||||
use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt, TyAndLayout};
|
||||
use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypeFoldable, TypeVisitableExt};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_middle::{bug, mir, span_bug};
|
||||
use rustc_target::abi::call::{FnAbi, PassMode};
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use std::iter;
|
||||
use crate::base;
|
||||
use crate::traits::*;
|
||||
|
||||
mod analyze;
|
||||
mod block;
|
||||
|
|
|
@ -1,23 +1,20 @@
|
|||
use super::place::{PlaceRef, PlaceValue};
|
||||
use super::{FunctionCx, LocalRef};
|
||||
|
||||
use crate::size_of_val;
|
||||
use crate::traits::*;
|
||||
use crate::MemFlags;
|
||||
use std::fmt;
|
||||
|
||||
use arrayvec::ArrayVec;
|
||||
use either::Either;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::mir::interpret::{alloc_range, Pointer, Scalar};
|
||||
use rustc_middle::mir::{self, ConstValue};
|
||||
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_target::abi::{self, Abi, Align, Size};
|
||||
|
||||
use std::fmt;
|
||||
|
||||
use arrayvec::ArrayVec;
|
||||
use either::Either;
|
||||
use tracing::debug;
|
||||
|
||||
use super::place::{PlaceRef, PlaceValue};
|
||||
use super::{FunctionCx, LocalRef};
|
||||
use crate::traits::*;
|
||||
use crate::{size_of_val, MemFlags};
|
||||
|
||||
/// The representation of a Rust value. The enum variant is in fact
|
||||
/// uniquely determined by the value's type, but is kept as a
|
||||
/// safety check.
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
use super::operand::OperandValue;
|
||||
use super::{FunctionCx, LocalRef};
|
||||
|
||||
use crate::common::IntPredicate;
|
||||
use crate::size_of_val;
|
||||
use crate::traits::*;
|
||||
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::mir::tcx::PlaceTy;
|
||||
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_target::abi::{Align, FieldsShape, Int, Pointer, Size, TagEncoding};
|
||||
use rustc_target::abi::{VariantIdx, Variants};
|
||||
use rustc_middle::{bug, mir};
|
||||
use rustc_target::abi::{
|
||||
Align, FieldsShape, Int, Pointer, Size, TagEncoding, VariantIdx, Variants,
|
||||
};
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use super::operand::OperandValue;
|
||||
use super::{FunctionCx, LocalRef};
|
||||
use crate::common::IntPredicate;
|
||||
use crate::size_of_val;
|
||||
use crate::traits::*;
|
||||
|
||||
/// The location and extra runtime properties of the place.
|
||||
///
|
||||
/// Typically found in a [`PlaceRef`] or an [`OperandValue::Ref`].
|
||||
|
|
|
@ -1,23 +1,20 @@
|
|||
use super::operand::{OperandRef, OperandValue};
|
||||
use super::place::PlaceRef;
|
||||
use super::{FunctionCx, LocalRef};
|
||||
|
||||
use crate::base;
|
||||
use crate::common::IntPredicate;
|
||||
use crate::traits::*;
|
||||
use crate::MemFlags;
|
||||
|
||||
use rustc_middle::mir;
|
||||
use arrayvec::ArrayVec;
|
||||
use rustc_middle::ty::adjustment::PointerCoercion;
|
||||
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{self, adjustment::PointerCoercion, Instance, Ty, TyCtxt};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
|
||||
use rustc_middle::{bug, mir, span_bug};
|
||||
use rustc_session::config::OptLevel;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use rustc_target::abi::{self, FieldIdx, FIRST_VARIANT};
|
||||
|
||||
use arrayvec::ArrayVec;
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use super::operand::{OperandRef, OperandValue};
|
||||
use super::place::PlaceRef;
|
||||
use super::{FunctionCx, LocalRef};
|
||||
use crate::common::IntPredicate;
|
||||
use crate::traits::*;
|
||||
use crate::{base, MemFlags};
|
||||
|
||||
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
#[instrument(level = "trace", skip(self, bx))]
|
||||
pub fn codegen_rvalue(
|
||||
|
|
|
@ -3,8 +3,7 @@ use rustc_middle::span_bug;
|
|||
use rustc_session::config::OptLevel;
|
||||
use tracing::instrument;
|
||||
|
||||
use super::FunctionCx;
|
||||
use super::LocalRef;
|
||||
use super::{FunctionCx, LocalRef};
|
||||
use crate::traits::*;
|
||||
|
||||
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
use crate::base;
|
||||
use crate::common;
|
||||
use crate::traits::*;
|
||||
use rustc_hir as hir;
|
||||
use rustc_middle::mir::interpret::ErrorHandled;
|
||||
use rustc_middle::mir::mono::MonoItem;
|
||||
use rustc_middle::mir::mono::{Linkage, Visibility};
|
||||
use rustc_middle::span_bug;
|
||||
use rustc_middle::ty;
|
||||
use rustc_middle::mir::mono::{Linkage, MonoItem, Visibility};
|
||||
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
|
||||
use rustc_middle::ty::Instance;
|
||||
use rustc_middle::{span_bug, ty};
|
||||
use tracing::debug;
|
||||
|
||||
use crate::traits::*;
|
||||
use crate::{base, common};
|
||||
|
||||
pub trait MonoItemExt<'a, 'tcx> {
|
||||
fn define<Bx: BuilderMethods<'a, 'tcx>>(&self, cx: &'a Bx::CodegenCx);
|
||||
fn predefine<Bx: BuilderMethods<'a, 'tcx>>(
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
//! Computing the size and alignment of a value.
|
||||
|
||||
use crate::common;
|
||||
use crate::common::IntPredicate;
|
||||
use crate::meth;
|
||||
use crate::traits::*;
|
||||
use rustc_hir::LangItem;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
|
||||
|
@ -11,6 +7,10 @@ use rustc_middle::ty::{self, Ty};
|
|||
use rustc_target::abi::WrappingRange;
|
||||
use tracing::{debug, trace};
|
||||
|
||||
use crate::common::IntPredicate;
|
||||
use crate::traits::*;
|
||||
use crate::{common, meth};
|
||||
|
||||
pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
bx: &mut Bx,
|
||||
t: Ty<'tcx>,
|
||||
|
|
|
@ -1,21 +1,19 @@
|
|||
use crate::errors;
|
||||
use rustc_ast::ast;
|
||||
use rustc_attr::InstructionSetAttr;
|
||||
use rustc_data_structures::fx::FxIndexSet;
|
||||
use rustc_data_structures::unord::UnordMap;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_hir::def_id::LOCAL_CRATE;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId, LOCAL_CRATE};
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
use crate::errors;
|
||||
|
||||
pub fn from_target_feature(
|
||||
tcx: TyCtxt<'_>,
|
||||
attr: &ast::Attribute,
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
use super::BackendTypes;
|
||||
use crate::mir::operand::OperandRef;
|
||||
use crate::mir::place::PlaceRef;
|
||||
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_middle::ty::Instance;
|
||||
use rustc_span::Span;
|
||||
use rustc_target::asm::InlineAsmRegOrRegClass;
|
||||
|
||||
use super::BackendTypes;
|
||||
use crate::mir::operand::OperandRef;
|
||||
use crate::mir::place::PlaceRef;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum InlineAsmOperandRef<'tcx, B: BackendTypes + ?Sized> {
|
||||
In {
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
use std::any::Any;
|
||||
|
||||
use super::write::WriteBackendMethods;
|
||||
use super::CodegenObject;
|
||||
use crate::back::write::TargetMachineFactoryFn;
|
||||
use crate::{CodegenResults, ModuleCodegen};
|
||||
|
||||
use rustc_ast::expand::allocator::AllocatorKind;
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_data_structures::sync::{DynSend, DynSync};
|
||||
|
@ -15,13 +10,16 @@ use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
|
|||
use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt, LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{Ty, TyCtxt};
|
||||
use rustc_middle::util::Providers;
|
||||
use rustc_session::{
|
||||
config::{self, OutputFilenames, PrintRequest},
|
||||
Session,
|
||||
};
|
||||
use rustc_session::config::{self, OutputFilenames, PrintRequest};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
|
||||
use super::write::WriteBackendMethods;
|
||||
use super::CodegenObject;
|
||||
use crate::back::write::TargetMachineFactoryFn;
|
||||
use crate::{CodegenResults, ModuleCodegen};
|
||||
|
||||
pub trait BackendTypes {
|
||||
type Value: CodegenObject;
|
||||
type Function: CodegenObject;
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
|
||||
use rustc_middle::ty::layout::{HasParamEnv, TyAndLayout};
|
||||
use rustc_middle::ty::{Instance, Ty};
|
||||
use rustc_session::config::OptLevel;
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
use rustc_target::abi::{Abi, Align, Scalar, Size, WrappingRange};
|
||||
use rustc_target::spec::HasTargetSpec;
|
||||
|
||||
use super::abi::AbiBuilderMethods;
|
||||
use super::asm::AsmBuilderMethods;
|
||||
use super::consts::ConstMethods;
|
||||
|
@ -7,7 +16,6 @@ use super::intrinsic::IntrinsicCallMethods;
|
|||
use super::misc::MiscMethods;
|
||||
use super::type_::{ArgAbiMethods, BaseTypeMethods, LayoutTypeMethods};
|
||||
use super::{HasCodegen, StaticBuilderMethods};
|
||||
|
||||
use crate::common::{
|
||||
AtomicOrdering, AtomicRmwBinOp, IntPredicate, RealPredicate, SynchronizationScope, TypeKind,
|
||||
};
|
||||
|
@ -15,15 +23,6 @@ use crate::mir::operand::{OperandRef, OperandValue};
|
|||
use crate::mir::place::{PlaceRef, PlaceValue};
|
||||
use crate::MemFlags;
|
||||
|
||||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
|
||||
use rustc_middle::ty::layout::{HasParamEnv, TyAndLayout};
|
||||
use rustc_middle::ty::{Instance, Ty};
|
||||
use rustc_session::config::OptLevel;
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
use rustc_target::abi::{Abi, Align, Scalar, Size, WrappingRange};
|
||||
use rustc_target::spec::HasTargetSpec;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum OverflowOp {
|
||||
Add,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use super::BackendTypes;
|
||||
use rustc_middle::mir::interpret::{ConstAllocation, Scalar};
|
||||
use rustc_target::abi;
|
||||
|
||||
use super::BackendTypes;
|
||||
|
||||
pub trait ConstMethods<'tcx>: BackendTypes {
|
||||
// Constant constructors
|
||||
fn const_null(&self, t: Self::Type) -> Self::Value;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use super::BackendTypes;
|
||||
use rustc_middle::mir::coverage::CoverageKind;
|
||||
use rustc_middle::ty::Instance;
|
||||
|
||||
use super::BackendTypes;
|
||||
|
||||
pub trait CoverageInfoBuilderMethods<'tcx>: BackendTypes {
|
||||
/// Performs any start-of-function codegen needed for coverage instrumentation.
|
||||
///
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
use super::BackendTypes;
|
||||
use crate::mir::debuginfo::{FunctionDebugContext, VariableKind};
|
||||
use std::ops::Range;
|
||||
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::ty::{Instance, PolyExistentialTraitRef, Ty};
|
||||
use rustc_span::{SourceFile, Span, Symbol};
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
use rustc_target::abi::Size;
|
||||
|
||||
use std::ops::Range;
|
||||
use super::BackendTypes;
|
||||
use crate::mir::debuginfo::{FunctionDebugContext, VariableKind};
|
||||
|
||||
pub trait DebugInfoMethods<'tcx>: BackendTypes {
|
||||
fn create_vtable_debuginfo(
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use super::BackendTypes;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_middle::mir::mono::{Linkage, Visibility};
|
||||
use rustc_middle::ty::Instance;
|
||||
|
||||
use super::BackendTypes;
|
||||
|
||||
pub trait PreDefineMethods<'tcx>: BackendTypes {
|
||||
fn predefine_static(
|
||||
&self,
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
use super::BackendTypes;
|
||||
use crate::mir::operand::OperandRef;
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
|
||||
use super::BackendTypes;
|
||||
use crate::mir::operand::OperandRef;
|
||||
|
||||
pub trait IntrinsicCallMethods<'tcx>: BackendTypes {
|
||||
/// Remember to add all intrinsics here, in `compiler/rustc_hir_analysis/src/check/mod.rs`,
|
||||
/// and in `library/core/src/intrinsics.rs`; if you need access to any LLVM intrinsics,
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
use super::BackendTypes;
|
||||
use std::cell::RefCell;
|
||||
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_middle::mir::mono::CodegenUnit;
|
||||
use rustc_middle::ty::{self, Instance, Ty};
|
||||
use rustc_session::Session;
|
||||
use std::cell::RefCell;
|
||||
|
||||
use super::BackendTypes;
|
||||
|
||||
pub trait MiscMethods<'tcx>: BackendTypes {
|
||||
fn vtables(
|
||||
|
|
|
@ -28,6 +28,11 @@ mod statics;
|
|||
mod type_;
|
||||
mod write;
|
||||
|
||||
use std::fmt;
|
||||
|
||||
use rustc_middle::ty::layout::{HasParamEnv, HasTyCtxt};
|
||||
use rustc_target::spec::HasTargetSpec;
|
||||
|
||||
pub use self::abi::AbiBuilderMethods;
|
||||
pub use self::asm::{AsmBuilderMethods, AsmMethods, GlobalAsmOperandRef, InlineAsmOperandRef};
|
||||
pub use self::backend::{Backend, BackendTypes, CodegenBackend, ExtraBackendMethods};
|
||||
|
@ -45,11 +50,6 @@ pub use self::type_::{
|
|||
};
|
||||
pub use self::write::{ModuleBufferMethods, ThinBufferMethods, WriteBackendMethods};
|
||||
|
||||
use rustc_middle::ty::layout::{HasParamEnv, HasTyCtxt};
|
||||
use rustc_target::spec::HasTargetSpec;
|
||||
|
||||
use std::fmt;
|
||||
|
||||
pub trait CodegenObject: Copy + PartialEq + fmt::Debug {}
|
||||
impl<T: Copy + PartialEq + fmt::Debug> CodegenObject for T {}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use super::BackendTypes;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_target::abi::Align;
|
||||
|
||||
use super::BackendTypes;
|
||||
|
||||
pub trait StaticMethods: BackendTypes {
|
||||
fn static_addr_of(&self, cv: Self::Value, align: Align, kind: Option<&str>) -> Self::Value;
|
||||
fn codegen_static(&self, def_id: DefId);
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
use super::misc::MiscMethods;
|
||||
use super::Backend;
|
||||
use super::HasCodegen;
|
||||
use crate::common::TypeKind;
|
||||
use crate::mir::place::PlaceRef;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::layout::TyAndLayout;
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_target::abi::call::{ArgAbi, CastTarget, FnAbi, Reg};
|
||||
use rustc_target::abi::{AddressSpace, Float, Integer};
|
||||
|
||||
use super::misc::MiscMethods;
|
||||
use super::{Backend, HasCodegen};
|
||||
use crate::common::TypeKind;
|
||||
use crate::mir::place::PlaceRef;
|
||||
|
||||
// This depends on `Backend` and not `BackendTypes`, because consumers will probably want to use
|
||||
// `LayoutOf` or `HasTyCtxt`. This way, they don't have to add a constraint on it themselves.
|
||||
pub trait BaseTypeMethods<'tcx>: Backend<'tcx> {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use rustc_errors::{DiagCtxtHandle, FatalError};
|
||||
use rustc_middle::dep_graph::WorkProduct;
|
||||
|
||||
use crate::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};
|
||||
use crate::back::write::{CodegenContext, FatLtoInput, ModuleConfig};
|
||||
use crate::{CompiledModule, ModuleCodegen};
|
||||
|
||||
use rustc_errors::{DiagCtxtHandle, FatalError};
|
||||
use rustc_middle::dep_graph::WorkProduct;
|
||||
|
||||
pub trait WriteBackendMethods: 'static + Sized + Clone {
|
||||
type Module: Send + Sync;
|
||||
type TargetMachine;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue