From 035a645e64df9e5192698c3d6c442e57c39b40b8 Mon Sep 17 00:00:00 2001 From: Eduard Burtescu Date: Tue, 22 Mar 2016 19:23:36 +0200 Subject: [PATCH] rustc_trans: move the contents of the trans module to top-level. --- src/librustc_driver/driver.rs | 2 +- src/librustc_trans/{trans => }/_match.rs | 36 ++++---- src/librustc_trans/{trans => }/abi.rs | 32 +++---- src/librustc_trans/{trans => }/adt.rs | 30 +++---- src/librustc_trans/{trans => }/asm.rs | 12 +-- .../{trans => }/assert_dep_graph.rs | 0 src/librustc_trans/{trans => }/attributes.rs | 2 +- src/librustc_trans/back/link.rs | 2 +- src/librustc_trans/back/linker.rs | 2 +- src/librustc_trans/back/symbol_names.rs | 3 +- src/librustc_trans/back/write.rs | 2 +- src/librustc_trans/{trans => }/base.rs | 80 +++++++++--------- src/librustc_trans/{trans => }/basic_block.rs | 2 +- src/librustc_trans/{trans => }/build.rs | 10 +-- src/librustc_trans/{trans => }/builder.rs | 10 +-- .../{trans => }/cabi_aarch64.rs | 6 +- src/librustc_trans/{trans => }/cabi_arm.rs | 6 +- src/librustc_trans/{trans => }/cabi_asmjs.rs | 4 +- src/librustc_trans/{trans => }/cabi_mips.rs | 6 +- .../{trans => }/cabi_powerpc.rs | 6 +- .../{trans => }/cabi_powerpc64.rs | 6 +- src/librustc_trans/{trans => }/cabi_x86.rs | 4 +- src/librustc_trans/{trans => }/cabi_x86_64.rs | 6 +- .../{trans => }/cabi_x86_win64.rs | 4 +- src/librustc_trans/{trans => }/callee.rs | 52 ++++++------ src/librustc_trans/{trans => }/cleanup.rs | 18 ++-- src/librustc_trans/{trans => }/closure.rs | 32 +++---- src/librustc_trans/{trans => }/collector.rs | 14 ++-- src/librustc_trans/{trans => }/common.rs | 44 +++++----- src/librustc_trans/{trans => }/consts.rs | 30 +++---- src/librustc_trans/{trans => }/context.rs | 22 ++--- src/librustc_trans/{trans => }/controlflow.rs | 33 ++++---- src/librustc_trans/{trans => }/datum.rs | 18 ++-- .../{trans => }/debuginfo/create_scope_map.rs | 2 +- .../{trans => }/debuginfo/doc.rs | 0 .../{trans => }/debuginfo/gdb.rs | 6 +- .../{trans => }/debuginfo/metadata.rs | 8 +- .../{trans => }/debuginfo/mod.rs | 9 +- .../{trans => }/debuginfo/namespace.rs | 2 +- .../{trans => }/debuginfo/source_loc.rs | 2 +- .../{trans => }/debuginfo/type_names.rs | 4 +- .../{trans => }/debuginfo/utils.rs | 6 +- src/librustc_trans/{trans => }/declare.rs | 8 +- src/librustc_trans/{trans => }/disr.rs | 0 src/librustc_trans/{trans => }/expr.rs | 34 ++++---- src/librustc_trans/{trans => }/glue.rs | 36 ++++---- src/librustc_trans/{trans => }/inline.rs | 6 +- src/librustc_trans/{trans => }/intrinsic.rs | 38 ++++----- src/librustc_trans/lib.rs | 69 ++++++++++++++- src/librustc_trans/{trans => }/machine.rs | 4 +- src/librustc_trans/{trans => }/macros.rs | 0 src/librustc_trans/{trans => }/meth.rs | 30 +++---- src/librustc_trans/{trans => }/mir/analyze.rs | 2 +- src/librustc_trans/{trans => }/mir/block.rs | 32 +++---- .../{trans => }/mir/constant.rs | 14 ++-- src/librustc_trans/{trans => }/mir/drop.rs | 12 +-- src/librustc_trans/{trans => }/mir/lvalue.rs | 18 ++-- src/librustc_trans/{trans => }/mir/mod.rs | 4 +- src/librustc_trans/{trans => }/mir/operand.rs | 10 +-- src/librustc_trans/{trans => }/mir/rvalue.rs | 30 +++---- .../{trans => }/mir/statement.rs | 2 +- .../{trans => }/monomorphize.rs | 14 ++-- .../{trans => }/symbol_names_test.rs | 22 ++--- src/librustc_trans/trans/mod.rs | 84 ------------------- src/librustc_trans/{trans => }/tvec.rs | 30 +++---- src/librustc_trans/{trans => }/type_.rs | 2 +- src/librustc_trans/{trans => }/type_of.rs | 10 +-- src/librustc_trans/{trans => }/value.rs | 4 +- 68 files changed, 534 insertions(+), 556 deletions(-) rename src/librustc_trans/{trans => }/_match.rs (99%) rename src/librustc_trans/{trans => }/abi.rs (97%) rename src/librustc_trans/{trans => }/adt.rs (99%) rename src/librustc_trans/{trans => }/asm.rs (96%) rename src/librustc_trans/{trans => }/assert_dep_graph.rs (100%) rename src/librustc_trans/{trans => }/attributes.rs (99%) rename src/librustc_trans/{trans => }/base.rs (98%) rename src/librustc_trans/{trans => }/basic_block.rs (97%) rename src/librustc_trans/{trans => }/build.rs (99%) rename src/librustc_trans/{trans => }/builder.rs (99%) rename src/librustc_trans/{trans => }/cabi_aarch64.rs (98%) rename src/librustc_trans/{trans => }/cabi_arm.rs (98%) rename src/librustc_trans/{trans => }/cabi_asmjs.rs (95%) rename src/librustc_trans/{trans => }/cabi_mips.rs (97%) rename src/librustc_trans/{trans => }/cabi_powerpc.rs (97%) rename src/librustc_trans/{trans => }/cabi_powerpc64.rs (98%) rename src/librustc_trans/{trans => }/cabi_x86.rs (97%) rename src/librustc_trans/{trans => }/cabi_x86_64.rs (99%) rename src/librustc_trans/{trans => }/cabi_x86_win64.rs (95%) rename src/librustc_trans/{trans => }/callee.rs (98%) rename src/librustc_trans/{trans => }/cleanup.rs (99%) rename src/librustc_trans/{trans => }/closure.rs (97%) rename src/librustc_trans/{trans => }/collector.rs (99%) rename src/librustc_trans/{trans => }/common.rs (98%) rename src/librustc_trans/{trans => }/consts.rs (98%) rename src/librustc_trans/{trans => }/context.rs (99%) rename src/librustc_trans/{trans => }/controlflow.rs (96%) rename src/librustc_trans/{trans => }/datum.rs (99%) rename src/librustc_trans/{trans => }/debuginfo/create_scope_map.rs (99%) rename src/librustc_trans/{trans => }/debuginfo/doc.rs (100%) rename src/librustc_trans/{trans => }/debuginfo/gdb.rs (97%) rename src/librustc_trans/{trans => }/debuginfo/metadata.rs (99%) rename src/librustc_trans/{trans => }/debuginfo/mod.rs (99%) rename src/librustc_trans/{trans => }/debuginfo/namespace.rs (99%) rename src/librustc_trans/{trans => }/debuginfo/source_loc.rs (99%) rename src/librustc_trans/{trans => }/debuginfo/type_names.rs (98%) rename src/librustc_trans/{trans => }/debuginfo/utils.rs (97%) rename src/librustc_trans/{trans => }/declare.rs (98%) rename src/librustc_trans/{trans => }/disr.rs (100%) rename src/librustc_trans/{trans => }/expr.rs (99%) rename src/librustc_trans/{trans => }/glue.rs (97%) rename src/librustc_trans/{trans => }/inline.rs (98%) rename src/librustc_trans/{trans => }/intrinsic.rs (99%) rename src/librustc_trans/{trans => }/machine.rs (98%) rename src/librustc_trans/{trans => }/macros.rs (100%) rename src/librustc_trans/{trans => }/meth.rs (97%) rename src/librustc_trans/{trans => }/mir/analyze.rs (99%) rename src/librustc_trans/{trans => }/mir/block.rs (97%) rename src/librustc_trans/{trans => }/mir/constant.rs (96%) rename src/librustc_trans/{trans => }/mir/drop.rs (87%) rename src/librustc_trans/{trans => }/mir/lvalue.rs (97%) rename src/librustc_trans/{trans => }/mir/mod.rs (99%) rename src/librustc_trans/{trans => }/mir/operand.rs (98%) rename src/librustc_trans/{trans => }/mir/rvalue.rs (98%) rename src/librustc_trans/{trans => }/mir/statement.rs (98%) rename src/librustc_trans/{trans => }/monomorphize.rs (97%) rename src/librustc_trans/{trans => }/symbol_names_test.rs (81%) delete mode 100644 src/librustc_trans/trans/mod.rs rename src/librustc_trans/{trans => }/tvec.rs (97%) rename src/librustc_trans/{trans => }/type_.rs (99%) rename src/librustc_trans/{trans => }/type_of.rs (99%) rename src/librustc_trans/{trans => }/value.rs (98%) diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 11ee2a4fbc3..468dc7b12c1 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -30,7 +30,7 @@ use rustc_metadata::creader::LocalCrateReader; use rustc_metadata::cstore::CStore; use rustc_trans::back::link; use rustc_trans::back::write; -use rustc_trans::trans; +use rustc_trans as trans; use rustc_typeck as typeck; use rustc_privacy; use rustc_plugin::registry::Registry; diff --git a/src/librustc_trans/trans/_match.rs b/src/librustc_trans/_match.rs similarity index 99% rename from src/librustc_trans/trans/_match.rs rename to src/librustc_trans/_match.rs index 7794ac763c6..008323ee5bf 100644 --- a/src/librustc_trans/trans/_match.rs +++ b/src/librustc_trans/_match.rs @@ -201,23 +201,23 @@ use middle::mem_categorization as mc; use middle::mem_categorization::Categorization; use middle::pat_util::*; use rustc::ty::subst::Substs; -use trans::adt; -use trans::base::*; -use trans::build::{AddCase, And, Br, CondBr, GEPi, InBoundsGEP, Load, PointerCast}; -use trans::build::{Not, Store, Sub, add_comment}; -use trans::build; -use trans::callee::{Callee, ArgVals}; -use trans::cleanup::{self, CleanupMethods, DropHintMethods}; -use trans::common::*; -use trans::consts; -use trans::datum::*; -use trans::debuginfo::{self, DebugLoc, ToDebugLoc}; -use trans::expr::{self, Dest}; -use trans::monomorphize; -use trans::tvec; -use trans::type_of; -use trans::Disr; -use trans::value::Value; +use adt; +use base::*; +use build::{AddCase, And, Br, CondBr, GEPi, InBoundsGEP, Load, PointerCast}; +use build::{Not, Store, Sub, add_comment}; +use build; +use callee::{Callee, ArgVals}; +use cleanup::{self, CleanupMethods, DropHintMethods}; +use common::*; +use consts; +use datum::*; +use debuginfo::{self, DebugLoc, ToDebugLoc}; +use expr::{self, Dest}; +use monomorphize; +use tvec; +use type_of; +use Disr; +use value::Value; use rustc::ty::{self, Ty, TyCtxt}; use rustc::traits::ProjectionMode; use session::config::NoDebugInfo; @@ -281,7 +281,7 @@ impl<'a, 'tcx> Opt<'a, 'tcx> { } fn trans<'blk>(&self, mut bcx: Block<'blk, 'tcx>) -> OptResult<'blk, 'tcx> { - use trans::consts::TrueConst::Yes; + use consts::TrueConst::Yes; let _icx = push_ctxt("match::trans_opt"); let ccx = bcx.ccx(); match *self { diff --git a/src/librustc_trans/trans/abi.rs b/src/librustc_trans/abi.rs similarity index 97% rename from src/librustc_trans/trans/abi.rs rename to src/librustc_trans/abi.rs index 87253924172..dd72322997a 100644 --- a/src/librustc_trans/trans/abi.rs +++ b/src/librustc_trans/abi.rs @@ -9,22 +9,22 @@ // except according to those terms. use llvm::{self, ValueRef}; -use trans::base; -use trans::builder::Builder; -use trans::common::{type_is_fat_ptr, BlockAndBuilder}; -use trans::context::CrateContext; -use trans::cabi_x86; -use trans::cabi_x86_64; -use trans::cabi_x86_win64; -use trans::cabi_arm; -use trans::cabi_aarch64; -use trans::cabi_powerpc; -use trans::cabi_powerpc64; -use trans::cabi_mips; -use trans::cabi_asmjs; -use trans::machine::{llalign_of_min, llsize_of, llsize_of_real}; -use trans::type_::Type; -use trans::type_of; +use base; +use builder::Builder; +use common::{type_is_fat_ptr, BlockAndBuilder}; +use context::CrateContext; +use cabi_x86; +use cabi_x86_64; +use cabi_x86_win64; +use cabi_arm; +use cabi_aarch64; +use cabi_powerpc; +use cabi_powerpc64; +use cabi_mips; +use cabi_asmjs; +use machine::{llalign_of_min, llsize_of, llsize_of_real}; +use type_::Type; +use type_of; use rustc_front::hir; use rustc::ty::{self, Ty}; diff --git a/src/librustc_trans/trans/adt.rs b/src/librustc_trans/adt.rs similarity index 99% rename from src/librustc_trans/trans/adt.rs rename to src/librustc_trans/adt.rs index f14c1a573cc..7c190c2ff71 100644 --- a/src/librustc_trans/trans/adt.rs +++ b/src/librustc_trans/adt.rs @@ -53,21 +53,21 @@ use rustc::ty::{self, Ty, TyCtxt}; use syntax::ast; use syntax::attr; use syntax::attr::IntType; -use trans::_match; -use trans::abi::FAT_PTR_ADDR; -use trans::base::InitAlloca; -use trans::build::*; -use trans::cleanup; -use trans::cleanup::CleanupMethods; -use trans::common::*; -use trans::datum; -use trans::debuginfo::DebugLoc; -use trans::glue; -use trans::machine; -use trans::monomorphize; -use trans::type_::Type; -use trans::type_of; -use trans::value::Value; +use _match; +use abi::FAT_PTR_ADDR; +use base::InitAlloca; +use build::*; +use cleanup; +use cleanup::CleanupMethods; +use common::*; +use datum; +use debuginfo::DebugLoc; +use glue; +use machine; +use monomorphize; +use type_::Type; +use type_of; +use value::Value; type Hint = attr::ReprAttr; diff --git a/src/librustc_trans/trans/asm.rs b/src/librustc_trans/asm.rs similarity index 96% rename from src/librustc_trans/trans/asm.rs rename to src/librustc_trans/asm.rs index 4d0c55131f7..41f1f4ae5f8 100644 --- a/src/librustc_trans/trans/asm.rs +++ b/src/librustc_trans/asm.rs @@ -11,12 +11,12 @@ //! # Translation of inline assembly. use llvm::{self, ValueRef}; -use trans::base; -use trans::build::*; -use trans::common::*; -use trans::datum::{Datum, Lvalue}; -use trans::type_of; -use trans::type_::Type; +use base; +use build::*; +use common::*; +use datum::{Datum, Lvalue}; +use type_of; +use type_::Type; use rustc_front::hir as ast; use std::ffi::CString; diff --git a/src/librustc_trans/trans/assert_dep_graph.rs b/src/librustc_trans/assert_dep_graph.rs similarity index 100% rename from src/librustc_trans/trans/assert_dep_graph.rs rename to src/librustc_trans/assert_dep_graph.rs diff --git a/src/librustc_trans/trans/attributes.rs b/src/librustc_trans/attributes.rs similarity index 99% rename from src/librustc_trans/trans/attributes.rs rename to src/librustc_trans/attributes.rs index b771afea0f3..d4930f37dcd 100644 --- a/src/librustc_trans/trans/attributes.rs +++ b/src/librustc_trans/attributes.rs @@ -14,7 +14,7 @@ use llvm::{self, ValueRef}; use session::config::NoDebugInfo; pub use syntax::attr::InlineAttr; use syntax::ast; -use trans::context::CrateContext; +use context::CrateContext; /// Mark LLVM function to use provided inline heuristic. #[inline] diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs index 64d11710054..062f9482c72 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs @@ -23,7 +23,7 @@ use session::Session; use middle::cstore::{self, CrateStore, LinkMeta}; use middle::cstore::{LinkagePreference, NativeLibraryKind}; use middle::dependency_format::Linkage; -use trans::CrateTranslation; +use CrateTranslation; use util::common::time; use util::fs::fix_windows_verbatim_for_gcc; use rustc_back::tempdir::TempDir; diff --git a/src/librustc_trans/back/linker.rs b/src/librustc_trans/back/linker.rs index c6576b7fe0d..29caf93dcd5 100644 --- a/src/librustc_trans/back/linker.rs +++ b/src/librustc_trans/back/linker.rs @@ -22,7 +22,7 @@ use session::Session; use session::config::CrateTypeDylib; use session::config; use syntax::ast; -use trans::CrateTranslation; +use CrateTranslation; /// Linker abstraction used by back::link to build up the command to invoke a /// linker. diff --git a/src/librustc_trans/back/symbol_names.rs b/src/librustc_trans/back/symbol_names.rs index f11be65521b..ee5282e9881 100644 --- a/src/librustc_trans/back/symbol_names.rs +++ b/src/librustc_trans/back/symbol_names.rs @@ -97,7 +97,8 @@ //! virtually impossible. Thus, symbol hash generation exclusively relies on //! DefPaths which are much more robust in the face of changes to the code base. -use trans::{CrateContext, Instance, gensym_name}; +use common::{CrateContext, gensym_name}; +use monomorphize::Instance; use util::sha2::{Digest, Sha256}; use rustc::middle::cstore; diff --git a/src/librustc_trans/back/write.rs b/src/librustc_trans/back/write.rs index 92d8b928ef4..2de650a59be 100644 --- a/src/librustc_trans/back/write.rs +++ b/src/librustc_trans/back/write.rs @@ -16,7 +16,7 @@ use session::config::{self, OutputType}; use llvm; use llvm::{ModuleRef, TargetMachineRef, PassManagerRef, DiagnosticInfoRef, ContextRef}; use llvm::SMDiagnosticRef; -use trans::{CrateTranslation, ModuleTranslation}; +use {CrateTranslation, ModuleTranslation}; use util::common::time; use util::common::path2cstr; use syntax::codemap; diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/base.rs similarity index 98% rename from src/librustc_trans/trans/base.rs rename to src/librustc_trans/base.rs index d4add752fa4..5f9997ffbb8 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/base.rs @@ -51,46 +51,46 @@ use rustc::util::common::time; use rustc::mir::mir_map::MirMap; use session::config::{self, NoDebugInfo, FullDebugInfo}; use session::Session; -use trans::_match; -use trans::abi::{self, Abi, FnType}; -use trans::adt; -use trans::assert_dep_graph; -use trans::attributes; -use trans::build::*; -use trans::builder::{Builder, noname}; -use trans::callee::{Callee, CallArgs, ArgExprs, ArgVals}; -use trans::cleanup::{self, CleanupMethods, DropHint}; -use trans::closure; -use trans::common::{Block, C_bool, C_bytes_in_context, C_i32, C_int, C_uint, C_integral}; -use trans::collector::{self, TransItem, TransItemState, TransItemCollectionMode}; -use trans::common::{C_null, C_struct_in_context, C_u64, C_u8, C_undef}; -use trans::common::{CrateContext, DropFlagHintsMap, Field, FunctionContext}; -use trans::common::{Result, NodeIdAndSpan, VariantInfo}; -use trans::common::{node_id_type, fulfill_obligation}; -use trans::common::{type_is_immediate, type_is_zero_size, val_ty}; -use trans::common; -use trans::consts; -use trans::context::SharedCrateContext; -use trans::controlflow; -use trans::datum; -use trans::debuginfo::{self, DebugLoc, ToDebugLoc}; -use trans::declare; -use trans::expr; -use trans::glue; -use trans::inline; -use trans::intrinsic; -use trans::machine; -use trans::machine::{llalign_of_min, llsize_of, llsize_of_real}; -use trans::meth; -use trans::mir; -use trans::monomorphize::{self, Instance}; -use trans::symbol_names_test; -use trans::tvec; -use trans::type_::Type; -use trans::type_of; -use trans::type_of::*; -use trans::value::Value; -use trans::Disr; +use _match; +use abi::{self, Abi, FnType}; +use adt; +use assert_dep_graph; +use attributes; +use build::*; +use builder::{Builder, noname}; +use callee::{Callee, CallArgs, ArgExprs, ArgVals}; +use cleanup::{self, CleanupMethods, DropHint}; +use closure; +use common::{Block, C_bool, C_bytes_in_context, C_i32, C_int, C_uint, C_integral}; +use collector::{self, TransItem, TransItemState, TransItemCollectionMode}; +use common::{C_null, C_struct_in_context, C_u64, C_u8, C_undef}; +use common::{CrateContext, DropFlagHintsMap, Field, FunctionContext}; +use common::{Result, NodeIdAndSpan, VariantInfo}; +use common::{node_id_type, fulfill_obligation}; +use common::{type_is_immediate, type_is_zero_size, val_ty}; +use common; +use consts; +use context::SharedCrateContext; +use controlflow; +use datum; +use debuginfo::{self, DebugLoc, ToDebugLoc}; +use declare; +use expr; +use glue; +use inline; +use intrinsic; +use machine; +use machine::{llalign_of_min, llsize_of, llsize_of_real}; +use meth; +use mir; +use monomorphize::{self, Instance}; +use symbol_names_test; +use tvec; +use type_::Type; +use type_of; +use type_of::*; +use value::Value; +use Disr; use util::common::indenter; use util::sha2::Sha256; use util::nodemap::{NodeMap, NodeSet}; diff --git a/src/librustc_trans/trans/basic_block.rs b/src/librustc_trans/basic_block.rs similarity index 97% rename from src/librustc_trans/trans/basic_block.rs rename to src/librustc_trans/basic_block.rs index d3d055cda12..919ea49b392 100644 --- a/src/librustc_trans/trans/basic_block.rs +++ b/src/librustc_trans/basic_block.rs @@ -10,7 +10,7 @@ use llvm; use llvm::BasicBlockRef; -use trans::value::{Users, Value}; +use value::{Users, Value}; use std::iter::{Filter, Map}; #[derive(Copy, Clone)] diff --git a/src/librustc_trans/trans/build.rs b/src/librustc_trans/build.rs similarity index 99% rename from src/librustc_trans/trans/build.rs rename to src/librustc_trans/build.rs index 53e64c086a8..0ce7fdb8b6d 100644 --- a/src/librustc_trans/trans/build.rs +++ b/src/librustc_trans/build.rs @@ -15,13 +15,13 @@ use llvm; use llvm::{AtomicBinOp, AtomicOrdering, SynchronizationScope, AsmDialect}; use llvm::{Opcode, IntPredicate, RealPredicate}; use llvm::{ValueRef, BasicBlockRef}; -use trans::common::*; +use common::*; use syntax::codemap::Span; -use trans::builder::Builder; -use trans::type_::Type; -use trans::value::Value; -use trans::debuginfo::DebugLoc; +use builder::Builder; +use type_::Type; +use value::Value; +use debuginfo::DebugLoc; use libc::{c_uint, c_char}; diff --git a/src/librustc_trans/trans/builder.rs b/src/librustc_trans/builder.rs similarity index 99% rename from src/librustc_trans/trans/builder.rs rename to src/librustc_trans/builder.rs index 869e9212b1c..55f65d29bfd 100644 --- a/src/librustc_trans/trans/builder.rs +++ b/src/librustc_trans/builder.rs @@ -14,11 +14,11 @@ use llvm; use llvm::{AtomicBinOp, AtomicOrdering, SynchronizationScope, AsmDialect}; use llvm::{Opcode, IntPredicate, RealPredicate, False, OperandBundleDef}; use llvm::{ValueRef, BasicBlockRef, BuilderRef, ModuleRef}; -use trans::base; -use trans::common::*; -use trans::machine::llalign_of_pref; -use trans::type_::Type; -use trans::value::Value; +use base; +use common::*; +use machine::llalign_of_pref; +use type_::Type; +use value::Value; use util::nodemap::FnvHashMap; use libc::{c_uint, c_char}; diff --git a/src/librustc_trans/trans/cabi_aarch64.rs b/src/librustc_trans/cabi_aarch64.rs similarity index 98% rename from src/librustc_trans/trans/cabi_aarch64.rs rename to src/librustc_trans/cabi_aarch64.rs index 6eea8d472ba..b2929d118a6 100644 --- a/src/librustc_trans/trans/cabi_aarch64.rs +++ b/src/librustc_trans/cabi_aarch64.rs @@ -11,9 +11,9 @@ #![allow(non_upper_case_globals)] use llvm::{Integer, Pointer, Float, Double, Struct, Array, Vector}; -use trans::abi::{FnType, ArgType}; -use trans::context::CrateContext; -use trans::type_::Type; +use abi::{FnType, ArgType}; +use context::CrateContext; +use type_::Type; use std::cmp; diff --git a/src/librustc_trans/trans/cabi_arm.rs b/src/librustc_trans/cabi_arm.rs similarity index 98% rename from src/librustc_trans/trans/cabi_arm.rs rename to src/librustc_trans/cabi_arm.rs index 14ca77836c2..5dbcf1ef86e 100644 --- a/src/librustc_trans/trans/cabi_arm.rs +++ b/src/librustc_trans/cabi_arm.rs @@ -11,9 +11,9 @@ #![allow(non_upper_case_globals)] use llvm::{Integer, Pointer, Float, Double, Struct, Array, Vector}; -use trans::abi::{FnType, ArgType}; -use trans::context::CrateContext; -use trans::type_::Type; +use abi::{FnType, ArgType}; +use context::CrateContext; +use type_::Type; use std::cmp; diff --git a/src/librustc_trans/trans/cabi_asmjs.rs b/src/librustc_trans/cabi_asmjs.rs similarity index 95% rename from src/librustc_trans/trans/cabi_asmjs.rs rename to src/librustc_trans/cabi_asmjs.rs index c901442f485..3cbc378ab02 100644 --- a/src/librustc_trans/trans/cabi_asmjs.rs +++ b/src/librustc_trans/cabi_asmjs.rs @@ -11,8 +11,8 @@ #![allow(non_upper_case_globals)] use llvm::{Struct, Array, Attribute}; -use trans::abi::{FnType, ArgType}; -use trans::context::CrateContext; +use abi::{FnType, ArgType}; +use context::CrateContext; // Data layout: e-p:32:32-i64:64-v128:32:128-n32-S128 diff --git a/src/librustc_trans/trans/cabi_mips.rs b/src/librustc_trans/cabi_mips.rs similarity index 97% rename from src/librustc_trans/trans/cabi_mips.rs rename to src/librustc_trans/cabi_mips.rs index 0d5e81be921..d0fce01ce73 100644 --- a/src/librustc_trans/trans/cabi_mips.rs +++ b/src/librustc_trans/cabi_mips.rs @@ -14,9 +14,9 @@ use libc::c_uint; use std::cmp; use llvm; use llvm::{Integer, Pointer, Float, Double, Struct, Array, Vector}; -use trans::abi::{ArgType, FnType}; -use trans::context::CrateContext; -use trans::type_::Type; +use abi::{ArgType, FnType}; +use context::CrateContext; +use type_::Type; fn align_up_to(off: usize, a: usize) -> usize { return (off + a - 1) / a * a; diff --git a/src/librustc_trans/trans/cabi_powerpc.rs b/src/librustc_trans/cabi_powerpc.rs similarity index 97% rename from src/librustc_trans/trans/cabi_powerpc.rs rename to src/librustc_trans/cabi_powerpc.rs index 9aa89a04d0a..c9751aa25c1 100644 --- a/src/librustc_trans/trans/cabi_powerpc.rs +++ b/src/librustc_trans/cabi_powerpc.rs @@ -11,9 +11,9 @@ use libc::c_uint; use llvm; use llvm::{Integer, Pointer, Float, Double, Struct, Array}; -use trans::abi::{FnType, ArgType}; -use trans::context::CrateContext; -use trans::type_::Type; +use abi::{FnType, ArgType}; +use context::CrateContext; +use type_::Type; use std::cmp; diff --git a/src/librustc_trans/trans/cabi_powerpc64.rs b/src/librustc_trans/cabi_powerpc64.rs similarity index 98% rename from src/librustc_trans/trans/cabi_powerpc64.rs rename to src/librustc_trans/cabi_powerpc64.rs index 340de235732..7e7033b4686 100644 --- a/src/librustc_trans/trans/cabi_powerpc64.rs +++ b/src/librustc_trans/cabi_powerpc64.rs @@ -16,9 +16,9 @@ // need to be fixed when PowerPC vector support is added. use llvm::{Integer, Pointer, Float, Double, Struct, Array}; -use trans::abi::{FnType, ArgType}; -use trans::context::CrateContext; -use trans::type_::Type; +use abi::{FnType, ArgType}; +use context::CrateContext; +use type_::Type; use std::cmp; diff --git a/src/librustc_trans/trans/cabi_x86.rs b/src/librustc_trans/cabi_x86.rs similarity index 97% rename from src/librustc_trans/trans/cabi_x86.rs rename to src/librustc_trans/cabi_x86.rs index 9e6c4d9af42..415579eb221 100644 --- a/src/librustc_trans/trans/cabi_x86.rs +++ b/src/librustc_trans/cabi_x86.rs @@ -9,8 +9,8 @@ // except according to those terms. use llvm::*; -use trans::abi::FnType; -use trans::type_::Type; +use abi::FnType; +use type_::Type; use super::common::*; use super::machine::*; diff --git a/src/librustc_trans/trans/cabi_x86_64.rs b/src/librustc_trans/cabi_x86_64.rs similarity index 99% rename from src/librustc_trans/trans/cabi_x86_64.rs rename to src/librustc_trans/cabi_x86_64.rs index 47d373f9043..a08d9fb5b40 100644 --- a/src/librustc_trans/trans/cabi_x86_64.rs +++ b/src/librustc_trans/cabi_x86_64.rs @@ -16,9 +16,9 @@ use self::RegClass::*; use llvm::{Integer, Pointer, Float, Double}; use llvm::{Struct, Array, Attribute, Vector}; -use trans::abi::{ArgType, FnType}; -use trans::context::CrateContext; -use trans::type_::Type; +use abi::{ArgType, FnType}; +use context::CrateContext; +use type_::Type; use std::cmp; diff --git a/src/librustc_trans/trans/cabi_x86_win64.rs b/src/librustc_trans/cabi_x86_win64.rs similarity index 95% rename from src/librustc_trans/trans/cabi_x86_win64.rs rename to src/librustc_trans/cabi_x86_win64.rs index 43f72c454cf..a5077f68fb5 100644 --- a/src/librustc_trans/trans/cabi_x86_win64.rs +++ b/src/librustc_trans/cabi_x86_win64.rs @@ -11,8 +11,8 @@ use llvm::*; use super::common::*; use super::machine::*; -use trans::abi::{ArgType, FnType}; -use trans::type_::Type; +use abi::{ArgType, FnType}; +use type_::Type; // Win64 ABI: http://msdn.microsoft.com/en-us/library/zthk2dkh.aspx diff --git a/src/librustc_trans/trans/callee.rs b/src/librustc_trans/callee.rs similarity index 98% rename from src/librustc_trans/trans/callee.rs rename to src/librustc_trans/callee.rs index 8559db3ce5e..d3c2a895379 100644 --- a/src/librustc_trans/trans/callee.rs +++ b/src/librustc_trans/callee.rs @@ -27,32 +27,32 @@ use rustc::ty::subst; use rustc::ty::subst::{Substs}; use rustc::traits; use rustc::front::map as hir_map; -use trans::abi::{Abi, FnType}; -use trans::adt; -use trans::attributes; -use trans::base; -use trans::base::*; -use trans::build::*; -use trans::cleanup; -use trans::cleanup::CleanupMethods; -use trans::closure; -use trans::common::{self, Block, Result, CrateContext, FunctionContext}; -use trans::common::{C_uint, C_undef}; -use trans::consts; -use trans::datum::*; -use trans::debuginfo::DebugLoc; -use trans::declare; -use trans::expr; -use trans::glue; -use trans::inline; -use trans::intrinsic; -use trans::machine::{llalign_of_min, llsize_of_store}; -use trans::meth; -use trans::monomorphize::{self, Instance}; -use trans::type_::Type; -use trans::type_of; -use trans::value::Value; -use trans::Disr; +use abi::{Abi, FnType}; +use adt; +use attributes; +use base; +use base::*; +use build::*; +use cleanup; +use cleanup::CleanupMethods; +use closure; +use common::{self, Block, Result, CrateContext, FunctionContext}; +use common::{C_uint, C_undef}; +use consts; +use datum::*; +use debuginfo::DebugLoc; +use declare; +use expr; +use glue; +use inline; +use intrinsic; +use machine::{llalign_of_min, llsize_of_store}; +use meth; +use monomorphize::{self, Instance}; +use type_::Type; +use type_of; +use value::Value; +use Disr; use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; use rustc_front::hir; diff --git a/src/librustc_trans/trans/cleanup.rs b/src/librustc_trans/cleanup.rs similarity index 99% rename from src/librustc_trans/trans/cleanup.rs rename to src/librustc_trans/cleanup.rs index 78481e0ed92..3a8dc144f9c 100644 --- a/src/librustc_trans/trans/cleanup.rs +++ b/src/librustc_trans/cleanup.rs @@ -120,16 +120,16 @@ pub use self::EarlyExitLabel::*; pub use self::Heap::*; use llvm::{BasicBlockRef, ValueRef}; -use trans::base; -use trans::build; -use trans::common; -use trans::common::{Block, FunctionContext, NodeIdAndSpan, LandingPad}; -use trans::datum::{Datum, Lvalue}; -use trans::debuginfo::{DebugLoc, ToDebugLoc}; -use trans::glue; +use base; +use build; +use common; +use common::{Block, FunctionContext, NodeIdAndSpan, LandingPad}; +use datum::{Datum, Lvalue}; +use debuginfo::{DebugLoc, ToDebugLoc}; +use glue; use middle::region; -use trans::type_::Type; -use trans::value::Value; +use type_::Type; +use value::Value; use rustc::ty::{Ty, TyCtxt}; use std::fmt; diff --git a/src/librustc_trans/trans/closure.rs b/src/librustc_trans/closure.rs similarity index 97% rename from src/librustc_trans/trans/closure.rs rename to src/librustc_trans/closure.rs index 3040d6a37c1..44b4f256082 100644 --- a/src/librustc_trans/trans/closure.rs +++ b/src/librustc_trans/closure.rs @@ -14,22 +14,22 @@ use llvm::{ValueRef, get_param, get_params}; use middle::def_id::DefId; use rustc::infer; use rustc::traits::ProjectionMode; -use trans::abi::{Abi, FnType}; -use trans::adt; -use trans::attributes; -use trans::base::*; -use trans::build::*; -use trans::callee::{self, ArgVals, Callee}; -use trans::cleanup::{CleanupMethods, CustomScope, ScopeId}; -use trans::common::*; -use trans::datum::{ByRef, Datum, lvalue_scratch_datum}; -use trans::datum::{rvalue_scratch_datum, Rvalue}; -use trans::debuginfo::{self, DebugLoc}; -use trans::declare; -use trans::expr; -use trans::monomorphize::{Instance}; -use trans::value::Value; -use trans::Disr; +use abi::{Abi, FnType}; +use adt; +use attributes; +use base::*; +use build::*; +use callee::{self, ArgVals, Callee}; +use cleanup::{CleanupMethods, CustomScope, ScopeId}; +use common::*; +use datum::{ByRef, Datum, lvalue_scratch_datum}; +use datum::{rvalue_scratch_datum, Rvalue}; +use debuginfo::{self, DebugLoc}; +use declare; +use expr; +use monomorphize::{Instance}; +use value::Value; +use Disr; use rustc::ty::{self, Ty, TyCtxt}; use session::config::FullDebugInfo; diff --git a/src/librustc_trans/trans/collector.rs b/src/librustc_trans/collector.rs similarity index 99% rename from src/librustc_trans/trans/collector.rs rename to src/librustc_trans/collector.rs index 5c36f9bb68c..7c5f784216a 100644 --- a/src/librustc_trans/trans/collector.rs +++ b/src/librustc_trans/collector.rs @@ -207,13 +207,13 @@ use syntax::codemap::DUMMY_SP; use syntax::errors; use syntax::parse::token; -use trans::base::custom_coerce_unsize_info; -use trans::context::CrateContext; -use trans::common::{fulfill_obligation, normalize_and_test_predicates, +use base::custom_coerce_unsize_info; +use context::CrateContext; +use common::{fulfill_obligation, normalize_and_test_predicates, type_is_sized}; -use trans::glue; -use trans::meth; -use trans::monomorphize::{self, Instance}; +use glue; +use meth; +use monomorphize::{self, Instance}; use util::nodemap::{FnvHashSet, FnvHashMap, DefIdMap}; use std::hash::{Hash, Hasher}; @@ -1202,7 +1202,7 @@ pub fn push_unique_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, output.push_str("unsafe "); } - if abi != ::trans::abi::Abi::Rust { + if abi != ::abi::Abi::Rust { output.push_str("extern \""); output.push_str(abi.name()); output.push_str("\" "); diff --git a/src/librustc_trans/trans/common.rs b/src/librustc_trans/common.rs similarity index 98% rename from src/librustc_trans/trans/common.rs rename to src/librustc_trans/common.rs index a6953f262c8..c5d54e30f13 100644 --- a/src/librustc_trans/trans/common.rs +++ b/src/librustc_trans/common.rs @@ -22,21 +22,21 @@ use middle::def_id::DefId; use rustc::infer; use middle::lang_items::LangItem; use rustc::ty::subst::Substs; -use trans::abi::{Abi, FnType}; -use trans::base; -use trans::build; -use trans::builder::Builder; -use trans::callee::Callee; -use trans::cleanup; -use trans::consts; -use trans::datum; -use trans::debuginfo::{self, DebugLoc}; -use trans::declare; -use trans::machine; -use trans::mir::CachedMir; -use trans::monomorphize; -use trans::type_::Type; -use trans::value::Value; +use abi::{Abi, FnType}; +use base; +use build; +use builder::Builder; +use callee::Callee; +use cleanup; +use consts; +use datum; +use debuginfo::{self, DebugLoc}; +use declare; +use machine; +use mir::CachedMir; +use monomorphize; +use type_::Type; +use value::Value; use rustc::ty::{self, Ty, TyCtxt}; use rustc::traits::{self, SelectionContext, ProjectionMode}; use rustc::ty::fold::{TypeFolder, TypeFoldable}; @@ -54,7 +54,7 @@ use syntax::codemap::{DUMMY_SP, Span}; use syntax::parse::token::InternedString; use syntax::parse::token; -pub use trans::context::CrateContext; +pub use context::CrateContext; /// Is the type's representation size known at compile time? pub fn type_is_sized<'tcx>(tcx: &TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool { @@ -75,8 +75,8 @@ pub fn type_is_fat_ptr<'tcx>(cx: &TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool { } pub fn type_is_immediate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ty: Ty<'tcx>) -> bool { - use trans::machine::llsize_of_alloc; - use trans::type_of::sizing_type_of; + use machine::llsize_of_alloc; + use type_of::sizing_type_of; let tcx = ccx.tcx(); let simple = ty.is_scalar() || @@ -100,8 +100,8 @@ pub fn type_is_immediate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ty: Ty<'tcx>) - /// Identify types which have size zero at runtime. pub fn type_is_zero_size<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ty: Ty<'tcx>) -> bool { - use trans::machine::llsize_of_alloc; - use trans::type_of::sizing_type_of; + use machine::llsize_of_alloc; + use type_of::sizing_type_of; let llty = sizing_type_of(ccx, ty); llsize_of_alloc(ccx, llty) == 0 } @@ -141,7 +141,7 @@ pub fn gensym_name(name: &str) -> ast::Name { * */ -use trans::Disr; +use Disr; #[derive(Copy, Clone)] pub struct NodeIdAndSpan { @@ -491,7 +491,7 @@ impl<'a, 'tcx> FunctionContext<'a, 'tcx> { // Returns a ValueRef of the "eh_unwind_resume" lang item if one is defined, // otherwise declares it as an external function. pub fn eh_unwind_resume(&self) -> Callee<'tcx> { - use trans::attributes; + use attributes; let ccx = self.ccx; let tcx = ccx.tcx(); assert!(ccx.sess().target.target.options.custom_unwind_resume); diff --git a/src/librustc_trans/trans/consts.rs b/src/librustc_trans/consts.rs similarity index 98% rename from src/librustc_trans/trans/consts.rs rename to src/librustc_trans/consts.rs index 7b832a7e99a..8302fc0158c 100644 --- a/src/librustc_trans/trans/consts.rs +++ b/src/librustc_trans/consts.rs @@ -17,21 +17,21 @@ use middle::const_eval::{self, ConstEvalErr}; use middle::def::Def; use middle::def_id::DefId; use rustc::front::map as hir_map; -use trans::{abi, adt, closure, debuginfo, expr, machine}; -use trans::base::{self, exported_name, imported_name, push_ctxt}; -use trans::callee::Callee; -use trans::collector::{self, TransItem}; -use trans::common::{type_is_sized, C_nil, const_get_elt}; -use trans::common::{CrateContext, C_integral, C_floating, C_bool, C_str_slice, C_bytes, val_ty}; -use trans::common::{C_struct, C_undef, const_to_opt_int, const_to_opt_uint, VariantInfo, C_uint}; -use trans::common::{type_is_fat_ptr, Field, C_vector, C_array, C_null}; -use trans::datum::{Datum, Lvalue}; -use trans::declare; -use trans::monomorphize::{self, Instance}; -use trans::type_::Type; -use trans::type_of; -use trans::value::Value; -use trans::Disr; +use {abi, adt, closure, debuginfo, expr, machine}; +use base::{self, exported_name, imported_name, push_ctxt}; +use callee::Callee; +use collector::{self, TransItem}; +use common::{type_is_sized, C_nil, const_get_elt}; +use common::{CrateContext, C_integral, C_floating, C_bool, C_str_slice, C_bytes, val_ty}; +use common::{C_struct, C_undef, const_to_opt_int, const_to_opt_uint, VariantInfo, C_uint}; +use common::{type_is_fat_ptr, Field, C_vector, C_array, C_null}; +use datum::{Datum, Lvalue}; +use declare; +use monomorphize::{self, Instance}; +use type_::Type; +use type_of; +use value::Value; +use Disr; use rustc::ty::subst::Substs; use rustc::ty::adjustment::{AdjustDerefRef, AdjustReifyFnPointer}; use rustc::ty::adjustment::{AdjustUnsafeFnPointer, AdjustMutToConstPointer}; diff --git a/src/librustc_trans/trans/context.rs b/src/librustc_trans/context.rs similarity index 99% rename from src/librustc_trans/trans/context.rs rename to src/librustc_trans/context.rs index 4511989534d..dcf96cfa814 100644 --- a/src/librustc_trans/trans/context.rs +++ b/src/librustc_trans/context.rs @@ -17,18 +17,18 @@ use middle::def_id::DefId; use rustc::traits; use rustc::mir::mir_map::MirMap; use rustc::mir::repr as mir; -use trans::adt; -use trans::base; -use trans::builder::Builder; -use trans::common::BuilderRef_res; -use trans::debuginfo; -use trans::declare; -use trans::glue::DropGlueKind; -use trans::mir::CachedMir; -use trans::Instance; +use adt; +use base; +use builder::Builder; +use common::BuilderRef_res; +use debuginfo; +use declare; +use glue::DropGlueKind; +use mir::CachedMir; +use monomorphize::Instance; -use trans::collector::{TransItem, TransItemState}; -use trans::type_::{Type, TypeNames}; +use collector::{TransItem, TransItemState}; +use type_::{Type, TypeNames}; use rustc::ty::subst::{Substs, VecPerParamSpace}; use rustc::ty::{self, Ty, TyCtxt}; use session::config::NoDebugInfo; diff --git a/src/librustc_trans/trans/controlflow.rs b/src/librustc_trans/controlflow.rs similarity index 96% rename from src/librustc_trans/trans/controlflow.rs rename to src/librustc_trans/controlflow.rs index 80ff11e968a..04562087af7 100644 --- a/src/librustc_trans/trans/controlflow.rs +++ b/src/librustc_trans/controlflow.rs @@ -12,19 +12,18 @@ use llvm::ValueRef; use middle::def::Def; use middle::lang_items::{PanicFnLangItem, PanicBoundsCheckFnLangItem}; use rustc::ty::subst::Substs; -use trans::base::*; -use trans::basic_block::BasicBlock; -use trans::build::*; -use trans::callee::{Callee, ArgVals}; -use trans::cleanup::CleanupMethods; -use trans::cleanup; -use trans::common::*; -use trans::consts; -use trans::debuginfo; -use trans::debuginfo::{DebugLoc, ToDebugLoc}; -use trans::expr; -use trans::machine; -use trans; +use base::*; +use basic_block::BasicBlock; +use build::*; +use callee::{Callee, ArgVals}; +use cleanup::CleanupMethods; +use cleanup; +use common::*; +use consts; +use debuginfo; +use debuginfo::{DebugLoc, ToDebugLoc}; +use expr; +use machine; use rustc_front::hir; use rustc_front::util as ast_util; @@ -169,11 +168,11 @@ pub fn trans_if<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, if cv == 1 { // if true { .. } [else { .. }] bcx = trans_block(bcx, &thn, dest); - trans::debuginfo::clear_source_location(bcx.fcx); + debuginfo::clear_source_location(bcx.fcx); } else { if let Some(elexpr) = els { bcx = expr::trans_into(bcx, &elexpr, dest); - trans::debuginfo::clear_source_location(bcx.fcx); + debuginfo::clear_source_location(bcx.fcx); } } @@ -183,7 +182,7 @@ pub fn trans_if<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, let name = format!("then-block-{}-", thn.id); let then_bcx_in = bcx.fcx.new_id_block(&name[..], thn.id); let then_bcx_out = trans_block(then_bcx_in, &thn, dest); - trans::debuginfo::clear_source_location(bcx.fcx); + debuginfo::clear_source_location(bcx.fcx); let cond_source_loc = cond.debug_loc(); @@ -206,7 +205,7 @@ pub fn trans_if<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, // Clear the source location because it is still set to whatever has been translated // right before. - trans::debuginfo::clear_source_location(next_bcx.fcx); + debuginfo::clear_source_location(next_bcx.fcx); next_bcx } diff --git a/src/librustc_trans/trans/datum.rs b/src/librustc_trans/datum.rs similarity index 99% rename from src/librustc_trans/trans/datum.rs rename to src/librustc_trans/datum.rs index c0858a6d93b..6f96b5769bf 100644 --- a/src/librustc_trans/trans/datum.rs +++ b/src/librustc_trans/datum.rs @@ -93,15 +93,15 @@ pub use self::Expr::*; pub use self::RvalueMode::*; use llvm::ValueRef; -use trans::adt; -use trans::base::*; -use trans::build::{Load, Store}; -use trans::common::*; -use trans::cleanup; -use trans::cleanup::{CleanupMethods, DropHintDatum, DropHintMethods}; -use trans::expr; -use trans::tvec; -use trans::value::Value; +use adt; +use base::*; +use build::{Load, Store}; +use common::*; +use cleanup; +use cleanup::{CleanupMethods, DropHintDatum, DropHintMethods}; +use expr; +use tvec; +use value::Value; use rustc::ty::Ty; use std::fmt; diff --git a/src/librustc_trans/trans/debuginfo/create_scope_map.rs b/src/librustc_trans/debuginfo/create_scope_map.rs similarity index 99% rename from src/librustc_trans/trans/debuginfo/create_scope_map.rs rename to src/librustc_trans/debuginfo/create_scope_map.rs index 41fed12e7bf..20e8a3fb0cf 100644 --- a/src/librustc_trans/trans/debuginfo/create_scope_map.rs +++ b/src/librustc_trans/debuginfo/create_scope_map.rs @@ -13,7 +13,7 @@ use super::utils::DIB; use llvm; use llvm::debuginfo::{DIScope, DISubprogram}; -use trans::common::CrateContext; +use common::CrateContext; use middle::pat_util; use rustc::util::nodemap::NodeMap; diff --git a/src/librustc_trans/trans/debuginfo/doc.rs b/src/librustc_trans/debuginfo/doc.rs similarity index 100% rename from src/librustc_trans/trans/debuginfo/doc.rs rename to src/librustc_trans/debuginfo/doc.rs diff --git a/src/librustc_trans/trans/debuginfo/gdb.rs b/src/librustc_trans/debuginfo/gdb.rs similarity index 97% rename from src/librustc_trans/trans/debuginfo/gdb.rs rename to src/librustc_trans/debuginfo/gdb.rs index 7740f277586..5612f3d1e90 100644 --- a/src/librustc_trans/trans/debuginfo/gdb.rs +++ b/src/librustc_trans/debuginfo/gdb.rs @@ -12,9 +12,9 @@ use llvm; -use trans::common::{C_bytes, CrateContext, C_i32}; -use trans::declare; -use trans::type_::Type; +use common::{C_bytes, CrateContext, C_i32}; +use declare; +use type_::Type; use session::config::NoDebugInfo; use std::ffi::CString; diff --git a/src/librustc_trans/trans/debuginfo/metadata.rs b/src/librustc_trans/debuginfo/metadata.rs similarity index 99% rename from src/librustc_trans/trans/debuginfo/metadata.rs rename to src/librustc_trans/debuginfo/metadata.rs index bd2a8e0193d..af7ccdb6cf5 100644 --- a/src/librustc_trans/trans/debuginfo/metadata.rs +++ b/src/librustc_trans/debuginfo/metadata.rs @@ -29,10 +29,10 @@ use middle::pat_util; use rustc::ty::subst; use rustc::front::map as hir_map; use rustc_front::hir::{self, PatKind}; -use trans::{type_of, adt, machine, monomorphize}; -use trans::common::{self, CrateContext, FunctionContext, Block}; -use trans::_match::{BindingInfo, TransBindingMode}; -use trans::type_::Type; +use {type_of, adt, machine, monomorphize}; +use common::{self, CrateContext, FunctionContext, Block}; +use _match::{BindingInfo, TransBindingMode}; +use type_::Type; use rustc::ty::{self, Ty}; use session::config::{self, FullDebugInfo}; use util::nodemap::FnvHashMap; diff --git a/src/librustc_trans/trans/debuginfo/mod.rs b/src/librustc_trans/debuginfo/mod.rs similarity index 99% rename from src/librustc_trans/trans/debuginfo/mod.rs rename to src/librustc_trans/debuginfo/mod.rs index 198a9899fda..66e33698389 100644 --- a/src/librustc_trans/trans/debuginfo/mod.rs +++ b/src/librustc_trans/debuginfo/mod.rs @@ -32,10 +32,9 @@ use rustc::ty::subst::{self, Substs}; use rustc_front; use rustc_front::hir; -use trans::abi::Abi; -use trans::common::{NodeIdAndSpan, CrateContext, FunctionContext, Block}; -use trans; -use trans::monomorphize; +use abi::Abi; +use common::{NodeIdAndSpan, CrateContext, FunctionContext, Block}; +use monomorphize; use rustc::infer; use rustc::ty::{self, Ty}; use session::config::{self, FullDebugInfo, LimitedDebugInfo, NoDebugInfo}; @@ -632,7 +631,7 @@ fn declare_local<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, debug_loc, bcx.llbb); - llvm::LLVMSetInstDebugLocation(trans::build::B(bcx).llbuilder, instr); + llvm::LLVMSetInstDebugLocation(::build::B(bcx).llbuilder, instr); } } } diff --git a/src/librustc_trans/trans/debuginfo/namespace.rs b/src/librustc_trans/debuginfo/namespace.rs similarity index 99% rename from src/librustc_trans/trans/debuginfo/namespace.rs rename to src/librustc_trans/debuginfo/namespace.rs index 0c2c29724a1..552188ae2a6 100644 --- a/src/librustc_trans/trans/debuginfo/namespace.rs +++ b/src/librustc_trans/debuginfo/namespace.rs @@ -16,7 +16,7 @@ use llvm; use llvm::debuginfo::DIScope; use rustc::middle::def_id::DefId; use rustc::front::map as hir_map; -use trans::common::CrateContext; +use common::CrateContext; use std::ffi::CString; use std::ptr; diff --git a/src/librustc_trans/trans/debuginfo/source_loc.rs b/src/librustc_trans/debuginfo/source_loc.rs similarity index 99% rename from src/librustc_trans/trans/debuginfo/source_loc.rs rename to src/librustc_trans/debuginfo/source_loc.rs index 981a23fd664..2879da7d03b 100644 --- a/src/librustc_trans/trans/debuginfo/source_loc.rs +++ b/src/librustc_trans/debuginfo/source_loc.rs @@ -16,7 +16,7 @@ use super::{FunctionDebugContext, DebugLoc}; use llvm; use llvm::debuginfo::DIScope; -use trans::common::{NodeIdAndSpan, CrateContext, FunctionContext}; +use common::{NodeIdAndSpan, CrateContext, FunctionContext}; use libc::c_uint; use std::ptr; diff --git a/src/librustc_trans/trans/debuginfo/type_names.rs b/src/librustc_trans/debuginfo/type_names.rs similarity index 98% rename from src/librustc_trans/trans/debuginfo/type_names.rs rename to src/librustc_trans/debuginfo/type_names.rs index fc9ace89ab7..71dd3e432df 100644 --- a/src/librustc_trans/trans/debuginfo/type_names.rs +++ b/src/librustc_trans/debuginfo/type_names.rs @@ -12,7 +12,7 @@ use super::namespace::crate_root_namespace; -use trans::common::CrateContext; +use common::CrateContext; use middle::def_id::DefId; use rustc::infer; use rustc::ty::subst; @@ -107,7 +107,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, output.push_str("unsafe "); } - if abi != ::trans::abi::Abi::Rust { + if abi != ::abi::Abi::Rust { output.push_str("extern \""); output.push_str(abi.name()); output.push_str("\" "); diff --git a/src/librustc_trans/trans/debuginfo/utils.rs b/src/librustc_trans/debuginfo/utils.rs similarity index 97% rename from src/librustc_trans/trans/debuginfo/utils.rs rename to src/librustc_trans/debuginfo/utils.rs index c1d7bb495fa..d2ae74569e7 100644 --- a/src/librustc_trans/trans/debuginfo/utils.rs +++ b/src/librustc_trans/debuginfo/utils.rs @@ -17,9 +17,9 @@ use middle::def_id::DefId; use llvm; use llvm::debuginfo::{DIScope, DIBuilderRef, DIDescriptor, DIArray}; -use trans::machine; -use trans::common::{CrateContext, FunctionContext}; -use trans::type_::Type; +use machine; +use common::{CrateContext, FunctionContext}; +use type_::Type; use syntax::codemap::Span; use syntax::{ast, codemap}; diff --git a/src/librustc_trans/trans/declare.rs b/src/librustc_trans/declare.rs similarity index 98% rename from src/librustc_trans/trans/declare.rs rename to src/librustc_trans/declare.rs index 41a87f8d6de..28a70fd5e0b 100644 --- a/src/librustc_trans/trans/declare.rs +++ b/src/librustc_trans/declare.rs @@ -22,10 +22,10 @@ use llvm::{self, ValueRef}; use rustc::ty; use rustc::infer; -use trans::abi::{Abi, FnType}; -use trans::attributes; -use trans::context::CrateContext; -use trans::type_::Type; +use abi::{Abi, FnType}; +use attributes; +use context::CrateContext; +use type_::Type; use std::ffi::CString; use libc::c_uint; diff --git a/src/librustc_trans/trans/disr.rs b/src/librustc_trans/disr.rs similarity index 100% rename from src/librustc_trans/trans/disr.rs rename to src/librustc_trans/disr.rs diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/expr.rs similarity index 99% rename from src/librustc_trans/trans/expr.rs rename to src/librustc_trans/expr.rs index 8f9f44fb2dd..b2e2e93a2be 100644 --- a/src/librustc_trans/trans/expr.rs +++ b/src/librustc_trans/expr.rs @@ -55,21 +55,21 @@ use llvm::{self, ValueRef, TypeKind}; use middle::const_qualif::ConstQualif; use middle::def::Def; use rustc::ty::subst::Substs; -use trans::{_match, abi, adt, asm, base, closure, consts, controlflow}; -use trans::base::*; -use trans::build::*; -use trans::callee::{Callee, ArgExprs, ArgOverloadedCall, ArgOverloadedOp}; -use trans::cleanup::{self, CleanupMethods, DropHintMethods}; -use trans::common::*; -use trans::datum::*; -use trans::debuginfo::{self, DebugLoc, ToDebugLoc}; -use trans::declare; -use trans::glue; -use trans::machine; -use trans::tvec; -use trans::type_of; -use trans::value::Value; -use trans::Disr; +use {_match, abi, adt, asm, base, closure, consts, controlflow}; +use base::*; +use build::*; +use callee::{Callee, ArgExprs, ArgOverloadedCall, ArgOverloadedOp}; +use cleanup::{self, CleanupMethods, DropHintMethods}; +use common::*; +use datum::*; +use debuginfo::{self, DebugLoc, ToDebugLoc}; +use declare; +use glue; +use machine; +use tvec; +use type_of; +use value::Value; +use Disr; use rustc::ty::adjustment::{AdjustDerefRef, AdjustReifyFnPointer}; use rustc::ty::adjustment::{AdjustUnsafeFnPointer, AdjustMutToConstPointer}; use rustc::ty::adjustment::CustomCoerceUnsized; @@ -77,8 +77,8 @@ use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::MethodCall; use rustc::ty::cast::{CastKind, CastTy}; use util::common::indenter; -use trans::machine::{llsize_of, llsize_of_alloc}; -use trans::type_::Type; +use machine::{llsize_of, llsize_of_alloc}; +use type_::Type; use rustc_front; use rustc_front::hir; diff --git a/src/librustc_trans/trans/glue.rs b/src/librustc_trans/glue.rs similarity index 97% rename from src/librustc_trans/trans/glue.rs rename to src/librustc_trans/glue.rs index dc4fc5a9ccf..1af816845b0 100644 --- a/src/librustc_trans/trans/glue.rs +++ b/src/librustc_trans/glue.rs @@ -21,24 +21,24 @@ use middle::lang_items::ExchangeFreeFnLangItem; use rustc::ty::subst::{Substs}; use rustc::traits; use rustc::ty::{self, Ty, TyCtxt}; -use trans::abi::{Abi, FnType}; -use trans::adt; -use trans::adt::GetDtorType; // for tcx.dtor_type() -use trans::base::*; -use trans::build::*; -use trans::callee::{Callee, ArgVals}; -use trans::cleanup; -use trans::cleanup::CleanupMethods; -use trans::collector::{self, TransItem}; -use trans::common::*; -use trans::debuginfo::DebugLoc; -use trans::declare; -use trans::expr; -use trans::machine::*; -use trans::monomorphize; -use trans::type_of::{type_of, sizing_type_of, align_of}; -use trans::type_::Type; -use trans::value::Value; +use abi::{Abi, FnType}; +use adt; +use adt::GetDtorType; // for tcx.dtor_type() +use base::*; +use build::*; +use callee::{Callee, ArgVals}; +use cleanup; +use cleanup::CleanupMethods; +use collector::{self, TransItem}; +use common::*; +use debuginfo::DebugLoc; +use declare; +use expr; +use machine::*; +use monomorphize; +use type_of::{type_of, sizing_type_of, align_of}; +use type_::Type; +use value::Value; use arena::TypedArena; use syntax::codemap::DUMMY_SP; diff --git a/src/librustc_trans/trans/inline.rs b/src/librustc_trans/inline.rs similarity index 98% rename from src/librustc_trans/trans/inline.rs rename to src/librustc_trans/inline.rs index b8abc1b6107..cf1542b7b03 100644 --- a/src/librustc_trans/trans/inline.rs +++ b/src/librustc_trans/inline.rs @@ -12,9 +12,9 @@ use llvm::{AvailableExternallyLinkage, InternalLinkage, SetLinkage}; use middle::cstore::{CrateStore, FoundAst, InlinedItem}; use middle::def_id::DefId; use rustc::ty::subst::Substs; -use trans::base::{push_ctxt, trans_item, trans_fn}; -use trans::callee::Callee; -use trans::common::*; +use base::{push_ctxt, trans_item, trans_fn}; +use callee::Callee; +use common::*; use rustc::dep_graph::DepNode; use rustc_front::hir; diff --git a/src/librustc_trans/trans/intrinsic.rs b/src/librustc_trans/intrinsic.rs similarity index 99% rename from src/librustc_trans/trans/intrinsic.rs rename to src/librustc_trans/intrinsic.rs index 9577a1817d7..b7b74e44d3e 100644 --- a/src/librustc_trans/trans/intrinsic.rs +++ b/src/librustc_trans/intrinsic.rs @@ -18,26 +18,26 @@ use llvm::{ValueRef, TypeKind}; use rustc::infer; use rustc::ty::subst; use rustc::ty::subst::FnSpace; -use trans::abi::{Abi, FnType}; -use trans::adt; -use trans::attributes; -use trans::base::*; -use trans::build::*; -use trans::callee::{self, Callee}; -use trans::cleanup; -use trans::cleanup::CleanupMethods; -use trans::common::*; -use trans::consts; -use trans::datum::*; -use trans::debuginfo::DebugLoc; -use trans::declare; -use trans::expr; -use trans::glue; -use trans::type_of; -use trans::machine; -use trans::type_::Type; +use abi::{Abi, FnType}; +use adt; +use attributes; +use base::*; +use build::*; +use callee::{self, Callee}; +use cleanup; +use cleanup::CleanupMethods; +use common::*; +use consts; +use datum::*; +use debuginfo::DebugLoc; +use declare; +use expr; +use glue; +use type_of; +use machine; +use type_::Type; use rustc::ty::{self, Ty, TypeFoldable}; -use trans::Disr; +use Disr; use rustc::ty::subst::Substs; use rustc::dep_graph::DepNode; use rustc_front::hir; diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index 80d805d843e..103de7e42af 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -61,6 +61,9 @@ pub use rustc::middle; pub use rustc::lint; pub use rustc::util; +pub use base::trans_crate; +pub use disr::Disr; + pub mod back { pub use rustc_back::rpath; pub use rustc_back::svh; @@ -76,10 +79,70 @@ pub mod back { pub mod diagnostics; -pub mod trans; +#[macro_use] +mod macros; -pub mod lib { - pub use llvm; +mod abi; +mod adt; +mod asm; +mod assert_dep_graph; +mod attributes; +mod base; +mod basic_block; +mod build; +mod builder; +mod cabi_aarch64; +mod cabi_arm; +mod cabi_asmjs; +mod cabi_mips; +mod cabi_powerpc; +mod cabi_powerpc64; +mod cabi_x86; +mod cabi_x86_64; +mod cabi_x86_win64; +mod callee; +mod cleanup; +mod closure; +mod common; +mod consts; +mod context; +mod controlflow; +mod datum; +mod debuginfo; +mod declare; +mod disr; +mod expr; +mod glue; +mod inline; +mod intrinsic; +mod machine; +mod _match; +mod meth; +mod mir; +mod monomorphize; +mod collector; +mod symbol_names_test; +mod tvec; +mod type_; +mod type_of; +mod value; + +#[derive(Copy, Clone)] +pub struct ModuleTranslation { + pub llcx: llvm::ContextRef, + pub llmod: llvm::ModuleRef, +} + +unsafe impl Send for ModuleTranslation { } +unsafe impl Sync for ModuleTranslation { } + +pub struct CrateTranslation { + pub modules: Vec, + pub metadata_module: ModuleTranslation, + pub link: middle::cstore::LinkMeta, + pub metadata: Vec, + pub reachable: Vec, + pub no_builtins: bool, } __build_diagnostic_array! { librustc_trans, DIAGNOSTICS } diff --git a/src/librustc_trans/trans/machine.rs b/src/librustc_trans/machine.rs similarity index 98% rename from src/librustc_trans/trans/machine.rs rename to src/librustc_trans/machine.rs index 691fba42d57..59020b38ddc 100644 --- a/src/librustc_trans/trans/machine.rs +++ b/src/librustc_trans/machine.rs @@ -13,9 +13,9 @@ #![allow(non_camel_case_types)] use llvm::{self, ValueRef}; -use trans::common::*; +use common::*; -use trans::type_::Type; +use type_::Type; pub type llbits = u64; pub type llsize = u64; diff --git a/src/librustc_trans/trans/macros.rs b/src/librustc_trans/macros.rs similarity index 100% rename from src/librustc_trans/trans/macros.rs rename to src/librustc_trans/macros.rs diff --git a/src/librustc_trans/trans/meth.rs b/src/librustc_trans/meth.rs similarity index 97% rename from src/librustc_trans/trans/meth.rs rename to src/librustc_trans/meth.rs index 696a0e3c0b6..65f52fd0799 100644 --- a/src/librustc_trans/trans/meth.rs +++ b/src/librustc_trans/meth.rs @@ -18,21 +18,21 @@ use rustc::infer; use rustc::ty::subst::{FnSpace, Subst, Substs}; use rustc::ty::subst; use rustc::traits::{self, ProjectionMode}; -use trans::abi::FnType; -use trans::base::*; -use trans::build::*; -use trans::callee::{Callee, Virtual, ArgVals, trans_fn_pointer_shim}; -use trans::closure; -use trans::common::*; -use trans::consts; -use trans::debuginfo::DebugLoc; -use trans::declare; -use trans::expr; -use trans::glue; -use trans::machine; -use trans::type_::Type; -use trans::type_of::*; -use trans::value::Value; +use abi::FnType; +use base::*; +use build::*; +use callee::{Callee, Virtual, ArgVals, trans_fn_pointer_shim}; +use closure; +use common::*; +use consts; +use debuginfo::DebugLoc; +use declare; +use expr; +use glue; +use machine; +use type_::Type; +use type_of::*; +use value::Value; use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; use syntax::ast::Name; diff --git a/src/librustc_trans/trans/mir/analyze.rs b/src/librustc_trans/mir/analyze.rs similarity index 99% rename from src/librustc_trans/trans/mir/analyze.rs rename to src/librustc_trans/mir/analyze.rs index 23cca55e4d4..9aa3d6c7dd0 100644 --- a/src/librustc_trans/trans/mir/analyze.rs +++ b/src/librustc_trans/mir/analyze.rs @@ -14,7 +14,7 @@ use rustc_data_structures::bitvec::BitVector; use rustc::mir::repr as mir; use rustc::mir::visit::{Visitor, LvalueContext}; -use trans::common::{self, Block}; +use common::{self, Block}; use super::rvalue; pub fn lvalue_temps<'bcx,'tcx>(bcx: Block<'bcx,'tcx>, diff --git a/src/librustc_trans/trans/mir/block.rs b/src/librustc_trans/mir/block.rs similarity index 97% rename from src/librustc_trans/trans/mir/block.rs rename to src/librustc_trans/mir/block.rs index 4f76fd56684..a60b03dd724 100644 --- a/src/librustc_trans/trans/mir/block.rs +++ b/src/librustc_trans/mir/block.rs @@ -11,19 +11,19 @@ use llvm::{self, BasicBlockRef, ValueRef, OperandBundleDef}; use rustc::ty; use rustc::mir::repr as mir; -use trans::abi::{Abi, FnType}; -use trans::adt; -use trans::base; -use trans::build; -use trans::callee::{Callee, CalleeData, Fn, Intrinsic, NamedTupleConstructor, Virtual}; -use trans::common::{self, Block, BlockAndBuilder, C_undef}; -use trans::debuginfo::DebugLoc; -use trans::Disr; -use trans::machine::{llalign_of_min, llbitsize_of_real}; -use trans::meth; -use trans::type_of; -use trans::glue; -use trans::type_::Type; +use abi::{Abi, FnType}; +use adt; +use base; +use build; +use callee::{Callee, CalleeData, Fn, Intrinsic, NamedTupleConstructor, Virtual}; +use common::{self, Block, BlockAndBuilder, C_undef}; +use debuginfo::DebugLoc; +use Disr; +use machine::{llalign_of_min, llbitsize_of_real}; +use meth; +use type_of; +use glue; +use type_::Type; use super::{MirContext, drop}; use super::lvalue::{LvalueRef, load_fat_ptr}; @@ -265,9 +265,9 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { callee.reify(bcx.ccx()).val } Intrinsic => { - use trans::callee::ArgVals; - use trans::expr::{Ignore, SaveIn}; - use trans::intrinsic::trans_intrinsic_call; + use callee::ArgVals; + use expr::{Ignore, SaveIn}; + use intrinsic::trans_intrinsic_call; let (dest, llargs) = if fn_ty.ret.is_indirect() { (SaveIn(llargs[0]), &llargs[1..]) diff --git a/src/librustc_trans/trans/mir/constant.rs b/src/librustc_trans/mir/constant.rs similarity index 96% rename from src/librustc_trans/trans/mir/constant.rs rename to src/librustc_trans/mir/constant.rs index 1e5c1c2c55a..be1c3f3b56b 100644 --- a/src/librustc_trans/trans/mir/constant.rs +++ b/src/librustc_trans/mir/constant.rs @@ -13,14 +13,14 @@ use rustc::ty::{Ty, TypeFoldable}; use rustc::middle::const_eval::{self, ConstVal}; use rustc_const_eval::ConstInt::*; use rustc::mir::repr as mir; -use trans::abi; -use trans::common::{self, BlockAndBuilder, C_bool, C_bytes, C_floating_f64, C_integral, +use abi; +use common::{self, BlockAndBuilder, C_bool, C_bytes, C_floating_f64, C_integral, C_str_slice, C_undef}; -use trans::consts; -use trans::datum; -use trans::expr; -use trans::type_of; -use trans::type_::Type; +use consts; +use datum; +use expr; +use type_of; +use type_::Type; use super::operand::{OperandRef, OperandValue}; use super::MirContext; diff --git a/src/librustc_trans/trans/mir/drop.rs b/src/librustc_trans/mir/drop.rs similarity index 87% rename from src/librustc_trans/trans/mir/drop.rs rename to src/librustc_trans/mir/drop.rs index cc033084ace..623cd5a6f8c 100644 --- a/src/librustc_trans/trans/mir/drop.rs +++ b/src/librustc_trans/mir/drop.rs @@ -10,12 +10,12 @@ use llvm::ValueRef; use rustc::ty::Ty; -use trans::adt; -use trans::base; -use trans::common::{self, BlockAndBuilder}; -use trans::machine; -use trans::type_of; -use trans::type_::Type; +use adt; +use base; +use common::{self, BlockAndBuilder}; +use machine; +use type_of; +use type_::Type; pub fn drop_fill<'bcx, 'tcx>(bcx: &BlockAndBuilder<'bcx, 'tcx>, value: ValueRef, ty: Ty<'tcx>) { let llty = type_of::type_of(bcx.ccx(), ty); diff --git a/src/librustc_trans/trans/mir/lvalue.rs b/src/librustc_trans/mir/lvalue.rs similarity index 97% rename from src/librustc_trans/trans/mir/lvalue.rs rename to src/librustc_trans/mir/lvalue.rs index 6271ad8d8b8..f5f8c23a982 100644 --- a/src/librustc_trans/trans/mir/lvalue.rs +++ b/src/librustc_trans/mir/lvalue.rs @@ -12,16 +12,16 @@ use llvm::ValueRef; use rustc::ty::{self, Ty, TypeFoldable}; use rustc::mir::repr as mir; use rustc::mir::tcx::LvalueTy; -use trans::abi; -use trans::adt; -use trans::base; -use trans::builder::Builder; -use trans::common::{self, BlockAndBuilder, C_uint}; -use trans::consts; -use trans::machine; -use trans::mir::drop; +use abi; +use adt; +use base; +use builder::Builder; +use common::{self, BlockAndBuilder, C_uint}; +use consts; +use machine; +use mir::drop; use llvm; -use trans::Disr; +use Disr; use std::ptr; diff --git a/src/librustc_trans/trans/mir/mod.rs b/src/librustc_trans/mir/mod.rs similarity index 99% rename from src/librustc_trans/trans/mir/mod.rs rename to src/librustc_trans/mir/mod.rs index ed4aa5fe583..61536f3ecae 100644 --- a/src/librustc_trans/trans/mir/mod.rs +++ b/src/librustc_trans/mir/mod.rs @@ -13,8 +13,8 @@ use llvm::{self, ValueRef}; use rustc::ty; use rustc::mir::repr as mir; use rustc::mir::tcx::LvalueTy; -use trans::base; -use trans::common::{self, Block, BlockAndBuilder, FunctionContext}; +use base; +use common::{self, Block, BlockAndBuilder, FunctionContext}; use std::ops::Deref; use std::rc::Rc; diff --git a/src/librustc_trans/trans/mir/operand.rs b/src/librustc_trans/mir/operand.rs similarity index 98% rename from src/librustc_trans/trans/mir/operand.rs rename to src/librustc_trans/mir/operand.rs index cc1446033de..3b909353f73 100644 --- a/src/librustc_trans/trans/mir/operand.rs +++ b/src/librustc_trans/mir/operand.rs @@ -11,11 +11,11 @@ use llvm::ValueRef; use rustc::ty::Ty; use rustc::mir::repr as mir; -use trans::base; -use trans::common::{self, Block, BlockAndBuilder}; -use trans::datum; -use trans::value::Value; -use trans::glue; +use base; +use common::{self, Block, BlockAndBuilder}; +use datum; +use value::Value; +use glue; use std::fmt; diff --git a/src/librustc_trans/trans/mir/rvalue.rs b/src/librustc_trans/mir/rvalue.rs similarity index 98% rename from src/librustc_trans/trans/mir/rvalue.rs rename to src/librustc_trans/mir/rvalue.rs index a78d0da5be4..47fa618ebad 100644 --- a/src/librustc_trans/trans/mir/rvalue.rs +++ b/src/librustc_trans/mir/rvalue.rs @@ -15,20 +15,20 @@ use middle::const_eval::ConstVal; use rustc_const_eval::ConstInt; use rustc::mir::repr as mir; -use trans::asm; -use trans::base; -use trans::callee::Callee; -use trans::common::{self, C_uint, BlockAndBuilder, Result}; -use trans::datum::{Datum, Lvalue}; -use trans::debuginfo::DebugLoc; -use trans::declare; -use trans::adt; -use trans::machine; -use trans::type_::Type; -use trans::type_of; -use trans::tvec; -use trans::value::Value; -use trans::Disr; +use asm; +use base; +use callee::Callee; +use common::{self, C_uint, BlockAndBuilder, Result}; +use datum::{Datum, Lvalue}; +use debuginfo::DebugLoc; +use declare; +use adt; +use machine; +use type_::Type; +use type_of; +use tvec; +use value::Value; +use Disr; use super::MirContext; use super::operand::{OperandRef, OperandValue}; @@ -138,7 +138,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { use syntax::ast::DUMMY_NODE_ID; use syntax::codemap::DUMMY_SP; use syntax::ptr::P; - use trans::closure; + use closure; closure::trans_closure_expr(closure::Dest::Ignore(bcx.ccx()), &hir::FnDecl { diff --git a/src/librustc_trans/trans/mir/statement.rs b/src/librustc_trans/mir/statement.rs similarity index 98% rename from src/librustc_trans/trans/mir/statement.rs rename to src/librustc_trans/mir/statement.rs index 0307fd649c8..d291bc19db5 100644 --- a/src/librustc_trans/trans/mir/statement.rs +++ b/src/librustc_trans/mir/statement.rs @@ -9,7 +9,7 @@ // except according to those terms. use rustc::mir::repr as mir; -use trans::common::BlockAndBuilder; +use common::BlockAndBuilder; use super::MirContext; use super::TempRef; diff --git a/src/librustc_trans/trans/monomorphize.rs b/src/librustc_trans/monomorphize.rs similarity index 97% rename from src/librustc_trans/trans/monomorphize.rs rename to src/librustc_trans/monomorphize.rs index 0440c74a60a..fe3ab58761a 100644 --- a/src/librustc_trans/trans/monomorphize.rs +++ b/src/librustc_trans/monomorphize.rs @@ -16,13 +16,13 @@ use rustc::infer::normalize_associated_type; use rustc::ty::subst; use rustc::ty::subst::{Subst, Substs}; use rustc::ty::{self, Ty, TypeFoldable, TyCtxt}; -use trans::attributes; -use trans::base::{push_ctxt}; -use trans::base::trans_fn; -use trans::base; -use trans::common::*; -use trans::declare; -use trans::Disr; +use attributes; +use base::{push_ctxt}; +use base::trans_fn; +use base; +use common::*; +use declare; +use Disr; use rustc::front::map as hir_map; use rustc::util::ppaux; diff --git a/src/librustc_trans/trans/symbol_names_test.rs b/src/librustc_trans/symbol_names_test.rs similarity index 81% rename from src/librustc_trans/trans/symbol_names_test.rs rename to src/librustc_trans/symbol_names_test.rs index bcfab663966..a75b6f736ee 100644 --- a/src/librustc_trans/trans/symbol_names_test.rs +++ b/src/librustc_trans/symbol_names_test.rs @@ -15,13 +15,13 @@ //! paths etc in all kinds of annoying scenarios. use back::symbol_names; -use rustc::ty::TyCtxt; use rustc_front::hir; use rustc_front::intravisit::{self, Visitor}; use syntax::ast; use syntax::attr::AttrMetaMethods; -use trans::common::CrateContext; -use trans::monomorphize::Instance; + +use common::CrateContext; +use monomorphize::Instance; const SYMBOL_NAME: &'static str = "rustc_symbol_name"; const ITEM_PATH: &'static str = "rustc_item_path"; @@ -36,28 +36,28 @@ pub fn report_symbol_names(ccx: &CrateContext) { } let _ignore = tcx.dep_graph.in_ignore(); - let mut visitor = SymbolNamesTest { ccx: ccx, tcx: tcx }; + let mut visitor = SymbolNamesTest { ccx: ccx }; tcx.map.krate().visit_all_items(&mut visitor); } struct SymbolNamesTest<'a, 'tcx:'a> { ccx: &'a CrateContext<'a, 'tcx>, - tcx: &'a TyCtxt<'tcx>, } impl<'a, 'tcx> SymbolNamesTest<'a, 'tcx> { fn process_attrs(&mut self, node_id: ast::NodeId) { - let def_id = self.tcx.map.local_def_id(node_id); - for attr in self.tcx.get_attrs(def_id).iter() { + let tcx = self.ccx.tcx(); + let def_id = tcx.map.local_def_id(node_id); + for attr in tcx.get_attrs(def_id).iter() { if attr.check_name(SYMBOL_NAME) { // for now, can only use on monomorphic names - let instance = Instance::mono(self.tcx, def_id); + let instance = Instance::mono(tcx, def_id); let name = symbol_names::exported_name(self.ccx, &instance); - self.tcx.sess.span_err(attr.span, &format!("symbol-name({})", name)); + tcx.sess.span_err(attr.span, &format!("symbol-name({})", name)); } else if attr.check_name(ITEM_PATH) { - let path = self.tcx.item_path_str(def_id); - self.tcx.sess.span_err(attr.span, &format!("item-path({})", path)); + let path = tcx.item_path_str(def_id); + tcx.sess.span_err(attr.span, &format!("item-path({})", path)); } // (*) The formatting of `tag({})` is chosen so that tests can elect diff --git a/src/librustc_trans/trans/mod.rs b/src/librustc_trans/trans/mod.rs deleted file mode 100644 index 930f37ce256..00000000000 --- a/src/librustc_trans/trans/mod.rs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use llvm::{ContextRef, ModuleRef}; -use middle::cstore::LinkMeta; - -pub use self::base::trans_crate; -pub use self::context::CrateContext; -pub use self::common::gensym_name; -pub use self::disr::Disr; -pub use self::monomorphize::Instance; - -#[macro_use] -mod macros; - -mod abi; -mod adt; -mod asm; -mod assert_dep_graph; -mod attributes; -mod base; -mod basic_block; -mod build; -mod builder; -mod cabi_aarch64; -mod cabi_arm; -mod cabi_asmjs; -mod cabi_mips; -mod cabi_powerpc; -mod cabi_powerpc64; -mod cabi_x86; -mod cabi_x86_64; -mod cabi_x86_win64; -mod callee; -mod cleanup; -mod closure; -mod common; -mod consts; -mod context; -mod controlflow; -mod datum; -mod debuginfo; -mod declare; -mod disr; -mod expr; -mod glue; -mod inline; -mod intrinsic; -mod machine; -mod _match; -mod meth; -mod mir; -mod monomorphize; -mod collector; -mod symbol_names_test; -mod tvec; -mod type_; -mod type_of; -mod value; - -#[derive(Copy, Clone)] -pub struct ModuleTranslation { - pub llcx: ContextRef, - pub llmod: ModuleRef, -} - -unsafe impl Send for ModuleTranslation { } -unsafe impl Sync for ModuleTranslation { } - -pub struct CrateTranslation { - pub modules: Vec, - pub metadata_module: ModuleTranslation, - pub link: LinkMeta, - pub metadata: Vec, - pub reachable: Vec, - pub no_builtins: bool, -} diff --git a/src/librustc_trans/trans/tvec.rs b/src/librustc_trans/tvec.rs similarity index 97% rename from src/librustc_trans/trans/tvec.rs rename to src/librustc_trans/tvec.rs index 4a7404b1fba..c42bad0bc0b 100644 --- a/src/librustc_trans/trans/tvec.rs +++ b/src/librustc_trans/tvec.rs @@ -12,21 +12,21 @@ use llvm; use llvm::ValueRef; -use trans::base::*; -use trans::base; -use trans::build::*; -use trans::cleanup; -use trans::cleanup::CleanupMethods; -use trans::common::*; -use trans::consts; -use trans::datum::*; -use trans::debuginfo::DebugLoc; -use trans::expr::{Dest, Ignore, SaveIn}; -use trans::expr; -use trans::machine::llsize_of_alloc; -use trans::type_::Type; -use trans::type_of; -use trans::value::Value; +use base::*; +use base; +use build::*; +use cleanup; +use cleanup::CleanupMethods; +use common::*; +use consts; +use datum::*; +use debuginfo::DebugLoc; +use expr::{Dest, Ignore, SaveIn}; +use expr; +use machine::llsize_of_alloc; +use type_::Type; +use type_of; +use value::Value; use rustc::ty::{self, Ty}; use rustc_front::hir; diff --git a/src/librustc_trans/trans/type_.rs b/src/librustc_trans/type_.rs similarity index 99% rename from src/librustc_trans/trans/type_.rs rename to src/librustc_trans/type_.rs index 57bd0ba8158..910a1c7f729 100644 --- a/src/librustc_trans/trans/type_.rs +++ b/src/librustc_trans/type_.rs @@ -14,7 +14,7 @@ use llvm; use llvm::{TypeRef, Bool, False, True, TypeKind}; use llvm::{Float, Double, X86_FP80, PPC_FP128, FP128}; -use trans::context::CrateContext; +use context::CrateContext; use util::nodemap::FnvHashMap; use syntax::ast; diff --git a/src/librustc_trans/trans/type_of.rs b/src/librustc_trans/type_of.rs similarity index 99% rename from src/librustc_trans/trans/type_of.rs rename to src/librustc_trans/type_of.rs index 00f42a3b243..02f659fdc2e 100644 --- a/src/librustc_trans/trans/type_of.rs +++ b/src/librustc_trans/type_of.rs @@ -13,13 +13,13 @@ use middle::def_id::DefId; use rustc::infer; use rustc::ty::subst; -use trans::abi::FnType; -use trans::adt; -use trans::common::*; -use trans::machine; +use abi::FnType; +use adt; +use common::*; +use machine; use rustc::ty::{self, Ty, TypeFoldable}; -use trans::type_::Type; +use type_::Type; use syntax::ast; diff --git a/src/librustc_trans/trans/value.rs b/src/librustc_trans/value.rs similarity index 98% rename from src/librustc_trans/trans/value.rs rename to src/librustc_trans/value.rs index a33b7d62d2d..00b316cc420 100644 --- a/src/librustc_trans/trans/value.rs +++ b/src/librustc_trans/value.rs @@ -10,8 +10,8 @@ use llvm; use llvm::{UseRef, ValueRef}; -use trans::basic_block::BasicBlock; -use trans::common::Block; +use basic_block::BasicBlock; +use common::Block; use std::fmt;