Skip to content

Commit 2b688a9

Browse files
committed
Don't use c_uint in cg_ssa
1 parent 2002b4b commit 2b688a9

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

src/librustc_codegen_llvm/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ impl MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> {
326326
get_fn(self, instance)
327327
}
328328

329-
fn get_param(&self, llfn: &'ll Value, index: c_uint) -> &'ll Value {
330-
llvm::get_param(llfn, index)
329+
fn get_param(&self, llfn: &'ll Value, index: usize) -> &'ll Value {
330+
llvm::get_param(llfn, index as c_uint)
331331
}
332332

333333
fn eh_personality(&self) -> &'ll Value {

src/librustc_codegen_ssa/mir/mod.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use libc::c_uint;
21
use rustc::ty::{self, Ty, TypeFoldable, UpvarSubsts};
32
use rustc::ty::layout::{TyLayout, HasTyCtxt};
43
use rustc::mir::{self, Mir};
@@ -534,18 +533,18 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
534533
}
535534
PassMode::Ignore(IgnoreMode::CVarArgs) => {}
536535
PassMode::Direct(_) => {
537-
let llarg = bx.get_param(bx.llfn(), llarg_idx as c_uint);
536+
let llarg = bx.get_param(bx.llfn(), llarg_idx);
538537
bx.set_value_name(llarg, &name);
539538
llarg_idx += 1;
540539
return local(
541540
OperandRef::from_immediate_or_packed_pair(bx, llarg, arg.layout));
542541
}
543542
PassMode::Pair(..) => {
544-
let a = bx.get_param(bx.llfn(), llarg_idx as c_uint);
543+
let a = bx.get_param(bx.llfn(), llarg_idx);
545544
bx.set_value_name(a, &(name.clone() + ".0"));
546545
llarg_idx += 1;
547546

548-
let b = bx.get_param(bx.llfn(), llarg_idx as c_uint);
547+
let b = bx.get_param(bx.llfn(), llarg_idx);
549548
bx.set_value_name(b, &(name + ".1"));
550549
llarg_idx += 1;
551550

@@ -562,16 +561,16 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
562561
// Don't copy an indirect argument to an alloca, the caller
563562
// already put it in a temporary alloca and gave it up.
564563
// FIXME: lifetimes
565-
let llarg = bx.get_param(bx.llfn(), llarg_idx as c_uint);
564+
let llarg = bx.get_param(bx.llfn(), llarg_idx);
566565
bx.set_value_name(llarg, &name);
567566
llarg_idx += 1;
568567
PlaceRef::new_sized(llarg, arg.layout, arg.layout.align.abi)
569568
} else if arg.is_unsized_indirect() {
570569
// As the storage for the indirect argument lives during
571570
// the whole function call, we just copy the fat pointer.
572-
let llarg = bx.get_param(bx.llfn(), llarg_idx as c_uint);
571+
let llarg = bx.get_param(bx.llfn(), llarg_idx);
573572
llarg_idx += 1;
574-
let llextra = bx.get_param(bx.llfn(), llarg_idx as c_uint);
573+
let llextra = bx.get_param(bx.llfn(), llarg_idx);
575574
llarg_idx += 1;
576575
let indirect_operand = OperandValue::Pair(llarg, llextra);
577576

src/librustc_codegen_ssa/traits/misc.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use super::BackendTypes;
2-
use libc::c_uint;
32
use rustc::mir::mono::Stats;
43
use rustc::session::Session;
54
use rustc::ty::{self, Instance, Ty};
@@ -15,7 +14,7 @@ pub trait MiscMethods<'tcx>: BackendTypes {
1514
fn check_overflow(&self) -> bool;
1615
fn instances(&self) -> &RefCell<FxHashMap<Instance<'tcx>, Self::Value>>;
1716
fn get_fn(&self, instance: Instance<'tcx>) -> Self::Value;
18-
fn get_param(&self, llfn: Self::Value, index: c_uint) -> Self::Value;
17+
fn get_param(&self, llfn: Self::Value, index: usize) -> Self::Value;
1918
fn eh_personality(&self) -> Self::Value;
2019
fn eh_unwind_resume(&self) -> Self::Value;
2120
fn sess(&self) -> &Session;

0 commit comments

Comments
 (0)