Skip to content

Commit b3b56d8

Browse files
committed
Remove unnecessary cx argument.
Because `bx` contains a `cx`.
1 parent 52c5de0 commit b3b56d8

File tree

1 file changed

+8
-11
lines changed
  • compiler/rustc_codegen_ssa/src

1 file changed

+8
-11
lines changed

compiler/rustc_codegen_ssa/src/base.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
425425

426426
let isize_ty = cx.type_isize();
427427
let ptr_ty = cx.type_ptr();
428-
let (arg_argc, arg_argv) = get_argc_argv(cx, &mut bx);
428+
let (arg_argc, arg_argv) = get_argc_argv(&mut bx);
429429

430430
let (start_fn, start_ty, args, instance) = if let EntryFnType::Main { sigpipe } = entry_type
431431
{
@@ -468,33 +468,30 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
468468
}
469469

470470
/// Obtain the `argc` and `argv` values to pass to the rust start function.
471-
fn get_argc_argv<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
472-
cx: &'a Bx::CodegenCx,
473-
bx: &mut Bx,
474-
) -> (Bx::Value, Bx::Value) {
475-
if cx.sess().target.os.contains("uefi") {
471+
fn get_argc_argv<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(bx: &mut Bx) -> (Bx::Value, Bx::Value) {
472+
if bx.cx().sess().target.os.contains("uefi") {
476473
// Params for UEFI
477474
let param_handle = bx.get_param(0);
478475
let param_system_table = bx.get_param(1);
479476
let ptr_size = bx.tcx().data_layout.pointer_size;
480477
let ptr_align = bx.tcx().data_layout.pointer_align.abi;
481-
let arg_argc = bx.const_int(cx.type_isize(), 2);
478+
let arg_argc = bx.const_int(bx.cx().type_isize(), 2);
482479
let arg_argv = bx.alloca(2 * ptr_size, ptr_align);
483480
bx.store(param_handle, arg_argv, ptr_align);
484481
let arg_argv_el1 = bx.inbounds_ptradd(arg_argv, bx.const_usize(ptr_size.bytes()));
485482
bx.store(param_system_table, arg_argv_el1, ptr_align);
486483
(arg_argc, arg_argv)
487-
} else if cx.sess().target.main_needs_argc_argv {
484+
} else if bx.cx().sess().target.main_needs_argc_argv {
488485
// Params from native `main()` used as args for rust start function
489486
let param_argc = bx.get_param(0);
490487
let param_argv = bx.get_param(1);
491-
let arg_argc = bx.intcast(param_argc, cx.type_isize(), true);
488+
let arg_argc = bx.intcast(param_argc, bx.cx().type_isize(), true);
492489
let arg_argv = param_argv;
493490
(arg_argc, arg_argv)
494491
} else {
495492
// The Rust start function doesn't need `argc` and `argv`, so just pass zeros.
496-
let arg_argc = bx.const_int(cx.type_int(), 0);
497-
let arg_argv = bx.const_null(cx.type_ptr());
493+
let arg_argc = bx.const_int(bx.cx().type_int(), 0);
494+
let arg_argv = bx.const_null(bx.cx().type_ptr());
498495
(arg_argc, arg_argv)
499496
}
500497
}

0 commit comments

Comments
 (0)