fn memory_ty(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type;
fn store(
&self,
- bx: &Builder<'_, 'll, 'tcx>,
+ bx: &mut Builder<'_, 'll, 'tcx>,
val: &'ll Value,
dst: PlaceRef<'tcx, &'ll Value>,
);
fn store_fn_arg(
&self,
- bx: &Builder<'_, 'll, 'tcx>,
+ bx: &mut Builder<'_, 'll, 'tcx>,
idx: &mut usize,
dst: PlaceRef<'tcx, &'ll Value>,
);
/// or results of call/invoke instructions into their destinations.
fn store(
&self,
- bx: &Builder<'_, 'll, 'tcx>,
+ bx: &mut Builder<'_, 'll, 'tcx>,
val: &'ll Value,
dst: PlaceRef<'tcx, &'ll Value>,
) {
if self.is_ignore() {
return;
}
- let cx = bx.cx();
if self.is_sized_indirect() {
OperandValue::Ref(val, None, self.layout.align).store(bx, dst)
} else if self.is_unsized_indirect() {
// uses it for i16 -> {i8, i8}, but not for i24 -> {i8, i8, i8}.
let can_store_through_cast_ptr = false;
if can_store_through_cast_ptr {
- let cast_dst = bx.pointercast(dst.llval, cx.type_ptr_to(cast.llvm_type(cx)));
+ let cast_ptr_llty = bx.cx().type_ptr_to(cast.llvm_type(bx.cx()));
+ let cast_dst = bx.pointercast(dst.llval, cast_ptr_llty);
bx.store(val, cast_dst, self.layout.align);
} else {
// The actual return type is a struct, but the ABI
// bitcasting to the struct type yields invalid cast errors.
// We instead thus allocate some scratch space...
- let scratch_size = cast.size(cx);
- let scratch_align = cast.align(cx);
- let llscratch = bx.alloca(cast.llvm_type(cx), "abi_cast", scratch_align);
+ let scratch_size = cast.size(bx.cx());
+ let scratch_align = cast.align(bx.cx());
+ let llscratch = bx.alloca(cast.llvm_type(bx.cx()), "abi_cast", scratch_align);
bx.lifetime_start(llscratch, scratch_size);
// ...where we first store the value...
// ...and then memcpy it to the intended destination.
bx.memcpy(
- bx.pointercast(dst.llval, cx.type_i8p()),
+ dst.llval,
self.layout.align,
- bx.pointercast(llscratch, cx.type_i8p()),
+ llscratch,
scratch_align,
- cx.const_usize(self.layout.size.bytes()),
+ bx.cx().const_usize(self.layout.size.bytes()),
MemFlags::empty()
);
fn store_fn_arg(
&self,
- bx: &Builder<'a, 'll, 'tcx>,
+ bx: &mut Builder<'a, 'll, 'tcx>,
idx: &mut usize,
dst: PlaceRef<'tcx, &'ll Value>,
) {
impl ArgTypeMethods<'tcx> for Builder<'a, 'll, 'tcx> {
fn store_fn_arg(
- &self,
+ &mut self,
ty: &ArgType<'tcx, Ty<'tcx>>,
idx: &mut usize, dst: PlaceRef<'tcx, Self::Value>
) {
ty.store_fn_arg(self, idx, dst)
}
fn store_arg_ty(
- &self,
+ &mut self,
ty: &ArgType<'tcx, Ty<'tcx>>,
val: &'ll Value,
dst: PlaceRef<'tcx, &'ll Value>
fn ptr_to_llvm_type(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type;
fn llvm_cconv(&self) -> llvm::CallConv;
fn apply_attrs_llfn(&self, llfn: &'ll Value);
- fn apply_attrs_callsite(&self, bx: &Builder<'a, 'll, 'tcx>, callsite: &'ll Value);
+ fn apply_attrs_callsite(&self, bx: &mut Builder<'a, 'll, 'tcx>, callsite: &'ll Value);
}
impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
}
}
- fn apply_attrs_callsite(&self, bx: &Builder<'a, 'll, 'tcx>, callsite: &'ll Value) {
+ fn apply_attrs_callsite(&self, bx: &mut Builder<'a, 'll, 'tcx>, callsite: &'ll Value) {
let mut i = 0;
let mut apply = |attrs: &ArgAttributes| {
attrs.apply_callsite(llvm::AttributePlace::Argument(i), callsite);
impl AbiBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
fn apply_attrs_callsite(
- &self,
+ &mut self,
ty: &FnType<'tcx, Ty<'tcx>>,
callsite: Self::Value
) {