Skip to content

Commit ff9fad6

Browse files
committed
---
yaml --- r: 6266 b: refs/heads/master c: b8dd148 h: refs/heads/master v: v3
1 parent a92cf25 commit ff9fad6

File tree

6 files changed

+24
-2
lines changed

6 files changed

+24
-2
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: 453168d91742777ee051ab4f8fe6f00c230190df
2+
refs/heads/master: b8dd148444d47ba75e635c34025fc0662ca69db0

trunk/src/comp/lib/llvm.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,8 @@ native "cdecl" mod llvm = "rustllvm" {
448448
fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
449449
fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef;
450450
fn LLVMDeleteFunction(Fn: ValueRef);
451+
fn LLVMGetOrInsertFunction(M: ModuleRef, Name: sbuf, FunctionTy: TypeRef)
452+
-> ValueRef;
451453
fn LLVMGetIntrinsicID(Fn: ValueRef) -> uint;
452454
fn LLVMGetFunctionCallConv(Fn: ValueRef) -> uint;
453455
fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: uint);

trunk/src/comp/middle/trans.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,8 @@ fn log_fn_time(ccx: @crate_ctxt, name: str, start: time::timeval,
301301

302302
fn decl_fn(llmod: ModuleRef, name: str, cc: uint, llty: TypeRef) -> ValueRef {
303303
let llfn: ValueRef =
304-
str::as_buf(name, {|buf| llvm::LLVMAddFunction(llmod, buf, llty) });
304+
str::as_buf(name, {|buf|
305+
llvm::LLVMGetOrInsertFunction(llmod, buf, llty) });
305306
llvm::LLVMSetFunctionCallConv(llfn, cc);
306307
ret llfn;
307308
}

trunk/src/rustllvm/RustWrapper.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,9 @@ extern "C" void LLVMRustEnableSegmentedStacks() {
141141
EnableSegmentedStacks = true;
142142
}
143143

144+
extern "C" LLVMValueRef LLVMGetOrInsertFunction(LLVMModuleRef M,
145+
const char* Name,
146+
LLVMTypeRef FunctionTy) {
147+
return wrap(unwrap(M)->getOrInsertFunction(Name,
148+
unwrap<FunctionType>(FunctionTy)));
149+
}

trunk/src/rustllvm/rustllvm.def.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ LLVMGetNextParam
364364
LLVMGetNextUse
365365
LLVMGetNumOperands
366366
LLVMGetOperand
367+
LLVMGetOrInsertFunction
367368
LLVMGetParam
368369
LLVMGetParamParent
369370
LLVMGetParamTypes
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
native "cdecl" mod rustrt1 = "rustrt" {
2+
fn pin_task();
3+
}
4+
5+
native "cdecl" mod rustrt2 = "rustrt" {
6+
fn pin_task();
7+
}
8+
9+
fn main() {
10+
rustrt1::pin_task();
11+
rustrt2::pin_task();
12+
}

0 commit comments

Comments
 (0)