Skip to content

Commit b02e5cc

Browse files
denismerigouxeddyb
authored andcommitted
Moved Backend interface into rustc_codegen_utils
1 parent b06836e commit b02e5cc

File tree

17 files changed

+129
-113
lines changed

17 files changed

+129
-113
lines changed

src/librustc_codegen_llvm/back/lto.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ use rustc::util::common::time_ext;
2424
use rustc_data_structures::fx::FxHashMap;
2525
use rustc_codegen_utils::symbol_export;
2626
use time_graph::Timeline;
27-
use {ModuleCodegen, ModuleLlvm, ModuleKind};
27+
use ModuleLlvm;
28+
use rustc_codegen_utils::{ModuleCodegen, ModuleKind};
2829

2930
use libc;
3031

src/librustc_codegen_llvm/back/write.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ use rustc::util::nodemap::FxHashMap;
2626
use time_graph::{self, TimeGraph, Timeline};
2727
use llvm::{self, DiagnosticInfo, PassManager, SMDiagnostic};
2828
use llvm_util;
29-
use {CodegenResults, ModuleCodegen, CompiledModule, ModuleKind, ModuleLlvm,
30-
CachedModuleCodegen};
29+
use {CodegenResults, ModuleLlvm};
30+
use rustc_codegen_utils::{ModuleCodegen, ModuleKind, CachedModuleCodegen, CompiledModule};
3131
use CrateInfo;
3232
use rustc::hir::def_id::{CrateNum, LOCAL_CRATE};
3333
use rustc::ty::TyCtxt;

src/librustc_codegen_llvm/base.rs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
//! int) and rec(x=int, y=int, z=int) will have the same llvm::Type.
2525
2626
use super::ModuleLlvm;
27-
use super::ModuleCodegen;
28-
use super::ModuleKind;
29-
use super::CachedModuleCodegen;
27+
use rustc_codegen_utils::{ModuleCodegen, ModuleKind, CachedModuleCodegen};
3028
use super::LlvmCodegenBackend;
3129

3230
use abi;
@@ -1197,25 +1195,3 @@ pub fn visibility_to_llvm(linkage: Visibility) -> llvm::Visibility {
11971195
Visibility::Protected => llvm::Visibility::Protected,
11981196
}
11991197
}
1200-
1201-
// FIXME(mw): Anything that is produced via DepGraph::with_task() must implement
1202-
// the HashStable trait. Normally DepGraph::with_task() calls are
1203-
// hidden behind queries, but CGU creation is a special case in two
1204-
// ways: (1) it's not a query and (2) CGU are output nodes, so their
1205-
// Fingerprints are not actually needed. It remains to be clarified
1206-
// how exactly this case will be handled in the red/green system but
1207-
// for now we content ourselves with providing a no-op HashStable
1208-
// implementation for CGUs.
1209-
mod temp_stable_hash_impls {
1210-
use rustc_data_structures::stable_hasher::{StableHasherResult, StableHasher,
1211-
HashStable};
1212-
use {ModuleCodegen, ModuleLlvm};
1213-
1214-
impl<HCX> HashStable<HCX> for ModuleCodegen<ModuleLlvm> {
1215-
fn hash_stable<W: StableHasherResult>(&self,
1216-
_: &mut HCX,
1217-
_: &mut StableHasher<W>) {
1218-
// do nothing
1219-
}
1220-
}
1221-
}

src/librustc_codegen_llvm/interfaces/asm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use super::backend::Backend;
11+
use super::Backend;
1212
use super::HasCodegen;
1313
use mir::place::PlaceRef;
1414
use rustc::hir::{GlobalAsm, InlineAsm};

src/librustc_codegen_llvm/interfaces/builder.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ pub trait BuilderMethods<'a, 'tcx: 'a>:
213213
fn set_cleanup(&self, landing_pad: Self::Value);
214214
fn resume(&self, exn: Self::Value) -> Self::Value;
215215
fn cleanup_pad(&self, parent: Option<Self::Value>, args: &[Self::Value]) -> Self::Funclet;
216-
fn cleanup_ret(&self, funclet: &Self::Funclet, unwind: Option<Self::BasicBlock>) -> Self::Value;
216+
fn cleanup_ret(&self, funclet: &Self::Funclet, unwind: Option<Self::BasicBlock>)
217+
-> Self::Value;
217218
fn catch_pad(&self, parent: Self::Value, args: &[Self::Value]) -> Self::Funclet;
218219
fn catch_ret(&self, funclet: &Self::Funclet, unwind: Self::BasicBlock) -> Self::Value;
219220
fn catch_switch(

src/librustc_codegen_llvm/interfaces/debuginfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use super::backend::Backend;
11+
use super::Backend;
1212
use super::HasCodegen;
1313
use debuginfo::{FunctionDebugContext, MirDebugScope, VariableAccess, VariableKind};
1414
use monomorphize::Instance;

src/librustc_codegen_llvm/interfaces/declare.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use super::backend::Backend;
11+
use super::Backend;
1212
use monomorphize::Instance;
1313
use rustc::hir::def_id::DefId;
1414
use rustc::mir::mono::{Linkage, Visibility};

src/librustc_codegen_llvm/interfaces/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use super::backend::Backend;
11+
use super::Backend;
1212
use super::HasCodegen;
1313
use abi::FnType;
1414
use mir::operand::OperandRef;

src/librustc_codegen_llvm/interfaces/misc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use super::backend::Backend;
11+
use super::Backend;
1212
use libc::c_uint;
1313
use monomorphize::partitioning::CodegenUnit;
1414
use rustc::mir::mono::Stats;

src/librustc_codegen_llvm/interfaces/mod.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
mod abi;
1212
mod asm;
13-
mod backend;
1413
mod builder;
1514
mod consts;
1615
mod debuginfo;
@@ -22,7 +21,6 @@ mod type_;
2221

2322
pub use self::abi::{AbiBuilderMethods, AbiMethods};
2423
pub use self::asm::{AsmBuilderMethods, AsmMethods};
25-
pub use self::backend::{Backend, BackendMethods, BackendTypes};
2624
pub use self::builder::BuilderMethods;
2725
pub use self::consts::ConstMethods;
2826
pub use self::debuginfo::{DebugInfoBuilderMethods, DebugInfoMethods};
@@ -33,8 +31,7 @@ pub use self::statics::StaticMethods;
3331
pub use self::type_::{
3432
ArgTypeMethods, BaseTypeMethods, DerivedTypeMethods, LayoutTypeMethods, TypeMethods,
3533
};
36-
37-
use std::fmt;
34+
pub use rustc_codegen_utils::interfaces::{Backend, BackendMethods, BackendTypes, CodegenObject};
3835

3936
pub trait CodegenMethods<'tcx>:
4037
Backend<'tcx>
@@ -76,6 +73,3 @@ pub trait HasCodegen<'tcx>: Backend<'tcx> {
7673
DIScope = Self::DIScope,
7774
>;
7875
}
79-
80-
pub trait CodegenObject: Copy + PartialEq + fmt::Debug {}
81-
impl<T: Copy + PartialEq + fmt::Debug> CodegenObject for T {}

0 commit comments

Comments
 (0)