]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_codegen_llvm/abi.rs
some more refactor of FnType. Things build now
[rust.git] / src / librustc_codegen_llvm / abi.rs
index 7a7008822372d5ae3e30b8eff1f3999059752e01..00e17ff990d95f3f9230c8f45f277afc8f330a9f 100644 (file)
@@ -2,17 +2,11 @@
 use crate::builder::Builder;
 use crate::context::CodegenCx;
 use crate::type_::Type;
-use crate::type_of::{LayoutLlvmExt, PointerKind};
 use crate::value::Value;
+use crate::type_of::{LayoutLlvmExt};
 use rustc_codegen_ssa::MemFlags;
 use rustc_codegen_ssa::mir::place::PlaceRef;
 use rustc_codegen_ssa::mir::operand::OperandValue;
-<<<<<<< HEAD
-=======
-use type_::Type;
-use type_of::{LayoutLlvmExt};
-use value::Value;
->>>>>>> Remove old pointee_info_at body.
 use rustc_target::abi::call::ArgType;
 
 use rustc_codegen_ssa::traits::*;
@@ -328,13 +322,13 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
     fn of_instance(cx: &CodegenCx<'ll, 'tcx>, instance: &ty::Instance<'tcx>) -> Self {
         let sig = instance.fn_sig(cx.tcx);
         let sig = cx.tcx.normalize_erasing_late_bound_regions(ty::ParamEnv::reveal_all(), &sig);
-        FnType::new(cx, sig, &[])
+        FnTypeExt::new(cx, sig, &[])
     }
 
     fn new(cx: &CodegenCx<'ll, 'tcx>,
            sig: ty::FnSig<'tcx>,
            extra_args: &[Ty<'tcx>]) -> Self {
-        FnType::new_internal(cx, sig, extra_args, |ty, _| {
+        FnTypeExt::new_internal(cx, sig, extra_args, |ty, _| {
             ArgType::new(cx.layout_of(ty))
         })
     }
@@ -342,7 +336,7 @@ fn new(cx: &CodegenCx<'ll, 'tcx>,
     fn new_vtable(cx: &CodegenCx<'ll, 'tcx>,
                   sig: ty::FnSig<'tcx>,
                   extra_args: &[Ty<'tcx>]) -> Self {
-        FnType::new_internal(cx, sig, extra_args, |ty, arg_idx| {
+        FnTypeExt::new_internal(cx, sig, extra_args, |ty, arg_idx| {
             let mut layout = cx.layout_of(ty);
             // Don't pass the vtable, it's not an argument of the virtual fn.
             // Instead, pass just the data pointer, but give it the type `*const/mut dyn Trait`
@@ -599,7 +593,7 @@ fn new_internal(
             c_variadic: sig.c_variadic,
             conv,
         };
-        fn_ty.adjust_for_abi(cx, sig.abi);
+        FnTypeExt::adjust_for_abi(&mut fn_ty, cx, sig.abi);
         fn_ty
     }
 
@@ -844,17 +838,17 @@ fn apply_attrs_callsite(&self, bx: &mut Builder<'a, 'll, 'tcx>, callsite: &'ll V
 
 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)
+        FnTypeExt::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)
+        FnTypeExt::new_vtable(&self, sig, extra_args)
     }
     fn fn_type_of_instance(&self, instance: &Instance<'tcx>) -> FnType<'tcx, Ty<'tcx>> {
-        FnType::of_instance(&self, instance)
+        FnTypeExt::of_instance(&self, instance)
     }
 }