> On Thu, Apr 08, 2010 at 03:38:52PM +0200, Stefan Weil wrote: > > Register fp is a bad choice for compilations without > > optimisation, because the compiler makes heavy use > > of this register (so the resulting code crashes). > > I don't fully understand why the compiler makes use of this register in > code where env is declared as register fp.
The frame pointer (and certain other registers, typically stack pointer, link register, PIC base, TLS base, etc.) are special. They have predefined uses, usually specified by the relevant platform ABI. Defining a global register variable (or using -ffixed-reg) only excludes these registers from general register allocation. It does not prevent them being used for specific purposes. The user is responsible for ensuring that any assumptions/requirements made by the ABI are still met. In some cases gcc can diagnose invalid uses. In others the overlap may be legitimate, but not necessarily what we intended in qemu. Paul