<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 1/4/2019 1:49 AM, Amilendra
      Kodithuwakku wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:AM6PR08MB3079E713BD10C38406BABDBB938E0@AM6PR08MB3079.eurprd08.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
      <div id="divtagdefaultwrapper" dir="ltr" style="font-size:10pt;
        color:rgb(0,0,0); font-family:"Courier
        New",monospace,"EmojiFont","Apple Color
        Emoji","Segoe UI
        Emoji",NotoColorEmoji,"Segoe UI
        Symbol","Android Emoji",EmojiSymbols">
        <pre class="_ad_q1">> 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? <a class="moz-txt-link-freetext" href="https://llvm.org/docs/WritingAnLLVMBackend.html#subtarget-support">https://llvm.org/docs/WritingAnLLVMBackend.html#subtarget-support</a>
I still have not gone through the specifics of that but do you know if it would work with LTO?
</pre>
      </div>
    </blockquote>
    <p>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 <a class="moz-txt-link-freetext" href="https://reviews.llvm.org/D46552">https://reviews.llvm.org/D46552</a> / 
      <a class="moz-txt-link-freetext" href="https://reviews.llvm.org/D48581">https://reviews.llvm.org/D48581</a> / <a class="moz-txt-link-freetext" href="https://reviews.llvm.org/D46552">https://reviews.llvm.org/D46552</a>
      / etc.</p>
    <p><br>
    </p>
    <p>-Eli<br>
    </p>
    <pre class="moz-signature" cols="72">-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project</pre>
  </body>
</html>