Skip to content
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

Implement AArch64 ABI #14519

Merged
merged 1 commit into from
Jan 5, 2016
Merged

Implement AArch64 ABI #14519

merged 1 commit into from
Jan 5, 2016

Conversation

yuyichao
Copy link
Contributor

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,

  • I do not include the LDC license since the header style and the link to the doc is the only thing I copied over. AFAICT, most of their ABI file is dealing with va_list and we don't have that yet.
  • Most of the lines in 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 from Int16).
  • Adding byval attribute to a byRef argument breaks the code generation for that argument. See repro here. Note that in the working case the mov 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 the byval 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.
  • The alignment of __int128 in C is 16 bytes on AArch64 so I increase the MAX_ALIGN for AArch64. This also seems to be the case on x64 although I haven't find any document for this.
  • Probably need tests for some corner cases that are important/special on this arch. Will try to add later.

@yuyichao yuyichao added system:arm ARMv7 and AArch64 compiler:codegen Generation of LLVM IR and native code needs tests Unit tests are required for this change labels Dec 31, 2015
@yuyichao yuyichao force-pushed the yyc/aarch64-abi branch 2 times, most recently from b72c604 to 4ecabcc Compare January 1, 2016 22:53
@vtjnash
Copy link
Member

vtjnash commented Jan 5, 2016

i believe tests will be covered by #14215

since this is a strict improvement, i'm going to merge this now.

@vtjnash vtjnash removed the needs tests Unit tests are required for this change label Jan 5, 2016
vtjnash added a commit that referenced this pull request Jan 5, 2016
@vtjnash vtjnash merged commit 15cae86 into master Jan 5, 2016
@vtjnash vtjnash deleted the yyc/aarch64-abi branch January 5, 2016 17:42
@JeffBezanson
Copy link
Member

Nice!!

@yuyichao
Copy link
Contributor Author

yuyichao commented Jan 5, 2016

I believe tests will be covered by #14215

I was going to add some AArch64 specific test (__int128, __fp128, __fp16, arguments alignment and spilling) after figuring out other problems on ARM but yes, those can be added later if not covered by #14215.

@ViralBShah
Copy link
Member

Can we backport this to support it on 0.4?

@yuyichao
Copy link
Contributor Author

Should be similar to #14194. Might need #14688 and I should probably have a look at #14215 ...

@ViralBShah
Copy link
Member

Putting the label on for now.

tkelman pushed a commit that referenced this pull request Mar 7, 2016
(cherry picked from commit d0fbd71)
ref #14519
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:codegen Generation of LLVM IR and native code system:arm ARMv7 and AArch64
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants