This is an archive of the discontinued LLVM Phabricator instance.

Add support for nest attribute to AArch64 backend
ClosedPublic

Authored by scross99 on Jun 19 2015, 6:28 PM.

Details

Reviewers
t.p.northover
Summary

The nest attribute is currently supported on the x86 (32-bit) and x86-64 backends, but not on ARM (32-bit) or AArch64. This patch adds support for nest to the AArch64 backend.

Register x18 is used by GCC for this purpose (see https://github.com/gcc-mirror/gcc/blob/7c62dfbbcd3699efcbbadc9fb3aa14f23a123add/gcc/testsuite/gcc.dg/cwsc1.c ) and hence is used here. As discussed on the GCC mailing list (see http://www.mail-archive.com/gcc@gcc.gnu.org/msg76966.html ) the register choice is an ABI issue and so choosing the same register as GCC means __builtin_call_with_static_chain is compatible.

A slight complexity to this issue is that x18 is reserved as the 'platform register' on iOS and Mac (see https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html ) and no register has been selected by GCC yet, so nest remains unsupported for those platforms.

Relevant LLVM mailing list discussion: http://comments.gmane.org/gmane.comp.compilers.llvm.devel/86370

Diff Detail

Event Timeline

scross99 retitled this revision from to Add support for nest attribute to AArch64 backend.
scross99 updated this object.
scross99 edited the test plan for this revision. (Show Details)
scross99 added a reviewer: t.p.northover.
scross99 added a subscriber: Unknown Object (MLST).

Has anyone had a chance to look at this change (allowing for understandably busy schedules)?

t.p.northover accepted this revision.Jul 2 2015, 11:51 AM
t.p.northover edited edge metadata.

Hi, sorry for the delay. I think the change itself looks reasonable. Just one question about the test...

test/CodeGen/AArch64/nest-register.ll
8

Have you checked this on a non-asserts build? I'm never really sure what gets skipped in the name of efficiency.

This revision is now accepted and ready to land.Jul 2 2015, 11:51 AM
scross99 added inline comments.Jul 2 2015, 3:06 PM
test/CodeGen/AArch64/nest-register.ll
8

Yes, this was tested on a Release build of LLVM with assertions off. Are you suggesting that enabling assertions might catch a problem with this line (I manually verified the output so this shouldn't happen) or that a Release build might not emit the assembly comment?

I did a bit of digging and found that neon-bitcast.ll (Git mirror link: https://github.com/llvm-mirror/llvm/blob/master/test/CodeGen/AArch64/neon-bitcast.ll ) has very similar code, such as:

define <1 x i64> @test_v8i8_to_v1i64(<8 x i8> %in) nounwind {
; CHECK: test_v8i8_to_v1i64:
; CHECK-NEXT: // BB#0:
; CHECK-NEXT: ret

  %val = bitcast <8 x i8> %in to <1 x i64>
  ret <1 x i64> %val
}

I'm very happy to do further testing with different configurations if needed.

Yes, this was tested on a Release build of LLVM with assertions off.

Oh good, seems fine then.

Are you suggesting that enabling assertions might catch a problem with this line (I manually verified the output so this shouldn't happen) or that a Release build might not emit the assembly comment?

The latter (I've been caught out by a flurry of bot complaints
before). But if you've tested it then that's fine.

Cheers.

Tim.


llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Oh good, seems fine then.

I don't have commit rights; could you commit this for me?

rengolin closed this revision.Jul 9 2015, 3:18 AM

Committed as r241794.

Thanks for committing this, however it looks like the test wasn't committed (only the change to the backend code).

Ooops, sorry! r241797

Ooops, sorry! r241797

No problem. Thanks again :-).