]> git.lizzy.rs Git - plan9front.git/commit
5c, 6c, 7c, 8c, kc, qc, vc: use explicit gmove(... , nn) in cgen() for result of...
authorcinap_lenrek <cinap_lenrek@felloff.net>
Sat, 13 Mar 2021 12:56:40 +0000 (13:56 +0100)
committercinap_lenrek <cinap_lenrek@felloff.net>
Sat, 13 Mar 2021 12:56:40 +0000 (13:56 +0100)
commit9de5aac7a29564ac0e1574d17d2589eefe8de3e6
tree3272d4e82cace88b97cacc4408d6eaeea42d9a16
parent2f55920a22c24bcf489fa3fa621eae5969b5bf2c
5c, 6c, 7c, 8c, kc, qc, vc: use explicit gmove(... , nn) in cgen() for result of OAS*, OPREINC, OPOSTINC

The expression value of the assignment operation was
returned implicitely by relying on regalloc() on the
right hand side "nod" borrowing the register from nn.

But this only works if nn is a register.

In case of 6c, it can also be a ONAME from a .safe
rathole returned by regsalloc().

This change adds explicit gmove() calls to assign the
expression value. Note that gmove() checks if source
and destination are the same register so it wont emit
redundant move operations in the common case.

The same is applied also to OPREINC and OPOSTINC operations.
sys/src/cmd/5c/cgen.c
sys/src/cmd/6c/cgen.c
sys/src/cmd/7c/cgen.c
sys/src/cmd/8c/cgen.c
sys/src/cmd/kc/cgen.c
sys/src/cmd/qc/cgen.c
sys/src/cmd/vc/cgen.c