[llvm-commits] [PATCH] Remove VRSAVE processing for PowerPC SVR4 ABIs

William J. Schmidt wschmidt at linux.vnet.ibm.com
Wed Oct 10 10:32:03 PDT 2012


The PowerPC VRSAVE register has been somewhat of an odd beast since the
Altivec extensions were introduced.  Its use is optional, and allows the
compiler to communicate to the operating system which vector registers
should be saved and restored during a context switch.  In practice, this
information is ignored by the various operating systems using the SVR4
ABI; the kernel saves and restores the entire register state.  Setting
the VRSAVE register is no longer performed by the AIX XL compilers, the
IBM i compilers, or by GCC on Power Linux systems.  It seems best to
avoid this logic within LLVM as well.

This patch avoids generating code to update and restore VRSAVE for the
PowerPC SVR4 ABIs (32- and 64-bit).  The code remains in place for the
Darwin ABI.

Side note: The VRSAVE logic contains a bug that may need to be addressed
for users of the Darwin ABI.  The code currently saves the original
state of VRSAVE in a GPR that persists for the lifetime of the function,
and is used to restore the VRSAVE contents when the function returns.
There is a later optimization that removes the prolog/epilog code for
updating VRSAVE when it provably does not change within the body of the
function (though it might change temporarily during a function call).
The removal of the code results in a compile failure at -O0 when the
function contains a function call, as the GPR containing original VRSAVE
contents is spilled and reloaded around the call.  Without the prolog
code, the spill instruction refers to an undefined register.

The attached patch has been tested with no new regressions.  Ok to
commit?

Thanks,
Bill
-- 
Bill Schmidt, Ph.D.
IBM Advance Toolchain for PowerLinux
IBM Linux Technology Center
wschmidt at us.ibm.com
wschmidt at linux.vnet.ibm.com





-------------- next part --------------
A non-text attachment was scrubbed...
Name: novrsave-2012-10-10.patch
Type: text/x-patch
Size: 2064 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121010/9fe0ea11/attachment.bin>


More information about the llvm-commits mailing list