Allow C argument regs to be used as global regs (R1, R2, etc.)
authorSimon Marlow <simonmar@microsoft.com>
Tue, 28 Feb 2006 15:29:42 +0000 (15:29 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Tue, 28 Feb 2006 15:29:42 +0000 (15:29 +0000)
commit14a5c62a2d27830ea8b3716bb32a04f23678b355
treef83af4d55b2aec38772188a24cc6010685c784eb
parent04db0e9fa47ce4dfbcb73ec1752d94195f3b394e
Allow C argument regs to be used as global regs (R1, R2, etc.)

The problem here was that we generated C calls with expressions
involving R1 etc. as parameters.  When some of the R registers are
also C argument registers, both GCC and the native code generator
generate incorrect code.  The hacky workaround is to assign
problematic arguments to temporaries first; fortunately this works
with both GCC and the NCG, but we have to be careful not to undo this
with later optimisations (see changes to CmmOpt).
ghc/compiler/cmm/CmmOpt.hs
ghc/compiler/cmm/CmmParse.y
ghc/compiler/cmm/CmmUtils.hs
ghc/compiler/codeGen/CgForeignCall.hs
ghc/compiler/codeGen/CgPrimOp.hs