Note [Register parameter passing]
On certain architectures, some registers are utilized for parameter passing in the C calling convention. For example, in x86-64 Linux convention, rdi, rsi, rdx and rcx (as well as r8 and r9) may be used for argument passing. These are registers R3-R6, which our generated code may also be using; as a result, it's necessary to save these values before doing a foreign call. This is done during initial code generation in callerSaveVolatileRegs in GHC.StgToCmm.Utils. However, one result of doing this is that the contents of these registers may mysteriously change if referenced inside the arguments. This is dangerous, so you'll need to disable inlining much in the same way is done in GHC.Cmm.Sink currently. We should fix this!
References 0
This Note does not link to any other.
Referenced by 8
- GHC.Cmm.Lint call site ×2
- GHC.Cmm.Node call site ×2
- GHC.Cmm.Sink call site
- Saving foreign call target to local GHC.StgToCmm.Foreign
- GHC.StgToCmm.Utils call site
- Caller saves and callee-saves regs.