Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes a few SegFault in the test (similar to the ones on ARM) and make the ccall test pass.
A few notes about this PR,
va_list
and we don't have that yet.abi_aarch64.cpp
are comments copied from the calling convension doc, which I use when writing this PR. I think keeping those lines can help reviewing and other people reading the code.__fp16
(Float16
) is allowed as C argument on AArch64 and is passed in a SIMD and floating-point register if possible (different fromInt16
).byval
attribute to abyRef
argument breaks the code generation for that argument. See repro here. Note that in the working case themov x0, sp
correctly set the pass-by-pointer argument while in the broken case this instruction is missing. This is on LLVM 3.7.0 and I couldn't find any docs about how thebyval
attribute affects ABI or how is it processes in a target-dependent way so I'm not sure if this is an LLVM bug or if we are using it incorrectly (on AArch64 at least) (@Keno @vtjnash ). Clang doesn't emit such attribute for these arguments so I just leave it out.__int128
in C is 16 bytes on AArch64 so I increase theMAX_ALIGN
for AArch64. This also seems to be the case on x64 although I haven't find any document for this.