Auto merge of #30567 - steffengy:master, r=alexcrichton
Add support to use functions exported using vectorcall. This essentially only allows to pass a new LLVM calling convention from rust to LLVM. ```rust extern "vectorcall" fn abc(param: c_void); ``` references ---- http://llvm.org/docs/doxygen/html/CallingConv_8h_source.html https://msdn.microsoft.com/en-us/library/dn375768.aspx
This commit is contained in:
@@ -39,6 +39,7 @@ pub enum Abi {
|
||||
Cdecl,
|
||||
Stdcall,
|
||||
Fastcall,
|
||||
Vectorcall,
|
||||
Aapcs,
|
||||
Win64,
|
||||
|
||||
@@ -85,6 +86,7 @@ const AbiDatas: &'static [AbiData] = &[
|
||||
AbiData {abi: Cdecl, name: "cdecl" },
|
||||
AbiData {abi: Stdcall, name: "stdcall" },
|
||||
AbiData {abi: Fastcall, name: "fastcall" },
|
||||
AbiData {abi: Vectorcall, name: "vectorcall"},
|
||||
AbiData {abi: Aapcs, name: "aapcs" },
|
||||
AbiData {abi: Win64, name: "win64" },
|
||||
|
||||
|
||||
@@ -239,6 +239,9 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option<u32>, Status
|
||||
|
||||
// Allows cfg(target_thread_local)
|
||||
("cfg_target_thread_local", "1.7.0", Some(29594), Active),
|
||||
|
||||
// rustc internal
|
||||
("abi_vectorcall", "1.7.0", None, Active)
|
||||
];
|
||||
// (changing above list without updating src/doc/reference.md makes @cmr sad)
|
||||
|
||||
@@ -872,6 +875,11 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
|
||||
Abi::PlatformIntrinsic => {
|
||||
Some(("platform_intrinsics",
|
||||
"platform intrinsics are experimental and possibly buggy"))
|
||||
},
|
||||
Abi::Vectorcall => {
|
||||
Some(("abi_vectorcall",
|
||||
"vectorcall is experimental and subject to change"
|
||||
))
|
||||
}
|
||||
_ => None
|
||||
};
|
||||
@@ -1045,11 +1053,17 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
|
||||
"intrinsics are subject to change")
|
||||
}
|
||||
FnKind::ItemFn(_, _, _, _, abi, _) |
|
||||
FnKind::Method(_, &ast::MethodSig { abi, .. }, _) if abi == Abi::RustCall => {
|
||||
self.gate_feature("unboxed_closures",
|
||||
span,
|
||||
"rust-call ABI is subject to change")
|
||||
}
|
||||
FnKind::Method(_, &ast::MethodSig { abi, .. }, _) => match abi {
|
||||
Abi::RustCall => {
|
||||
self.gate_feature("unboxed_closures", span,
|
||||
"rust-call ABI is subject to change");
|
||||
},
|
||||
Abi::Vectorcall => {
|
||||
self.gate_feature("abi_vectorcall", span,
|
||||
"vectorcall is experimental and subject to change");
|
||||
},
|
||||
_ => {}
|
||||
},
|
||||
_ => {}
|
||||
}
|
||||
visit::walk_fn(self, fn_kind, fn_decl, block, span);
|
||||
|
||||
Reference in New Issue
Block a user