[llvm-dev] Reserve ARM register for only section of the program
Nisal Menuka via llvm-dev
llvm-dev at lists.llvm.org
Wed Jun 14 12:33:29 PDT 2017
Thanks a lot. Is it possible to implement that functionality as a pragma?
Lets say I want to reserve registers X9 and X10 only within pragma A
and B. Is it possible to achieve this in llvm?
On Mon, Jun 12, 2017 at 9:54 PM, Tim Northover <t.p.northover at gmail.com> wrote:
> Hi Nisal,
> (Adding llvm-dev back again; best to keep these things public in case
> they help someone else in the future).
> On 12 June 2017 at 19:43, Nisal Menuka <nisalmenuka23 at gmail.com> wrote:
>> I am a first year graduate student at Rice University, I'm looking to
>> reserve registers X9 and X10 for one of my research projects. I have
>> some questions regarding this and greatly appreciate any help you can
>> provide (I am a newbee when it comes to hacking compilers).
>> 1. Is it possible to reserve X9 and X10 by the same methodology used
>> to reserve X18 in LLVM?
> It should be (x9 and x10 are very similar to x18, with no other
> special purposes in the ABI), but you'll have to implement it
> yourself. Searching for all uses of X18 in lib/Target/AArch64 and
> adding your own code for the others would be a good place to get
> started. For Clang the key phrase is "fixed_x18".
> You're going to have more work to do for the interworking though. For
> example if a function with -ffixed-x9-x10 calls one without, you'll
> probably have to implement code to save those two registers at the
> callsite and restore them afterwards because the callee will be
> treating them as temporaries.
>> 2. Else can you suggest a method to achieve it?
> If you didn't need interworking I'd probably suggest just
> unconditionally reserving them, which would be substantially simpler
> (a 2-4 line change in LLVM).
> But from what you've said so far I think following x18's
> implementation is probably your best bet. It's most of the way there,
> and already piped through to Clang in a usable way.
More information about the llvm-dev