On Thu, Jul 29, 2021 at 09:25:43AM -0700, Nick Desaulniers wrote: > On Thu, Jul 29, 2021 at 6:42 AM Paul Menzel <pmen...@molgen.mpg.de> wrote: > > Am 29.07.21 um 15:12 schrieb Michael Ellerman: > > > Note this only works with GCC, clang does not support -ffixed-rN. > > > > Maybe the clang/LLVM build support folks (in CC) have an idea. > > Right, we've had issues with these in the past. Generally, we need to > teach clang about which registers are valid for `N` so that it can > diagnose invalid values ASAP. This has to be done on a per arch basis > in LLVM to steal the register from the register allocator. For > example, this was used previously for aarch64 (but removed from use in > the kernel) and IIRC is used for m68k (which we're working to get > builds online for).
In GCC, it is -ffixed-* (note: no "r"). The string is stripped of the standard prefix for the target (for Power, none), and possibly of one "%" or "#". If the string is a recognised register name (or alternative register name) for the target, that is used. If not, and it is a decimal number, then the internal GCC register of that number is used (these numbers can differ from one GCC release to another, and in fact we have changed the numbering for Power before -- but 0..31 have always been the GPRs, and 32..63 have always been the FPRs). The names for the Power registers are: GPRs: 0..31, or alternatively r0..r31 FPRs: 0..31, or alternatively fr0..fr31, or alternatively vs0..vs31 VRs: 0..31, or alternatively v0..v31, or alternatively vs32..vs63 CR fields: 0..7, or alternatively cr0..cr7 (There are more, but changing the default calling convention for those will not work anyway. Also, some non-Linux configurations use different names.) Segher