New Backend trait containing associated types
This commit is contained in:
parent
d577ec7e5f
commit
3889c2dcfb
4 changed files with 26 additions and 9 deletions
|
@ -18,7 +18,7 @@ use rustc::ty::TyCtxt;
|
|||
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 @@ bitflags! {
|
|||
}
|
||||
}
|
||||
|
||||
impl BuilderMethods<'a, 'll, 'tcx> for Builder<'a, 'll, 'tcx> {
|
||||
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,
|
||||
|
|
15
src/librustc_codegen_llvm/interfaces/backend.rs
Normal file
15
src/librustc_codegen_llvm/interfaces/backend.rs
Normal file
|
@ -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 <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.
|
||||
|
||||
pub trait Backend {
|
||||
type Value;
|
||||
type BasicBlock;
|
||||
type Type;
|
||||
}
|
|
@ -14,6 +14,7 @@ use rustc::ty::TyCtxt;
|
|||
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 @@ use syntax::ast::AsmDialect;
|
|||
|
||||
|
||||
|
||||
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>,
|
||||
|
|
|
@ -9,5 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
mod builder;
|
||||
mod backend;
|
||||
|
||||
pub use self::builder::BuilderMethods;
|
||||
pub use self::backend::Backend;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue