[llvm-dev] [RFC] Allocatable Global Register Variables for ARM

Friedman, Eli via llvm-dev llvm-dev at lists.llvm.org
Mon Jan 7 14:31:45 PST 2019


On 1/4/2019 1:49 AM, Amilendra Kodithuwakku wrote:
> > Why did you decide to use global metadata here?  For AArch64, we use a target feature instead, to implement roughly equivalent functionality (the reserve-x18 feature, to implement -ffixed-x18).
> > Making a global register declaration have side-effects never made sense, IMO; on the surface, it's using variable declaration syntax, but in reality it's actually changing the ABI rules for the whole file. 
> > I would prefer to support -ffixed-r4, and never allow global register declarations to modify the ABI. This subset should be compatible with gcc, as far as I know.
> >
> > (Compiler flags that affect the ABI are easy to misuse, but clang and gcc have a long tradition of flags which change the ABI, so it's not really worse than what we already do.)
> >
> >
> We were looking for a solution which works with LTO.
> While we investigated a possible -ffixed-reg flag, our understanding was that it would only work as long as it sets module metadata in the IR.
> Adding a -ffixed-reg option in the LLVM backend, and adding that option to the -cc1 command-line, would not work because that would not get passed through to the backend when LTO is used. So our belief was that one could later implement the -ffixed-reg flag upon the module metadata added by this patch.
>
> Is this the target feature mechanism you explained? https://llvm.org/docs/WritingAnLLVMBackend.html#subtarget-support
> I still have not gone through the specifics of that but do you know if it would work with LTO?

You're correct that any solution that works with LTO must encode the 
information into the object file.  But module metadata isn't the best 
way to do that here.  The approach I'm suggesting is to use the 
"target-features" attribute on each function in the file. See 
https://reviews.llvm.org/D46552 / https://reviews.llvm.org/D48581 / 
https://reviews.llvm.org/D46552 / etc.


-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190107/7c22d720/attachment.html>


More information about the llvm-dev mailing list