Skip to content

Commit

Permalink
Use BackendTypes instead of Backend or HasCodegen in a few places
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Nov 29, 2018
1 parent 66c3195 commit 187c4cf
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/librustc_codegen_ssa/traits/abi.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use super::HasCodegen;
use super::BackendTypes;
use rustc::ty::{FnSig, Instance, Ty};
use rustc_target::abi::call::FnType;

Expand All @@ -18,6 +18,6 @@ pub trait AbiMethods<'tcx> {
fn fn_type_of_instance(&self, instance: &Instance<'tcx>) -> FnType<'tcx, Ty<'tcx>>;
}

pub trait AbiBuilderMethods<'tcx>: HasCodegen<'tcx> {
pub trait AbiBuilderMethods<'tcx>: BackendTypes {
fn apply_attrs_callsite(&mut self, ty: &FnType<'tcx, Ty<'tcx>>, callsite: Self::Value);
}
9 changes: 4 additions & 5 deletions src/librustc_codegen_ssa/traits/asm.rs
Expand Up @@ -8,13 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use super::Backend;
use super::HasCodegen;
use super::BackendTypes;
use mir::place::PlaceRef;
use rustc::hir::{GlobalAsm, InlineAsm};

pub trait AsmBuilderMethods<'tcx>: HasCodegen<'tcx> {
// Take an inline assembly expression and splat it out via LLVM
pub trait AsmBuilderMethods<'tcx>: BackendTypes {
/// Take an inline assembly expression and splat it out via LLVM
fn codegen_inline_asm(
&mut self,
ia: &InlineAsm,
Expand All @@ -23,6 +22,6 @@ pub trait AsmBuilderMethods<'tcx>: HasCodegen<'tcx> {
) -> bool;
}

pub trait AsmMethods<'tcx>: Backend<'tcx> {
pub trait AsmMethods<'tcx> {
fn codegen_global_asm(&self, ga: &GlobalAsm);
}
7 changes: 3 additions & 4 deletions src/librustc_codegen_ssa/traits/debuginfo.rs
Expand Up @@ -8,8 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use super::Backend;
use super::HasCodegen;
use super::BackendTypes;
use debuginfo::{FunctionDebugContext, MirDebugScope, VariableAccess, VariableKind};
use rustc::hir::def_id::CrateNum;
use rustc::mir;
Expand All @@ -19,7 +18,7 @@ use rustc_mir::monomorphize::Instance;
use syntax::ast::Name;
use syntax_pos::{SourceFile, Span};

pub trait DebugInfoMethods<'tcx>: Backend<'tcx> {
pub trait DebugInfoMethods<'tcx>: BackendTypes {
fn create_vtable_metadata(&self, ty: Ty<'tcx>, vtable: Self::Value);

/// Creates the function-specific debug context.
Expand Down Expand Up @@ -51,7 +50,7 @@ pub trait DebugInfoMethods<'tcx>: Backend<'tcx> {
fn debuginfo_upvar_decls_ops_sequence(&self, byte_offset_of_var_in_env: u64) -> [i64; 4];
}

pub trait DebugInfoBuilderMethods<'tcx>: HasCodegen<'tcx> {
pub trait DebugInfoBuilderMethods<'tcx>: BackendTypes {
fn declare_local(
&mut self,
dbg_context: &FunctionDebugContext<Self::DIScope>,
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_codegen_ssa/traits/declare.rs
Expand Up @@ -8,13 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use super::Backend;
use super::BackendTypes;
use rustc::hir::def_id::DefId;
use rustc::mir::mono::{Linkage, Visibility};
use rustc::ty;
use rustc_mir::monomorphize::Instance;

pub trait DeclareMethods<'tcx>: Backend<'tcx> {
pub trait DeclareMethods<'tcx>: BackendTypes {
/// Declare a global value.
///
/// If there’s a value with the same name already declared, the function will
Expand Down Expand Up @@ -71,7 +71,7 @@ pub trait DeclareMethods<'tcx>: Backend<'tcx> {
fn get_defined_value(&self, name: &str) -> Option<Self::Value>;
}

pub trait PreDefineMethods<'tcx>: Backend<'tcx> {
pub trait PreDefineMethods<'tcx>: BackendTypes {
fn predefine_static(
&self,
def_id: DefId,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_ssa/traits/intrinsic.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use super::HasCodegen;
use super::BackendTypes;
use mir::operand::OperandRef;
use rustc::ty::Ty;
use rustc_target::abi::call::FnType;
Expand All @@ -21,7 +21,7 @@ pub enum OverflowOp {
Mul,
}

pub trait IntrinsicCallMethods<'tcx>: HasCodegen<'tcx> {
pub trait IntrinsicCallMethods<'tcx>: BackendTypes {
/// Remember to add all intrinsics here, in librustc_typeck/check/mod.rs,
/// and in libcore/intrinsics.rs; if you need access to any llvm intrinsics,
/// add them to librustc_codegen_llvm/context.rs
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_ssa/traits/misc.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use super::Backend;
use super::BackendTypes;
use libc::c_uint;
use rustc::mir::mono::Stats;
use rustc::session::Session;
Expand All @@ -18,7 +18,7 @@ use rustc_mir::monomorphize::partitioning::CodegenUnit;
use std::cell::RefCell;
use std::sync::Arc;

pub trait MiscMethods<'tcx>: Backend<'tcx> {
pub trait MiscMethods<'tcx>: BackendTypes {
fn vtables(
&self,
) -> &RefCell<FxHashMap<(Ty<'tcx>, ty::PolyExistentialTraitRef<'tcx>), Self::Value>>;
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_codegen_ssa/traits/type_.rs
Expand Up @@ -20,6 +20,8 @@ use rustc_target::abi::call::{ArgType, CastTarget, FnType, Reg};
use std::cell::RefCell;
use syntax::ast;

// This depends on `Backend` and not `BackendTypes`, because consumers will probably want to use
// `LayoutOf` or `HasTyCtxt`. This way, they don't have to add a constraint on it themselves.
pub trait BaseTypeMethods<'tcx>: Backend<'tcx> {
fn type_void(&self) -> Self::Type;
fn type_metadata(&self) -> Self::Type;
Expand Down

0 comments on commit 187c4cf

Please sign in to comment.