Don't use c_uint in cg_ssa

This commit is contained in:
bjorn3 2018-12-02 12:54:54 +01:00
parent 2002b4b39a
commit 2b688a959d
3 changed files with 9 additions and 11 deletions

View File

@ -326,8 +326,8 @@ impl MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> {
get_fn(self, instance)
}
fn get_param(&self, llfn: &'ll Value, index: c_uint) -> &'ll Value {
llvm::get_param(llfn, index)
fn get_param(&self, llfn: &'ll Value, index: usize) -> &'ll Value {
llvm::get_param(llfn, index as c_uint)
}
fn eh_personality(&self) -> &'ll Value {

View File

@ -1,4 +1,3 @@
use libc::c_uint;
use rustc::ty::{self, Ty, TypeFoldable, UpvarSubsts};
use rustc::ty::layout::{TyLayout, HasTyCtxt};
use rustc::mir::{self, Mir};
@ -534,18 +533,18 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
}
PassMode::Ignore(IgnoreMode::CVarArgs) => {}
PassMode::Direct(_) => {
let llarg = bx.get_param(bx.llfn(), llarg_idx as c_uint);
let llarg = bx.get_param(bx.llfn(), llarg_idx);
bx.set_value_name(llarg, &name);
llarg_idx += 1;
return local(
OperandRef::from_immediate_or_packed_pair(bx, llarg, arg.layout));
}
PassMode::Pair(..) => {
let a = bx.get_param(bx.llfn(), llarg_idx as c_uint);
let a = bx.get_param(bx.llfn(), llarg_idx);
bx.set_value_name(a, &(name.clone() + ".0"));
llarg_idx += 1;
let b = bx.get_param(bx.llfn(), llarg_idx as c_uint);
let b = bx.get_param(bx.llfn(), llarg_idx);
bx.set_value_name(b, &(name + ".1"));
llarg_idx += 1;
@ -562,16 +561,16 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
// Don't copy an indirect argument to an alloca, the caller
// already put it in a temporary alloca and gave it up.
// FIXME: lifetimes
let llarg = bx.get_param(bx.llfn(), llarg_idx as c_uint);
let llarg = bx.get_param(bx.llfn(), llarg_idx);
bx.set_value_name(llarg, &name);
llarg_idx += 1;
PlaceRef::new_sized(llarg, arg.layout, arg.layout.align.abi)
} else if arg.is_unsized_indirect() {
// As the storage for the indirect argument lives during
// the whole function call, we just copy the fat pointer.
let llarg = bx.get_param(bx.llfn(), llarg_idx as c_uint);
let llarg = bx.get_param(bx.llfn(), llarg_idx);
llarg_idx += 1;
let llextra = bx.get_param(bx.llfn(), llarg_idx as c_uint);
let llextra = bx.get_param(bx.llfn(), llarg_idx);
llarg_idx += 1;
let indirect_operand = OperandValue::Pair(llarg, llextra);

View File

@ -1,5 +1,4 @@
use super::BackendTypes;
use libc::c_uint;
use rustc::mir::mono::Stats;
use rustc::session::Session;
use rustc::ty::{self, Instance, Ty};
@ -15,7 +14,7 @@ pub trait MiscMethods<'tcx>: BackendTypes {
fn check_overflow(&self) -> bool;
fn instances(&self) -> &RefCell<FxHashMap<Instance<'tcx>, Self::Value>>;
fn get_fn(&self, instance: Instance<'tcx>) -> Self::Value;
fn get_param(&self, llfn: Self::Value, index: c_uint) -> Self::Value;
fn get_param(&self, llfn: Self::Value, index: usize) -> Self::Value;
fn eh_personality(&self) -> Self::Value;
fn eh_unwind_resume(&self) -> Self::Value;
fn sess(&self) -> &Session;