Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

librustc_codegen_ssa => 2018 #58322

Merged
merged 1 commit into from
Feb 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/librustc_codegen_ssa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
authors = ["The Rust Project Developers"]
name = "rustc_codegen_ssa"
version = "0.0.0"
edition = "2018"

[lib]
name = "rustc_codegen_ssa"
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_target::spec::LinkerFlavor;
use rustc::hir::def_id::CrateNum;

use super::command::Command;
use CrateInfo;
use crate::CrateInfo;

use cc::windows_registry;
use std::fs;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_ssa/back/lto.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::write::CodegenContext;
use traits::*;
use ModuleCodegen;
use crate::traits::*;
use crate::ModuleCodegen;

use rustc::util::time_graph::Timeline;
use rustc_errors::FatalError;
Expand Down
7 changes: 3 additions & 4 deletions src/librustc_codegen_ssa/back/write.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use {ModuleCodegen, ModuleKind, CachedModuleCodegen, CompiledModule, CrateInfo, CodegenResults,
RLIB_BYTECODE_EXTENSION};
use crate::{ModuleCodegen, ModuleKind, CachedModuleCodegen, CompiledModule, CrateInfo,
CodegenResults, RLIB_BYTECODE_EXTENSION};
use super::linker::LinkerInfo;
use super::lto::{self, SerializedModule};
use super::link::{self, remove, get_linker};
use super::command::Command;
use super::symbol_export::ExportedSymbols;

use memmap;
use crate::traits::*;
use rustc_incremental::{copy_cgu_workproducts_to_incr_comp_cache_dir,
in_incr_comp_dir, in_incr_comp_dir_sess};
use rustc::dep_graph::{WorkProduct, WorkProductId, WorkProductFileKind};
Expand All @@ -16,7 +16,6 @@ use rustc::session::config::{self, OutputFilenames, OutputType, Passes, Sanitize
use rustc::session::Session;
use rustc::util::nodemap::FxHashMap;
use rustc::util::time_graph::{self, TimeGraph, Timeline};
use traits::*;
use rustc::hir::def_id::{CrateNum, LOCAL_CRATE};
use rustc::ty::TyCtxt;
use rustc::util::common::{time_depth, set_time_depth, print_time_passes_entry};
Expand Down
24 changes: 12 additions & 12 deletions src/librustc_codegen_ssa/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//! but one llvm::Type corresponds to many `Ty`s; for instance, tup(int, int,
//! int) and rec(x=int, y=int, z=int) will have the same llvm::Type.

use {ModuleCodegen, ModuleKind, CachedModuleCodegen};
use crate::{ModuleCodegen, ModuleKind, CachedModuleCodegen};

use rustc::dep_graph::cgu_reuse_tracker::CguReuse;
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
Expand All @@ -28,26 +28,26 @@ use rustc::util::common::{time, print_time_passes_entry};
use rustc::util::profiling::ProfileCategory;
use rustc::session::config::{self, EntryFnType, Lto};
use rustc::session::Session;
use mir::place::PlaceRef;
use back::write::{OngoingCodegen, start_async_codegen, submit_pre_lto_module_to_llvm,
submit_post_lto_module_to_llvm};
use {MemFlags, CrateInfo};
use callee;
use rustc_mir::monomorphize::item::DefPathBasedNames;
use common::{RealPredicate, TypeKind, IntPredicate};
use meth;
use mir;
use rustc::util::time_graph;
use rustc_mir::monomorphize::Instance;
use rustc_mir::monomorphize::partitioning::{CodegenUnit, CodegenUnitExt};
use mono_item::MonoItem;
use rustc::util::nodemap::FxHashMap;
use rustc_data_structures::indexed_vec::Idx;
use rustc_data_structures::sync::Lrc;
use rustc_codegen_utils::{symbol_names_test, check_for_rustc_errors_attr};
use rustc::ty::layout::{FAT_PTR_ADDR, FAT_PTR_EXTRA};
use crate::mir::place::PlaceRef;
use crate::back::write::{OngoingCodegen, start_async_codegen, submit_pre_lto_module_to_llvm,
submit_post_lto_module_to_llvm};
use crate::{MemFlags, CrateInfo};
use crate::callee;
use crate::common::{RealPredicate, TypeKind, IntPredicate};
use crate::meth;
use crate::mir;
use crate::mono_item::MonoItem;

use traits::*;
use crate::traits::*;

use std::any::Any;
use std::cmp;
Expand All @@ -58,7 +58,7 @@ use syntax_pos::Span;
use syntax::attr;
use rustc::hir;

use mir::operand::OperandValue;
use crate::mir::operand::OperandValue;

use std::marker::PhantomData;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/callee.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use traits::*;
use crate::traits::*;
use rustc::ty;
use rustc::ty::subst::Substs;
use rustc::hir::def_id::DefId;
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_codegen_ssa/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use syntax_pos::{DUMMY_SP, Span};

use rustc::hir::def_id::DefId;
use rustc::middle::lang_items::LangItem;
use base;
use traits::*;
use crate::base;
use crate::traits::*;

use rustc::hir;
use traits::BuilderMethods;
use crate::traits::BuilderMethods;

pub fn type_needs_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
ty.needs_drop(tcx, ty::ParamEnv::reveal_all())
Expand Down Expand Up @@ -123,7 +123,7 @@ pub enum TypeKind {
mod temp_stable_hash_impls {
use rustc_data_structures::stable_hasher::{StableHasherResult, StableHasher,
HashStable};
use ModuleCodegen;
use crate::ModuleCodegen;

impl<HCX, M> HashStable<HCX> for ModuleCodegen<M> {
fn hash_stable<W: StableHasherResult>(&self,
Expand Down
8 changes: 3 additions & 5 deletions src/librustc_codegen_ssa/glue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
//
// Code relating to drop glue.

use std;

use common::IntPredicate;
use meth;
use rustc::ty::{self, Ty};
use traits::*;
use crate::common::IntPredicate;
use crate::meth;
use crate::traits::*;

pub fn size_and_align_of_dst<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
bx: &mut Bx,
Expand Down
25 changes: 5 additions & 20 deletions src/librustc_codegen_ssa/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,19 @@
#![feature(nll)]
#![allow(unused_attributes)]
#![allow(dead_code)]
#![deny(rust_2018_idioms)]
#![allow(explicit_outlives_requirements)]
#![allow(elided_lifetimes_in_paths)]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This crate uses TyCtxt more than a few times, so elided_lifetimes_in_paths is allowed.


#![recursion_limit="256"]

//! This crate contains codegen code that is used by all codegen backends (LLVM and others).
//! The backend-agnostic functions of this crate use functions defined in various traits that
//! have to be implemented by each backends.

#[macro_use] extern crate bitflags;
#[macro_use] extern crate log;
extern crate rustc_apfloat;
#[macro_use] extern crate rustc;
extern crate rustc_target;
extern crate rustc_mir;
#[macro_use] extern crate rustc;
#[macro_use] extern crate syntax;
extern crate syntax_pos;
extern crate rustc_incremental;
extern crate rustc_codegen_utils;
extern crate rustc_data_structures;
extern crate rustc_allocator;
extern crate rustc_fs_util;
extern crate serialize;
extern crate rustc_errors;
extern crate rustc_demangle;
extern crate cc;
extern crate libc;
extern crate jobserver;
extern crate memmap;
extern crate num_cpus;

use std::path::PathBuf;
use rustc::dep_graph::WorkProduct;
Expand Down Expand Up @@ -133,7 +118,7 @@ pub enum ModuleKind {
Allocator,
}

bitflags! {
bitflags::bitflags! {
pub struct MemFlags: u8 {
const VOLATILE = 1 << 0;
const NONTEMPORAL = 1 << 1;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_ssa/meth.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use rustc_target::abi::call::FnType;
use callee;
use rustc_mir::monomorphize;

use traits::*;
use crate::callee;
use crate::traits::*;

use rustc::ty::{self, Ty};

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/mir/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use rustc::mir::traversal;
use rustc::ty;
use rustc::ty::layout::{LayoutOf, HasTyCtxt};
use super::FunctionCx;
use traits::*;
use crate::traits::*;

pub fn non_ssa_locals<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
fx: &FunctionCx<'a, 'tcx, Bx>
Expand Down
10 changes: 5 additions & 5 deletions src/librustc_codegen_ssa/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ use rustc::mir;
use rustc::mir::interpret::EvalErrorKind;
use rustc_target::abi::call::{ArgType, FnType, PassMode};
use rustc_target::spec::abi::Abi;
use base;
use MemFlags;
use common::{self, IntPredicate};
use meth;
use rustc_mir::monomorphize;
use crate::base;
use crate::MemFlags;
use crate::common::{self, IntPredicate};
use crate::meth;

use traits::*;
use crate::traits::*;

use syntax::symbol::Symbol;
use syntax_pos::Pos;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/mir/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rustc::mir::interpret::GlobalId;
use rustc::ty::{self, Ty};
use rustc::ty::layout;
use syntax::source_map::Span;
use traits::*;
use crate::traits::*;

use super::FunctionCx;

Expand Down
6 changes: 3 additions & 3 deletions src/librustc_codegen_ssa/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use rustc::ty::layout::{TyLayout, HasTyCtxt};
use rustc::mir::{self, Mir};
use rustc::ty::subst::Substs;
use rustc::session::config::DebugInfo;
use base;
use debuginfo::{self, VariableAccess, VariableKind, FunctionDebugContext};
use rustc_mir::monomorphize::Instance;
use rustc_target::abi::call::{FnType, PassMode};
use traits::*;
use crate::base;
use crate::debuginfo::{self, VariableAccess, VariableKind, FunctionDebugContext};
use crate::traits::*;

use syntax_pos::{DUMMY_SP, NO_EXPANSION, BytePos, Span};
use syntax::symbol::keywords;
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_codegen_ssa/mir/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use rustc::mir;
use rustc::ty;
use rustc::ty::layout::{self, Align, LayoutOf, TyLayout};

use base;
use MemFlags;
use glue;
use crate::base;
use crate::MemFlags;
use crate::glue;

use traits::*;
use crate::traits::*;

use std::fmt;

Expand Down
8 changes: 4 additions & 4 deletions src/librustc_codegen_ssa/mir/place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ use rustc::ty::{self, Ty};
use rustc::ty::layout::{self, Align, TyLayout, LayoutOf, VariantIdx, HasTyCtxt};
use rustc::mir;
use rustc::mir::tcx::PlaceTy;
use MemFlags;
use common::IntPredicate;
use glue;
use crate::MemFlags;
use crate::common::IntPredicate;
use crate::glue;

use traits::*;
use crate::traits::*;

use super::{FunctionCx, LocalRef};
use super::operand::OperandValue;
Expand Down
10 changes: 5 additions & 5 deletions src/librustc_codegen_ssa/mir/rvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ use rustc::middle::lang_items::ExchangeMallocFnLangItem;
use rustc_apfloat::{ieee, Float, Status, Round};
use std::{u128, i128};

use base;
use MemFlags;
use callee;
use common::{self, RealPredicate, IntPredicate};
use crate::base;
use crate::MemFlags;
use crate::callee;
use crate::common::{self, RealPredicate, IntPredicate};
use rustc_mir::monomorphize;

use traits::*;
use crate::traits::*;

use super::{FunctionCx, LocalRef};
use super::operand::{OperandRef, OperandValue};
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_ssa/mir/statement.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use rustc::mir;

use traits::BuilderMethods;
use crate::traits::BuilderMethods;
use super::FunctionCx;
use super::LocalRef;
use super::OperandValue;
use traits::*;
use crate::traits::*;

impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
pub fn codegen_statement(
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_ssa/mono_item.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use base;
use rustc::hir;
use rustc::hir::def::Def;
use rustc::mir::mono::{Linkage, Visibility};
use rustc::ty::layout::HasTyCtxt;
use std::fmt;
use traits::*;
use crate::base;
use crate::traits::*;

pub use rustc::mir::mono::MonoItem;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/traits/asm.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::BackendTypes;
use mir::place::PlaceRef;
use crate::mir::place::PlaceRef;
use rustc::hir::{GlobalAsm, InlineAsm};

pub trait AsmBuilderMethods<'tcx>: BackendTypes {
Expand Down
9 changes: 5 additions & 4 deletions src/librustc_codegen_ssa/traits/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ use super::debuginfo::DebugInfoBuilderMethods;
use super::intrinsic::IntrinsicCallMethods;
use super::type_::ArgTypeMethods;
use super::{HasCodegen, StaticBuilderMethods};
use common::{AtomicOrdering, AtomicRmwBinOp, IntPredicate, RealPredicate, SynchronizationScope};
use mir::operand::OperandRef;
use mir::place::PlaceRef;
use crate::common::{AtomicOrdering, AtomicRmwBinOp, IntPredicate, RealPredicate,
SynchronizationScope};
use crate::mir::operand::OperandRef;
use crate::mir::place::PlaceRef;
use crate::MemFlags;
use rustc::ty::Ty;
use rustc::ty::layout::{Align, Size};
use std::ffi::CStr;
use MemFlags;

use std::borrow::Cow;
use std::ops::Range;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/traits/consts.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::BackendTypes;
use mir::place::PlaceRef;
use crate::mir::place::PlaceRef;
use rustc::mir::interpret::Allocation;
use rustc::mir::interpret::Scalar;
use rustc::ty::layout;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/traits/debuginfo.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::BackendTypes;
use debuginfo::{FunctionDebugContext, MirDebugScope, VariableAccess, VariableKind};
use crate::debuginfo::{FunctionDebugContext, MirDebugScope, VariableAccess, VariableKind};
use rustc::hir::def_id::CrateNum;
use rustc::mir;
use rustc::ty::{self, Ty};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/traits/intrinsic.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::BackendTypes;
use mir::operand::OperandRef;
use crate::mir::operand::OperandRef;
use rustc::ty::Ty;
use rustc_target::abi::call::FnType;
use syntax_pos::Span;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_ssa/traits/type_.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use super::misc::MiscMethods;
use super::Backend;
use super::HasCodegen;
use common::{self, TypeKind};
use mir::place::PlaceRef;
use crate::common::{self, TypeKind};
use crate::mir::place::PlaceRef;
use rustc::ty::layout::{self, Align, Size, TyLayout};
use rustc::ty::{self, Ty};
use rustc::util::nodemap::FxHashMap;
Expand Down
Loading