@@ -6655,21 +6655,27 @@ fn decl_native_fn_and_pair(@crate_ctxt ccx,
6655
6655
fn push_arg( @block_ctxt cx,
6656
6656
& mutable vec[ ValueRef ] args,
6657
6657
ValueRef v,
6658
- ty. t t) {
6659
- if ( ty. type_is_integral( cx. fcx. lcx. ccx. tcx, t) ) {
6660
- auto lldsttype = T_int ( ) ;
6661
- auto llsrctype = type_of( cx. fcx. lcx. ccx, t) ;
6662
- if ( llvm. LLVMGetIntTypeWidth ( lldsttype) >
6663
- llvm. LLVMGetIntTypeWidth ( llsrctype) ) {
6664
- args += vec( cx. build. ZExtOrBitCast ( v, T_int ( ) ) ) ;
6665
- } else {
6666
- args += vec( cx. build. TruncOrBitCast ( v, T_int ( ) ) ) ;
6658
+ ty. t t,
6659
+ ast. mode mode) {
6660
+ if ( mode == ast. val) {
6661
+ if ( ty. type_is_integral( cx. fcx. lcx. ccx. tcx, t) ) {
6662
+ auto lldsttype = T_int ( ) ;
6663
+ auto llsrctype = type_of( cx. fcx. lcx. ccx, t) ;
6664
+ if ( llvm. LLVMGetIntTypeWidth ( lldsttype) >
6665
+ llvm. LLVMGetIntTypeWidth ( llsrctype) ) {
6666
+ args += vec( cx. build. ZExtOrBitCast ( v, T_int ( ) ) ) ;
6667
+ } else {
6668
+ args += vec( cx. build. TruncOrBitCast ( v, T_int ( ) ) ) ;
6669
+ }
6670
+ ret;
6671
+ }
6672
+ if ( ty. type_is_fp( cx. fcx. lcx. ccx. tcx, t) ) {
6673
+ args += vec( cx. build. FPToSI ( v, T_int ( ) ) ) ;
6674
+ ret;
6667
6675
}
6668
- } else if ( ty. type_is_fp( cx. fcx. lcx. ccx. tcx, t) ) {
6669
- args += vec( cx. build. FPToSI ( v, T_int ( ) ) ) ;
6670
- } else {
6671
- args += vec( vp2i( cx, v) ) ;
6672
6676
}
6677
+
6678
+ args += vec( vp2i( cx, v) ) ;
6673
6679
}
6674
6680
6675
6681
auto r;
@@ -6699,7 +6705,7 @@ fn decl_native_fn_and_pair(@crate_ctxt ccx,
6699
6705
for ( ty. arg arg in args ) {
6700
6706
auto llarg = llvm. LLVMGetParam ( fcx. llfn , arg_n) ;
6701
6707
check ( llarg as int != 0 ) ;
6702
- push_arg ( bcx, call_args, llarg, arg. ty ) ;
6708
+ push_arg ( bcx, call_args, llarg, arg. ty , arg . mode ) ;
6703
6709
if ( arg. mode == ast. val ) {
6704
6710
drop_args += vec ( tup ( llarg, arg. ty ) ) ;
6705
6711
}
0 commit comments