[PATCH] D50694: [Sparc] Give the option to use the OS reserved global registers

James Y Knight via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 14 12:41:25 PDT 2018


jyknight added a comment.

I generally cringe at these sorts of register-use-changing-flags, but SPARC has basically explicitly defined all of G2-G7 as fixed-usage or scratch registers as the user/system desires. And these registers don't participate in the calling convention (not args or return values, and aren't saved)...so, it's not completely terrible. Only G7 is ever used for anything by the compiler, to implement TLS.

Some general comments:

1. G2-G4 should also be handled the same way, and the existing internal command-line-flag hack removed.
2. Should be careful of the usage of %g7 -- the TLS emission functions should error out when G7 is declared as a scratch register -- it doesn't make sense to try to use it as a thread register at the same time.
3. SparcAsmPrinter::EmitFunctionBodyStart should be updated to annotate usage of the registers appropriately.



================
Comment at: lib/Target/Sparc/SparcSubtarget.h:46
   bool HasNoFMULS;
+  bool UseG5;
+  bool UseG6;
----------------
I find this name unclear. I'd suggest having a set of fields named "ReserveRegG5" etc. (that is: with the opposite sense).


Repository:
  rL LLVM

https://reviews.llvm.org/D50694





More information about the llvm-commits mailing list