let fn_ty = FnType::new(ccx, abi, &sig, &[]);
- let fcx = FunctionContext::new(ccx, lldecl, fn_ty, Some((instance, &sig, abi)), true);
+ let fcx = FunctionContext::new(ccx, lldecl, fn_ty);
let mir = ccx.tcx().item_mir(instance.def);
mir::trans_mir(&fcx, &mir, instance, &sig, abi);
let sig = ccx.tcx().erase_late_bound_regions_and_normalize(&ctor_ty.fn_sig());
let fn_ty = FnType::new(ccx, Abi::Rust, &sig, &[]);
- let fcx = FunctionContext::new(ccx, llfndecl, fn_ty, None, false);
+ let fcx = FunctionContext::new(ccx, llfndecl, fn_ty);
let bcx = fcx.get_entry_block();
if !fcx.fn_ty.ret.is_ignore() {
// But if there are no nested returns, we skip the indirection
let lloncefn = declare::define_internal_fn(ccx, &function_name, llonce_fn_ty);
attributes::set_frame_pointer_elimination(ccx, lloncefn);
- let fcx = FunctionContext::new(ccx, lloncefn, fn_ty, None, false);
+ let fcx = FunctionContext::new(ccx, lloncefn, fn_ty);
let mut bcx = fcx.get_entry_block();
// the first argument (`self`) will be the (by value) closure env.
let llfn = declare::define_internal_fn(ccx, &function_name, tuple_fn_ty);
attributes::set_frame_pointer_elimination(ccx, llfn);
//
- let fcx = FunctionContext::new(ccx, llfn, fn_ty, None, false);
+ let fcx = FunctionContext::new(ccx, llfn, fn_ty);
let bcx = fcx.get_entry_block();
let llargs = get_params(fcx.llfn);
use session::Session;
use llvm;
use llvm::{ValueRef, BasicBlockRef, ContextRef, TypeKind};
-use llvm::{True, False, Bool, OperandBundleDef, get_param};
-use monomorphize::Instance;
+use llvm::{True, False, Bool, OperandBundleDef};
use rustc::hir::def::Def;
use rustc::hir::def_id::DefId;
use rustc::hir::map::DefPathData;
// section of the executable we're generating.
pub llfn: ValueRef,
- // A pointer to where to store the return value. If the return type is
- // immediate, this points to an alloca in the function. Otherwise, it's a
- // pointer to the hidden first parameter of the function. After function
- // construction, this should always be Some.
- pub llretslotptr: Option<ValueRef>,
-
// These pub elements: "hoisted basic blocks" containing
// administrative activities that have to happen in only one place in
// the function, due to LLVM's quirks.
ccx: &'a CrateContext<'a, 'tcx>,
llfndecl: ValueRef,
fn_ty: FnType,
- skip_retptr: bool,
) -> FunctionContext<'a, 'tcx> {
let mut fcx = FunctionContext {
llfn: llfndecl,
- llretslotptr: None,
alloca_insert_pt: None,
fn_ty: fn_ty,
ccx: ccx,
// This is later removed in the drop of FunctionContext.
fcx.alloca_insert_pt = Some(val);
- // We normally allocate the llretslotptr, unless we
- // have been instructed to skip it for immediate return
- // values, or there is nothing to return at all.
- if !fcx.fn_ty.ret.is_ignore() && !skip_retptr {
- // But if there are no nested returns, we skip the indirection
- // and have a single retslot
- let slot = if fcx.fn_ty.ret.is_indirect() {
- get_param(fcx.llfn, 0)
- } else {
- // We create an alloca to hold a pointer of type `ret.original_ty`
- // which will hold the pointer to the right alloca which has the
- // final ret value
- fcx.alloca(fcx.fn_ty.ret.memory_ty(ccx), "sret_slot")
- };
-
- fcx.llretslotptr = Some(slot);
- }
-
fcx
}
assert_eq!(g.ty(), get_drop_glue_type(ccx.shared(), g.ty()));
let (llfn, fn_ty) = ccx.drop_glues().borrow().get(&g).unwrap().clone();
- let fcx = FunctionContext::new(ccx, llfn, fn_ty, None, false);
+ let fcx = FunctionContext::new(ccx, llfn, fn_ty);
let bcx = fcx.get_entry_block();
ccx.stats().n_glues_created.set(ccx.stats().n_glues_created.get() + 1);
sig: ty::Binder(sig)
}));
let llfn = declare::define_internal_fn(ccx, name, rust_fn_ty);
- let fcx = FunctionContext::new(ccx, llfn, fn_ty, None, true);
+ let fcx = FunctionContext::new(ccx, llfn, fn_ty);
trans(fcx.get_entry_block());
llfn
}
let llfn = declare::define_internal_fn(ccx, &function_name, callee.ty);
attributes::set_frame_pointer_elimination(ccx, llfn);
- let fcx = FunctionContext::new(ccx, llfn, fn_ty, None, false);
+ let fcx = FunctionContext::new(ccx, llfn, fn_ty);
let bcx = fcx.get_entry_block();
let llargs = get_params(fcx.llfn);