This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Support reserving x20 register
ClosedPublic

Authored by phosek on May 7 2018, 3:17 PM.

Details

Summary

Register x20 is a callee-saved register which may be used for other
purposes in certain contexts, for example to hold special variables
within the kernel. This change adds support for reserving this register
both to frontend and backend to make this register usable for these
purposes.

Diff Detail

Repository
rC Clang

Event Timeline

phosek created this revision.May 7 2018, 3:17 PM
phosek added a subscriber: pcc.May 7 2018, 3:19 PM

This is an alternative to D46215, @pcc suggested using x19/x20 instead of x16/x17 to avoid potential linker collisions.

efriedma added inline comments.
llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
170 ↗(On Diff #145563)

As you sort of note here, -ffixed-x19 conflicts with LLVM's usage of x19 as the base pointer (in functions which have dynamic allocas). Granted, LLVM could be changed to use a different register for this, but currently you'll just miscompile.

phosek updated this revision to Diff 150601.Jun 8 2018, 7:54 PM
phosek marked an inline comment as done.
phosek retitled this revision from [AArch64] Support reserving x19 and x20 register to [AArch64] Support reserving x20 register.
phosek edited the summary of this revision. (Show Details)

I have modified the patch to support x20 since we only need only a single register at the moment.

This revision is now accepted and ready to land.Jun 11 2018, 3:08 PM
This revision was automatically updated to reflect the committed changes.