Skip to content

Commit 098c6be

Browse files
committed
---
yaml --- r: 911 b: refs/heads/master c: 640d167 h: refs/heads/master i: 909: f313993 907: 53c76be 903: a3ecbb4 895: 265fe0a v: v3
1 parent 29b2a4d commit 098c6be

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
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: a7af86155d9b82cd65758c1fd6954aaef053b11a
2+
refs/heads/master: 640d1670372942531db4902ac85a87400dc6bcca

trunk/src/comp/middle/trans.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,25 @@ fn C_tydesc(TypeRef t) -> ValueRef {
341341
C_null(T_opaque()))); // is_stateful
342342
}
343343

344-
fn decl_cdecl_fn(ModuleRef llmod, str name,
345-
vec[TypeRef] inputs, TypeRef output) -> ValueRef {
344+
fn decl_fn(ModuleRef llmod, str name,
345+
uint cc, vec[TypeRef] inputs, TypeRef output) -> ValueRef {
346346
let TypeRef llty = T_fn(inputs, output);
347347
let ValueRef llfn =
348348
llvm.LLVMAddFunction(llmod, _str.buf(name), llty);
349-
llvm.LLVMSetFunctionCallConv(llfn, lib.llvm.LLVMCCallConv);
349+
llvm.LLVMSetFunctionCallConv(llfn, cc);
350350
ret llfn;
351351
}
352352

353+
fn decl_cdecl_fn(ModuleRef llmod, str name,
354+
vec[TypeRef] inputs, TypeRef output) -> ValueRef {
355+
ret decl_fn(llmod, name, lib.llvm.LLVMCCallConv, inputs, output);
356+
}
357+
358+
fn decl_fastcall_fn(ModuleRef llmod, str name,
359+
vec[TypeRef] inputs, TypeRef output) -> ValueRef {
360+
ret decl_fn(llmod, name, lib.llvm.LLVMFastCallConv, inputs, output);
361+
}
362+
353363
fn decl_glue(ModuleRef llmod, str s) -> ValueRef {
354364
ret decl_cdecl_fn(llmod, s, vec(T_taskptr()), T_void());
355365
}
@@ -947,6 +957,8 @@ impure fn trans_expr(@block_ctxt cx, &ast.expr e) -> result {
947957
cx.fcx.lltaskptr);
948958
llargs += args_res._1;
949959
auto call_val = args_res._0.build.Call(f_res._0.val, llargs);
960+
llvm.LLVMSetInstructionCallConv(call_val,
961+
lib.llvm.LLVMFastCallConv);
950962
ret res(args_res._0,
951963
args_res._0.build.Load(outptr));
952964
}
@@ -1246,7 +1258,7 @@ fn collect_item(&@trans_ctxt cx, @ast.item i) -> @trans_ctxt {
12461258
args += T_explicit_args;
12471259

12481260
let str s = cx.names.next("_rust_fn") + "." + name;
1249-
let ValueRef llfn = decl_cdecl_fn(cx.llmod, s, args, T_void());
1261+
let ValueRef llfn = decl_fastcall_fn(cx.llmod, s, args, T_void());
12501262
cx.fn_ids.insert(fid, llfn);
12511263
}
12521264

0 commit comments

Comments
 (0)