Skip to content

Commit 4aba9ee

Browse files
committed
---
yaml --- r: 2278 b: refs/heads/master c: f0d24ff h: refs/heads/master v: v3
1 parent 1ab00da commit 4aba9ee

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 5d3e5531412952c556fabb541536bcae34b0ce09
2+
refs/heads/master: f0d24ff49e1578bf28de3cad808c8d68437c44d4

trunk/src/comp/middle/trans.rs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6655,21 +6655,27 @@ fn decl_native_fn_and_pair(@crate_ctxt ccx,
66556655
fn push_arg(@block_ctxt cx,
66566656
&mutable vec[ValueRef] args,
66576657
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;
66676675
}
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));
66726676
}
6677+
6678+
args += vec(vp2i(cx, v));
66736679
}
66746680

66756681
auto r;
@@ -6699,7 +6705,7 @@ fn decl_native_fn_and_pair(@crate_ctxt ccx,
66996705
for (ty.arg arg in args) {
67006706
auto llarg = llvm.LLVMGetParam(fcx.llfn, arg_n);
67016707
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);
67036709
if (arg.mode == ast.val) {
67046710
drop_args += vec(tup(llarg, arg.ty));
67056711
}

0 commit comments

Comments
 (0)