summaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
authorDavid Cole <david.cole1340@gmail.com>2022-03-13 12:30:06 +1300
committerEmilio Cobos Álvarez <emilio@crisal.io>2022-03-15 03:39:58 +0100
commit1b66dcf87692e455dc5e1603ca05d3f41b3f771b (patch)
treebedb23fcd1ea0b9263995a0a84e3d5506cdf3973 /src/codegen
parent6a169f21344d541ab4790dee894d2cc9e51a0345 (diff)
Added support for `vectorcall` ABI
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/mod.rs33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index a0a0670c..1b54597f 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -17,6 +17,7 @@ use self::struct_layout::StructLayoutTracker;
use super::BindgenOptions;
+use crate::features::RustFeatures;
use crate::ir::analysis::{HasVtable, Sizedness};
use crate::ir::annotations::FieldAccessorKind;
use crate::ir::comment;
@@ -2414,10 +2415,22 @@ impl MethodCodegen for Method {
_ => panic!("How in the world?"),
};
- if let (Abi::ThisCall, false) =
- (signature.abi(), ctx.options().rust_features().thiscall_abi)
- {
- return;
+ match (signature.abi(), ctx.options().rust_features()) {
+ (
+ Abi::ThisCall,
+ RustFeatures {
+ thiscall_abi: false,
+ ..
+ },
+ ) |
+ (
+ Abi::Vectorcall,
+ RustFeatures {
+ vectorcall_abi: false,
+ ..
+ },
+ ) => return,
+ _ => {}
}
// Do not generate variadic methods, since rust does not allow
@@ -3867,6 +3880,12 @@ impl TryToRustTy for FunctionSig {
warn!("Skipping function with thiscall ABI that isn't supported by the configured Rust target");
Ok(proc_macro2::TokenStream::new())
}
+ Abi::Vectorcall
+ if !ctx.options().rust_features().vectorcall_abi =>
+ {
+ warn!("Skipping function with vectorcall ABI that isn't supported by the configured Rust target");
+ Ok(proc_macro2::TokenStream::new())
+ }
_ => Ok(quote! {
unsafe extern #abi fn ( #( #arguments ),* ) #ret
}),
@@ -3958,6 +3977,12 @@ impl CodeGenerator for Function {
warn!("Skipping function with thiscall ABI that isn't supported by the configured Rust target");
return None;
}
+ Abi::Vectorcall
+ if !ctx.options().rust_features().vectorcall_abi =>
+ {
+ warn!("Skipping function with vectorcall ABI that isn't supported by the configured Rust target");
+ return None;
+ }
Abi::Win64 if signature.is_variadic() => {
warn!("Skipping variadic function with Win64 ABI that isn't supported");
return None;