]> git.lizzy.rs Git - rust.git/commitdiff
Beginning of moving all backend-agnostic code to rustc_codegen_ssa
authorDenis Merigoux <denis.merigoux@gmail.com>
Mon, 1 Oct 2018 16:07:04 +0000 (18:07 +0200)
committerEduard-Mihai Burtescu <edy.burt@gmail.com>
Fri, 16 Nov 2018 12:55:42 +0000 (14:55 +0200)
27 files changed:
src/Cargo.lock
src/librustc_codegen_llvm/Cargo.toml
src/librustc_codegen_llvm/back/lto.rs
src/librustc_codegen_llvm/back/write.rs
src/librustc_codegen_llvm/base.rs
src/librustc_codegen_llvm/builder.rs
src/librustc_codegen_llvm/common.rs
src/librustc_codegen_llvm/glue.rs
src/librustc_codegen_llvm/interfaces/builder.rs
src/librustc_codegen_llvm/interfaces/mod.rs
src/librustc_codegen_llvm/interfaces/type_.rs
src/librustc_codegen_llvm/intrinsic.rs
src/librustc_codegen_llvm/lib.rs
src/librustc_codegen_llvm/llvm/ffi.rs
src/librustc_codegen_llvm/mir/block.rs
src/librustc_codegen_llvm/mir/place.rs
src/librustc_codegen_llvm/mir/rvalue.rs
src/librustc_codegen_llvm/type_.rs
src/librustc_codegen_ssa/Cargo.toml [new file with mode: 0644]
src/librustc_codegen_ssa/common.rs [new file with mode: 0644]
src/librustc_codegen_ssa/interfaces/backend.rs [new file with mode: 0644]
src/librustc_codegen_ssa/interfaces/mod.rs [new file with mode: 0644]
src/librustc_codegen_ssa/lib.rs [new file with mode: 0644]
src/librustc_codegen_utils/common.rs [deleted file]
src/librustc_codegen_utils/interfaces/backend.rs [deleted file]
src/librustc_codegen_utils/interfaces/mod.rs [deleted file]
src/librustc_codegen_utils/lib.rs

index a0bb92867ff4e65a4cb48dd43df49a2c9394c51d..031dac88df13e39be9a2795d9fa6de2a3dab493a 100644 (file)
@@ -2122,9 +2122,14 @@ dependencies = [
  "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc_codegen_ssa 0.0.0",
  "rustc_llvm 0.0.0",
 ]
 
+[[package]]
+name = "rustc_codegen_ssa"
+version = "0.0.0"
+
 [[package]]
 name = "rustc_codegen_utils"
 version = "0.0.0"
index b711502b14b7fb1af4222d0859fbf82a03e75d06..34017009c2838eae75707709b2e53e02dc2cc58e 100644 (file)
@@ -13,6 +13,7 @@ test = false
 cc = "1.0.1"
 num_cpus = "1.0"
 rustc-demangle = "0.1.4"
+rustc_codegen_ssa = { path = "../librustc_codegen_ssa" }
 rustc_llvm = { path = "../librustc_llvm" }
 memmap = "0.6"
 
index de69531fa8bffd5625b47255b10f10f2f7b06ae3..0f62ea6d35714deaba52221322cb65811064b5b9 100644 (file)
@@ -25,7 +25,7 @@
 use rustc_codegen_utils::symbol_export;
 use time_graph::Timeline;
 use ModuleLlvm;
-use rustc_codegen_utils::{ModuleCodegen, ModuleKind};
+use rustc_codegen_ssa::{ModuleCodegen, ModuleKind};
 
 use libc;
 
index d96dd93e3e2c3a5ee1fd220dd25c30d813b79413..60cfe203e402b91cb57fae1c239516d8ea7f1923 100644 (file)
@@ -27,7 +27,7 @@
 use llvm::{self, DiagnosticInfo, PassManager, SMDiagnostic};
 use llvm_util;
 use {CodegenResults, ModuleLlvm};
-use rustc_codegen_utils::{ModuleCodegen, ModuleKind, CachedModuleCodegen, CompiledModule};
+use rustc_codegen_ssa::{ModuleCodegen, ModuleKind, CachedModuleCodegen, CompiledModule};
 use CrateInfo;
 use rustc::hir::def_id::{CrateNum, LOCAL_CRATE};
 use rustc::ty::TyCtxt;
index d8f5c25714f664339b8ef8cd8a512198be716a1e..4e69bf8e8b3974da5579726dd685e43f3bb9a436 100644 (file)
@@ -24,7 +24,7 @@
 //!     int) and rec(x=int, y=int, z=int) will have the same llvm::Type.
 
 use super::ModuleLlvm;
-use rustc_codegen_utils::{ModuleCodegen, ModuleKind, CachedModuleCodegen};
+use rustc_codegen_ssa::{ModuleCodegen, ModuleKind, CachedModuleCodegen};
 use super::LlvmCodegenBackend;
 
 use abi;
@@ -52,7 +52,7 @@
 use callee;
 use rustc_mir::monomorphize::item::DefPathBasedNames;
 use common;
-use rustc_codegen_utils::common::{RealPredicate, TypeKind, IntPredicate};
+use rustc_codegen_ssa::common::{RealPredicate, TypeKind, IntPredicate};
 use meth;
 use mir;
 use context::CodegenCx;
index ae0d89a56098a6d29ee346cec2144a807950cda6..efd2e146f357fa4aad4303edfde8f5db10945a4b 100644 (file)
@@ -10,8 +10,8 @@
 
 use llvm::{AtomicRmwBinOp, AtomicOrdering, SynchronizationScope, AsmDialect};
 use llvm::{self, False, BasicBlock};
-use rustc_codegen_utils::common::{IntPredicate, TypeKind, RealPredicate};
-use rustc_codegen_utils;
+use rustc_codegen_ssa::common::{IntPredicate, TypeKind, RealPredicate};
+use rustc_codegen_ssa;
 use common::Funclet;
 use context::CodegenCx;
 use type_::Type;
@@ -527,7 +527,7 @@ fn volatile_load(&self, ptr: &'ll Value) -> &'ll Value {
     fn atomic_load(
         &self,
         ptr: &'ll Value,
-        order: rustc_codegen_utils::common::AtomicOrdering,
+        order: rustc_codegen_ssa::common::AtomicOrdering,
         size: Size,
     ) -> &'ll Value {
         self.count_insn("load.atomic");
@@ -681,7 +681,7 @@ fn store_with_flags(
     }
 
    fn atomic_store(&self, val: &'ll Value, ptr: &'ll Value,
-                   order: rustc_codegen_utils::common::AtomicOrdering, size: Size) {
+                   order: rustc_codegen_ssa::common::AtomicOrdering, size: Size) {
         debug!("Store {:?} -> {:?}", val, ptr);
         self.count_insn("store.atomic");
         let ptr = self.check_store(val, ptr);
@@ -1204,8 +1204,8 @@ fn atomic_cmpxchg(
         dst: &'ll Value,
         cmp: &'ll Value,
         src: &'ll Value,
-        order: rustc_codegen_utils::common::AtomicOrdering,
-        failure_order: rustc_codegen_utils::common::AtomicOrdering,
+        order: rustc_codegen_ssa::common::AtomicOrdering,
+        failure_order: rustc_codegen_ssa::common::AtomicOrdering,
         weak: bool,
     ) -> &'ll Value {
         let weak = if weak { llvm::True } else { llvm::False };
@@ -1223,10 +1223,10 @@ fn atomic_cmpxchg(
     }
     fn atomic_rmw(
         &self,
-        op: rustc_codegen_utils::common::AtomicRmwBinOp,
+        op: rustc_codegen_ssa::common::AtomicRmwBinOp,
         dst: &'ll Value,
         src: &'ll Value,
-        order: rustc_codegen_utils::common::AtomicOrdering,
+        order: rustc_codegen_ssa::common::AtomicOrdering,
     ) -> &'ll Value {
         unsafe {
             llvm::LLVMBuildAtomicRMW(
@@ -1241,8 +1241,8 @@ fn atomic_rmw(
 
     fn atomic_fence(
         &self,
-        order: rustc_codegen_utils::common::AtomicOrdering,
-        scope: rustc_codegen_utils::common::SynchronizationScope
+        order: rustc_codegen_ssa::common::AtomicOrdering,
+        scope: rustc_codegen_ssa::common::SynchronizationScope
     ) {
         unsafe {
             llvm::LLVMRustBuildAtomicFence(
index 13e71b8ab04aad770b845d1e2e811f16d9688ace..7dc4b00f79449cb2ff472da18ffaa43dd1a90cfd 100644 (file)
@@ -29,7 +29,7 @@
 use rustc::hir;
 use mir::constant::const_alloc_to_llvm;
 use mir::place::PlaceRef;
-use rustc_codegen_utils::common::TypeKind;
+use rustc_codegen_ssa::common::TypeKind;
 
 use libc::{c_uint, c_char};
 
index e641c15302321e7b8ccddb2464f9bcd0996d877a..5e1a03031dde6b7494558c9ae83880f63245b0f4 100644 (file)
@@ -14,7 +14,7 @@
 
 use std;
 
-use rustc_codegen_utils::common::IntPredicate;
+use rustc_codegen_ssa::common::IntPredicate;
 use meth;
 use rustc::ty::layout::LayoutOf;
 use rustc::ty::{self, Ty};
index 74a31975a390e0b3f2ea95ad055610a3ff5dfd58..2e1abb12e168825c133c45e94e669f654d2443f6 100644 (file)
@@ -19,7 +19,7 @@
 use mir::operand::OperandRef;
 use mir::place::PlaceRef;
 use rustc::ty::layout::{Align, Size};
-use rustc_codegen_utils::common::{
+use rustc_codegen_ssa::common::{
     AtomicOrdering, AtomicRmwBinOp, IntPredicate, RealPredicate, SynchronizationScope,
 };
 
index 61aa7e29326ba39bd83ed2f312ba13650b1e4451..0547ce7ce4c45f0e98ff3d897d70cb8325425b55 100644 (file)
@@ -31,7 +31,7 @@
 pub use self::type_::{
     ArgTypeMethods, BaseTypeMethods, DerivedTypeMethods, LayoutTypeMethods, TypeMethods,
 };
-pub use rustc_codegen_utils::interfaces::{Backend, BackendMethods, BackendTypes, CodegenObject};
+pub use rustc_codegen_ssa::interfaces::{Backend, BackendMethods, BackendTypes, CodegenObject};
 
 pub trait CodegenMethods<'tcx>:
     Backend<'tcx>
index 775ca2d2d0268dd77a342d67917e40aacfc2fbf0..fe4b7a0b8525357a716863a37c4adff99c929e29 100644 (file)
@@ -15,7 +15,7 @@
 use rustc::ty::layout::{self, Align, Size};
 use rustc::ty::Ty;
 use rustc::util::nodemap::FxHashMap;
-use rustc_codegen_utils::common::TypeKind;
+use rustc_codegen_ssa::common::TypeKind;
 use rustc_target::abi::call::{ArgType, CastTarget, FnType, Reg};
 use std::cell::RefCell;
 use syntax::ast;
index 07b5017e4c847335137c34079c88f6579a0fee88..c7b36cc58918062eec2f20e6831647cb166c1628 100644 (file)
@@ -24,7 +24,7 @@
 use type_of::LayoutLlvmExt;
 use rustc::ty::{self, Ty};
 use rustc::ty::layout::{LayoutOf, HasTyCtxt};
-use rustc_codegen_utils::common::TypeKind;
+use rustc_codegen_ssa::common::TypeKind;
 use rustc::hir;
 use syntax::ast;
 use syntax::symbol::Symbol;
@@ -463,8 +463,8 @@ fn codegen_intrinsic_call(
             // This requires that atomic intrinsics follow a specific naming pattern:
             // "atomic_<operation>[_<ordering>]", and no ordering means SeqCst
             name if name.starts_with("atomic_") => {
-                use rustc_codegen_utils::common::AtomicOrdering::*;
-                use rustc_codegen_utils::common::
+                use rustc_codegen_ssa::common::AtomicOrdering::*;
+                use rustc_codegen_ssa::common::
                     {SynchronizationScope, AtomicRmwBinOp};
 
                 let split: Vec<&str> = name.split('_').collect();
index e8f488ab04c17ef33eb950c1cf387d1197f86066..8d5214ce376f79d8fa57fff977be30d3b7db1934 100644 (file)
@@ -55,6 +55,7 @@
 extern crate rustc_llvm;
 extern crate rustc_platform_intrinsics as intrinsics;
 extern crate rustc_codegen_utils;
+extern crate rustc_codegen_ssa;
 extern crate rustc_fs_util;
 
 #[macro_use] extern crate log;
@@ -91,7 +92,7 @@
 use rustc::util::nodemap::{FxHashSet, FxHashMap};
 use rustc::util::profiling::ProfileCategory;
 use rustc_mir::monomorphize;
-use rustc_codegen_utils::{ModuleCodegen, CompiledModule};
+use rustc_codegen_ssa::{ModuleCodegen, CompiledModule};
 use rustc_codegen_utils::codegen_backend::CodegenBackend;
 use rustc_data_structures::svh::Svh;
 
index 06c60dba2f52830ed2f9c8d19f9db8c52506793d..f1a966d7654388c1389e0a5b37c1cb007b25c829 100644 (file)
@@ -19,8 +19,8 @@
 use libc::{c_ulonglong, c_void};
 
 use std::marker::PhantomData;
-use rustc_codegen_utils;
 use syntax;
+use rustc_codegen_ssa;
 
 use super::RustString;
 
@@ -144,18 +144,18 @@ pub enum IntPredicate {
 }
 
 impl IntPredicate {
-    pub fn from_generic(intpre: rustc_codegen_utils::common::IntPredicate) -> Self {
+    pub fn from_generic(intpre: rustc_codegen_ssa::common::IntPredicate) -> Self {
         match intpre {
-            rustc_codegen_utils::common::IntPredicate::IntEQ => IntPredicate::IntEQ,
-            rustc_codegen_utils::common::IntPredicate::IntNE => IntPredicate::IntNE,
-            rustc_codegen_utils::common::IntPredicate::IntUGT => IntPredicate::IntUGT,
-            rustc_codegen_utils::common::IntPredicate::IntUGE => IntPredicate::IntUGE,
-            rustc_codegen_utils::common::IntPredicate::IntULT => IntPredicate::IntULT,
-            rustc_codegen_utils::common::IntPredicate::IntULE => IntPredicate::IntULE,
-            rustc_codegen_utils::common::IntPredicate::IntSGT => IntPredicate::IntSGT,
-            rustc_codegen_utils::common::IntPredicate::IntSGE => IntPredicate::IntSGE,
-            rustc_codegen_utils::common::IntPredicate::IntSLT => IntPredicate::IntSLT,
-            rustc_codegen_utils::common::IntPredicate::IntSLE => IntPredicate::IntSLE,
+            rustc_codegen_ssa::common::IntPredicate::IntEQ => IntPredicate::IntEQ,
+            rustc_codegen_ssa::common::IntPredicate::IntNE => IntPredicate::IntNE,
+            rustc_codegen_ssa::common::IntPredicate::IntUGT => IntPredicate::IntUGT,
+            rustc_codegen_ssa::common::IntPredicate::IntUGE => IntPredicate::IntUGE,
+            rustc_codegen_ssa::common::IntPredicate::IntULT => IntPredicate::IntULT,
+            rustc_codegen_ssa::common::IntPredicate::IntULE => IntPredicate::IntULE,
+            rustc_codegen_ssa::common::IntPredicate::IntSGT => IntPredicate::IntSGT,
+            rustc_codegen_ssa::common::IntPredicate::IntSGE => IntPredicate::IntSGE,
+            rustc_codegen_ssa::common::IntPredicate::IntSLT => IntPredicate::IntSLT,
+            rustc_codegen_ssa::common::IntPredicate::IntSLE => IntPredicate::IntSLE,
         }
     }
 }
@@ -183,25 +183,25 @@ pub enum RealPredicate {
 }
 
 impl RealPredicate {
-    pub fn from_generic(realpred: rustc_codegen_utils::common::RealPredicate) -> Self {
+    pub fn from_generic(realpred: rustc_codegen_ssa::common::RealPredicate) -> Self {
         match realpred {
-            rustc_codegen_utils::common::RealPredicate::RealPredicateFalse =>
+            rustc_codegen_ssa::common::RealPredicate::RealPredicateFalse =>
                 RealPredicate::RealPredicateFalse,
-            rustc_codegen_utils::common::RealPredicate::RealOEQ => RealPredicate::RealOEQ,
-            rustc_codegen_utils::common::RealPredicate::RealOGT => RealPredicate::RealOGT,
-            rustc_codegen_utils::common::RealPredicate::RealOGE => RealPredicate::RealOGE,
-            rustc_codegen_utils::common::RealPredicate::RealOLT => RealPredicate::RealOLT,
-            rustc_codegen_utils::common::RealPredicate::RealOLE => RealPredicate::RealOLE,
-            rustc_codegen_utils::common::RealPredicate::RealONE => RealPredicate::RealONE,
-            rustc_codegen_utils::common::RealPredicate::RealORD => RealPredicate::RealORD,
-            rustc_codegen_utils::common::RealPredicate::RealUNO => RealPredicate::RealUNO,
-            rustc_codegen_utils::common::RealPredicate::RealUEQ => RealPredicate::RealUEQ,
-            rustc_codegen_utils::common::RealPredicate::RealUGT => RealPredicate::RealUGT,
-            rustc_codegen_utils::common::RealPredicate::RealUGE => RealPredicate::RealUGE,
-            rustc_codegen_utils::common::RealPredicate::RealULT => RealPredicate::RealULT,
-            rustc_codegen_utils::common::RealPredicate::RealULE => RealPredicate::RealULE,
-            rustc_codegen_utils::common::RealPredicate::RealUNE => RealPredicate::RealUNE,
-            rustc_codegen_utils::common::RealPredicate::RealPredicateTrue =>
+            rustc_codegen_ssa::common::RealPredicate::RealOEQ => RealPredicate::RealOEQ,
+            rustc_codegen_ssa::common::RealPredicate::RealOGT => RealPredicate::RealOGT,
+            rustc_codegen_ssa::common::RealPredicate::RealOGE => RealPredicate::RealOGE,
+            rustc_codegen_ssa::common::RealPredicate::RealOLT => RealPredicate::RealOLT,
+            rustc_codegen_ssa::common::RealPredicate::RealOLE => RealPredicate::RealOLE,
+            rustc_codegen_ssa::common::RealPredicate::RealONE => RealPredicate::RealONE,
+            rustc_codegen_ssa::common::RealPredicate::RealORD => RealPredicate::RealORD,
+            rustc_codegen_ssa::common::RealPredicate::RealUNO => RealPredicate::RealUNO,
+            rustc_codegen_ssa::common::RealPredicate::RealUEQ => RealPredicate::RealUEQ,
+            rustc_codegen_ssa::common::RealPredicate::RealUGT => RealPredicate::RealUGT,
+            rustc_codegen_ssa::common::RealPredicate::RealUGE => RealPredicate::RealUGE,
+            rustc_codegen_ssa::common::RealPredicate::RealULT => RealPredicate::RealULT,
+            rustc_codegen_ssa::common::RealPredicate::RealULE => RealPredicate::RealULE,
+            rustc_codegen_ssa::common::RealPredicate::RealUNE => RealPredicate::RealUNE,
+            rustc_codegen_ssa::common::RealPredicate::RealPredicateTrue =>
                 RealPredicate::RealPredicateTrue
         }
     }
@@ -231,25 +231,25 @@ pub enum TypeKind {
 }
 
 impl TypeKind {
-    pub fn to_generic(self) -> rustc_codegen_utils::common::TypeKind {
+    pub fn to_generic(self) -> rustc_codegen_ssa::common::TypeKind {
         match self {
-            TypeKind::Void => rustc_codegen_utils::common::TypeKind::Void,
-            TypeKind::Half => rustc_codegen_utils::common::TypeKind::Half,
-            TypeKind::Float => rustc_codegen_utils::common::TypeKind::Float,
-            TypeKind::Double => rustc_codegen_utils::common::TypeKind::Double,
-            TypeKind::X86_FP80 => rustc_codegen_utils::common::TypeKind::X86_FP80,
-            TypeKind::FP128 => rustc_codegen_utils::common::TypeKind::FP128,
-            TypeKind::PPC_FP128 => rustc_codegen_utils::common::TypeKind::PPC_FP128,
-            TypeKind::Label => rustc_codegen_utils::common::TypeKind::Label,
-            TypeKind::Integer => rustc_codegen_utils::common::TypeKind::Integer,
-            TypeKind::Function => rustc_codegen_utils::common::TypeKind::Function,
-            TypeKind::Struct => rustc_codegen_utils::common::TypeKind::Struct,
-            TypeKind::Array => rustc_codegen_utils::common::TypeKind::Array,
-            TypeKind::Pointer => rustc_codegen_utils::common::TypeKind::Pointer,
-            TypeKind::Vector => rustc_codegen_utils::common::TypeKind::Vector,
-            TypeKind::Metadata => rustc_codegen_utils::common::TypeKind::Metadata,
-            TypeKind::X86_MMX => rustc_codegen_utils::common::TypeKind::X86_MMX,
-            TypeKind::Token => rustc_codegen_utils::common::TypeKind::Token,
+            TypeKind::Void => rustc_codegen_ssa::common::TypeKind::Void,
+            TypeKind::Half => rustc_codegen_ssa::common::TypeKind::Half,
+            TypeKind::Float => rustc_codegen_ssa::common::TypeKind::Float,
+            TypeKind::Double => rustc_codegen_ssa::common::TypeKind::Double,
+            TypeKind::X86_FP80 => rustc_codegen_ssa::common::TypeKind::X86_FP80,
+            TypeKind::FP128 => rustc_codegen_ssa::common::TypeKind::FP128,
+            TypeKind::PPC_FP128 => rustc_codegen_ssa::common::TypeKind::PPC_FP128,
+            TypeKind::Label => rustc_codegen_ssa::common::TypeKind::Label,
+            TypeKind::Integer => rustc_codegen_ssa::common::TypeKind::Integer,
+            TypeKind::Function => rustc_codegen_ssa::common::TypeKind::Function,
+            TypeKind::Struct => rustc_codegen_ssa::common::TypeKind::Struct,
+            TypeKind::Array => rustc_codegen_ssa::common::TypeKind::Array,
+            TypeKind::Pointer => rustc_codegen_ssa::common::TypeKind::Pointer,
+            TypeKind::Vector => rustc_codegen_ssa::common::TypeKind::Vector,
+            TypeKind::Metadata => rustc_codegen_ssa::common::TypeKind::Metadata,
+            TypeKind::X86_MMX => rustc_codegen_ssa::common::TypeKind::X86_MMX,
+            TypeKind::Token => rustc_codegen_ssa::common::TypeKind::Token,
         }
     }
 }
@@ -272,19 +272,19 @@ pub enum AtomicRmwBinOp {
 }
 
 impl AtomicRmwBinOp {
-    pub fn from_generic(op: rustc_codegen_utils::common::AtomicRmwBinOp) -> Self {
+    pub fn from_generic(op: rustc_codegen_ssa::common::AtomicRmwBinOp) -> Self {
         match op {
-            rustc_codegen_utils::common::AtomicRmwBinOp::AtomicXchg => AtomicRmwBinOp::AtomicXchg,
-            rustc_codegen_utils::common::AtomicRmwBinOp::AtomicAdd => AtomicRmwBinOp::AtomicAdd,
-            rustc_codegen_utils::common::AtomicRmwBinOp::AtomicSub => AtomicRmwBinOp::AtomicSub,
-            rustc_codegen_utils::common::AtomicRmwBinOp::AtomicAnd => AtomicRmwBinOp::AtomicAnd,
-            rustc_codegen_utils::common::AtomicRmwBinOp::AtomicNand => AtomicRmwBinOp::AtomicNand,
-            rustc_codegen_utils::common::AtomicRmwBinOp::AtomicOr => AtomicRmwBinOp::AtomicOr,
-            rustc_codegen_utils::common::AtomicRmwBinOp::AtomicXor => AtomicRmwBinOp::AtomicXor,
-            rustc_codegen_utils::common::AtomicRmwBinOp::AtomicMax => AtomicRmwBinOp::AtomicMax,
-            rustc_codegen_utils::common::AtomicRmwBinOp::AtomicMin => AtomicRmwBinOp::AtomicMin,
-            rustc_codegen_utils::common::AtomicRmwBinOp::AtomicUMax => AtomicRmwBinOp::AtomicUMax,
-            rustc_codegen_utils::common::AtomicRmwBinOp::AtomicUMin => AtomicRmwBinOp::AtomicUMin
+            rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXchg => AtomicRmwBinOp::AtomicXchg,
+            rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAdd => AtomicRmwBinOp::AtomicAdd,
+            rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicSub => AtomicRmwBinOp::AtomicSub,
+            rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAnd => AtomicRmwBinOp::AtomicAnd,
+            rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicNand => AtomicRmwBinOp::AtomicNand,
+            rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicOr => AtomicRmwBinOp::AtomicOr,
+            rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXor => AtomicRmwBinOp::AtomicXor,
+            rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMax => AtomicRmwBinOp::AtomicMax,
+            rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMin => AtomicRmwBinOp::AtomicMin,
+            rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMax => AtomicRmwBinOp::AtomicUMax,
+            rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMin => AtomicRmwBinOp::AtomicUMin
         }
     }
 }
@@ -305,16 +305,16 @@ pub enum AtomicOrdering {
 }
 
 impl AtomicOrdering {
-    pub fn from_generic(ao: rustc_codegen_utils::common::AtomicOrdering) -> Self {
+    pub fn from_generic(ao: rustc_codegen_ssa::common::AtomicOrdering) -> Self {
         match ao {
-            rustc_codegen_utils::common::AtomicOrdering::NotAtomic => AtomicOrdering::NotAtomic,
-            rustc_codegen_utils::common::AtomicOrdering::Unordered => AtomicOrdering::Unordered,
-            rustc_codegen_utils::common::AtomicOrdering::Monotonic => AtomicOrdering::Monotonic,
-            rustc_codegen_utils::common::AtomicOrdering::Acquire => AtomicOrdering::Acquire,
-            rustc_codegen_utils::common::AtomicOrdering::Release => AtomicOrdering::Release,
-            rustc_codegen_utils::common::AtomicOrdering::AcquireRelease =>
+            rustc_codegen_ssa::common::AtomicOrdering::NotAtomic => AtomicOrdering::NotAtomic,
+            rustc_codegen_ssa::common::AtomicOrdering::Unordered => AtomicOrdering::Unordered,
+            rustc_codegen_ssa::common::AtomicOrdering::Monotonic => AtomicOrdering::Monotonic,
+            rustc_codegen_ssa::common::AtomicOrdering::Acquire => AtomicOrdering::Acquire,
+            rustc_codegen_ssa::common::AtomicOrdering::Release => AtomicOrdering::Release,
+            rustc_codegen_ssa::common::AtomicOrdering::AcquireRelease =>
                 AtomicOrdering::AcquireRelease,
-            rustc_codegen_utils::common::AtomicOrdering::SequentiallyConsistent =>
+            rustc_codegen_ssa::common::AtomicOrdering::SequentiallyConsistent =>
                 AtomicOrdering::SequentiallyConsistent
         }
     }
@@ -333,12 +333,12 @@ pub enum SynchronizationScope {
 }
 
 impl SynchronizationScope {
-    pub fn from_generic(sc: rustc_codegen_utils::common::SynchronizationScope) -> Self {
+    pub fn from_generic(sc: rustc_codegen_ssa::common::SynchronizationScope) -> Self {
         match sc {
-            rustc_codegen_utils::common::SynchronizationScope::Other => SynchronizationScope::Other,
-            rustc_codegen_utils::common::SynchronizationScope::SingleThread =>
+            rustc_codegen_ssa::common::SynchronizationScope::Other => SynchronizationScope::Other,
+            rustc_codegen_ssa::common::SynchronizationScope::SingleThread =>
                 SynchronizationScope::SingleThread,
-            rustc_codegen_utils::common::SynchronizationScope::CrossThread =>
+            rustc_codegen_ssa::common::SynchronizationScope::CrossThread =>
                 SynchronizationScope::CrossThread,
         }
     }
index 02d532f8c0d965e6ec5a6bf72a52e53713d53a3c..d72fdb2fb236e0d7ebbab2a7981050c1066c4a5f 100644 (file)
@@ -18,7 +18,7 @@
 use base;
 use builder::MemFlags;
 use common;
-use rustc_codegen_utils::common::IntPredicate;
+use rustc_codegen_ssa::common::IntPredicate;
 use meth;
 use monomorphize;
 
index 22ba0fda83bbca9fe8a9e12d8c722d73b1f80df2..8fa35d3aaf27423fba11f218649c6d7793c98a9e 100644 (file)
@@ -13,7 +13,7 @@
 use rustc::mir;
 use rustc::mir::tcx::PlaceTy;
 use builder::MemFlags;
-use rustc_codegen_utils::common::IntPredicate;
+use rustc_codegen_ssa::common::IntPredicate;
 use type_of::LayoutLlvmExt;
 use glue;
 
index f1b07c39178d2fc080c451710d455512852bc6a3..9870c93a5088141edc9ea4e69131fee09ceda667 100644 (file)
@@ -20,7 +20,7 @@
 use builder::MemFlags;
 use callee;
 use common;
-use rustc_codegen_utils::common::{RealPredicate, IntPredicate};
+use rustc_codegen_ssa::common::{RealPredicate, IntPredicate};
 use monomorphize;
 use type_of::LayoutLlvmExt;
 
index 56dac0175e581da0ed76cb5f4aaa50b18af1acbe..00dd3be8c9fd4a2760ca5736420e0ac028265c3d 100644 (file)
@@ -27,8 +27,8 @@
 use rustc_target::abi::call::{CastTarget, FnType, Reg};
 use rustc_data_structures::small_c_str::SmallCStr;
 use common;
-use rustc_codegen_utils;
-use rustc_codegen_utils::common::TypeKind;
+use rustc_codegen_ssa;
+use rustc_codegen_ssa::common::TypeKind;
 use type_of::LayoutLlvmExt;
 use abi::{LlvmType, FnTypeExt};
 
@@ -364,15 +364,15 @@ fn type_padding_filler(
     }
 
     fn type_needs_drop(&self, ty: Ty<'tcx>) -> bool {
-        rustc_codegen_utils::common::type_needs_drop(self.tcx(), ty)
+        rustc_codegen_ssa::common::type_needs_drop(self.tcx(), ty)
     }
 
     fn type_is_sized(&self, ty: Ty<'tcx>) -> bool {
-        rustc_codegen_utils::common::type_is_sized(self.tcx(), ty)
+        rustc_codegen_ssa::common::type_is_sized(self.tcx(), ty)
     }
 
     fn type_is_freeze(&self, ty: Ty<'tcx>) -> bool {
-        rustc_codegen_utils::common::type_is_freeze(self.tcx(), ty)
+        rustc_codegen_ssa::common::type_is_freeze(self.tcx(), ty)
     }
 
     fn type_has_metadata(&self, ty: Ty<'tcx>) -> bool {
diff --git a/src/librustc_codegen_ssa/Cargo.toml b/src/librustc_codegen_ssa/Cargo.toml
new file mode 100644 (file)
index 0000000..ae187c5
--- /dev/null
@@ -0,0 +1,11 @@
+[package]
+authors = ["The Rust Project Developers"]
+name = "rustc_codegen_ssa"
+version = "0.0.0"
+
+[lib]
+name = "rustc_codegen_ssa"
+path = "lib.rs"
+test = false
+
+[dependencies]
diff --git a/src/librustc_codegen_ssa/common.rs b/src/librustc_codegen_ssa/common.rs
new file mode 100644 (file)
index 0000000..3f43899
--- /dev/null
@@ -0,0 +1,137 @@
+// Copyright 2018 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+#![allow(non_camel_case_types, non_snake_case)]
+
+use rustc::ty::{self, Ty, TyCtxt};
+use syntax_pos::DUMMY_SP;
+
+
+pub fn type_needs_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
+    ty.needs_drop(tcx, ty::ParamEnv::reveal_all())
+}
+
+pub fn type_is_sized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
+    ty.is_sized(tcx.at(DUMMY_SP), ty::ParamEnv::reveal_all())
+}
+
+pub fn type_is_freeze<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
+    ty.is_freeze(tcx, ty::ParamEnv::reveal_all(), DUMMY_SP)
+}
+
+pub enum IntPredicate {
+    IntEQ,
+    IntNE,
+    IntUGT,
+    IntUGE,
+    IntULT,
+    IntULE,
+    IntSGT,
+    IntSGE,
+    IntSLT,
+    IntSLE
+}
+
+
+#[allow(dead_code)]
+pub enum RealPredicate {
+    RealPredicateFalse,
+    RealOEQ,
+    RealOGT,
+    RealOGE,
+    RealOLT,
+    RealOLE,
+    RealONE,
+    RealORD,
+    RealUNO,
+    RealUEQ,
+    RealUGT,
+    RealUGE,
+    RealULT,
+    RealULE,
+    RealUNE,
+    RealPredicateTrue
+}
+
+pub enum AtomicRmwBinOp {
+    AtomicXchg,
+    AtomicAdd,
+    AtomicSub,
+    AtomicAnd,
+    AtomicNand,
+    AtomicOr,
+    AtomicXor,
+    AtomicMax,
+    AtomicMin,
+    AtomicUMax,
+    AtomicUMin
+}
+
+pub enum AtomicOrdering {
+    #[allow(dead_code)]
+    NotAtomic,
+    Unordered,
+    Monotonic,
+    // Consume,  // Not specified yet.
+    Acquire,
+    Release,
+    AcquireRelease,
+    SequentiallyConsistent,
+}
+
+pub enum SynchronizationScope {
+    // FIXME: figure out if this variant is needed at all.
+    #[allow(dead_code)]
+    Other,
+    SingleThread,
+    CrossThread,
+}
+
+#[derive(Copy, Clone, PartialEq, Debug)]
+pub enum TypeKind {
+    Void,
+    Half,
+    Float,
+    Double,
+    X86_FP80,
+    FP128,
+    PPC_FP128,
+    Label,
+    Integer,
+    Function,
+    Struct,
+    Array,
+    Pointer,
+    Vector,
+    Metadata,
+    X86_MMX,
+    Token,
+}
+
+// FIXME(mw): Anything that is produced via DepGraph::with_task() must implement
+//            the HashStable trait. Normally DepGraph::with_task() calls are
+//            hidden behind queries, but CGU creation is a special case in two
+//            ways: (1) it's not a query and (2) CGU are output nodes, so their
+//            Fingerprints are not actually needed. It remains to be clarified
+//            how exactly this case will be handled in the red/green system but
+//            for now we content ourselves with providing a no-op HashStable
+//            implementation for CGUs.
+mod temp_stable_hash_impls {
+    use rustc_data_structures::stable_hasher::{StableHasherResult, StableHasher,
+                                               HashStable};
+    use ModuleCodegen;
+
+    impl<HCX, M> HashStable<HCX> for ModuleCodegen<M> {
+        fn hash_stable<W: StableHasherResult>(&self,
+                                              _: &mut HCX,
+                                              _: &mut StableHasher<W>) {
+            // do nothing
+        }
+    }
+}
diff --git a/src/librustc_codegen_ssa/interfaces/backend.rs b/src/librustc_codegen_ssa/interfaces/backend.rs
new file mode 100644 (file)
index 0000000..3cdb1c6
--- /dev/null
@@ -0,0 +1,80 @@
+// Copyright 2018 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use rustc::ty::layout::{HasTyCtxt, LayoutOf, TyLayout};
+use rustc::ty::Ty;
+
+use super::CodegenObject;
+use rustc::middle::allocator::AllocatorKind;
+use rustc::middle::cstore::EncodedMetadata;
+use rustc::mir::mono::Stats;
+use rustc::session::Session;
+use rustc::ty::TyCtxt;
+use rustc::util::time_graph::TimeGraph;
+use std::any::Any;
+use std::sync::mpsc::Receiver;
+use syntax_pos::symbol::InternedString;
+use ModuleCodegen;
+
+pub trait BackendTypes {
+    type Value: CodegenObject;
+    type BasicBlock: Copy;
+    type Type: CodegenObject;
+    type Context;
+    type Funclet;
+
+    type DIScope: Copy;
+}
+
+pub trait Backend<'tcx>:
+    BackendTypes + HasTyCtxt<'tcx> + LayoutOf<Ty = Ty<'tcx>, TyLayout = TyLayout<'tcx>>
+{
+}
+
+impl<'tcx, T> Backend<'tcx> for T where
+    Self: BackendTypes + HasTyCtxt<'tcx> + LayoutOf<Ty = Ty<'tcx>, TyLayout = TyLayout<'tcx>>
+{}
+
+pub trait BackendMethods {
+    type Module;
+    type OngoingCodegen;
+
+    fn new_metadata(&self, sess: &Session, mod_name: &str) -> Self::Module;
+    fn write_metadata<'b, 'gcx>(
+        &self,
+        tcx: TyCtxt<'b, 'gcx, 'gcx>,
+        metadata: &Self::Module,
+    ) -> EncodedMetadata;
+    fn codegen_allocator(&self, tcx: TyCtxt, mods: &Self::Module, kind: AllocatorKind);
+
+    fn start_async_codegen(
+        &self,
+        tcx: TyCtxt,
+        time_graph: Option<TimeGraph>,
+        metadata: EncodedMetadata,
+        coordinator_receive: Receiver<Box<dyn Any + Send>>,
+        total_cgus: usize,
+    ) -> Self::OngoingCodegen;
+    fn submit_pre_codegened_module_to_llvm(
+        &self,
+        codegen: &Self::OngoingCodegen,
+        tcx: TyCtxt,
+        module: ModuleCodegen<Self::Module>,
+    );
+    fn codegen_aborted(codegen: Self::OngoingCodegen);
+    fn codegen_finished(&self, codegen: &Self::OngoingCodegen, tcx: TyCtxt);
+    fn check_for_errors(&self, codegen: &Self::OngoingCodegen, sess: &Session);
+    fn wait_for_signal_to_codegen_item(&self, codegen: &Self::OngoingCodegen);
+    fn compile_codegen_unit<'a, 'tcx: 'a>(
+        &self,
+        tcx: TyCtxt<'a, 'tcx, 'tcx>,
+        cgu_name: InternedString,
+    ) -> Stats;
+}
diff --git a/src/librustc_codegen_ssa/interfaces/mod.rs b/src/librustc_codegen_ssa/interfaces/mod.rs
new file mode 100644 (file)
index 0000000..f958dba
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2018 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod backend;
+
+pub use self::backend::{Backend, BackendMethods, BackendTypes};
+
+use std::fmt;
+
+pub trait CodegenObject: Copy + PartialEq + fmt::Debug {}
+impl<T: Copy + PartialEq + fmt::Debug> CodegenObject for T {}
diff --git a/src/librustc_codegen_ssa/lib.rs b/src/librustc_codegen_ssa/lib.rs
new file mode 100644 (file)
index 0000000..e8e6222
--- /dev/null
@@ -0,0 +1,113 @@
+// Copyright 2017 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! # Note
+//!
+//! This API is completely unstable and subject to change.
+
+#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+      html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
+      html_root_url = "https://doc.rust-lang.org/nightly/")]
+
+#![feature(box_patterns)]
+#![feature(box_syntax)]
+#![feature(custom_attribute)]
+#![feature(nll)]
+#![allow(unused_attributes)]
+#![allow(dead_code)]
+#![feature(quote)]
+#![feature(rustc_diagnostic_macros)]
+
+#![recursion_limit="256"]
+
+extern crate rustc;
+extern crate rustc_target;
+extern crate rustc_mir;
+extern crate syntax;
+extern crate syntax_pos;
+extern crate rustc_data_structures;
+
+use std::path::PathBuf;
+use rustc::dep_graph::WorkProduct;
+use rustc::session::config::{OutputFilenames, OutputType};
+
+pub mod common;
+pub mod interfaces;
+
+pub struct ModuleCodegen<M> {
+    /// The name of the module. When the crate may be saved between
+    /// compilations, incremental compilation requires that name be
+    /// unique amongst **all** crates.  Therefore, it should contain
+    /// something unique to this crate (e.g., a module path) as well
+    /// as the crate name and disambiguator.
+    /// We currently generate these names via CodegenUnit::build_cgu_name().
+    pub name: String,
+    pub module_llvm: M,
+    pub kind: ModuleKind,
+}
+
+pub const RLIB_BYTECODE_EXTENSION: &str = "bc.z";
+
+impl<M> ModuleCodegen<M> {
+    pub fn into_compiled_module(self,
+                            emit_obj: bool,
+                            emit_bc: bool,
+                            emit_bc_compressed: bool,
+                            outputs: &OutputFilenames) -> CompiledModule {
+        let object = if emit_obj {
+            Some(outputs.temp_path(OutputType::Object, Some(&self.name)))
+        } else {
+            None
+        };
+        let bytecode = if emit_bc {
+            Some(outputs.temp_path(OutputType::Bitcode, Some(&self.name)))
+        } else {
+            None
+        };
+        let bytecode_compressed = if emit_bc_compressed {
+            Some(outputs.temp_path(OutputType::Bitcode, Some(&self.name))
+                    .with_extension(RLIB_BYTECODE_EXTENSION))
+        } else {
+            None
+        };
+
+        CompiledModule {
+            name: self.name.clone(),
+            kind: self.kind,
+            object,
+            bytecode,
+            bytecode_compressed,
+        }
+    }
+}
+
+#[derive(Debug)]
+pub struct CompiledModule {
+    pub name: String,
+    pub kind: ModuleKind,
+    pub object: Option<PathBuf>,
+    pub bytecode: Option<PathBuf>,
+    pub bytecode_compressed: Option<PathBuf>,
+}
+
+pub struct CachedModuleCodegen {
+    pub name: String,
+    pub source: WorkProduct,
+}
+
+#[derive(Copy, Clone, Debug, PartialEq)]
+pub enum ModuleKind {
+    Regular,
+    Metadata,
+    Allocator,
+}
+
+
+__build_diagnostic_array! { librustc_codegen_ssa, DIAGNOSTICS }
diff --git a/src/librustc_codegen_utils/common.rs b/src/librustc_codegen_utils/common.rs
deleted file mode 100644 (file)
index 3f43899..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright 2018 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 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-#![allow(non_camel_case_types, non_snake_case)]
-
-use rustc::ty::{self, Ty, TyCtxt};
-use syntax_pos::DUMMY_SP;
-
-
-pub fn type_needs_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
-    ty.needs_drop(tcx, ty::ParamEnv::reveal_all())
-}
-
-pub fn type_is_sized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
-    ty.is_sized(tcx.at(DUMMY_SP), ty::ParamEnv::reveal_all())
-}
-
-pub fn type_is_freeze<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
-    ty.is_freeze(tcx, ty::ParamEnv::reveal_all(), DUMMY_SP)
-}
-
-pub enum IntPredicate {
-    IntEQ,
-    IntNE,
-    IntUGT,
-    IntUGE,
-    IntULT,
-    IntULE,
-    IntSGT,
-    IntSGE,
-    IntSLT,
-    IntSLE
-}
-
-
-#[allow(dead_code)]
-pub enum RealPredicate {
-    RealPredicateFalse,
-    RealOEQ,
-    RealOGT,
-    RealOGE,
-    RealOLT,
-    RealOLE,
-    RealONE,
-    RealORD,
-    RealUNO,
-    RealUEQ,
-    RealUGT,
-    RealUGE,
-    RealULT,
-    RealULE,
-    RealUNE,
-    RealPredicateTrue
-}
-
-pub enum AtomicRmwBinOp {
-    AtomicXchg,
-    AtomicAdd,
-    AtomicSub,
-    AtomicAnd,
-    AtomicNand,
-    AtomicOr,
-    AtomicXor,
-    AtomicMax,
-    AtomicMin,
-    AtomicUMax,
-    AtomicUMin
-}
-
-pub enum AtomicOrdering {
-    #[allow(dead_code)]
-    NotAtomic,
-    Unordered,
-    Monotonic,
-    // Consume,  // Not specified yet.
-    Acquire,
-    Release,
-    AcquireRelease,
-    SequentiallyConsistent,
-}
-
-pub enum SynchronizationScope {
-    // FIXME: figure out if this variant is needed at all.
-    #[allow(dead_code)]
-    Other,
-    SingleThread,
-    CrossThread,
-}
-
-#[derive(Copy, Clone, PartialEq, Debug)]
-pub enum TypeKind {
-    Void,
-    Half,
-    Float,
-    Double,
-    X86_FP80,
-    FP128,
-    PPC_FP128,
-    Label,
-    Integer,
-    Function,
-    Struct,
-    Array,
-    Pointer,
-    Vector,
-    Metadata,
-    X86_MMX,
-    Token,
-}
-
-// FIXME(mw): Anything that is produced via DepGraph::with_task() must implement
-//            the HashStable trait. Normally DepGraph::with_task() calls are
-//            hidden behind queries, but CGU creation is a special case in two
-//            ways: (1) it's not a query and (2) CGU are output nodes, so their
-//            Fingerprints are not actually needed. It remains to be clarified
-//            how exactly this case will be handled in the red/green system but
-//            for now we content ourselves with providing a no-op HashStable
-//            implementation for CGUs.
-mod temp_stable_hash_impls {
-    use rustc_data_structures::stable_hasher::{StableHasherResult, StableHasher,
-                                               HashStable};
-    use ModuleCodegen;
-
-    impl<HCX, M> HashStable<HCX> for ModuleCodegen<M> {
-        fn hash_stable<W: StableHasherResult>(&self,
-                                              _: &mut HCX,
-                                              _: &mut StableHasher<W>) {
-            // do nothing
-        }
-    }
-}
diff --git a/src/librustc_codegen_utils/interfaces/backend.rs b/src/librustc_codegen_utils/interfaces/backend.rs
deleted file mode 100644 (file)
index 3cdb1c6..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2018 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 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use rustc::ty::layout::{HasTyCtxt, LayoutOf, TyLayout};
-use rustc::ty::Ty;
-
-use super::CodegenObject;
-use rustc::middle::allocator::AllocatorKind;
-use rustc::middle::cstore::EncodedMetadata;
-use rustc::mir::mono::Stats;
-use rustc::session::Session;
-use rustc::ty::TyCtxt;
-use rustc::util::time_graph::TimeGraph;
-use std::any::Any;
-use std::sync::mpsc::Receiver;
-use syntax_pos::symbol::InternedString;
-use ModuleCodegen;
-
-pub trait BackendTypes {
-    type Value: CodegenObject;
-    type BasicBlock: Copy;
-    type Type: CodegenObject;
-    type Context;
-    type Funclet;
-
-    type DIScope: Copy;
-}
-
-pub trait Backend<'tcx>:
-    BackendTypes + HasTyCtxt<'tcx> + LayoutOf<Ty = Ty<'tcx>, TyLayout = TyLayout<'tcx>>
-{
-}
-
-impl<'tcx, T> Backend<'tcx> for T where
-    Self: BackendTypes + HasTyCtxt<'tcx> + LayoutOf<Ty = Ty<'tcx>, TyLayout = TyLayout<'tcx>>
-{}
-
-pub trait BackendMethods {
-    type Module;
-    type OngoingCodegen;
-
-    fn new_metadata(&self, sess: &Session, mod_name: &str) -> Self::Module;
-    fn write_metadata<'b, 'gcx>(
-        &self,
-        tcx: TyCtxt<'b, 'gcx, 'gcx>,
-        metadata: &Self::Module,
-    ) -> EncodedMetadata;
-    fn codegen_allocator(&self, tcx: TyCtxt, mods: &Self::Module, kind: AllocatorKind);
-
-    fn start_async_codegen(
-        &self,
-        tcx: TyCtxt,
-        time_graph: Option<TimeGraph>,
-        metadata: EncodedMetadata,
-        coordinator_receive: Receiver<Box<dyn Any + Send>>,
-        total_cgus: usize,
-    ) -> Self::OngoingCodegen;
-    fn submit_pre_codegened_module_to_llvm(
-        &self,
-        codegen: &Self::OngoingCodegen,
-        tcx: TyCtxt,
-        module: ModuleCodegen<Self::Module>,
-    );
-    fn codegen_aborted(codegen: Self::OngoingCodegen);
-    fn codegen_finished(&self, codegen: &Self::OngoingCodegen, tcx: TyCtxt);
-    fn check_for_errors(&self, codegen: &Self::OngoingCodegen, sess: &Session);
-    fn wait_for_signal_to_codegen_item(&self, codegen: &Self::OngoingCodegen);
-    fn compile_codegen_unit<'a, 'tcx: 'a>(
-        &self,
-        tcx: TyCtxt<'a, 'tcx, 'tcx>,
-        cgu_name: InternedString,
-    ) -> Stats;
-}
diff --git a/src/librustc_codegen_utils/interfaces/mod.rs b/src/librustc_codegen_utils/interfaces/mod.rs
deleted file mode 100644 (file)
index f958dba..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2018 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 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod backend;
-
-pub use self::backend::{Backend, BackendMethods, BackendTypes};
-
-use std::fmt;
-
-pub trait CodegenObject: Copy + PartialEq + fmt::Debug {}
-impl<T: Copy + PartialEq + fmt::Debug> CodegenObject for T {}
index 4fb182e4f05402e1aae56228fc814a37de76508c..8d85c6691c2709b3c334be860a532c4f0237e9e6 100644 (file)
 
 use rustc::session::Session;
 use rustc::ty::TyCtxt;
-use rustc::dep_graph::WorkProduct;
-use rustc::session::config::{OutputFilenames, OutputType};
 
 pub mod command;
-pub mod interfaces;
 pub mod link;
 pub mod linker;
 pub mod codegen_backend;
 pub mod symbol_export;
 pub mod symbol_names;
 pub mod symbol_names_test;
-pub mod common;
-
-pub struct ModuleCodegen<M> {
-    /// The name of the module. When the crate may be saved between
-    /// compilations, incremental compilation requires that name be
-    /// unique amongst **all** crates.  Therefore, it should contain
-    /// something unique to this crate (e.g., a module path) as well
-    /// as the crate name and disambiguator.
-    /// We currently generate these names via CodegenUnit::build_cgu_name().
-    pub name: String,
-    pub module_llvm: M,
-    pub kind: ModuleKind,
-}
-
-pub const RLIB_BYTECODE_EXTENSION: &str = "bc.z";
-
-impl<M> ModuleCodegen<M> {
-    pub fn into_compiled_module(self,
-                            emit_obj: bool,
-                            emit_bc: bool,
-                            emit_bc_compressed: bool,
-                            outputs: &OutputFilenames) -> CompiledModule {
-        let object = if emit_obj {
-            Some(outputs.temp_path(OutputType::Object, Some(&self.name)))
-        } else {
-            None
-        };
-        let bytecode = if emit_bc {
-            Some(outputs.temp_path(OutputType::Bitcode, Some(&self.name)))
-        } else {
-            None
-        };
-        let bytecode_compressed = if emit_bc_compressed {
-            Some(outputs.temp_path(OutputType::Bitcode, Some(&self.name))
-                    .with_extension(RLIB_BYTECODE_EXTENSION))
-        } else {
-            None
-        };
-
-        CompiledModule {
-            name: self.name.clone(),
-            kind: self.kind,
-            object,
-            bytecode,
-            bytecode_compressed,
-        }
-    }
-}
-
-#[derive(Debug)]
-pub struct CompiledModule {
-    pub name: String,
-    pub kind: ModuleKind,
-    pub object: Option<PathBuf>,
-    pub bytecode: Option<PathBuf>,
-    pub bytecode_compressed: Option<PathBuf>,
-}
-
-pub struct CachedModuleCodegen {
-    pub name: String,
-    pub source: WorkProduct,
-}
-
-#[derive(Copy, Clone, Debug, PartialEq)]
-pub enum ModuleKind {
-    Regular,
-    Metadata,
-    Allocator,
-}
 
 /// check for the #[rustc_error] annotation, which forces an
 /// error in codegen. This is used to write compile-fail tests