Skip to content

Commit c324b4e

Browse files
committed
Don't use c_uint in cg_ssa
1 parent 7b4f8f9 commit c324b4e

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};
@@ -540,18 +539,18 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
540539
});
541540
}
542541
PassMode::Direct(_) => {
543-
let llarg = bx.get_param(bx.llfn(), llarg_idx as c_uint);
542+
let llarg = bx.get_param(bx.llfn(), llarg_idx);
544543
bx.set_value_name(llarg, &name);
545544
llarg_idx += 1;
546545
return local(
547546
OperandRef::from_immediate_or_packed_pair(bx, llarg, arg.layout));
548547
}
549548
PassMode::Pair(..) => {
550-
let a = bx.get_param(bx.llfn(), llarg_idx as c_uint);
549+
let a = bx.get_param(bx.llfn(), llarg_idx);
551550
bx.set_value_name(a, &(name.clone() + ".0"));
552551
llarg_idx += 1;
553552

554-
let b = bx.get_param(bx.llfn(), llarg_idx as c_uint);
553+
let b = bx.get_param(bx.llfn(), llarg_idx);
555554
bx.set_value_name(b, &(name + ".1"));
556555
llarg_idx += 1;
557556

@@ -568,16 +567,16 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
568567
// Don't copy an indirect argument to an alloca, the caller
569568
// already put it in a temporary alloca and gave it up.
570569
// FIXME: lifetimes
571-
let llarg = bx.get_param(bx.llfn(), llarg_idx as c_uint);
570+
let llarg = bx.get_param(bx.llfn(), llarg_idx);
572571
bx.set_value_name(llarg, &name);
573572
llarg_idx += 1;
574573
PlaceRef::new_sized(llarg, arg.layout, arg.layout.align.abi)
575574
} else if arg.is_unsized_indirect() {
576575
// As the storage for the indirect argument lives during
577576
// the whole function call, we just copy the fat pointer.
578-
let llarg = bx.get_param(bx.llfn(), llarg_idx as c_uint);
577+
let llarg = bx.get_param(bx.llfn(), llarg_idx);
579578
llarg_idx += 1;
580-
let llextra = bx.get_param(bx.llfn(), llarg_idx as c_uint);
579+
let llextra = bx.get_param(bx.llfn(), llarg_idx);
581580
llarg_idx += 1;
582581
let indirect_operand = OperandValue::Pair(llarg, llextra);
583582

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)