-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[WIP] stdlib: add support for AAPCS64 variadics #12623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,6 +201,30 @@ extension OpaquePointer : Equatable { | |
} | ||
|
||
/// The corresponding Swift type to `va_list` in imported C APIs. | ||
#if arch(arm64) && !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a comment here describing this as the AAPCS64 case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure |
||
|
||
// non-Darwin AAPCS64 ABI | ||
@_fixed_layout | ||
public struct CVaListPointer { | ||
@_versioned // FIXME(sil-serialize-all) | ||
internal var value: (__stack: UnsafeMutablePointer<Int>?, | ||
__gr_top: UnsafeMutablePointer<Int>?, | ||
__vr_top: UnsafeMutablePointer<Int>?, | ||
__gr_off: Int32, | ||
__vr_off: Int32) | ||
|
||
@_inlineable // FIXME(sil-serialize-all) | ||
public // @testable | ||
init(__stack: UnsafeMutablePointer<Int>?, | ||
__gr_top: UnsafeMutablePointer<Int>?, | ||
__vr_top: UnsafeMutablePointer<Int>?, | ||
__gr_off: Int32, | ||
__vr_off: Int32) { | ||
value = (__stack, __gr_top, __vr_top, __gr_off, __vr_off) | ||
} | ||
} | ||
|
||
#else | ||
@_fixed_layout | ||
public struct CVaListPointer { | ||
@_versioned // FIXME(sil-serialize-all) | ||
|
@@ -220,6 +244,7 @@ extension CVaListPointer : CustomDebugStringConvertible { | |
return value.debugDescription | ||
} | ||
} | ||
#endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This …and if it isn't valid, you should add a valid one for the AAPCS version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The value type is different in all cases. In fact, for the AAPCS64 case, its a tuple, rather than an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Saleem and I briefly talked about this at the LLVM dev meeting, and I told him to go ahead without it. I'm not sure we have a good debug description for a struct-based va_list that's any better than just showing the children (the default behavior of |
||
|
||
@_versioned | ||
@_inlineable | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jrose-apple I couldn't see the equivalent of
getTypeSize
in the swiftASTContext
, perhaps I missed something? Is there an easy way to address that TODO?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really. Swift doesn't bother measuring sizes until IR generation time, and even then you won't be able to do it under certain conditions. I think it's okay to just explicitly leave AAPCS64 out of the impedance check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, Ill probably move this back into the switch then