Skip to content

Commit 5a1bf2d

Browse files
committed
---
yaml --- r: 80754 b: refs/heads/try c: 150b4ff h: refs/heads/master v: v3
1 parent 010e5e4 commit 5a1bf2d

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cbd1eefbd350797b783df119fed7956d7e1c74ad
5-
refs/heads/try: b81743e69c56cbfeb5f1fa8b5dc03eff9a34bc52
5+
refs/heads/try: 150b4ffcccbaf6f85b4b3f5be76305edb963689f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustc/middle/trans/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,9 +655,9 @@ pub fn FastCall(cx: @mut Block, Fn: ValueRef, Args: &[ValueRef]) -> ValueRef {
655655
}
656656

657657
pub fn CallWithConv(cx: @mut Block, Fn: ValueRef, Args: &[ValueRef],
658-
Conv: CallConv) -> ValueRef {
658+
Conv: CallConv, sret: bool) -> ValueRef {
659659
if cx.unreachable { return _UndefReturn(cx, Fn); }
660-
B(cx).call_with_conv(Fn, Args, Conv)
660+
B(cx).call_with_conv(Fn, Args, Conv, sret)
661661
}
662662

663663
pub fn AtomicFence(cx: @mut Block, order: AtomicOrdering) {

branches/try/src/librustc/middle/trans/builder.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use lib::llvm::llvm;
1313
use lib::llvm::{CallConv, AtomicBinOp, AtomicOrdering, AsmDialect};
1414
use lib::llvm::{Opcode, IntPredicate, RealPredicate, False};
1515
use lib::llvm::{ValueRef, BasicBlockRef, BuilderRef, ModuleRef};
16+
use lib::llvm::{StructRetAttribute};
1617
use middle::trans::base;
1718
use middle::trans::common::*;
1819
use middle::trans::machine::llalign_of_min;
@@ -778,14 +779,9 @@ impl Builder {
778779

779780
pub fn call(&self, llfn: ValueRef, args: &[ValueRef]) -> ValueRef {
780781
self.count_insn("call");
781-
782-
debug!("Call(llfn=%s, args=%?)",
783-
self.ccx.tn.val_to_str(llfn),
784-
args.map(|arg| self.ccx.tn.val_to_str(*arg)));
785-
786782
do args.as_imm_buf |ptr, len| {
787783
unsafe {
788-
llvm::LLVMBuildCall(self.llbuilder, llfn, ptr, len as c_uint, noname())
784+
llvm::LLVMBuildCall(self.llbuilder, llfn, ptr, len as c_uint, noname())
789785
}
790786
}
791787
}
@@ -801,12 +797,16 @@ impl Builder {
801797
}
802798

803799
pub fn call_with_conv(&self, llfn: ValueRef, args: &[ValueRef],
804-
conv: CallConv) -> ValueRef {
800+
conv: CallConv, sret: bool) -> ValueRef {
805801
self.count_insn("callwithconv");
806802
unsafe {
807803
let v = llvm::LLVMBuildCall(self.llbuilder, llfn, vec::raw::to_ptr(args),
808804
args.len() as c_uint, noname());
809805
lib::llvm::SetInstructionCallConv(v, conv);
806+
if sret {
807+
let return_slot = 1;
808+
llvm::LLVMAddInstrAttribute(v, return_slot, StructRetAttribute as c_uint);
809+
}
810810
v
811811
}
812812
}

branches/try/src/librustc/middle/trans/foreign.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ pub fn trans_native_call(bcx: @mut Block,
266266
}
267267
};
268268

269-
let llforeign_retval = CallWithConv(bcx, llfn, llargs_foreign, cc);
269+
let llforeign_retval = CallWithConv(bcx, llfn, llargs_foreign, cc, fn_type.sret);
270270

271271
// If the function we just called does not use an outpointer,
272272
// store the result into the rust outpointer. Cast the outpointer

0 commit comments

Comments
 (0)