[PATCH] [AArch64] Add -mgeneral_regs_only option

Tim Northover t.p.northover at gmail.com
Fri Jan 24 08:23:30 PST 2014


> I think that should be an error.

I disagree. If someone wants to pretend their CPU doesn't have
floating point registers entirely, that's what -march is for. This
option says that it's constraining the compiler.

Also, people usually want this so that they *can* use floating point
registers under strict controls. For example in kernels to save
FP-context only when necessary.

There's no way to do this with the behaviour you're proposing (short
of a completely separate .S file under complete user control): as soon
as the -mgeneral_regs_only option is removed LLVM has permission to
throw them around with gay abandon and any inline asm you use might
(potentially) see corrupted values produce them.

> GCC throws an error if you try to use
> floating point types with -mgeneral-regs-only, so inline assembly wouldn't work anyway.

You don't have to use floating-point types to use FP values in inline
asm. A simple context-save block might just depend on a "char *" at
the C level, for example:

    asm("stp q0, q1, [%0]" : : "r"(&process->fp_regs) : "memory");

Cheers.

Tim.



More information about the cfe-commits mailing list