On Mon, Apr 02, 2012 at 04:07:59PM +0200, Michael Matz wrote: > On Fri, 30 Mar 2012, Jan Hubicka wrote: > > > > Motion across hardreg sets/uses are not restricted. And I would not > > > expect > > > an optimizing compiler to do that (it's your own fault to use hardregs in > > > complex C code). > > > > Well, the syscall sequence is an example of somehting that should be > > inlined into arbitrary code w/o potential risk of ICEs. > > The syscall sequence doesn't consist of multiple independend instructions, > but rather is one asm with the right constraints. So gcc has no chance to > move something between the register setup (which only is explicit after > reload) and the syscall instruction. If syscall sequences were > implemented like this: > > inline int syscall1(int number, long arg1) { > register int ax __asm__("eax"); > register long di __asm__("rdi"); > ax = number; > di = arg1; > __asm__ volatile ("syscall"); > } > > _then_ we would probably get miscompilations here and there.
That is actually what is used on most targets, including x86_64 (i?86 is an exception here, because it has single hard register constraints for most of the interesting registers). Jakub