
But this only includes the NCG. What about the LLVM backend? For LLVM I only found in compiler/llvmGen/LlvmCodeGen/CodeGen.hs function definition getTrashRegs which makes use of function callerSaves which is defined in includes/CodeGen.Platform.hs: callerSaves :: GlobalReg -> Bool #if defined(CALLER_SAVES_Base) callerSaves BaseReg = True #endif ... callerSaves _ = False There only for general-purpose and floating-point registers function callerSaves may be defined to True. Thus, for XMMi, YMMi, and ZMMi arguments the function evaluates to False. Do I miss something for the LLVM backend? Maybe we just need to extend the definition of callerSaves in order to respect vector registers, too? Cheers, Stefan On Sun, Jun 30, 2019 at 07:16:15PM +0200, Andreas Klebinger wrote:
What you want is not the macro but this function: https://hackage.haskell.org/package/ghc-8.6.5/docs/src/X86.Regs.html#callClo...
whose results depend on the System ABI.
Cheers, Andreas
Hi all,
I'm wondering what GHC assumes about vector registers XMMi, YMMi, and ZMMi used by the STG machine: are those assumed to be caller or callee-saved? Only for the x86-64 architecture there exist macro definitions like CALLER_SAVES_XMM1 in includes/stg/MachRegs.h. However, I cannot find any other place where those macros are used. AFAIK most C ABIs assume that vector registers are call clobbered. Is this also the case for GHC?
Many thanks in advance, Stefan