DMD 0.177 release
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Tue Dec 12 10:54:36 PST 2006
Jarrett Billingsley wrote:
<snip>
> Yes, I guess that's true. But if a simple addition i.e.
>
> x = a + b;
>
> Compiled to
>
> mov _TEMP1, a
> mov _TEMP2, b
> add _TEMP1, _TEMP2
> mov x, _TEMP1
>
> Instead of
>
> mov x, a
> add x, b
>
> It'd still be semantically correct, but would it make sense?
Almost. I could see it generate the following code (with optimizations
turned off):
mov _TEMP, a
add _TEMP, b
mov x, _TEMP
where a, b and x are memory locations and _TEMP is a register. On x86,
you can't add the contents of two memory locations, at least one of the
values needs to be in a register.
With optimizations on, of course, the variables might be stored in
registers instead of memory. If so, your proposed code would be legal.
More information about the Digitalmars-d-announce
mailing list