提交 3889c2dc 编写于 作者: D Denis Merigoux 提交者: Eduard-Mihai Burtescu

New Backend trait containing associated types

上级 d577ec7e
......@@ -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,
......
// 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::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>,
......
......@@ -9,5 +9,7 @@
// except according to those terms.
mod builder;
mod backend;
pub use self::builder::BuilderMethods;
pub use self::backend::Backend;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册