removes AbiMethods
This commit is contained in:
parent
e1b3c79d5c
commit
44eb607d76
8 changed files with 29 additions and 39 deletions
|
@ -12,8 +12,8 @@ use rustc_target::abi::call::ArgType;
|
|||
use rustc_codegen_ssa::traits::*;
|
||||
|
||||
use rustc_target::abi::{HasDataLayout, LayoutOf};
|
||||
use rustc::ty::{self, Ty, Instance};
|
||||
use rustc::ty::layout::{self, FnTypeExt};
|
||||
use rustc::ty::{Ty};
|
||||
use rustc::ty::layout::{self};
|
||||
|
||||
use libc::c_uint;
|
||||
|
||||
|
@ -471,22 +471,6 @@ impl<'tcx> FnTypeLlvmExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
|
|||
}
|
||||
}
|
||||
|
||||
impl AbiMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
||||
fn new_fn_type(&self, sig: ty::FnSig<'tcx>, extra_args: &[Ty<'tcx>]) -> FnType<'tcx, Ty<'tcx>> {
|
||||
FnType::new(self, sig, extra_args)
|
||||
}
|
||||
fn new_vtable(
|
||||
&self,
|
||||
sig: ty::FnSig<'tcx>,
|
||||
extra_args: &[Ty<'tcx>]
|
||||
) -> FnType<'tcx, Ty<'tcx>> {
|
||||
FnType::new_vtable(self, sig, extra_args)
|
||||
}
|
||||
fn fn_type_of_instance(&self, instance: &Instance<'tcx>) -> FnType<'tcx, Ty<'tcx>> {
|
||||
FnType::of_instance(self, instance)
|
||||
}
|
||||
}
|
||||
|
||||
impl AbiBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
|
||||
fn apply_attrs_callsite(
|
||||
&mut self,
|
||||
|
|
|
@ -18,6 +18,7 @@ use rustc_codegen_ssa::traits::*;
|
|||
use rustc_codegen_ssa::base::to_immediate;
|
||||
use rustc_codegen_ssa::mir::operand::{OperandValue, OperandRef};
|
||||
use rustc_codegen_ssa::mir::place::PlaceRef;
|
||||
use rustc_target::spec::{HasTargetSpec, Target};
|
||||
use std::borrow::Cow;
|
||||
use std::ops::{Deref, Range};
|
||||
use std::ptr;
|
||||
|
@ -72,6 +73,12 @@ impl ty::layout::HasParamEnv<'tcx> for Builder<'_, '_, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl HasTargetSpec for Builder<'_, '_, 'tcx> {
|
||||
fn target_spec(&self) -> &Target {
|
||||
&self.cx.target_spec()
|
||||
}
|
||||
}
|
||||
|
||||
impl ty::layout::LayoutOf for Builder<'_, '_, 'tcx> {
|
||||
type Ty = Ty<'tcx>;
|
||||
type TyLayout = TyLayout<'tcx>;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use rustc::middle::lang_items;
|
||||
use rustc::ty::{self, Ty, TypeFoldable};
|
||||
use rustc::ty::layout::{self, LayoutOf, HasTyCtxt};
|
||||
use rustc::ty::layout::{self, LayoutOf, HasTyCtxt, FnTypeExt};
|
||||
use rustc::mir::{self, Place, PlaceBase, Static, StaticKind};
|
||||
use rustc::mir::interpret::InterpError;
|
||||
use rustc_target::abi::call::{ArgType, FnType, PassMode, IgnoreMode};
|
||||
|
@ -334,14 +334,14 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
ty::ParamEnv::reveal_all(),
|
||||
&sig,
|
||||
);
|
||||
let fn_ty = bx.new_vtable(sig, &[]);
|
||||
let fn_ty = FnType::new_vtable(&bx, sig, &[]);
|
||||
let vtable = args[1];
|
||||
args = &args[..1];
|
||||
(meth::DESTRUCTOR.get_fn(&mut bx, vtable, &fn_ty), fn_ty)
|
||||
}
|
||||
_ => {
|
||||
(bx.get_fn(drop_fn),
|
||||
bx.fn_type_of_instance(&drop_fn))
|
||||
FnType::of_instance(&bx, &drop_fn))
|
||||
}
|
||||
};
|
||||
helper.do_call(self, &mut bx, fn_ty, drop_fn, args,
|
||||
|
@ -439,7 +439,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
// Obtain the panic entry point.
|
||||
let def_id = common::langcall(bx.tcx(), Some(span), "", lang_item);
|
||||
let instance = ty::Instance::mono(bx.tcx(), def_id);
|
||||
let fn_ty = bx.fn_type_of_instance(&instance);
|
||||
let fn_ty = FnType::of_instance(&bx, &instance);
|
||||
let llfn = bx.get_fn(instance);
|
||||
|
||||
// Codegen the actual panic invoke/call.
|
||||
|
@ -518,7 +518,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
|
||||
let fn_ty = match def {
|
||||
Some(ty::InstanceDef::Virtual(..)) => {
|
||||
bx.new_vtable(sig, &extra_args)
|
||||
FnType::new_vtable(&bx, sig, &extra_args)
|
||||
}
|
||||
Some(ty::InstanceDef::DropGlue(_, None)) => {
|
||||
// Empty drop glue; a no-op.
|
||||
|
@ -526,7 +526,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
helper.funclet_br(self, &mut bx, target);
|
||||
return;
|
||||
}
|
||||
_ => bx.new_fn_type(sig, &extra_args)
|
||||
_ => FnType::new(&bx, sig, &extra_args)
|
||||
};
|
||||
|
||||
// Emit a panic or a no-op for `panic_if_uninhabited`.
|
||||
|
@ -556,7 +556,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
let def_id =
|
||||
common::langcall(bx.tcx(), Some(span), "", lang_items::PanicFnLangItem);
|
||||
let instance = ty::Instance::mono(bx.tcx(), def_id);
|
||||
let fn_ty = bx.fn_type_of_instance(&instance);
|
||||
let fn_ty = FnType::of_instance(&bx, &instance);
|
||||
let llfn = bx.get_fn(instance);
|
||||
|
||||
// Codegen the actual panic invoke/call.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use rustc::ty::{self, Ty, TypeFoldable, UpvarSubsts};
|
||||
use rustc::ty::layout::{TyLayout, HasTyCtxt};
|
||||
use rustc::ty::layout::{TyLayout, HasTyCtxt, FnTypeExt};
|
||||
use rustc::mir::{self, Mir};
|
||||
use rustc::session::config::DebugInfo;
|
||||
use rustc_mir::monomorphize::Instance;
|
||||
|
@ -202,7 +202,7 @@ pub fn codegen_mir<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
|
|||
) {
|
||||
assert!(!instance.substs.needs_infer());
|
||||
|
||||
let fn_ty = cx.new_fn_type(sig, &[]);
|
||||
let fn_ty = FnType::new(cx, sig, &[]);
|
||||
debug!("fn_ty: {:?}", fn_ty);
|
||||
let mut debug_context =
|
||||
cx.create_function_debug_context(instance, sig, llfn, mir);
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
use super::BackendTypes;
|
||||
use rustc::ty::{FnSig, Instance, Ty};
|
||||
use rustc::ty::{Ty};
|
||||
use rustc_target::abi::call::FnType;
|
||||
|
||||
pub trait AbiMethods<'tcx> {
|
||||
fn new_fn_type(&self, sig: FnSig<'tcx>, extra_args: &[Ty<'tcx>]) -> FnType<'tcx, Ty<'tcx>>;
|
||||
fn new_vtable(&self, sig: FnSig<'tcx>, extra_args: &[Ty<'tcx>]) -> FnType<'tcx, Ty<'tcx>>;
|
||||
fn fn_type_of_instance(&self, instance: &Instance<'tcx>) -> FnType<'tcx, Ty<'tcx>>;
|
||||
}
|
||||
|
||||
pub trait AbiBuilderMethods<'tcx>: BackendTypes {
|
||||
fn apply_attrs_callsite(&mut self, ty: &FnType<'tcx, Ty<'tcx>>, callsite: Self::Value);
|
||||
fn get_param(&self, index: usize) -> Self::Value;
|
||||
|
|
|
@ -11,6 +11,7 @@ use crate::mir::place::PlaceRef;
|
|||
use crate::MemFlags;
|
||||
use rustc::ty::Ty;
|
||||
use rustc::ty::layout::{Align, Size, HasParamEnv};
|
||||
use rustc_target::spec::{HasTargetSpec};
|
||||
use std::ops::Range;
|
||||
use std::iter::TrustedLen;
|
||||
|
||||
|
@ -30,6 +31,7 @@ pub trait BuilderMethods<'a, 'tcx: 'a>:
|
|||
+ AsmBuilderMethods<'tcx>
|
||||
+ StaticBuilderMethods<'tcx>
|
||||
+ HasParamEnv<'tcx>
|
||||
+ HasTargetSpec
|
||||
|
||||
{
|
||||
fn new_block<'b>(cx: &'a Self::CodegenCx, llfn: Self::Value, name: &'b str) -> Self;
|
||||
|
|
|
@ -27,7 +27,7 @@ mod statics;
|
|||
mod type_;
|
||||
mod write;
|
||||
|
||||
pub use self::abi::{AbiBuilderMethods, AbiMethods};
|
||||
pub use self::abi::{AbiBuilderMethods};
|
||||
pub use self::asm::{AsmBuilderMethods, AsmMethods};
|
||||
pub use self::backend::{Backend, BackendTypes, ExtraBackendMethods};
|
||||
pub use self::builder::{BuilderMethods, OverflowOp};
|
||||
|
@ -41,7 +41,8 @@ pub use self::type_::{
|
|||
ArgTypeMethods, BaseTypeMethods, DerivedTypeMethods, LayoutTypeMethods, TypeMethods,
|
||||
};
|
||||
pub use self::write::{ModuleBufferMethods, ThinBufferMethods, WriteBackendMethods};
|
||||
use rustc::ty::layout::{HasParamEnv};
|
||||
use rustc::ty::layout::{HasParamEnv, HasTyCtxt};
|
||||
use rustc_target::spec::{HasTargetSpec};
|
||||
|
||||
|
||||
use std::fmt;
|
||||
|
@ -56,11 +57,12 @@ pub trait CodegenMethods<'tcx>:
|
|||
+ ConstMethods<'tcx>
|
||||
+ StaticMethods
|
||||
+ DebugInfoMethods<'tcx>
|
||||
+ AbiMethods<'tcx>
|
||||
+ DeclareMethods<'tcx>
|
||||
+ AsmMethods<'tcx>
|
||||
+ PreDefineMethods<'tcx>
|
||||
+ HasParamEnv<'tcx>
|
||||
+ HasTyCtxt<'tcx>
|
||||
+ HasTargetSpec
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -71,11 +73,12 @@ impl<'tcx, T> CodegenMethods<'tcx> for T where
|
|||
+ ConstMethods<'tcx>
|
||||
+ StaticMethods
|
||||
+ DebugInfoMethods<'tcx>
|
||||
+ AbiMethods<'tcx>
|
||||
+ DeclareMethods<'tcx>
|
||||
+ AsmMethods<'tcx>
|
||||
+ PreDefineMethods<'tcx>
|
||||
+ HasParamEnv<'tcx>
|
||||
+ HasTyCtxt<'tcx>
|
||||
+ HasTargetSpec
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue