Hi,
On Mon, 2 Apr 2012, Jakub Jelinek wrote:
> > 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
Yikes! That's indeed the case. I'll want to retract what I said, concede
with Honza that we're lucky and add that we're lucky mostly because
register variables are not regarded as gimple registers, hence all stores
to such variables are regarded as VDEFs. So there will be VDEF/VUSE
chains between initializer and syscall, which prevents most code motion
into that chain. That itself doesn't e.g. prevent the load/store
disambiguator from disambiguating two such decls, even if they refer to
the same hardreg. So we really are merely lucky, with enough effort we
probably could create a "miscompiling" testcase.
Ciao,
Michael.