diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index 6decc18561444de7323793b134ef3e60e32049d1..289010713395ac34118e984b10aa49281521db55 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -18,7 +18,7 @@ use rustc::ty::layout::{Align, Size}; use rustc::session::{config, Session}; use rustc_data_structures::small_c_str::SmallCStr; -use interfaces::BuilderMethods; +use interfaces::{BuilderMethods, Backend}; use syntax; use std::borrow::Cow; @@ -55,11 +55,13 @@ pub struct MemFlags: u8 { } } -impl BuilderMethods<'a, 'll, 'tcx> for Builder<'a, 'll, 'tcx> { - type Value = &'ll Value; - type BasicBlock = &'ll BasicBlock; - type Type = &'ll type_::Type; +impl Backend for Builder<'a, 'll, 'tcx> { + type Value = &'ll Value; + type BasicBlock = &'ll BasicBlock; + type Type = &'ll type_::Type; +} +impl BuilderMethods<'a, 'll, 'tcx> for Builder<'a, 'll, 'tcx> { fn new_block<'b>( cx: &'a CodegenCx<'ll, 'tcx>, llfn: &'ll Value, diff --git a/src/librustc_codegen_llvm/interfaces/backend.rs b/src/librustc_codegen_llvm/interfaces/backend.rs new file mode 100644 index 0000000000000000000000000000000000000000..b2a6bf2dd8c0a5058f9293d290328e651011e858 --- /dev/null +++ b/src/librustc_codegen_llvm/interfaces/backend.rs @@ -0,0 +1,15 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub trait Backend { + type Value; + type BasicBlock; + type Type; +} diff --git a/src/librustc_codegen_llvm/interfaces/builder.rs b/src/librustc_codegen_llvm/interfaces/builder.rs index 994ddd65d3df88051aff7c0e61b3e907a72aaa0d..c43e41724eec9f15e1a012748bff86cd7abc1878 100644 --- a/src/librustc_codegen_llvm/interfaces/builder.rs +++ b/src/librustc_codegen_llvm/interfaces/builder.rs @@ -14,6 +14,7 @@ use rustc::ty::layout::{Align, Size}; use rustc::session::Session; use builder::MemFlags; +use super::backend::Backend; use std::borrow::Cow; use std::ops::Range; @@ -21,10 +22,7 @@ -pub trait BuilderMethods<'a, 'll :'a, 'tcx: 'll> { - type Value; - type BasicBlock; - type Type; +pub trait BuilderMethods<'a, 'll :'a, 'tcx: 'll> : Backend { fn new_block<'b>( cx: &'a CodegenCx<'ll, 'tcx, Self::Value>, diff --git a/src/librustc_codegen_llvm/interfaces/mod.rs b/src/librustc_codegen_llvm/interfaces/mod.rs index d0cd8e6a696ede82510ffd85596a0116891e1372..b9a356874ba969e5b0294a27b694c1f89e7d87c5 100644 --- a/src/librustc_codegen_llvm/interfaces/mod.rs +++ b/src/librustc_codegen_llvm/interfaces/mod.rs @@ -9,5 +9,7 @@ // except according to those terms. mod builder; +mod backend; pub use self::builder::BuilderMethods; +pub use self::backend::Backend;