Skip to content

Commit 5dd07b6

Browse files
committed
Auto merge of #38756 - Mark-Simulacrum:2nd-trans-cleanup, r=eddyb
Additional cleanup to rustc_trans Removes `BlockAndBuilder`, `FunctionContext`, and `MaybeSizedValue`. `LvalueRef` is used instead of `MaybeSizedValue`, which has the added benefit of making functions operating on `Lvalue`s be able to take just that (since it encodes the type with an `LvalueTy`, which can carry discriminant information) instead of a `MaybeSizedValue` and a discriminant. r? @eddyb
2 parents 80745e2 + b01b6e1 commit 5dd07b6

24 files changed

+787
-949
lines changed

Diff for: src/librustc_trans/abi.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
use llvm::{self, ValueRef, Integer, Pointer, Float, Double, Struct, Array, Vector, AttributePlace};
1212
use base;
13-
use common::{type_is_fat_ptr, BlockAndBuilder, C_uint};
13+
use builder::Builder;
14+
use common::{type_is_fat_ptr, C_uint};
1415
use context::CrateContext;
1516
use cabi_x86;
1617
use cabi_x86_64;
@@ -236,7 +237,7 @@ impl ArgType {
236237
/// lvalue for the original Rust type of this argument/return.
237238
/// Can be used for both storing formal arguments into Rust variables
238239
/// or results of call/invoke instructions into their destinations.
239-
pub fn store(&self, bcx: &BlockAndBuilder, mut val: ValueRef, dst: ValueRef) {
240+
pub fn store(&self, bcx: &Builder, mut val: ValueRef, dst: ValueRef) {
240241
if self.is_ignore() {
241242
return;
242243
}
@@ -269,7 +270,7 @@ impl ArgType {
269270
// bitcasting to the struct type yields invalid cast errors.
270271

271272
// We instead thus allocate some scratch space...
272-
let llscratch = bcx.fcx().alloca(ty, "abi_cast");
273+
let llscratch = bcx.alloca(ty, "abi_cast");
273274
base::Lifetime::Start.call(bcx, llscratch);
274275

275276
// ...where we first store the value...
@@ -293,14 +294,14 @@ impl ArgType {
293294
}
294295
}
295296

296-
pub fn store_fn_arg(&self, bcx: &BlockAndBuilder, idx: &mut usize, dst: ValueRef) {
297+
pub fn store_fn_arg(&self, bcx: &Builder, idx: &mut usize, dst: ValueRef) {
297298
if self.pad.is_some() {
298299
*idx += 1;
299300
}
300301
if self.is_ignore() {
301302
return;
302303
}
303-
let val = llvm::get_param(bcx.fcx().llfn, *idx as c_uint);
304+
let val = llvm::get_param(bcx.llfn(), *idx as c_uint);
304305
*idx += 1;
305306
self.store(bcx, val, dst);
306307
}

0 commit comments

Comments
 (0)