document why attributes are set on CallInst
This commit is contained in:
parent
b2eb1c01a4
commit
22b6f7481f
|
@ -706,12 +706,15 @@ pub fn trans_call_inner(in_cx: @mut Block,
|
|||
_ => {}
|
||||
}
|
||||
|
||||
// Invoke the actual rust fn and update bcx/llresult.
|
||||
// A function pointer is called without the declaration available, so we have to apply
|
||||
// any attributes with ABI implications directly to the call instruction. Right now, the
|
||||
// only attribute we need to worry about is `sret`.
|
||||
let mut attrs = ~[];
|
||||
if type_of::return_uses_outptr(in_cx.tcx(), ret_ty) {
|
||||
attrs.push((1, StructRetAttribute));
|
||||
}
|
||||
|
||||
// The `noalias` attribute on the return value is useful to a function ptr caller.
|
||||
match ty::get(ret_ty).sty {
|
||||
// `~` pointer return values never alias because ownership is transferred
|
||||
ty::ty_uniq(*) |
|
||||
|
@ -721,6 +724,7 @@ pub fn trans_call_inner(in_cx: @mut Block,
|
|||
_ => ()
|
||||
}
|
||||
|
||||
// Invoke the actual rust fn and update bcx/llresult.
|
||||
let (llret, b) = base::invoke(bcx, llfn, llargs, attrs);
|
||||
bcx = b;
|
||||
llresult = llret;
|
||||
|
|
|
@ -264,6 +264,9 @@ pub fn trans_native_call(bcx: @mut Block,
|
|||
}
|
||||
};
|
||||
|
||||
// A function pointer is called without the declaration available, so we have to apply
|
||||
// any attributes with ABI implications directly to the call instruction. Right now, the
|
||||
// only attribute we need to worry about is `sret`.
|
||||
let attrs;
|
||||
if fn_type.sret {
|
||||
attrs = &[(1, StructRetAttribute)];
|
||||
|
|
Loading…
Reference in New Issue