compiler: Directly use rustc_abi in codegen

This commit is contained in:
Jubilee Young 2024-11-02 19:32:52 -07:00
parent e3a918ece0
commit b895bf4fdc
35 changed files with 50 additions and 52 deletions

View File

@ -2,6 +2,7 @@ use std::cmp;
use libc::c_uint; use libc::c_uint;
use rustc_abi as abi; use rustc_abi as abi;
pub(crate) use rustc_abi::ExternAbi;
use rustc_abi::Primitive::Int; use rustc_abi::Primitive::Int;
use rustc_abi::{HasDataLayout, Size}; use rustc_abi::{HasDataLayout, Size};
use rustc_codegen_ssa::MemFlags; use rustc_codegen_ssa::MemFlags;
@ -13,9 +14,8 @@ use rustc_middle::ty::layout::LayoutOf;
pub(crate) use rustc_middle::ty::layout::{WIDE_PTR_ADDR, WIDE_PTR_EXTRA}; pub(crate) use rustc_middle::ty::layout::{WIDE_PTR_ADDR, WIDE_PTR_EXTRA};
use rustc_middle::{bug, ty}; use rustc_middle::{bug, ty};
use rustc_session::config; use rustc_session::config;
pub(crate) use rustc_target::abi::call::*; pub(crate) use rustc_target::callconv::*;
use rustc_target::spec::SanitizerSet; use rustc_target::spec::SanitizerSet;
pub(crate) use rustc_target::spec::abi::Abi;
use smallvec::SmallVec; use smallvec::SmallVec;
use crate::attributes::llfn_attrs_from_instance; use crate::attributes::llfn_attrs_from_instance;
@ -436,7 +436,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
i - 1 i - 1
}; };
let apply_range_attr = |idx: AttributePlace, scalar: rustc_target::abi::Scalar| { let apply_range_attr = |idx: AttributePlace, scalar: rustc_abi::Scalar| {
if cx.sess().opts.optimize != config::OptLevel::No if cx.sess().opts.optimize != config::OptLevel::No
&& llvm_util::get_version() >= (19, 0, 0) && llvm_util::get_version() >= (19, 0, 0)
&& matches!(scalar.primitive(), Int(..)) && matches!(scalar.primitive(), Int(..))

View File

@ -1,6 +1,7 @@
use std::assert_matches::assert_matches; use std::assert_matches::assert_matches;
use libc::{c_char, c_uint}; use libc::{c_char, c_uint};
use rustc_abi::{BackendRepr, Float, Integer, Primitive, Scalar};
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
use rustc_codegen_ssa::mir::operand::OperandValue; use rustc_codegen_ssa::mir::operand::OperandValue;
use rustc_codegen_ssa::traits::*; use rustc_codegen_ssa::traits::*;
@ -9,7 +10,6 @@ use rustc_middle::ty::Instance;
use rustc_middle::ty::layout::TyAndLayout; use rustc_middle::ty::layout::TyAndLayout;
use rustc_middle::{bug, span_bug}; use rustc_middle::{bug, span_bug};
use rustc_span::{Pos, Span, Symbol, sym}; use rustc_span::{Pos, Span, Symbol, sym};
use rustc_target::abi::*;
use rustc_target::asm::*; use rustc_target::asm::*;
use smallvec::SmallVec; use smallvec::SmallVec;
use tracing::debug; use tracing::debug;

View File

@ -21,7 +21,7 @@ use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
use rustc_sanitizers::{cfi, kcfi}; use rustc_sanitizers::{cfi, kcfi};
use rustc_session::config::OptLevel; use rustc_session::config::OptLevel;
use rustc_span::Span; use rustc_span::Span;
use rustc_target::abi::call::FnAbi; use rustc_target::callconv::FnAbi;
use rustc_target::spec::{HasTargetSpec, SanitizerSet, Target}; use rustc_target::spec::{HasTargetSpec, SanitizerSet, Target};
use smallvec::SmallVec; use smallvec::SmallVec;
use tracing::{debug, instrument}; use tracing::{debug, instrument};

View File

@ -1,5 +1,8 @@
use std::ops::Range; use std::ops::Range;
use rustc_abi::{
Align, AlignFromBytesError, HasDataLayout, Primitive, Scalar, Size, WrappingRange,
};
use rustc_codegen_ssa::common; use rustc_codegen_ssa::common;
use rustc_codegen_ssa::traits::*; use rustc_codegen_ssa::traits::*;
use rustc_hir::def::DefKind; use rustc_hir::def::DefKind;
@ -14,9 +17,6 @@ use rustc_middle::ty::layout::LayoutOf;
use rustc_middle::ty::{self, Instance}; use rustc_middle::ty::{self, Instance};
use rustc_middle::{bug, span_bug}; use rustc_middle::{bug, span_bug};
use rustc_session::config::Lto; use rustc_session::config::Lto;
use rustc_target::abi::{
Align, AlignFromBytesError, HasDataLayout, Primitive, Scalar, Size, WrappingRange,
};
use tracing::{debug, instrument, trace}; use tracing::{debug, instrument, trace};
use crate::common::{AsCCharPtr, CodegenCx}; use crate::common::{AsCCharPtr, CodegenCx};

View File

@ -3,6 +3,7 @@ use std::cell::{Cell, RefCell};
use std::ffi::{CStr, c_uint}; use std::ffi::{CStr, c_uint};
use std::str; use std::str;
use rustc_abi::{HasDataLayout, TargetDataLayout, VariantIdx};
use rustc_codegen_ssa::back::versioned_llvm_target; use rustc_codegen_ssa::back::versioned_llvm_target;
use rustc_codegen_ssa::base::{wants_msvc_seh, wants_wasm_eh}; use rustc_codegen_ssa::base::{wants_msvc_seh, wants_wasm_eh};
use rustc_codegen_ssa::errors as ssa_errors; use rustc_codegen_ssa::errors as ssa_errors;
@ -24,7 +25,6 @@ use rustc_session::config::{
}; };
use rustc_span::source_map::Spanned; use rustc_span::source_map::Spanned;
use rustc_span::{DUMMY_SP, Span}; use rustc_span::{DUMMY_SP, Span};
use rustc_target::abi::{HasDataLayout, TargetDataLayout, VariantIdx};
use rustc_target::spec::{HasTargetSpec, RelocModel, SmallDataThresholdSupport, Target, TlsModel}; use rustc_target::spec::{HasTargetSpec, RelocModel, SmallDataThresholdSupport, Target, TlsModel};
use smallvec::SmallVec; use smallvec::SmallVec;

View File

@ -2,6 +2,7 @@ use std::cell::{OnceCell, RefCell};
use std::ffi::{CStr, CString}; use std::ffi::{CStr, CString};
use libc::c_uint; use libc::c_uint;
use rustc_abi::Size;
use rustc_codegen_ssa::traits::{ use rustc_codegen_ssa::traits::{
BuilderMethods, ConstCodegenMethods, CoverageInfoBuilderMethods, MiscCodegenMethods, BuilderMethods, ConstCodegenMethods, CoverageInfoBuilderMethods, MiscCodegenMethods,
}; };
@ -10,7 +11,6 @@ use rustc_llvm::RustString;
use rustc_middle::mir::coverage::CoverageKind; use rustc_middle::mir::coverage::CoverageKind;
use rustc_middle::ty::Instance; use rustc_middle::ty::Instance;
use rustc_middle::ty::layout::HasTyCtxt; use rustc_middle::ty::layout::HasTyCtxt;
use rustc_target::abi::Size;
use tracing::{debug, instrument}; use tracing::{debug, instrument};
use crate::builder::Builder; use crate::builder::Builder;

View File

@ -5,6 +5,7 @@ use std::path::{Path, PathBuf};
use std::{iter, ptr}; use std::{iter, ptr};
use libc::{c_char, c_longlong, c_uint}; use libc::{c_char, c_longlong, c_uint};
use rustc_abi::{Align, Size};
use rustc_codegen_ssa::debuginfo::type_names::{VTableNameKind, cpp_like_debuginfo}; use rustc_codegen_ssa::debuginfo::type_names::{VTableNameKind, cpp_like_debuginfo};
use rustc_codegen_ssa::traits::*; use rustc_codegen_ssa::traits::*;
use rustc_hir::def::{CtorKind, DefKind}; use rustc_hir::def::{CtorKind, DefKind};
@ -19,7 +20,6 @@ use rustc_session::config::{self, DebugInfo, Lto};
use rustc_span::symbol::Symbol; use rustc_span::symbol::Symbol;
use rustc_span::{DUMMY_SP, FileName, FileNameDisplayPreference, SourceFile, hygiene}; use rustc_span::{DUMMY_SP, FileName, FileNameDisplayPreference, SourceFile, hygiene};
use rustc_symbol_mangling::typeid_for_trait_ref; use rustc_symbol_mangling::typeid_for_trait_ref;
use rustc_target::abi::{Align, Size};
use rustc_target::spec::DebuginfoKind; use rustc_target::spec::DebuginfoKind;
use smallvec::smallvec; use smallvec::smallvec;
use tracing::{debug, instrument}; use tracing::{debug, instrument};

View File

@ -1,6 +1,7 @@
use std::borrow::Cow; use std::borrow::Cow;
use libc::c_uint; use libc::c_uint;
use rustc_abi::{Align, Endian, Size, TagEncoding, VariantIdx, Variants};
use rustc_codegen_ssa::debuginfo::type_names::compute_debuginfo_type_name; use rustc_codegen_ssa::debuginfo::type_names::compute_debuginfo_type_name;
use rustc_codegen_ssa::debuginfo::{tag_base_type, wants_c_like_enum_debuginfo}; use rustc_codegen_ssa::debuginfo::{tag_base_type, wants_c_like_enum_debuginfo};
use rustc_codegen_ssa::traits::ConstCodegenMethods; use rustc_codegen_ssa::traits::ConstCodegenMethods;
@ -8,7 +9,6 @@ use rustc_index::IndexVec;
use rustc_middle::bug; use rustc_middle::bug;
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout}; use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
use rustc_middle::ty::{self, AdtDef, CoroutineArgs, CoroutineArgsExt, Ty}; use rustc_middle::ty::{self, AdtDef, CoroutineArgs, CoroutineArgsExt, Ty};
use rustc_target::abi::{Align, Endian, Size, TagEncoding, VariantIdx, Variants};
use smallvec::smallvec; use smallvec::smallvec;
use crate::common::{AsCCharPtr, CodegenCx}; use crate::common::{AsCCharPtr, CodegenCx};

View File

@ -1,5 +1,6 @@
use std::borrow::Cow; use std::borrow::Cow;
use rustc_abi::{FieldIdx, TagEncoding, VariantIdx, Variants};
use rustc_codegen_ssa::debuginfo::type_names::{compute_debuginfo_type_name, cpp_like_debuginfo}; use rustc_codegen_ssa::debuginfo::type_names::{compute_debuginfo_type_name, cpp_like_debuginfo};
use rustc_codegen_ssa::debuginfo::{tag_base_type, wants_c_like_enum_debuginfo}; use rustc_codegen_ssa::debuginfo::{tag_base_type, wants_c_like_enum_debuginfo};
use rustc_hir::def::CtorKind; use rustc_hir::def::CtorKind;
@ -9,7 +10,6 @@ use rustc_middle::mir::CoroutineLayout;
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout}; use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
use rustc_middle::ty::{self, AdtDef, CoroutineArgs, CoroutineArgsExt, Ty, VariantDef}; use rustc_middle::ty::{self, AdtDef, CoroutineArgs, CoroutineArgsExt, Ty, VariantDef};
use rustc_span::Symbol; use rustc_span::Symbol;
use rustc_target::abi::{FieldIdx, TagEncoding, VariantIdx, Variants};
use super::type_map::{DINodeCreationResult, UniqueTypeId}; use super::type_map::{DINodeCreationResult, UniqueTypeId};
use super::{SmallVec, size_and_align_of}; use super::{SmallVec, size_and_align_of};

View File

@ -1,13 +1,13 @@
use std::borrow::Cow; use std::borrow::Cow;
use libc::c_uint; use libc::c_uint;
use rustc_abi::{Size, TagEncoding, VariantIdx, Variants};
use rustc_codegen_ssa::debuginfo::type_names::compute_debuginfo_type_name; use rustc_codegen_ssa::debuginfo::type_names::compute_debuginfo_type_name;
use rustc_codegen_ssa::debuginfo::{tag_base_type, wants_c_like_enum_debuginfo}; use rustc_codegen_ssa::debuginfo::{tag_base_type, wants_c_like_enum_debuginfo};
use rustc_codegen_ssa::traits::ConstCodegenMethods; use rustc_codegen_ssa::traits::ConstCodegenMethods;
use rustc_middle::bug; use rustc_middle::bug;
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout}; use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
use rustc_middle::ty::{self}; use rustc_middle::ty::{self};
use rustc_target::abi::{Size, TagEncoding, VariantIdx, Variants};
use smallvec::smallvec; use smallvec::smallvec;
use crate::common::{AsCCharPtr, CodegenCx}; use crate::common::{AsCCharPtr, CodegenCx};

View File

@ -1,12 +1,12 @@
use std::cell::RefCell; use std::cell::RefCell;
use rustc_abi::{Align, Size, VariantIdx};
use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_macros::HashStable; use rustc_macros::HashStable;
use rustc_middle::bug; use rustc_middle::bug;
use rustc_middle::ty::{ParamEnv, PolyExistentialTraitRef, Ty, TyCtxt}; use rustc_middle::ty::{ParamEnv, PolyExistentialTraitRef, Ty, TyCtxt};
use rustc_target::abi::{Align, Size, VariantIdx};
use super::{SmallVec, UNKNOWN_LINE_NUMBER, unknown_file_metadata}; use super::{SmallVec, UNKNOWN_LINE_NUMBER, unknown_file_metadata};
use crate::common::{AsCCharPtr, CodegenCx}; use crate::common::{AsCCharPtr, CodegenCx};

View File

@ -5,6 +5,7 @@ use std::ops::Range;
use std::{iter, ptr}; use std::{iter, ptr};
use libc::c_uint; use libc::c_uint;
use rustc_abi::Size;
use rustc_codegen_ssa::debuginfo::type_names; use rustc_codegen_ssa::debuginfo::type_names;
use rustc_codegen_ssa::mir::debuginfo::VariableKind::*; use rustc_codegen_ssa::mir::debuginfo::VariableKind::*;
use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext, VariableKind}; use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext, VariableKind};
@ -22,7 +23,6 @@ use rustc_span::symbol::Symbol;
use rustc_span::{ use rustc_span::{
BytePos, Pos, SourceFile, SourceFileAndLine, SourceFileHash, Span, StableSourceFileId, BytePos, Pos, SourceFile, SourceFileAndLine, SourceFileHash, Span, StableSourceFileId,
}; };
use rustc_target::abi::Size;
use smallvec::SmallVec; use smallvec::SmallVec;
use tracing::debug; use tracing::debug;

View File

@ -1,6 +1,7 @@
use std::assert_matches::assert_matches; use std::assert_matches::assert_matches;
use std::cmp::Ordering; use std::cmp::Ordering;
use rustc_abi::{self as abi, Align, Float, HasDataLayout, Primitive, Size};
use rustc_codegen_ssa::base::{compare_simd_types, wants_msvc_seh, wants_wasm_eh}; use rustc_codegen_ssa::base::{compare_simd_types, wants_msvc_seh, wants_wasm_eh};
use rustc_codegen_ssa::common::{IntPredicate, TypeKind}; use rustc_codegen_ssa::common::{IntPredicate, TypeKind};
use rustc_codegen_ssa::errors::{ExpectedPointerMutability, InvalidMonomorphization}; use rustc_codegen_ssa::errors::{ExpectedPointerMutability, InvalidMonomorphization};
@ -13,11 +14,10 @@ use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt, LayoutOf};
use rustc_middle::ty::{self, GenericArgsRef, Ty}; use rustc_middle::ty::{self, GenericArgsRef, Ty};
use rustc_middle::{bug, span_bug}; use rustc_middle::{bug, span_bug};
use rustc_span::{Span, Symbol, sym}; use rustc_span::{Span, Symbol, sym};
use rustc_target::abi::{self, Align, Float, HasDataLayout, Primitive, Size};
use rustc_target::spec::{HasTargetSpec, PanicStrategy}; use rustc_target::spec::{HasTargetSpec, PanicStrategy};
use tracing::debug; use tracing::debug;
use crate::abi::{Abi, FnAbi, FnAbiLlvmExt, LlvmType, PassMode}; use crate::abi::{ExternAbi, FnAbi, FnAbiLlvmExt, LlvmType, PassMode};
use crate::builder::Builder; use crate::builder::Builder;
use crate::context::CodegenCx; use crate::context::CodegenCx;
use crate::llvm::{self, Metadata}; use crate::llvm::{self, Metadata};
@ -1094,7 +1094,7 @@ fn get_rust_try_fn<'ll, 'tcx>(
tcx.types.unit, tcx.types.unit,
false, false,
hir::Safety::Unsafe, hir::Safety::Unsafe,
Abi::Rust, ExternAbi::Rust,
)), )),
); );
// `unsafe fn(*mut i8, *mut i8) -> ()` // `unsafe fn(*mut i8, *mut i8) -> ()`
@ -1105,7 +1105,7 @@ fn get_rust_try_fn<'ll, 'tcx>(
tcx.types.unit, tcx.types.unit,
false, false,
hir::Safety::Unsafe, hir::Safety::Unsafe,
Abi::Rust, ExternAbi::Rust,
)), )),
); );
// `unsafe fn(unsafe fn(*mut i8) -> (), *mut i8, unsafe fn(*mut i8, *mut i8) -> ()) -> i32` // `unsafe fn(unsafe fn(*mut i8) -> (), *mut i8, unsafe fn(*mut i8, *mut i8) -> ()) -> i32`
@ -1114,7 +1114,7 @@ fn get_rust_try_fn<'ll, 'tcx>(
tcx.types.i32, tcx.types.i32,
false, false,
hir::Safety::Unsafe, hir::Safety::Unsafe,
Abi::Rust, ExternAbi::Rust,
)); ));
let rust_try = gen_fn(cx, "__rust_try", rust_fn_sig, codegen); let rust_try = gen_fn(cx, "__rust_try", rust_fn_sig, codegen);
cx.rust_try_fn.set(Some(rust_try)); cx.rust_try_fn.set(Some(rust_try));

View File

@ -8,8 +8,8 @@ use std::str::FromStr;
use std::string::FromUtf8Error; use std::string::FromUtf8Error;
use libc::c_uint; use libc::c_uint;
use rustc_abi::{Align, Size, WrappingRange};
use rustc_llvm::RustString; use rustc_llvm::RustString;
use rustc_target::abi::{Align, Size, WrappingRange};
pub use self::AtomicRmwBinOp::*; pub use self::AtomicRmwBinOp::*;
pub use self::CallConv::*; pub use self::CallConv::*;

View File

@ -1,14 +1,14 @@
use std::{fmt, ptr}; use std::{fmt, ptr};
use libc::{c_char, c_uint}; use libc::{c_char, c_uint};
use rustc_abi::{AddressSpace, Align, Integer, Size};
use rustc_codegen_ssa::common::TypeKind; use rustc_codegen_ssa::common::TypeKind;
use rustc_codegen_ssa::traits::*; use rustc_codegen_ssa::traits::*;
use rustc_data_structures::small_c_str::SmallCStr; use rustc_data_structures::small_c_str::SmallCStr;
use rustc_middle::bug; use rustc_middle::bug;
use rustc_middle::ty::layout::TyAndLayout; use rustc_middle::ty::layout::TyAndLayout;
use rustc_middle::ty::{self, Ty}; use rustc_middle::ty::{self, Ty};
use rustc_target::abi::call::{CastTarget, FnAbi, Reg}; use rustc_target::callconv::{CastTarget, FnAbi, Reg};
use rustc_target::abi::{AddressSpace, Align, Integer, Size};
use crate::abi::{FnAbiLlvmExt, LlvmType}; use crate::abi::{FnAbiLlvmExt, LlvmType};
use crate::context::CodegenCx; use crate::context::CodegenCx;

View File

@ -1,9 +1,9 @@
use rustc_abi::{Align, Endian, HasDataLayout, Size};
use rustc_codegen_ssa::common::IntPredicate; use rustc_codegen_ssa::common::IntPredicate;
use rustc_codegen_ssa::mir::operand::OperandRef; use rustc_codegen_ssa::mir::operand::OperandRef;
use rustc_codegen_ssa::traits::{BaseTypeCodegenMethods, BuilderMethods, ConstCodegenMethods}; use rustc_codegen_ssa::traits::{BaseTypeCodegenMethods, BuilderMethods, ConstCodegenMethods};
use rustc_middle::ty::Ty; use rustc_middle::ty::Ty;
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf}; use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
use rustc_target::abi::{Align, Endian, HasDataLayout, Size};
use crate::builder::Builder; use crate::builder::Builder;
use crate::type_::Type; use crate::type_::Type;

View File

@ -11,6 +11,7 @@ use object::{
SectionFlags, SectionKind, SubArchitecture, SymbolFlags, SymbolKind, SymbolScope, elf, pe, SectionFlags, SectionKind, SubArchitecture, SymbolFlags, SymbolKind, SymbolScope, elf, pe,
xcoff, xcoff,
}; };
use rustc_abi::Endian;
use rustc_data_structures::memmap::Mmap; use rustc_data_structures::memmap::Mmap;
use rustc_data_structures::owned_slice::{OwnedSlice, try_slice_owned}; use rustc_data_structures::owned_slice::{OwnedSlice, try_slice_owned};
use rustc_metadata::EncodedMetadata; use rustc_metadata::EncodedMetadata;
@ -19,7 +20,6 @@ use rustc_metadata::fs::METADATA_FILENAME;
use rustc_middle::bug; use rustc_middle::bug;
use rustc_session::Session; use rustc_session::Session;
use rustc_span::sym; use rustc_span::sym;
use rustc_target::abi::Endian;
use rustc_target::spec::{RelocModel, Target, ef_avr_arch}; use rustc_target::spec::{RelocModel, Target, ef_avr_arch};
use super::apple; use super::apple;

View File

@ -548,7 +548,7 @@ pub(crate) fn linking_symbol_name_for_instance_in_crate<'tcx>(
symbol: ExportedSymbol<'tcx>, symbol: ExportedSymbol<'tcx>,
instantiating_crate: CrateNum, instantiating_crate: CrateNum,
) -> String { ) -> String {
use rustc_target::abi::call::Conv; use rustc_target::callconv::Conv;
let mut undecorated = symbol_name_for_instance_in_crate(tcx, symbol, instantiating_crate); let mut undecorated = symbol_name_for_instance_in_crate(tcx, symbol, instantiating_crate);

View File

@ -3,6 +3,7 @@ use std::collections::BTreeSet;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use itertools::Itertools; use itertools::Itertools;
use rustc_abi::FIRST_VARIANT;
use rustc_ast::expand::allocator::{ALLOCATOR_METHODS, AllocatorKind, global_fn_name}; use rustc_ast::expand::allocator::{ALLOCATOR_METHODS, AllocatorKind, global_fn_name};
use rustc_attr as attr; use rustc_attr as attr;
use rustc_data_structures::fx::{FxHashMap, FxIndexSet}; use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
@ -26,7 +27,6 @@ use rustc_session::Session;
use rustc_session::config::{self, CrateType, EntryFnType, OptLevel, OutputType}; use rustc_session::config::{self, CrateType, EntryFnType, OptLevel, OutputType};
use rustc_span::symbol::sym; use rustc_span::symbol::sym;
use rustc_span::{DUMMY_SP, Symbol}; use rustc_span::{DUMMY_SP, Symbol};
use rustc_target::abi::FIRST_VARIANT;
use rustc_trait_selection::infer::at::ToTrace; use rustc_trait_selection::infer::at::ToTrace;
use rustc_trait_selection::infer::{BoundRegionConversionTime, TyCtxtInferExt}; use rustc_trait_selection::infer::{BoundRegionConversionTime, TyCtxtInferExt};
use rustc_trait_selection::traits::{ObligationCause, ObligationCtxt}; use rustc_trait_selection::traits::{ObligationCause, ObligationCtxt};

View File

@ -1,7 +1,7 @@
use rustc_abi::{Integer, Primitive, Size, TagEncoding, Variants};
use rustc_middle::bug; use rustc_middle::bug;
use rustc_middle::ty::layout::{IntegerExt, PrimitiveExt, TyAndLayout}; use rustc_middle::ty::layout::{IntegerExt, PrimitiveExt, TyAndLayout};
use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_target::abi::{Integer, Primitive, Size, TagEncoding, Variants};
// FIXME(eddyb) find a place for this (or a way to replace it). // FIXME(eddyb) find a place for this (or a way to replace it).
pub mod type_names; pub mod type_names;

View File

@ -13,6 +13,7 @@
use std::fmt::Write; use std::fmt::Write;
use rustc_abi::Integer;
use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::stable_hasher::{Hash64, HashStable, StableHasher}; use rustc_data_structures::stable_hasher::{Hash64, HashStable, StableHasher};
use rustc_hir::def_id::DefId; use rustc_hir::def_id::DefId;
@ -23,7 +24,6 @@ use rustc_middle::ty::layout::{IntegerExt, TyAndLayout};
use rustc_middle::ty::{ use rustc_middle::ty::{
self, ExistentialProjection, GenericArgKind, GenericArgsRef, ParamEnv, Ty, TyCtxt, self, ExistentialProjection, GenericArgKind, GenericArgsRef, ParamEnv, Ty, TyCtxt,
}; };
use rustc_target::abi::Integer;
use smallvec::SmallVec; use smallvec::SmallVec;
use crate::debuginfo::wants_c_like_enum_debuginfo; use crate::debuginfo::wants_c_like_enum_debuginfo;
@ -364,7 +364,7 @@ fn push_debuginfo_type_name<'tcx>(
} else { } else {
output.push_str(sig.safety.prefix_str()); output.push_str(sig.safety.prefix_str());
if sig.abi != rustc_target::spec::abi::Abi::Rust { if sig.abi != rustc_abi::ExternAbi::Rust {
output.push_str("extern \""); output.push_str("extern \"");
output.push_str(sig.abi.name()); output.push_str(sig.abi.name());
output.push_str("\" "); output.push_str("\" ");

View File

@ -2,7 +2,7 @@ use rustc_middle::bug;
use rustc_middle::ty::{self, GenericArgKind, Ty}; use rustc_middle::ty::{self, GenericArgKind, Ty};
use rustc_session::config::Lto; use rustc_session::config::Lto;
use rustc_symbol_mangling::typeid_for_trait_ref; use rustc_symbol_mangling::typeid_for_trait_ref;
use rustc_target::abi::call::FnAbi; use rustc_target::callconv::FnAbi;
use tracing::{debug, instrument}; use tracing::{debug, instrument};
use crate::traits::*; use crate::traits::*;

View File

@ -1,5 +1,6 @@
use std::cmp; use std::cmp;
use rustc_abi::{self as abi, ExternAbi, HasDataLayout, WrappingRange};
use rustc_ast as ast; use rustc_ast as ast;
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
use rustc_hir::lang_items::LangItem; use rustc_hir::lang_items::LangItem;
@ -13,9 +14,7 @@ use rustc_middle::{bug, span_bug};
use rustc_session::config::OptLevel; use rustc_session::config::OptLevel;
use rustc_span::source_map::Spanned; use rustc_span::source_map::Spanned;
use rustc_span::{Span, sym}; use rustc_span::{Span, sym};
use rustc_target::abi::call::{ArgAbi, FnAbi, PassMode, Reg}; use rustc_target::callconv::{ArgAbi, FnAbi, PassMode, Reg};
use rustc_target::abi::{self, HasDataLayout, WrappingRange};
use rustc_target::spec::abi::Abi;
use tracing::{debug, info}; use tracing::{debug, info};
use super::operand::OperandRef; use super::operand::OperandRef;
@ -977,7 +976,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
}); });
// Split the rust-call tupled arguments off. // Split the rust-call tupled arguments off.
let (first_args, untuple) = if abi == Abi::RustCall && !args.is_empty() { let (first_args, untuple) = if abi == ExternAbi::RustCall && !args.is_empty() {
let (tup, args) = args.split_last().unwrap(); let (tup, args) = args.split_last().unwrap();
(args, Some(tup)) (args, Some(tup))
} else { } else {

View File

@ -1,9 +1,9 @@
use rustc_abi::WrappingRange;
use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_middle::{bug, span_bug}; use rustc_middle::{bug, span_bug};
use rustc_session::config::OptLevel; use rustc_session::config::OptLevel;
use rustc_span::{Span, sym}; use rustc_span::{Span, sym};
use rustc_target::abi::WrappingRange; use rustc_target::callconv::{FnAbi, PassMode};
use rustc_target::abi::call::{FnAbi, PassMode};
use super::FunctionCx; use super::FunctionCx;
use super::operand::OperandRef; use super::operand::OperandRef;

View File

@ -7,7 +7,7 @@ use rustc_middle::mir::{UnwindTerminateReason, traversal};
use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt, TyAndLayout}; use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt, TyAndLayout};
use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypeFoldable, TypeVisitableExt}; use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypeFoldable, TypeVisitableExt};
use rustc_middle::{bug, mir, span_bug}; use rustc_middle::{bug, mir, span_bug};
use rustc_target::abi::call::{FnAbi, PassMode}; use rustc_target::callconv::{FnAbi, PassMode};
use tracing::{debug, instrument}; use tracing::{debug, instrument};
use crate::base; use crate::base;

View File

@ -1,10 +1,9 @@
use rustc_abi::Primitive::{Int, Pointer}; use rustc_abi::Primitive::{Int, Pointer};
use rustc_abi::{Align, FieldsShape, Size, TagEncoding, Variants}; use rustc_abi::{Align, FieldsShape, Size, TagEncoding, VariantIdx, Variants};
use rustc_middle::mir::tcx::PlaceTy; use rustc_middle::mir::tcx::PlaceTy;
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout}; use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
use rustc_middle::ty::{self, Ty}; use rustc_middle::ty::{self, Ty};
use rustc_middle::{bug, mir}; use rustc_middle::{bug, mir};
use rustc_target::abi::VariantIdx;
use tracing::{debug, instrument}; use tracing::{debug, instrument};
use super::operand::OperandValue; use super::operand::OperandValue;

View File

@ -1,13 +1,13 @@
use std::assert_matches::assert_matches; use std::assert_matches::assert_matches;
use arrayvec::ArrayVec; use arrayvec::ArrayVec;
use rustc_abi::{self as abi, FIRST_VARIANT, FieldIdx};
use rustc_middle::ty::adjustment::PointerCoercion; use rustc_middle::ty::adjustment::PointerCoercion;
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout}; use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
use rustc_middle::ty::{self, Instance, Ty, TyCtxt}; use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
use rustc_middle::{bug, mir, span_bug}; use rustc_middle::{bug, mir, span_bug};
use rustc_session::config::OptLevel; use rustc_session::config::OptLevel;
use rustc_span::{DUMMY_SP, Span}; use rustc_span::{DUMMY_SP, Span};
use rustc_target::abi::{self, FIRST_VARIANT, FieldIdx};
use tracing::{debug, instrument}; use tracing::{debug, instrument};
use super::operand::{OperandRef, OperandValue}; use super::operand::{OperandRef, OperandValue};

View File

@ -78,7 +78,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
let count = self.codegen_operand(bx, count).immediate(); let count = self.codegen_operand(bx, count).immediate();
let pointee_layout = dst_val let pointee_layout = dst_val
.layout .layout
.pointee_info_at(bx, rustc_target::abi::Size::ZERO) .pointee_info_at(bx, rustc_abi::Size::ZERO)
.expect("Expected pointer"); .expect("Expected pointer");
let bytes = bx.mul(count, bx.const_usize(pointee_layout.size.bytes())); let bytes = bx.mul(count, bx.const_usize(pointee_layout.size.bytes()));

View File

@ -1,10 +1,10 @@
//! Computing the size and alignment of a value. //! Computing the size and alignment of a value.
use rustc_abi::WrappingRange;
use rustc_hir::LangItem; use rustc_hir::LangItem;
use rustc_middle::bug; use rustc_middle::bug;
use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths}; use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
use rustc_middle::ty::{self, Ty}; use rustc_middle::ty::{self, Ty};
use rustc_target::abi::WrappingRange;
use tracing::{debug, trace}; use tracing::{debug, trace};
use crate::common::IntPredicate; use crate::common::IntPredicate;

View File

@ -7,7 +7,7 @@ use rustc_middle::ty::layout::{FnAbiOf, LayoutOf, TyAndLayout};
use rustc_middle::ty::{Instance, Ty}; use rustc_middle::ty::{Instance, Ty};
use rustc_session::config::OptLevel; use rustc_session::config::OptLevel;
use rustc_span::Span; use rustc_span::Span;
use rustc_target::abi::call::FnAbi; use rustc_target::callconv::FnAbi;
use super::abi::AbiBuilderMethods; use super::abi::AbiBuilderMethods;
use super::asm::AsmBuilderMethods; use super::asm::AsmBuilderMethods;

View File

@ -1,10 +1,10 @@
use std::ops::Range; use std::ops::Range;
use rustc_abi::Size;
use rustc_middle::mir; use rustc_middle::mir;
use rustc_middle::ty::{Instance, PolyExistentialTraitRef, Ty}; use rustc_middle::ty::{Instance, PolyExistentialTraitRef, Ty};
use rustc_span::{SourceFile, Span, Symbol}; use rustc_span::{SourceFile, Span, Symbol};
use rustc_target::abi::Size; use rustc_target::callconv::FnAbi;
use rustc_target::abi::call::FnAbi;
use super::BackendTypes; use super::BackendTypes;
use crate::mir::debuginfo::{FunctionDebugContext, VariableKind}; use crate::mir::debuginfo::{FunctionDebugContext, VariableKind};

View File

@ -1,6 +1,6 @@
use rustc_middle::ty::{self, Ty}; use rustc_middle::ty::{self, Ty};
use rustc_span::Span; use rustc_span::Span;
use rustc_target::abi::call::FnAbi; use rustc_target::callconv::FnAbi;
use super::BackendTypes; use super::BackendTypes;
use crate::mir::operand::OperandRef; use crate::mir::operand::OperandRef;

View File

@ -29,7 +29,7 @@ use std::fmt;
use rustc_middle::ty::Ty; use rustc_middle::ty::Ty;
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf, TyAndLayout}; use rustc_middle::ty::layout::{FnAbiOf, LayoutOf, TyAndLayout};
use rustc_target::abi::call::FnAbi; use rustc_target::callconv::FnAbi;
pub use self::abi::AbiBuilderMethods; pub use self::abi::AbiBuilderMethods;
pub use self::asm::{ pub use self::asm::{

View File

@ -1,5 +1,5 @@
use rustc_abi::Align;
use rustc_hir::def_id::DefId; use rustc_hir::def_id::DefId;
use rustc_target::abi::Align;
use super::BackendTypes; use super::BackendTypes;

View File

@ -1,8 +1,8 @@
use rustc_abi::{AddressSpace, Float, Integer};
use rustc_middle::bug; use rustc_middle::bug;
use rustc_middle::ty::layout::{HasTyCtxt, TyAndLayout}; use rustc_middle::ty::layout::{HasTyCtxt, TyAndLayout};
use rustc_middle::ty::{self, Ty}; use rustc_middle::ty::{self, Ty};
use rustc_target::abi::call::{ArgAbi, CastTarget, FnAbi, Reg}; use rustc_target::callconv::{ArgAbi, CastTarget, FnAbi, Reg};
use rustc_target::abi::{AddressSpace, Float, Integer};
use super::BackendTypes; use super::BackendTypes;
use super::misc::MiscCodegenMethods; use super::misc::MiscCodegenMethods;