From 860448f070d56885317bbe1d9ae81871008a9143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinbrink?= Date: Mon, 25 May 2015 12:58:19 +0200 Subject: [PATCH] Fix interchanged names of to_arg_ty and from_arg_ty --- src/librustc_trans/trans/base.rs | 10 +++++----- src/librustc_trans/trans/intrinsic.rs | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs index 9310d1e202ab3..c26fa77a10f93 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/trans/base.rs @@ -785,7 +785,7 @@ pub fn load_ty<'blk, 'tcx>(cx: Block<'blk, 'tcx>, if !global.is_null() && llvm::LLVMIsGlobalConstant(global) == llvm::True { let val = llvm::LLVMGetInitializer(global); if !val.is_null() { - return from_arg_ty(cx, val, t); + return to_arg_ty(cx, val, t); } } } @@ -807,7 +807,7 @@ pub fn load_ty<'blk, 'tcx>(cx: Block<'blk, 'tcx>, llvm::LLVMSetAlignment(val, align); } - from_arg_ty(cx, val, t) + to_arg_ty(cx, val, t) } /// Helper for storing values in memory. Does the necessary conversion if the in-memory type @@ -817,13 +817,13 @@ pub fn store_ty<'blk, 'tcx>(cx: Block<'blk, 'tcx>, v: ValueRef, dst: ValueRef, t return; } - let store = Store(cx, to_arg_ty(cx, v, t), to_arg_ty_ptr(cx, dst, t)); + let store = Store(cx, from_arg_ty(cx, v, t), to_arg_ty_ptr(cx, dst, t)); unsafe { llvm::LLVMSetAlignment(store, type_of::align_of(cx.ccx(), t)); } } -pub fn to_arg_ty(bcx: Block, val: ValueRef, ty: Ty) -> ValueRef { +pub fn from_arg_ty(bcx: Block, val: ValueRef, ty: Ty) -> ValueRef { if ty::type_is_bool(ty) { ZExt(bcx, val, Type::i8(bcx.ccx())) } else { @@ -831,7 +831,7 @@ pub fn to_arg_ty(bcx: Block, val: ValueRef, ty: Ty) -> ValueRef { } } -pub fn from_arg_ty(bcx: Block, val: ValueRef, ty: Ty) -> ValueRef { +pub fn to_arg_ty(bcx: Block, val: ValueRef, ty: Ty) -> ValueRef { if ty::type_is_bool(ty) { Trunc(bcx, val, Type::i1(bcx.ccx())) } else { diff --git a/src/librustc_trans/trans/intrinsic.rs b/src/librustc_trans/trans/intrinsic.rs index 4608918ec59bd..18c7390933b6f 100644 --- a/src/librustc_trans/trans/intrinsic.rs +++ b/src/librustc_trans/trans/intrinsic.rs @@ -490,12 +490,12 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, unsafe { llvm::LLVMSetAlignment(load, type_of::align_of(ccx, tp_ty)); } - from_arg_ty(bcx, load, tp_ty) + to_arg_ty(bcx, load, tp_ty) }, (_, "volatile_store") => { let tp_ty = *substs.types.get(FnSpace, 0); let ptr = to_arg_ty_ptr(bcx, llargs[0], tp_ty); - let val = to_arg_ty(bcx, llargs[1], tp_ty); + let val = from_arg_ty(bcx, llargs[1], tp_ty); let store = VolatileStore(bcx, val, ptr); unsafe { llvm::LLVMSetAlignment(store, type_of::align_of(ccx, tp_ty)); @@ -777,8 +777,8 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, let tp_ty = *substs.types.get(FnSpace, 0); let ptr = to_arg_ty_ptr(bcx, llargs[0], tp_ty); - let cmp = to_arg_ty(bcx, llargs[1], tp_ty); - let src = to_arg_ty(bcx, llargs[2], tp_ty); + let cmp = from_arg_ty(bcx, llargs[1], tp_ty); + let src = from_arg_ty(bcx, llargs[2], tp_ty); let res = AtomicCmpXchg(bcx, ptr, cmp, src, order, strongest_failure_ordering); ExtractValue(bcx, res, 0) @@ -787,12 +787,12 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, "load" => { let tp_ty = *substs.types.get(FnSpace, 0); let ptr = to_arg_ty_ptr(bcx, llargs[0], tp_ty); - from_arg_ty(bcx, AtomicLoad(bcx, ptr, order), tp_ty) + to_arg_ty(bcx, AtomicLoad(bcx, ptr, order), tp_ty) } "store" => { let tp_ty = *substs.types.get(FnSpace, 0); let ptr = to_arg_ty_ptr(bcx, llargs[0], tp_ty); - let val = to_arg_ty(bcx, llargs[1], tp_ty); + let val = from_arg_ty(bcx, llargs[1], tp_ty); AtomicStore(bcx, val, ptr, order); C_nil(ccx) } @@ -826,7 +826,7 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, let tp_ty = *substs.types.get(FnSpace, 0); let ptr = to_arg_ty_ptr(bcx, llargs[0], tp_ty); - let val = to_arg_ty(bcx, llargs[1], tp_ty); + let val = from_arg_ty(bcx, llargs[1], tp_ty); AtomicRMW(bcx, atom_op, ptr, val, order) } }